Package org.springframework.tests.transaction

Examples of org.springframework.tests.transaction.CallCountingTransactionManager


        new AnnotationConfigApplicationContext(Spr11915Config.class);

    TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);
    bean.saveQualifiedFoo();

    CallCountingTransactionManager txManager = ctx
        .getBean("qualifiedTransactionManager", CallCountingTransactionManager.class);
    assertThat(txManager.begun, equalTo(1));
    assertThat(txManager.commits, equalTo(1));
    assertThat(txManager.rollbacks, equalTo(0));
  }
View Full Code Here


    private ConfigurableApplicationContext applicationContext;

    @PostConstruct
    public void initializeApp() {
      applicationContext.getBeanFactory().registerSingleton(
          "qualifiedTransactionManager", new CallCountingTransactionManager());
    }
View Full Code Here

      return new TransactionalTestBean();
    }

    @Bean
    public PlatformTransactionManager txManager() {
      return new CallCountingTransactionManager();
    }
View Full Code Here

  @Configuration
  static class MultiTxManagerConfig extends TxManagerConfig implements TransactionManagementConfigurer {

    @Bean
    public PlatformTransactionManager txManager2() {
      return new CallCountingTransactionManager();
    }
View Full Code Here

    assertTrue("Stereotype annotation not visible", services.containsKey("testBean"));
  }

  public void testInvokeTransactional() throws Exception {
    TransactionalTestBean testBean = getTestBean();
    CallCountingTransactionManager ptm = (CallCountingTransactionManager) context.getBean("transactionManager");

    // try with transactional
    assertEquals("Should not have any started transactions", 0, ptm.begun);
    testBean.findAllFoos();
    assertEquals("Should have 1 started transaction", 1, ptm.begun);
View Full Code Here

    }
  }

  public void testNonPublicMethodsNotAdvised() {
    TransactionalTestBean testBean = getTestBean();
    CallCountingTransactionManager ptm = (CallCountingTransactionManager) context.getBean("transactionManager");

    assertEquals("Should not have any started transactions", 0, ptm.begun);
    testBean.annotationsOnProtectedAreIgnored();
    assertEquals("Should not have any started transactions", 0, ptm.begun);
  }
View Full Code Here

  private TransactionInterceptor ti;


  @Override
  public void setUp() {
    this.ptm = new CallCountingTransactionManager();
    this.source = new AnnotationTransactionAttributeSource();
    this.ti = new TransactionInterceptor(this.ptm, this.source);
  }
View Full Code Here

TOP

Related Classes of org.springframework.tests.transaction.CallCountingTransactionManager

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.