diff options
author | aclement <aclement> | 2005-10-14 07:23:40 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-10-14 07:23:40 +0000 |
commit | 8982544f13eb5cb082ca19db2bd2c5f77b1e5965 (patch) | |
tree | d7e4c96b17ce76331686fc3cab53326d0087f039 /tests | |
parent | 51a0fe4edd56a626ef5570e43bd2225be0dcb4dd (diff) | |
download | aspectj-8982544f13eb5cb082ca19db2bd2c5f77b1e5965.tar.gz aspectj-8982544f13eb5cb082ca19db2bd2c5f77b1e5965.zip |
Code for enhancement 107741: Updated WeavingURLClassLoader (thanks to Matthew Webster for the patch)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ltw/Aspect1.aj | 19 | ||||
-rw-r--r-- | tests/ltw/Aspect2.aj | 19 | ||||
-rw-r--r-- | tests/ltw/Main.java | 28 | ||||
-rw-r--r-- | tests/ltw/aop-ltwreweavable.xml | 6 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java | 5 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java | 35 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml | 33 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml | 11 |
8 files changed, 155 insertions, 1 deletions
diff --git a/tests/ltw/Aspect1.aj b/tests/ltw/Aspect1.aj new file mode 100644 index 000000000..173cb8603 --- /dev/null +++ b/tests/ltw/Aspect1.aj @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ +import org.aspectj.lang.JoinPoint; + +public aspect Aspect1 { + + before () : execution(void Main.test1()) { + System.err.println("Aspect1.before_" + thisJoinPoint.getSignature().getName()); + } +} diff --git a/tests/ltw/Aspect2.aj b/tests/ltw/Aspect2.aj new file mode 100644 index 000000000..519a47eeb --- /dev/null +++ b/tests/ltw/Aspect2.aj @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ +import org.aspectj.lang.JoinPoint; + +public aspect Aspect2 { + + before () : execution(void Main.test2()){ + System.err.println("Aspect2.before_" + thisJoinPoint.getSignature().getName()); + } +} diff --git a/tests/ltw/Main.java b/tests/ltw/Main.java new file mode 100644 index 000000000..fca018ac9 --- /dev/null +++ b/tests/ltw/Main.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ + +public class Main { + + public void test1 () { + System.out.println("Main.test1"); + } + + public void test2 () { + System.out.println("Main.test2"); + } + + public static void main (String[] args) { + System.out.println("Main.main"); + new Main().test1(); + new Main().test2(); + } +} diff --git a/tests/ltw/aop-ltwreweavable.xml b/tests/ltw/aop-ltwreweavable.xml new file mode 100644 index 000000000..9afd80e02 --- /dev/null +++ b/tests/ltw/aop-ltwreweavable.xml @@ -0,0 +1,6 @@ +<aspectj> + <aspect name="Aspect1"/> + <aspect name="Aspect2"/> + + <weaver options="-showWeaveInfo"/> +</aspectj> diff --git a/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java b/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java index 0f457c739..32748c455 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java +++ b/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java @@ -13,6 +13,7 @@ package org.aspectj.systemtest.ajc150; import org.aspectj.systemtest.ajc150.ataspectj.AtAjSyntaxTests; import org.aspectj.systemtest.ajc150.ataspectj.AtAjMisuseTests; import org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests; +import org.aspectj.systemtest.ajc150.ltw.LTWTests; import junit.framework.Test; import junit.framework.TestSuite; @@ -52,7 +53,9 @@ public class AllTestsAspectJ150 { suite.addTest(AtAjMisuseTests.suite()); suite.addTest(AtAjLTWTests.suite()); suite.addTest(HasMember.suite()); - //$JUnit-END$ + + suite.addTestSuite(LTWTests.class); + //$JUnit-END$ return suite; } } diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java new file mode 100644 index 000000000..543d586e8 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2005 Contributors. + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ltw; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(LTWTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml"); + } + + + public void test001(){ + runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect"); + } +} + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml new file mode 100644 index 000000000..0e818afbf --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -0,0 +1,33 @@ +<!-- Load-time weaving tests --> + + <ajc-test dir="ltw" + title="Ensure 1st aspect is rewoven when weaving 2nd aspect" + keywords="reweavable"> + <compile + files="Main.java, Aspect1.aj" + outjar="main1.jar" + options="-showWeaveInfo" + > + <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:15) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/> + </compile> + <compile + classpath="main1.jar" + files="Aspect2.aj" + outjar="aspect2.jar" + options="-showWeaveInfo" + > + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml"> + <stdout> + <line text="Main.main"/> + <line text="Main.test1"/> + <line text="Main.test2"/> + </stdout> + <stderr> + <line text="Aspect1.before_test1"/> + <line text="Aspect2.before_test2"/> + </stderr> + </run> + </ajc-test> + + diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml new file mode 100644 index 000000000..311872c09 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml"> +]> + +<!-- Load-time weaving tests --> + +<suite> + +&tests; + +</suite> |