aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Clement <aclement@gopivotal.com>2013-07-29 22:24:55 -0700
committerAndy Clement <aclement@gopivotal.com>2013-10-18 11:36:11 -0700
commitaba10968da43b517e68308e14681a14311a76d42 (patch)
tree925f50ad14e0f2480621e3623e73c974389ac8f3 /tests
parentd82db7bf44e2e0d5f68798c22cd7eb373452bc54 (diff)
downloadaspectj-aba10968da43b517e68308e14681a14311a76d42.tar.gz
aspectj-aba10968da43b517e68308e14681a14311a76d42.zip
Fix for 368046: exclude certain loaders
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs174/pr368046/Azpect.java5
-rw-r--r--tests/bugs174/pr368046/Code.java5
-rw-r--r--tests/bugs174/pr368046/aop1.xml6
-rw-r--r--tests/bugs174/pr368046/aop2.xml6
-rw-r--r--tests/bugs174/pr368046/aop3.xml6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java27
-rw-r--r--tests/src/org/aspectj/systemtest/ajc174/ajc174.xml93
7 files changed, 148 insertions, 0 deletions
diff --git a/tests/bugs174/pr368046/Azpect.java b/tests/bugs174/pr368046/Azpect.java
new file mode 100644
index 000000000..ab3bf6d74
--- /dev/null
+++ b/tests/bugs174/pr368046/Azpect.java
@@ -0,0 +1,5 @@
+public aspect Azpect {
+ before(): execution(* *(..)) {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/bugs174/pr368046/Code.java b/tests/bugs174/pr368046/Code.java
new file mode 100644
index 000000000..618e3dbd1
--- /dev/null
+++ b/tests/bugs174/pr368046/Code.java
@@ -0,0 +1,5 @@
+public class Code {
+ public static void main(String []argv) {
+ System.out.println("running");
+ }
+}
diff --git a/tests/bugs174/pr368046/aop1.xml b/tests/bugs174/pr368046/aop1.xml
new file mode 100644
index 000000000..be9a87c1d
--- /dev/null
+++ b/tests/bugs174/pr368046/aop1.xml
@@ -0,0 +1,6 @@
+<aspectj>
+ <aspects>
+ <aspect name="Azpect"/>
+ </aspects>
+ <weaver options="-verbose"/>
+</aspectj>
diff --git a/tests/bugs174/pr368046/aop2.xml b/tests/bugs174/pr368046/aop2.xml
new file mode 100644
index 000000000..f9d201ec7
--- /dev/null
+++ b/tests/bugs174/pr368046/aop2.xml
@@ -0,0 +1,6 @@
+<aspectj>
+ <aspects>
+ <aspect name="Azpect"/>
+ </aspects>
+ <weaver options="-verbose -loadersToSkip:com.foo.Bar"/>
+</aspectj>
diff --git a/tests/bugs174/pr368046/aop3.xml b/tests/bugs174/pr368046/aop3.xml
new file mode 100644
index 000000000..45c088588
--- /dev/null
+++ b/tests/bugs174/pr368046/aop3.xml
@@ -0,0 +1,6 @@
+<aspectj>
+ <aspects>
+ <aspect name="Azpect"/>
+ </aspects>
+ <weaver options="-verbose -loadersToSkip:org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
+</aspectj>
diff --git a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
index 464c948e5..06af6a53b 100644
--- a/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc174/Ajc174Tests.java
@@ -25,6 +25,33 @@ public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("super itd ctor");
}
+ // no exclusion, this is how it should work
+ public void testCLExclusion_pr368046_1_noskippedloaders() {
+ runTest("classloader exclusion - 1");
+ }
+
+ public void testCLExclusion_pr368046_1_syspropset() {
+ try {
+ System.setProperty("aj.weaving.loadersToSkip", "foo");
+ runTest("classloader exclusion - 2");
+ } finally {
+ System.setProperty("aj.weaving.loadersToSkip", "");
+ }
+ }
+
+ // final repeat this test, to confirm no lingering static
+ public void testCLExclusion_pr368046_1_again_noskippedloaders() {
+ runTest("classloader exclusion - 3");
+ }
+
+ public void testCLExclusion_pr368046_2_usingaopxml() {
+ runTest("classloader exclusion - 4");
+ }
+
+ public void testCLExclusion_pr368046_2_usingaopxmlReal() {
+ runTest("classloader exclusion - 5");
+ }
+
// ---
public static Test suite() {
diff --git a/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml b/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml
index 0a64273e5..85ff2af8b 100644
--- a/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml
+++ b/tests/src/org/aspectj/systemtest/ajc174/ajc174.xml
@@ -13,5 +13,98 @@
</stdout>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 1">
+ <compile files="Azpect.java" outjar="foo.jar"/>
+ <compile files="Code.java" classpath="$sandbox/foo.jar"/>
+ <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml">
+ <stdout>
+ <line text="advice"/>
+ <line text="running"/>
+ </stdout>
+ <stderr>
+ <line text="AspectJ Weaver"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="register aspect"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 2">
+ <compile files="Azpect.java" outjar="foo.jar"/>
+ <compile files="Code.java" classpath="$sandbox/foo.jar"/>
+ <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml">
+ <stdout>
+ <line text="advice"/>
+ <line text="running"/>
+ </stdout>
+ <stderr>
+ <line text="AspectJ Weaver"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="no longer creating weavers for these classloaders: [foo]"/>
+ <line text="register aspect"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 3">
+ <compile files="Azpect.java" outjar="foo.jar"/>
+ <compile files="Code.java" classpath="$sandbox/foo.jar"/>
+ <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml">
+ <stdout>
+ <line text="advice"/>
+ <line text="running"/>
+ </stdout>
+ <stderr>
+ <line text="AspectJ Weaver"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="register aspect"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 4">
+ <compile files="Azpect.java" outjar="foo.jar"/>
+ <compile files="Code.java" classpath="$sandbox/foo.jar"/>
+ <run class="Code" classpath="$sandbox/foo.jar" ltw="aop2.xml">
+ <stdout>
+ <line text="advice"/>
+ <line text="running"/>
+ </stdout>
+ <stderr>
+ <line text="AspectJ Weaver"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="no longer creating weavers for these classloaders: [com.foo.Bar]"/>
+ <line text="register aspect"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 5">
+ <compile files="Azpect.java" outjar="foo.jar"/>
+ <compile files="Code.java" classpath="$sandbox/foo.jar"/>
+ <run class="Code" classpath="$sandbox/foo.jar" ltw="aop3.xml">
+ <stdout>
+ <line text="advice"/>
+ <line text="running"/>
+ </stdout>
+ <stderr>
+ <line text="AspectJ Weaver"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="no longer creating weavers for these classloaders: [org.aspectj.weaver.loadtime.WeavingURLClassLoader]"/>
+ <line text="register aspect"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ </run>
+ </ajc-test>
</suite>