]> source.dussan.org Git - aspectj.git/commitdiff
Bug 157474 "Handle duplicate aop.xml definitions more gracefully" (tests for duplicat...
authormwebster <mwebster>
Tue, 19 Sep 2006 15:00:21 +0000 (15:00 +0000)
committermwebster <mwebster>
Tue, 19 Sep 2006 15:00:21 +0000 (15:00 +0000)
16 files changed:
tests/bugs153/pr157474/AbstractTracing.aj [new file with mode: 0644]
tests/bugs153/pr157474/HelloWorld.java [new file with mode: 0644]
tests/bugs153/pr157474/ant-server.xml [new file with mode: 0644]
tests/bugs153/pr157474/aop-application.xml [new file with mode: 0644]
tests/bugs153/pr157474/aop-library.xml [new file with mode: 0644]
tests/bugs153/pr157474/server-applicationandlibrary.properties [new file with mode: 0644]
tests/ltw/Tracing.aj [new file with mode: 0644]
tests/ltw/ant-server.xml
tests/ltw/ant.xml
tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java
tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
tests/src/org/aspectj/systemtest/tracing/tracing.xml

diff --git a/tests/bugs153/pr157474/AbstractTracing.aj b/tests/bugs153/pr157474/AbstractTracing.aj
new file mode 100644 (file)
index 0000000..1dfd64f
--- /dev/null
@@ -0,0 +1,8 @@
+public abstract aspect AbstractTracing {
+       
+       protected abstract pointcut scope ();
+       
+       before () : execution(public static void main(String[])) && scope() {
+               System.out.println("? " + thisJoinPointStaticPart.getSignature().getName());
+       }
+}
\ No newline at end of file
diff --git a/tests/bugs153/pr157474/HelloWorld.java b/tests/bugs153/pr157474/HelloWorld.java
new file mode 100644 (file)
index 0000000..8e5a1fd
--- /dev/null
@@ -0,0 +1,7 @@
+public class HelloWorld {
+       
+       public static void main (String[] args) throws Exception {
+               System.out.println("Hello World!");
+       }
+       
+}
\ No newline at end of file
diff --git a/tests/bugs153/pr157474/ant-server.xml b/tests/bugs153/pr157474/ant-server.xml
new file mode 100644 (file)
index 0000000..af31598
--- /dev/null
@@ -0,0 +1,27 @@
+<!-- ajc-ant script, not to be used from Ant commant line - see AntSpec -->
+<project name="ltw">
+
+    <!-- using this we can debug the forked VM -->
+    <property
+        name="jdwp"
+        value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+
+    <target name="TestServer with duplicate configuration">
+        <copy file="${aj.root}/tests/bugs153/pr157474/server-applicationandlibrary.properties"
+              tofile="${aj.sandbox}/server.properties"/>
+       
+        <mkdir dir="${aj.sandbox}/Application"/>
+        <copy file="${aj.root}/tests/bugs153/pr157474/aop-application.xml"
+              tofile="${aj.sandbox}/Application/META-INF/aop.xml"/>
+       
+        <java fork="yes" classname="org.aspectj.testing.server.TestServer" failonerror="yes">
+            <classpath refid="aj.path"/>
+            <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
+            <jvmarg value="-Daj.weaving.verbose=true"/>
+            <jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
+<!--            <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
+               <arg path="${aj.sandbox}"/>
+        </java>
+    </target>
+
+</project>
diff --git a/tests/bugs153/pr157474/aop-application.xml b/tests/bugs153/pr157474/aop-application.xml
new file mode 100644 (file)
index 0000000..8654ca2
--- /dev/null
@@ -0,0 +1,9 @@
+<aspectj>
+       <aspects>
+        <concrete-aspect name="HelloWorldTracing" extends="AbstractTracing">
+               <pointcut name="scope" expression="within(HelloWorld)"/>
+        </concrete-aspect>
+    </aspects>
+    
+    <weaver options="-debug"/>
+</aspectj>
\ No newline at end of file
diff --git a/tests/bugs153/pr157474/aop-library.xml b/tests/bugs153/pr157474/aop-library.xml
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/bugs153/pr157474/server-applicationandlibrary.properties b/tests/bugs153/pr157474/server-applicationandlibrary.properties
new file mode 100644 (file)
index 0000000..0fc39dc
--- /dev/null
@@ -0,0 +1,7 @@
+# loader.XXX=Name,Classpath[,Parent]
+loader.parent=Library,Application;library.jar
+loader.child=Application,Application;application.jar,Library
+#loader.child=Application,Application;library.jar;application.jar
+
+# main=Class,Loader
+main=HelloWorld,Application
\ No newline at end of file
diff --git a/tests/ltw/Tracing.aj b/tests/ltw/Tracing.aj
new file mode 100644 (file)
index 0000000..74b0e5a
--- /dev/null
@@ -0,0 +1,6 @@
+public aspect Tracing {
+       
+       before () : execution(public static void main(String[])) {
+               System.out.println("? " + thisJoinPointStaticPart.getSignature().getName());
+       }
+}
\ No newline at end of file
index 1bb336ab1848e5510232a94335dc77712cb0b043..9960962ca5246ecdc129ec6f2de42e8190a8c300 100644 (file)
@@ -14,7 +14,7 @@
             <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
             <jvmarg value="-Daj.weaving.verbose=true"/>
             <jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
-            <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>
+<!--            <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
                <arg path="${aj.sandbox}"/>
         </java>
     </target>
@@ -27,7 +27,7 @@
             <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
             <jvmarg value="-Daj.weaving.verbose=true"/>
             <jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
-            <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>
+<!--            <jvmarg value="-Dorg.aspectj.testing.server.debug=true"/>-->
                <arg path="${aj.sandbox}"/>
         </java>
     </target>
index dfde53635bd8e9ec37188b1d18e133e6857fa66a..db38cb16a195d4a6df40e92127d87889b647c0eb 100644 (file)
             <jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
             <!-- use META-INF/aop.xml style -->
 <!--            <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
+<!--            <jvmarg line="${jdwp}"/>-->
+        </java>
+    </target>
+
+       <!-- We have three JARs files, two containing aspects (ExceptionHandler and Tracing)
+            for which aop-ajc.xml files have been generate. However we supply our own
+            aop.xml which declares only ExceptionHandler. We then override the 
+            configuration search path -->
+    <target name="override default path using -Dorg.aspectj.weaver.loadtime.configuration">
+        <copy file="${aj.root}/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml"
+              tofile="${aj.sandbox}/META-INF/aop-random.xml"/>
+        <java fork="yes" classname="HelloWorld" failonerror="yes">
+            <classpath refid="aj.path"/>
+            <classpath>
+                <pathelement path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar:${aj.sandbox}/tracing.jar"/>
+            </classpath>
+            <jvmarg value="-Dorg.aspectj.weaver.loadtime.configuration=META-INF/aop-random.xml"/>
+            <jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
+            <jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
+            <jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
+            <!-- use META-INF/aop.xml style -->
+            <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
 <!--            <jvmarg line="${jdwp}"/>-->
         </java>
     </target>
diff --git a/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml b/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml
new file mode 100644 (file)
index 0000000..232c72e
--- /dev/null
@@ -0,0 +1,5 @@
+<aspectj>
+       <aspects>
+               <aspect name="ExceptionHandler"/>
+       </aspects>
+</aspectj>
\ No newline at end of file
index 38346279edc832c4f139ad2c7d44bcb70b35008d..cf59b8cb1717eae27e67451c465e151854e368da 100644 (file)
@@ -137,6 +137,11 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
        public void testSeparateCompilationDeclareParentsCall_pr133770() {
                runTest("separate compilation with ltw: declare parents and call");
        }
+       
+       public void testConfigutationSystemProperty_pr149289 () {
+               runTest("override default path using -Dorg.aspectj.weaver.loadtime.configuration");
+                               
+       }
                
        /*
         * Allow system properties to be set and restored
index 816ff27b26f26679747140639f2f97211bdd1857..01167c34ed322d501edf2dd93ebf96a72c4e4ca1 100644 (file)
                 <line text="info AspectJ Weaver Version"/>
                 <line text="info register classloader"/>
                 <line text="info using"/>
+                <line text="info define aspect ConcreteAspect"/>
                 <line text="debug generating class 'ConcreteAspect'"/>
                 <line text="debug weaving 'Main'"/>
                 <line text="AbstractSuperAspect.before_test1"/>
                </stdout>
         </ant>
     </ajc-test>
+
+       <ajc-test dir="ltw" title="override default path using -Dorg.aspectj.weaver.loadtime.configuration" keywords="ltw">
+        <compile files="HelloWorld.java" options="-outjar hello.jar"/>
+        <compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/>
+        <compile files="Tracing.aj" options="-outxml -outjar tracing.jar"/>
+               <ant file="ant.xml" target="override default path using -Dorg.aspectj.weaver.loadtime.configuration" verbose="true">
+               <stdout>
+               <line text="Hello World!"/>
+               </stdout>
+        </ant>
+    </ajc-test>
     
     
\ No newline at end of file
index ae1e9a7e98fa931eefb4f4f2710e7a326c60804d..2951175f3784c96b5731e0994f4ec7a569918640 100644 (file)
@@ -21,6 +21,7 @@ public class AllTestsAspectJ153 {
                suite.addTest(Ajc153Tests.suite());
                suite.addTest(JDTLikeHandleProviderTests.suite());
                suite.addTest(PipeliningTests.suite());
+               suite.addTest(LTWServer153Tests.suite());
         //$JUnit-END$
                return suite;
        }
diff --git a/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java
new file mode 100644 (file)
index 0000000..151af02
--- /dev/null
@@ -0,0 +1,23 @@
+package org.aspectj.systemtest.ajc153;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+public class LTWServer153Tests extends XMLBasedAjcTestCase {
+
+       public static Test suite() {
+               return loadSuite(LTWServer153Tests.class);
+       }
+
+       protected File getSpecFile() {
+           return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
+       }
+    
+       public void testHandleDuplicateConfiguration_pr157474 () {
+               runTest("TestServer with duplicate configuration");
+       }
+
+}
index 8070cdd3012b155f998700130538b4d676717d8c..2beddab0125e876d68096ca364cbe18e6c321556 100644 (file)
                <message kind="warning" line="27" text="adviceDidNotMatch"/>
          </compile>    
     </ajc-test>
+    
+       <ajc-test dir="bugs153/pr157474" title="TestServer with duplicate configuration" keywords="ltw,server">
+        <compile files="AbstractTracing.aj" options="-outjar library.jar -outxml"/>
+        <compile files="HelloWorld.java" options="-outjar application.jar"/>
+        <ant file="ant-server.xml" target="TestServer with duplicate configuration" verbose="true">
+               <stdout>
+               <line text="Starting ..."/>
+               <line text="Running HelloWorld"/>
+               <line text="? main"/>
+               <line text="Hello World!"/>
+               <line text="Stopping ..."/>
+               </stdout>
+        </ant>
+    </ajc-test>
 
 </suite>
\ No newline at end of file
index bed65f12d3a31bb790f989f9c7773b9c81e4befc..eb5998149938dd0b0e28fa6a830016bd71e275a7 100644 (file)
@@ -50,6 +50,7 @@
                        <line text="info register aspect IncludedAspect"/>
                        <line text="warning aspect ExcludedAspect exluded"/>
                        <line text="warning aspect ExcludedAspect exluded"/>
+                       <line text="info define aspect IncludedMissingAspect"/>
                        <line text="error Cannot find m_parent aspect"/>
                        <line text="error Cannot find m_parent aspect"/>
                        <line text="error Concrete-aspect 'IncludedMissingAspect' could not be registered"/>