2626import org .springframework .beans .factory .config .BeanDefinition ;
2727import org .springframework .beans .factory .config .BeanReference ;
2828import org .springframework .beans .factory .parsing .BeanComponentDefinition ;
29- import org .springframework .beans .factory .parsing .CollectingReaderEventListener ;
3029import org .springframework .beans .factory .parsing .ComponentDefinition ;
3130import org .springframework .beans .factory .parsing .CompositeComponentDefinition ;
3231import org .springframework .beans .factory .support .DefaultListableBeanFactory ;
3332import org .springframework .beans .factory .xml .XmlBeanDefinitionReader ;
3433import org .springframework .core .io .ClassPathResource ;
3534
35+ import test .parsing .CollectingReaderEventListener ;
36+
3637/**
3738 * @author Rob Harrop
3839 * @author Juergen Hoeller
3940 * @author Chris Beams
4041 */
4142public final class AopNamespaceHandlerEventTests {
4243
44+ private static final Class <?> CLASS = AopNamespaceHandlerEventTests .class ;
45+ private static final String CLASSNAME = CLASS .getSimpleName ();
46+
47+ private static final String CONTEXT = CLASSNAME + "-context.xml" ;
48+ private static final String POINTCUT_EVENTS_CONTEXT = CLASSNAME + "-pointcutEvents.xml" ;
49+ private static final String POINTCUT_REF_CONTEXT = CLASSNAME + "-pointcutRefEvents.xml" ;
50+ private static final String DIRECT_POINTCUT_EVENTS_CONTEXT = CLASSNAME + "-directPointcutEvents.xml" ;
51+
4352 private CollectingReaderEventListener eventListener = new CollectingReaderEventListener ();
4453
4554 private XmlBeanDefinitionReader reader ;
4655
4756 private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory ();
57+
4858
4959
5060 @ Before
@@ -55,7 +65,7 @@ public void setUp() throws Exception {
5565
5666 @ Test
5767 public void testPointcutEvents () throws Exception {
58- loadBeansFrom ("aopNamespaceHandlerPointcutEventTests.xml" );
68+ loadBeansFrom (POINTCUT_EVENTS_CONTEXT );
5969 ComponentDefinition [] componentDefinitions = this .eventListener .getComponentDefinitions ();
6070 assertEquals ("Incorrect number of events fired" , 1 , componentDefinitions .length );
6171 assertTrue ("No holder with nested components" , componentDefinitions [0 ] instanceof CompositeComponentDefinition );
@@ -79,7 +89,7 @@ public void testPointcutEvents() throws Exception {
7989
8090 @ Test
8191 public void testAdvisorEventsWithPointcutRef () throws Exception {
82- loadBeansFrom ("aopNamespaceHandlerAdvisorWithPointcutRefEventTests.xml" );
92+ loadBeansFrom (POINTCUT_REF_CONTEXT );
8393 ComponentDefinition [] componentDefinitions = this .eventListener .getComponentDefinitions ();
8494 assertEquals ("Incorrect number of events fired" , 2 , componentDefinitions .length );
8595
@@ -108,7 +118,7 @@ public void testAdvisorEventsWithPointcutRef() throws Exception {
108118
109119 @ Test
110120 public void testAdvisorEventsWithDirectPointcut () throws Exception {
111- loadBeansFrom ("aopNamespaceHandlerAdvisorWithDirectPointcutEventTests.xml" );
121+ loadBeansFrom (DIRECT_POINTCUT_EVENTS_CONTEXT );
112122 ComponentDefinition [] componentDefinitions = this .eventListener .getComponentDefinitions ();
113123 assertEquals ("Incorrect number of events fired" , 2 , componentDefinitions .length );
114124
@@ -137,7 +147,7 @@ public void testAdvisorEventsWithDirectPointcut() throws Exception {
137147
138148 @ Test
139149 public void testAspectEvent () throws Exception {
140- loadBeansFrom ("aopNamespaceHandlerAspectEventTests.xml" );
150+ loadBeansFrom (CONTEXT );
141151 ComponentDefinition [] componentDefinitions = this .eventListener .getComponentDefinitions ();
142152 assertEquals ("Incorrect number of events fired" , 5 , componentDefinitions .length );
143153
0 commit comments