use of org.springframework.transaction.testfixture.CallCountingTransactionManager in project spring-framework by spring-projects.
the class AnnotationTransactionNamespaceHandlerTests method nonPublicMethodsNotAdvised.
@Test
public void nonPublicMethodsNotAdvised() {
TransactionalTestBean testBean = getTestBean();
CallCountingTransactionManager ptm = (CallCountingTransactionManager) context.getBean("transactionManager");
assertThat(ptm.begun).as("Should not have any started transactions").isEqualTo(0);
testBean.annotationsOnProtectedAreIgnored();
assertThat(ptm.begun).as("Should not have any started transactions").isEqualTo(0);
}
use of org.springframework.transaction.testfixture.CallCountingTransactionManager in project spring-framework by spring-projects.
the class AnnotationDrivenTests method doTestWithMultipleTransactionManagers.
private void doTestWithMultipleTransactionManagers(ApplicationContext context) {
CallCountingTransactionManager tm1 = context.getBean("transactionManager1", CallCountingTransactionManager.class);
CallCountingTransactionManager tm2 = context.getBean("transactionManager2", CallCountingTransactionManager.class);
TransactionalService service = context.getBean("service", TransactionalService.class);
assertThat(AopUtils.isCglibProxy(service)).isTrue();
service.setSomething("someName");
assertThat(tm1.commits).isEqualTo(1);
assertThat(tm2.commits).isEqualTo(0);
service.doSomething();
assertThat(tm1.commits).isEqualTo(1);
assertThat(tm2.commits).isEqualTo(1);
service.setSomething("someName");
assertThat(tm1.commits).isEqualTo(2);
assertThat(tm2.commits).isEqualTo(1);
service.doSomething();
assertThat(tm1.commits).isEqualTo(2);
assertThat(tm2.commits).isEqualTo(2);
}
Aggregations