use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method withMultiMethodOverride.
@Test
public void withMultiMethodOverride() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithMultiMethodOverride());
proxyFactory.addAdvice(this.ti);
TestWithMultiMethodOverride proxy = (TestWithMultiMethodOverride) proxyFactory.getProxy();
proxy.doSomething();
assertGetTransactionAndCommitCount(1);
proxy.doSomethingElse();
assertGetTransactionAndCommitCount(2);
proxy.doSomethingCompletelyElse();
assertGetTransactionAndCommitCount(3);
proxy.doSomething();
assertGetTransactionAndCommitCount(4);
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method withSingleMethodOverride.
@Test
public void withSingleMethodOverride() {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new TestWithSingleMethodOverride());
proxyFactory.addAdvice(this.ti);
TestWithSingleMethodOverride proxy = (TestWithSingleMethodOverride) proxyFactory.getProxy();
proxy.doSomething();
assertGetTransactionAndCommitCount(1);
proxy.doSomethingElse();
assertGetTransactionAndCommitCount(2);
proxy.doSomethingCompletelyElse();
assertGetTransactionAndCommitCount(3);
proxy.doSomething();
assertGetTransactionAndCommitCount(4);
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class AnnotationTransactionInterceptorTests method crossClassInterfaceOnJdkProxy.
@Test
public void crossClassInterfaceOnJdkProxy() throws Exception {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTarget(new OtherServiceImpl());
proxyFactory.addInterface(OtherService.class);
proxyFactory.addAdvice(this.ti);
OtherService otherService = (OtherService) proxyFactory.getProxy();
otherService.foo();
assertGetTransactionAndCommitCount(1);
}
Aggregations