use of org.springframework.transaction.interceptor.TransactionInterceptor in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method withMonoSuccess.
@Test
public void withMonoSuccess() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
TestWithReactive proxy = (TestWithReactive) proxyFactory.getProxy();
StepVerifier.withVirtualTime(proxy::monoSuccess).thenAwait(Duration.ofSeconds(10)).verifyComplete();
assertReactiveGetTransactionAndCommitCount(1);
}
use of org.springframework.transaction.interceptor.TransactionInterceptor in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method withFluxRollback.
@Test
public void withFluxRollback() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
TestWithReactive proxy = (TestWithReactive) proxyFactory.getProxy();
StepVerifier.withVirtualTime(proxy::fluxSuccess).thenAwait(Duration.ofSeconds(1)).thenCancel().verify();
assertReactiveGetTransactionAndRollbackCount(1);
}
use of org.springframework.transaction.interceptor.TransactionInterceptor in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method withFluxSuccess.
@Test
public void withFluxSuccess() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithReactive());
proxyFactory.addAdvice(new TransactionInterceptor(rtm, this.source));
TestWithReactive proxy = (TestWithReactive) proxyFactory.getProxy();
StepVerifier.withVirtualTime(proxy::fluxSuccess).thenAwait(Duration.ofSeconds(10)).expectNextCount(1).verifyComplete();
assertReactiveGetTransactionAndCommitCount(1);
}
use of org.springframework.transaction.interceptor.TransactionInterceptor in project spring-framework by spring-projects.
the class ProxyTransactionManagementConfiguration method transactionInterceptor.
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionInterceptor transactionInterceptor(TransactionAttributeSource transactionAttributeSource) {
TransactionInterceptor interceptor = new TransactionInterceptor();
interceptor.setTransactionAttributeSource(transactionAttributeSource);
if (this.txManager != null) {
interceptor.setTransactionManager(this.txManager);
}
return interceptor;
}
Aggregations