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.junit.runners.BlockJUnit4ClassRunner;
23  import org.slf4j.Logger;
24  import org.slf4j.LoggerFactory;
25  import org.springframework.context.ConfigurableApplicationContext;
26  import org.springframework.context.support.ClassPathXmlApplicationContext;
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  @RunWith(BlockJUnit4ClassRunner.class)
40  public class TestWebServiceAwareBeanPostProcessorSinglePostProcessor  {
41  
42  	private static final Logger log = LoggerFactory.getLogger(TestWebServiceAwareBeanPostProcessorSinglePostProcessor.class);
43  	private ConfigurableApplicationContext context;
44  	
45  	
46  
47  
48  	public TestWebServiceAwareBeanPostProcessorSinglePostProcessor() {
49  	}
50  	
51  	@Before
52  	public void onBefore() {
53  		
54  		
55  
56  
57  		
58  		context = new ClassPathXmlApplicationContext("classpath:test-spring-post-processor.xml");
59  		
60  		context.registerShutdownHook();
61  		
62  	}
63  
64  	
65  	
66  
67  	@Test
68  	public void testDirectDictionaryServiceWithMessageServiceProxy() {
69  		TestBean bean = context.getBean(TestBean.class);
70  		
71  		String dataDictionaryClassName = bean.getDictionaryService().getClass().getName();
72  		
73  		Assert.assertTrue(dataDictionaryClassName.equals("org.kuali.student.common.spring.FakeDictionaryServiceDecoratorImpl"));
74  		
75  		String messageServiceClassName = bean.getMessageService().getClass().getName();
76  		
77  		Assert.assertTrue("class name must contain $Proxy", messageServiceClassName.contains("$Proxy"));
78  		
79  	}
80  }