diff options
author | mwebster <mwebster> | 2006-09-19 15:00:21 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-09-19 15:00:21 +0000 |
commit | a06896ea1981bb66838fbb352249eb614b2f2946 (patch) | |
tree | 0e9d4da17cc0b0e28791adc90fcf2335052e17a5 /tests | |
parent | a40594edf71956e8e7b1d3229a335ce3892ba4a6 (diff) | |
download | aspectj-a06896ea1981bb66838fbb352249eb614b2f2946.tar.gz aspectj-a06896ea1981bb66838fbb352249eb614b2f2946.zip |
Bug 157474 "Handle duplicate aop.xml definitions more gracefully" (tests for duplicate aop.xml and -Dorg.aspectj.weaver.loadtime.configuration)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs153/pr157474/AbstractTracing.aj | 8 | ||||
-rw-r--r-- | tests/bugs153/pr157474/HelloWorld.java | 7 | ||||
-rw-r--r-- | tests/bugs153/pr157474/ant-server.xml | 27 | ||||
-rw-r--r-- | tests/bugs153/pr157474/aop-application.xml | 9 | ||||
-rw-r--r-- | tests/bugs153/pr157474/aop-library.xml | 0 | ||||
-rw-r--r-- | tests/bugs153/pr157474/server-applicationandlibrary.properties | 7 | ||||
-rw-r--r-- | tests/ltw/Tracing.aj | 6 | ||||
-rw-r--r-- | tests/ltw/ant-server.xml | 4 | ||||
-rw-r--r-- | tests/ltw/ant.xml | 22 | ||||
-rw-r--r-- | tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml | 5 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java | 5 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml | 12 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java | 23 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc153/ajc153.xml | 14 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/tracing/tracing.xml | 1 |
16 files changed, 149 insertions, 2 deletions
diff --git a/tests/bugs153/pr157474/AbstractTracing.aj b/tests/bugs153/pr157474/AbstractTracing.aj new file mode 100644 index 000000000..1dfd64f57 --- /dev/null +++ b/tests/bugs153/pr157474/AbstractTracing.aj @@ -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 index 000000000..8e5a1fdd7 --- /dev/null +++ b/tests/bugs153/pr157474/HelloWorld.java @@ -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 index 000000000..af315984a --- /dev/null +++ b/tests/bugs153/pr157474/ant-server.xml @@ -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 index 000000000..8654ca277 --- /dev/null +++ b/tests/bugs153/pr157474/aop-application.xml @@ -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 index 000000000..e69de29bb --- /dev/null +++ b/tests/bugs153/pr157474/aop-library.xml diff --git a/tests/bugs153/pr157474/server-applicationandlibrary.properties b/tests/bugs153/pr157474/server-applicationandlibrary.properties new file mode 100644 index 000000000..0fc39dc43 --- /dev/null +++ b/tests/bugs153/pr157474/server-applicationandlibrary.properties @@ -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 index 000000000..74b0e5a8e --- /dev/null +++ b/tests/ltw/Tracing.aj @@ -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 diff --git a/tests/ltw/ant-server.xml b/tests/ltw/ant-server.xml index 1bb336ab1..9960962ca 100644 --- a/tests/ltw/ant-server.xml +++ b/tests/ltw/ant-server.xml @@ -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> diff --git a/tests/ltw/ant.xml b/tests/ltw/ant.xml index dfde53635..db38cb16a 100644 --- a/tests/ltw/ant.xml +++ b/tests/ltw/ant.xml @@ -45,4 +45,26 @@ </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> + </project> diff --git a/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml b/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml new file mode 100644 index 000000000..232c72ee6 --- /dev/null +++ b/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="ExceptionHandler"/> + </aspects> +</aspectj>
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java index 38346279e..cf59b8cb1 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -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 diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml index 816ff27b2..01167c34e 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -227,6 +227,7 @@ <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"/> @@ -581,5 +582,16 @@ </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 diff --git a/tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java b/tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java index ae1e9a7e9..2951175f3 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java +++ b/tests/src/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java @@ -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 index 000000000..151af029d --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc153/LTWServer153Tests.java @@ -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"); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 8070cdd30..2beddab01 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -423,5 +423,19 @@ <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 diff --git a/tests/src/org/aspectj/systemtest/tracing/tracing.xml b/tests/src/org/aspectj/systemtest/tracing/tracing.xml index bed65f12d..eb5998149 100644 --- a/tests/src/org/aspectj/systemtest/tracing/tracing.xml +++ b/tests/src/org/aspectj/systemtest/tracing/tracing.xml @@ -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"/> |