org.springframework.tests.aop.interceptor.SerializableNopInterceptor Java Examples

The following examples show how to use org.springframework.tests.aop.interceptor.SerializableNopInterceptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DelegatingIntroductionInterceptorTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testSerializableDelegatingIntroductionInterceptorSerializable() throws Exception {
	SerializablePerson serializableTarget = new SerializablePerson();
	String name = "Tony";
	serializableTarget.setName("Tony");

	ProxyFactory factory = new ProxyFactory(serializableTarget);
	factory.addInterface(Person.class);
	long time = 1000;
	TimeStamped ts = new SerializableTimeStamped(time);

	factory.addAdvisor(new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts)));
	factory.addAdvice(new SerializableNopInterceptor());

	Person p = (Person) factory.getProxy();

	assertEquals(name, p.getName());
	assertEquals(time, ((TimeStamped) p).getTimeStamp());

	Person p1 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
	assertEquals(name, p1.getName());
	assertEquals(time, ((TimeStamped) p1).getTimeStamp());
}
 
Example #2
Source File: DelegatingIntroductionInterceptorTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testSerializableDelegatingIntroductionInterceptorSerializable() throws Exception {
	SerializablePerson serializableTarget = new SerializablePerson();
	String name = "Tony";
	serializableTarget.setName("Tony");

	ProxyFactory factory = new ProxyFactory(serializableTarget);
	factory.addInterface(Person.class);
	long time = 1000;
	TimeStamped ts = new SerializableTimeStamped(time);

	factory.addAdvisor(new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts)));
	factory.addAdvice(new SerializableNopInterceptor());

	Person p = (Person) factory.getProxy();

	assertEquals(name, p.getName());
	assertEquals(time, ((TimeStamped) p).getTimeStamp());

	Person p1 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
	assertEquals(name, p1.getName());
	assertEquals(time, ((TimeStamped) p1).getTimeStamp());
}
 
Example #3
Source File: DelegatingIntroductionInterceptorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testSerializableDelegatingIntroductionInterceptorSerializable() throws Exception {
	SerializablePerson serializableTarget = new SerializablePerson();
	String name = "Tony";
	serializableTarget.setName("Tony");

	ProxyFactory factory = new ProxyFactory(serializableTarget);
	factory.addInterface(Person.class);
	long time = 1000;
	TimeStamped ts = new SerializableTimeStamped(time);

	factory.addAdvisor(new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts)));
	factory.addAdvice(new SerializableNopInterceptor());

	Person p = (Person) factory.getProxy();

	assertEquals(name, p.getName());
	assertEquals(time, ((TimeStamped) p).getTimeStamp());

	Person p1 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
	assertEquals(name, p1.getName());
	assertEquals(time, ((TimeStamped) p1).getTimeStamp());
}
 
Example #4
Source File: NameMatchMethodPointcutTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create an empty pointcut, populating instance variables.
 */
@Before
public void setup() {
	ProxyFactory pf = new ProxyFactory(new SerializablePerson());
	nop = new SerializableNopInterceptor();
	pc = new NameMatchMethodPointcut();
	pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
	proxied = (Person) pf.getProxy();
}
 
Example #5
Source File: NameMatchMethodPointcutTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create an empty pointcut, populating instance variables.
 */
@Before
public void setup() {
	ProxyFactory pf = new ProxyFactory(new SerializablePerson());
	nop = new SerializableNopInterceptor();
	pc = new NameMatchMethodPointcut();
	pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
	proxied = (Person) pf.getProxy();
}
 
Example #6
Source File: NameMatchMethodPointcutTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Create an empty pointcut, populating instance variables.
 */
@Before
public void setUp() {
	ProxyFactory pf = new ProxyFactory(new SerializablePerson());
	nop = new SerializableNopInterceptor();
	pc = new NameMatchMethodPointcut();
	pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
	proxied = (Person) pf.getProxy();
}