1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.spring;
17
18 import org.junit.Assert;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.beans.factory.support.AbstractBeanFactory;
26 import org.springframework.test.context.ContextConfiguration;
27 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
28
29
30
31
32
33
34
35
36 @RunWith(SpringJUnit4ClassRunner.class)
37 @ContextConfiguration (locations="classpath:test-spring-post-processor.xml")
38 public class TestWebServiceAwareBeanPostProcessorMultiProcessors {
39
40 private static final Logger log = LoggerFactory.getLogger(TestWebServiceAwareBeanPostProcessorMultiProcessors.class);
41
42 @Autowired
43 private AbstractBeanFactory context;
44
45
46
47
48 public TestWebServiceAwareBeanPostProcessorMultiProcessors() {
49 }
50
51 @Before
52 public void before() {
53
54
55
56
57
58
59
60
61
62
63 context.getBeanPostProcessors().clear();
64 context.addBeanPostProcessor(new WebServiceAwareSpringBeanPostProcessor());
65
66
67 }
68
69 @Test
70 public void testDirectDictionaryServiceWithMessageServiceProxy() {
71
72 TestBean bean = context.getBean(TestBean.class);
73
74 String dataDictionaryClassName = bean.getDictionaryService().getClass().getName();
75
76
77 Assert.assertTrue(dataDictionaryClassName.equals("org.kuali.student.common.spring.FakeDictionaryServiceDecoratorImpl"));
78
79 String messageServiceClassName = bean.getMessageService().getClass().getName();
80
81 Assert.assertTrue("class name must contain $Proxy", messageServiceClassName.contains("$Proxy"));
82
83 }
84 }