Package org.springframework.transaction.annotation.AnnotationTransactionNamespaceHandlerTests

Examples of org.springframework.transaction.annotation.AnnotationTransactionNamespaceHandlerTests.TransactionalTestBean


  @Test
  public void transactionProxyIsCreated() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableTxConfig.class, TxManagerConfig.class);
    ctx.refresh();
    TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);
    assertThat("testBean is not a proxy", AopUtils.isAopProxy(bean), is(true));
    Map<?,?> services = ctx.getBeansWithAnnotation(Service.class);
    assertThat("Stereotype annotation not visible", services.containsKey("testBean"), is(true));
  }
View Full Code Here


  @Test
  public void transactionProxyIsCreatedWithEnableOnSuperclass() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(InheritedEnableTxConfig.class, TxManagerConfig.class);
    ctx.refresh();
    TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);
    assertThat("testBean is not a proxy", AopUtils.isAopProxy(bean), is(true));
    Map<?,?> services = ctx.getBeansWithAnnotation(Service.class);
    assertThat("Stereotype annotation not visible", services.containsKey("testBean"), is(true));
  }
View Full Code Here

  @Test
  public void txManagerIsResolvedOnInvocationOfTransactionalMethod() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableTxConfig.class, TxManagerConfig.class);
    ctx.refresh();
    TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);

    // invoke a transactional method, causing the PlatformTransactionManager bean to be resolved.
    bean.findAllFoos();
  }
View Full Code Here

  @Test
  public void txManagerIsResolvedCorrectlyWhenMultipleManagersArePresent() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableTxConfig.class, MultiTxManagerConfig.class);
    ctx.refresh();
    TransactionalTestBean bean = ctx.getBean(TransactionalTestBean.class);

    // invoke a transactional method, causing the PlatformTransactionManager bean to be resolved.
    bean.findAllFoos();
  }
View Full Code Here

  @Test
  public void spr11915() {
    AnnotationConfigApplicationContext ctx =
        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));
View Full Code Here

          "qualifiedTransactionManager", new CallCountingTransactionManager());
    }

    @Bean
    public TransactionalTestBean testBean() {
      return new TransactionalTestBean();
    }
View Full Code Here

  @Configuration
  static class TxManagerConfig {

    @Bean
    public TransactionalTestBean testBean() {
      return new TransactionalTestBean();
    }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.annotation.AnnotationTransactionNamespaceHandlerTests.TransactionalTestBean

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.