diff options
author | aclement <aclement> | 2010-05-13 04:06:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-05-13 04:06:42 +0000 |
commit | 50b9cc3c0afda97d251f884e4173e04c6c8c25ac (patch) | |
tree | 7d25ca37b82226e073060705fce2651494732daf /tests/src/org/aspectj/systemtest | |
parent | 27fa7e935696eda000b944d163ce1f3c4fa5afa5 (diff) | |
download | aspectj-50b9cc3c0afda97d251f884e4173e04c6c8c25ac.tar.gz aspectj-50b9cc3c0afda97d251f884e4173e04c6c8c25ac.zip |
more overweaving tests and fixes: method call/field get/set
Diffstat (limited to 'tests/src/org/aspectj/systemtest')
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java | 19 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc167/overweaving.xml | 87 |
2 files changed, 106 insertions, 0 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java b/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java index 1ced76f59..e29bd3349 100644 --- a/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java +++ b/tests/src/org/aspectj/systemtest/ajc167/OverweavingTests.java @@ -17,11 +17,30 @@ import junit.framework.Test; import org.aspectj.testing.XMLBasedAjcTestCase; /** + * Testing whether AspectJ can overweave. Overweaving is where we attempt to weave something that has already been woven. The simple + * rule followed is that aspects that applied to the type before are not applied this time around (if they are visible to the + * weaver). * * @author Andy Clement */ public class OverweavingTests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testGetSet1() { + runTest("getset - 1"); // testing what should happen for get/set + } + + public void testGetSet2() { + runTest("getset - 2"); // testing what actually happens when overweaving + } + + public void testCalls1() { + runTest("calls - 1"); // testing what should happen for calls + } + + public void testCalls2() { + runTest("calls - 2"); // testing what actually happens when overweaving + } + public void testComplex() { runTest("really messy"); } diff --git a/tests/src/org/aspectj/systemtest/ajc167/overweaving.xml b/tests/src/org/aspectj/systemtest/ajc167/overweaving.xml index 358ab7d85..c48f7b0fa 100644 --- a/tests/src/org/aspectj/systemtest/ajc167/overweaving.xml +++ b/tests/src/org/aspectj/systemtest/ajc167/overweaving.xml @@ -2,6 +2,93 @@ <suite> + + <ajc-test dir="features167/overweaving/getset" title="getset - 1"> + <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/> + <run class="Class1"> + <stdout> + <line text="B:set(String Class1.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class1.message)"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2"> + <stdout> + <line text="B:set(String Class2.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class2.message)"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/getset" title="getset - 2"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="B:set(String Class1.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class1.message)"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:set(String Class2.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class2.message)"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/calls" title="calls - 1"> + <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/> + <run class="Class1"> + <stdout> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2"> + <stdout> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/calls" title="calls - 2"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="features167/overweaving/messy2" title="really messy"> <compile files="A.aj Class1.java" options="-1.5"/> <compile files="B.aj" options="-1.5 -Xlint:ignore"/> |