Examples of CallCountingTransactionManager


Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @Test
  public void testTransactionAttributeOnMethod() throws Exception {
    BeanFactory bf = getBeanFactory();
    ITestBean test = (ITestBean) bf.getBean("test");

    CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
    OrderedTxCheckAdvisor txc = (OrderedTxCheckAdvisor) bf.getBean("orderedBeforeTransaction");
    assertEquals(0, txc.getCountingBeforeAdvice().getCalls());

    assertEquals(0, txMan.commits);
    assertEquals("Initial value was correct", 4, test.getAge());
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @Test
  public void testRollbackRulesOnMethodCauseRollback() throws Exception {
    BeanFactory bf = getBeanFactory();
    Rollback rb = (Rollback) bf.getBean("rollback");

    CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);
    OrderedTxCheckAdvisor txc = (OrderedTxCheckAdvisor) bf.getBean("orderedBeforeTransaction");
    assertEquals(0, txc.getCountingBeforeAdvice().getCalls());

    assertEquals(0, txMan.commits);
    rb.echoException(null);
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @Test
  public void testRollbackRulesOnMethodPreventRollback() throws Exception {
    BeanFactory bf = getBeanFactory();
    Rollback rb = (Rollback) bf.getBean("rollback");

    CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);

    assertEquals(0, txMan.commits);
    // Should NOT roll back on ServletException
    try {
      rb.echoException(new ServletException());
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  public void testProgrammaticRollback() throws Exception {
    BeanFactory bf = getBeanFactory();

    Object bean = bf.getBean(TXMANAGER_BEAN_NAME);
    assertTrue(bean instanceof CallCountingTransactionManager);
    CallCountingTransactionManager txMan = (CallCountingTransactionManager) bf.getBean(TXMANAGER_BEAN_NAME);

    Rollback rb = (Rollback) bf.getBean("rollback");
    assertEquals(0, txMan.commits);
    rb.rollbackOnly(false);
    assertEquals("Transaction counts match", 1, txMan.commits);
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

    ctx.refresh();

    FooRepository fooRepository = ctx.getBean(FooRepository.class);
    fooRepository.findAll();

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

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

    ctx.refresh();

    FooRepository fooRepository = ctx.getBean(FooRepository.class);
    fooRepository.findAll();

    CallCountingTransactionManager txManager1 = ctx.getBean("txManager1", CallCountingTransactionManager.class);
    assertThat(txManager1.begun, equalTo(1));
    assertThat(txManager1.commits, equalTo(1));
    assertThat(txManager1.rollbacks, equalTo(0));

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

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @EnableTransactionManagement
  @ImportResource("org/springframework/transaction/annotation/enable-caching.xml")
  static class EnableTxAndCachingConfig {
    @Bean
    public PlatformTransactionManager txManager() {
      return new CallCountingTransactionManager();
    }
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @Configuration
  @EnableTransactionManagement
  static class ImplicitTxManagerConfig {
    @Bean
    public PlatformTransactionManager txManager() {
      return new CallCountingTransactionManager();
    }
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

  @Configuration
  @EnableTransactionManagement
  static class ExplicitTxManagerConfig implements TransactionManagementConfigurer {
    @Bean
    public PlatformTransactionManager txManager1() {
      return new CallCountingTransactionManager();
    }
View Full Code Here

Examples of org.springframework.tests.transaction.CallCountingTransactionManager

      return new CallCountingTransactionManager();
    }

    @Bean
    public PlatformTransactionManager txManager2() {
      return new CallCountingTransactionManager();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.