summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-04 07:14:47 +0000
committeraclement <aclement>2006-05-04 07:14:47 +0000
commit5a01932b9dbdf81fe41e029fa56ede17364a2c2e (patch)
treea2991f73f2b496670e3de21f00538fbae9da891d /tests
parentcb5dfe759852d4965c692934ed7e14c41f61b715 (diff)
downloadaspectj-5a01932b9dbdf81fe41e029fa56ede17364a2c2e.tar.gz
aspectj-5a01932b9dbdf81fe41e029fa56ede17364a2c2e.zip
fixes for 137235 (contributed by Ron): more intelligent logic for determining if a path entry is a jar/zip (don't just rely on suffix, some new .bndl files seem to be becoming popular...)
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs152/pr137235/directory.jar/Before.java5
-rw-r--r--tests/bugs152/pr137235/directory.jar/BeforeExec.aj5
-rw-r--r--tests/bugs152/pr137235/directory.jar/Hello.java6
-rw-r--r--tests/bugs152/pr137235/directory.jar/Rename.aj5
-rw-r--r--tests/ltw/folder.jar/Aspect1.aj19
-rw-r--r--tests/ltw/folder.jar/Aspect2.aj19
-rw-r--r--tests/ltw/folder.jar/Main.java41
-rw-r--r--tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java19
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml130
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml26
12 files changed, 280 insertions, 2 deletions
diff --git a/tests/bugs152/pr137235/directory.jar/Before.java b/tests/bugs152/pr137235/directory.jar/Before.java
new file mode 100644
index 000000000..cf2f1b4cb
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Before.java
@@ -0,0 +1,5 @@
+public aspect Before {
+ before() : call(* getName()) {
+ System.out.println("Before call");
+ }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/BeforeExec.aj b/tests/bugs152/pr137235/directory.jar/BeforeExec.aj
new file mode 100644
index 000000000..35d12cd86
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/BeforeExec.aj
@@ -0,0 +1,5 @@
+public aspect BeforeExec {
+ before() : execution(* getName()) {
+ System.out.println("Before execution");
+ }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/Hello.java b/tests/bugs152/pr137235/directory.jar/Hello.java
new file mode 100644
index 000000000..30008d603
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Hello.java
@@ -0,0 +1,6 @@
+public class Hello {
+ public static void main(String argz[]) {
+ System.out.println("Hello "+getName());
+ }
+ public static String getName() { return "Java"; }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/Rename.aj b/tests/bugs152/pr137235/directory.jar/Rename.aj
new file mode 100644
index 000000000..fb89dfca5
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Rename.aj
@@ -0,0 +1,5 @@
+public aspect Rename {
+ String around() : call(* getName()) {
+ return "AspectJ not just "+proceed();
+ }
+}
diff --git a/tests/ltw/folder.jar/Aspect1.aj b/tests/ltw/folder.jar/Aspect1.aj
new file mode 100644
index 000000000..173cb8603
--- /dev/null
+++ b/tests/ltw/folder.jar/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/folder.jar/Aspect2.aj b/tests/ltw/folder.jar/Aspect2.aj
new file mode 100644
index 000000000..519a47eeb
--- /dev/null
+++ b/tests/ltw/folder.jar/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/folder.jar/Main.java b/tests/ltw/folder.jar/Main.java
new file mode 100644
index 000000000..9e53bfb4d
--- /dev/null
+++ b/tests/ltw/folder.jar/Main.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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 java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class Main {
+
+ public void test1 () {
+ System.out.println("Main.test1");
+ }
+
+ public void test2 () {
+ System.out.println("Main.test2");
+ }
+
+ public void invokeDeclaredMethods () throws Exception {
+ Method[] methods = getClass().getDeclaredMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ int modifiers = method.getModifiers();
+ if (!Modifier.isStatic(modifiers) && !method.getName().equals("invokeDeclaredMethods")) {
+ method.invoke(this,new Object[] {});
+ }
+ }
+ }
+
+ public static void main (String[] args) throws Exception {
+ System.out.println("Main.main");
+ new Main().test1();
+ new Main().test2();
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
index 096a7daa9..80c234fda 100644
--- a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
@@ -467,13 +467,16 @@
<ajc-test dir="bugs" pr="43714"
title="weaving using an empty jar in -injars" >
<compile files="notAJar.jar" outjar="outJar.jar">
- <message kind="error" line="0"/>
+ <message kind="warning" text="build config error: skipping missing, empty or corrupt inpath entry"/>
+ <message kind="error" text="no sources specified"/>
+ <message kind="fail"/>
</compile>
</ajc-test>
<ajc-test dir="bugs" pr="43714"
title="weaving using an empty jar in -aspectpath" >
<compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >
+ <message kind="warning" text="build config error: skipping missing, empty or corrupt aspectpath entry"/>
</compile>
</ajc-test>
\ 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 57ca49810..6516af53d 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
@@ -89,6 +89,25 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
}
+ public void testNonstandardJarFiles() {
+ runTest("Nonstandard jar file extensions");
+ }
+
+ public void testOddzipOnClasspath() {
+ runTest("Odd zip on classpath");
+ }
+
+ // separate bugzilla patch has this one... commented out
+// public void testSeparateCompilationDeclareParentsCall() {
+// runTest("Separate compilation with ltw: declare parents and call");
+// }
+//
+// public void testChildAspectDoesntWeaveParentDeclareParentsCall() {
+// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
+// setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true");
+// runTest("Child loader aspect won't weave parent loader: declare parents and call");
+// }
+
/*
* Allow system properties to be set and restored
* TODO maw move to XMLBasedAjcTestCase or RunSpec
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 8e6233fca..f56e49925 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
@@ -1,6 +1,5 @@
<!-- Load-time weaving tests -->
-
<ajc-test dir="ltw"
title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
keywords="reweavable">
@@ -339,4 +338,133 @@
</stderr>
</run>
</ajc-test>
+
+ <!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
+ <ajc-test dir="ltw"
+ title="Nonstandard jar file extensions" pr="137235">
+ <compile
+ files="folder.jar/Main.java, folder.jar/Aspect1.aj"
+ outjar="folder.jar/main1.zip"
+ options="-showWeaveInfo"
+ >
+ <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ </compile>
+ <compile
+ classpath="$sandbox/folder.jar/main1.zip"
+ files="Aspect2.aj"
+ outjar="aspect2Jar"
+ options="-showWeaveInfo"
+ >
+ </compile>
+ <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
+ <stdout>
+ <line text="Main.main"/>
+ <line text="Main.test1"/>
+ <line text="Main.test2"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
+ <line text="Aspect1.before_test1"/>
+ <line text="Aspect2.before_test2"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="ltw"
+ title="Odd zip on classpath" pr="137235">
+ <compile
+ files="folder.jar/Main.java, folder.jar/Aspect1.aj"
+ outjar="folder.jar/main1.archive"
+ options="-showWeaveInfo"
+ >
+ <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ </compile>
+ <compile
+ classpath="$sandbox/folder.jar/main1.archive"
+ files="Aspect2.aj"
+ outjar="aspect2Jar"
+ options="-showWeaveInfo"
+ >
+ </compile>
+ <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
+ <stdout>
+ <line text="Main.main"/>
+ <line text="Main.test1"/>
+ <line text="Main.test2"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
+ <line text="Aspect1.before_test1"/>
+ <line text="Aspect2.before_test2"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+<!--
+commented out: reported in another bugzilla bug...
+
+ <ajc-test dir="ltw/hier"
+ title="Separate compilation with ltw: declare parents and call"
+ keywords="ltw">
+ <compile
+ files="util/A.aj,util/T.aj"
+ />
+ <compile
+ files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
+ >
+ <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
+ </compile>
+ <run class="top.SimpleMain" ltw="aop-single.xml">
+ <stdout>
+ <line text="T call"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
+ < - - TODO: fix up any errors in the expected output when the join point actually matches - - >
+ <line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="ltw/hier"
+ title="Child loader aspect won't weave parent loader: declare parents and call"
+ keywords="ltw">
+ <compile
+ files="top/HierMain.aj"
+ />
+ <compile
+ files="util/A.aj,util/T.aj"
+ outjar="util.jar"
+ />
+ <compile
+ files="child/Executor.aj,child/Advisor.aj"
+ classpath="util.jar"
+ options="-outxml"
+ outjar="child.zip"
+ >
+ <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
+ </compile>
+ < - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
+ since we don't want any top-level aspects, we deploy an empty one!
+ the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
+ <run class="top.HierMain" ltw="null-aop.xml">
+ <stdout/>
+ <stderr>
+ <line text="info AspectJ Weaver Version"/>
+ <line text="info register classloader"/>
+ <line text="info using"/>
+ <line text="info weaving 'top.HierMain'"/>
+ <line text="info AspectJ Weaver Version"/>
+ <line text="info register classloader"/>
+ <line text="info using"/>
+ <line text="info using file:"/>
+ <line text="info register aspect child.Advisor"/>
+ <line text="info weaving 'child.Executor'"/>
+ <line text="info weaving 'util.A'"/>
+ </stderr>
+ </run>
+ </ajc-test>
+-->
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 0cd43ed2d..362d107a5 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -45,6 +45,8 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}
+ public void testJarChecking_pr137235_1() { runTest("directory with .jar extension: source and outjar"); }
+ public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }
/////////////////////////////////////////
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index 600c318ae..9e193b67e 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -197,4 +197,30 @@
</compile>
<run class="a.b.c.AroundAdvicePassingPjpAsArgToSuper"/>
</ajc-test>
+
+ <ajc-test dir="bugs152/pr137235" pr="137235"
+ title="directory with .jar extension: source and outjar">
+ <compile files="directory.jar/Hello.java" outjar="directory.jar/run.custom"/>
+ <run class="Hello" classpath="$sandbox/directory.jar/run.custom">
+ <stdout>
+ <line text="Hello Java"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr137235" pr="137235"
+ title="directory with .jar extension" >
+ <compile files="directory.jar/Before.java" outjar="directory.jar/inOne.custom"/>
+ <compile files="directory.jar/BeforeExec.aj" outjar="directory.jar/inTwo"/>
+ <compile files="directory.jar/Rename.aj" outjar="directory.jar/weave.jar"/>
+ <compile files="directory.jar/Hello.java" inpath="directory.jar/inOne.custom,directory.jar/inTwo" aspectpath="directory.jar/weave.jar" outjar="directory.jar/outJar.jar"/>
+ <run class="Hello" classpath="$sandbox/directory.jar/outJar.jar,$sandbox/directory.jar/weave.jar">
+ <stdout>
+ <line text="Before call"/>
+ <line text="Before execution"/>
+ <line text="Hello AspectJ not just Java"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite> \ No newline at end of file