Package org.springframework.transaction

Examples of org.springframework.transaction.PlatformTransactionManager


    psControl.replay();
    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setTimeout(timeout);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    try {
View Full Code Here


    conControl.setVoidCallable(1);

    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        // something transactional
View Full Code Here

    conControl.setVoidCallable(2);

    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    final TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

    conControl.setVoidCallable(2);

    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    final TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

    con.close();
    conControl.setVoidCallable();
    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          // something transactional
View Full Code Here

    con.close();
    conControl.setVoidCallable(1);
    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          // something transactional
View Full Code Here

    con.close();
    conControl.setVoidCallable(1);
    conControl.replay();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
          status.setRollbackOnly();
View Full Code Here

  public void testTransactionWithPropagationSupports() throws Exception {
    MockControl dsControl = MockControl.createControl(DataSource.class);
    final DataSource ds = (DataSource) dsControl.getMock();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

  public void testTransactionWithPropagationNotSupported() throws Exception {
    MockControl dsControl = MockControl.createControl(DataSource.class);
    final DataSource ds = (DataSource) dsControl.getMock();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

  public void testTransactionWithPropagationNever() throws Exception {
    MockControl dsControl = MockControl.createControl(DataSource.class);
    final DataSource ds = (DataSource) dsControl.getMock();
    dsControl.replay();

    PlatformTransactionManager tm = new DataSourceTransactionManager(ds);
    TransactionTemplate tt = new TransactionTemplate(tm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NEVER);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

TOP

Related Classes of org.springframework.transaction.PlatformTransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.