aboutsummaryrefslogtreecommitdiffstats
path: root/tests/harness
diff options
context:
space:
mode:
Diffstat (limited to 'tests/harness')
-rw-r--r--tests/harness/classpathTest/AspectMain.java15
-rw-r--r--tests/harness/classpathTest/Main.java11
-rw-r--r--tests/harness/classpathTest/classesDir/classfile/required/ClassFile.classbin0 -> 421 bytes
-rw-r--r--tests/harness/classpathTest/classpath-src/aspectjar/testaspect/SignalMainRunnable.java17
-rw-r--r--tests/harness/classpathTest/classpath-src/build.xml81
-rw-r--r--tests/harness/classpathTest/classpath-src/classesDir/classfile/required/ClassFile.java8
-rw-r--r--tests/harness/classpathTest/classpath-src/classjar/jar/required/Global.java8
-rw-r--r--tests/harness/classpathTest/jars/required.jarbin0 -> 448 bytes
-rw-r--r--tests/harness/classpathTest/jars/requiredAspects.jarbin0 -> 898 bytes
-rw-r--r--tests/harness/classpathTest/readme.txt25
10 files changed, 165 insertions, 0 deletions
diff --git a/tests/harness/classpathTest/AspectMain.java b/tests/harness/classpathTest/AspectMain.java
new file mode 100644
index 000000000..cc7576a15
--- /dev/null
+++ b/tests/harness/classpathTest/AspectMain.java
@@ -0,0 +1,15 @@
+
+import org.aspectj.testing.Tester;
+import jar.required.Global;
+import classfile.required.ClassFile;
+
+public class AspectMain {
+ public static void main (String[] args) {
+ Tester.expectEvent("aspect");
+ Tester.check(ClassFile.isTrue(), "not ClassFile.isTrue()?");
+ Tester.check(Global.isTrue(), "not Global.isTrue()?");
+ // aspect advises this invocation, adds "aspect" event
+ new Runnable() { public void run(){}}.run();
+ Tester.checkAllEvents();
+ }
+}
diff --git a/tests/harness/classpathTest/Main.java b/tests/harness/classpathTest/Main.java
new file mode 100644
index 000000000..f2c1e2f91
--- /dev/null
+++ b/tests/harness/classpathTest/Main.java
@@ -0,0 +1,11 @@
+
+import org.aspectj.testing.Tester;
+import jar.required.Global;
+import classfile.required.ClassFile;
+
+public class Main {
+ public static void main (String[] args) {
+ Tester.check(ClassFile.isTrue(), "not ClassFile.isTrue()?");
+ Tester.check(Global.isTrue(), "not Global.isTrue()?");
+ }
+}
diff --git a/tests/harness/classpathTest/classesDir/classfile/required/ClassFile.class b/tests/harness/classpathTest/classesDir/classfile/required/ClassFile.class
new file mode 100644
index 000000000..3093b6805
--- /dev/null
+++ b/tests/harness/classpathTest/classesDir/classfile/required/ClassFile.class
Binary files differ
diff --git a/tests/harness/classpathTest/classpath-src/aspectjar/testaspect/SignalMainRunnable.java b/tests/harness/classpathTest/classpath-src/aspectjar/testaspect/SignalMainRunnable.java
new file mode 100644
index 000000000..74a75a008
--- /dev/null
+++ b/tests/harness/classpathTest/classpath-src/aspectjar/testaspect/SignalMainRunnable.java
@@ -0,0 +1,17 @@
+
+package testaspect;
+
+import org.aspectj.testing.Tester;
+
+public aspect SignalMainRunnable {
+
+ /**
+ * Signal Tester event "aspect" if a main method
+ * calls run() on a Runnable.
+ */
+ after() returning : withincode(public static void main(..))
+ && target(Runnable) && call(void run()) {
+ Tester.event("aspect");
+ }
+}
+
diff --git a/tests/harness/classpathTest/classpath-src/build.xml b/tests/harness/classpathTest/classpath-src/build.xml
new file mode 100644
index 000000000..1bbc6bdcb
--- /dev/null
+++ b/tests/harness/classpathTest/classpath-src/build.xml
@@ -0,0 +1,81 @@
+
+<!-- ========================================================================= -->
+<!-- Copyright (c) 2002 Wes Isberg -->
+<!-- All rights reserved. -->
+<!-- This program and the accompanying materials are made available -->
+<!-- under the terms of the Common Public License v1.0 -->
+<!-- which accompanies this distribution and is available at -->
+<!-- http://www.eclipse.org/legal/cpl-v10.html -->
+<!-- -->
+<!-- Contributors: -->
+<!-- Xerox/PARC initial implementation -->
+<!-- ========================================================================= -->
+
+<project name="classpath-test" default="all" basedir=".">
+
+
+ <target name="init.variables"
+ description="setup variables - user defines aspectj.lib.dir">
+
+ <!-- required directories - run from examples or predefine -->
+ <property name="test.base.dir"
+ location="${basedir}/.."/>
+ <property name="classes.dir"
+ location="${test.base.dir}/classesDir"/>
+ <property name="jar.dir"
+ location="${test.base.dir}/jars"/>
+
+
+ <!-- caller must define aspectj.lib.dir -->
+ <property name="aspectj.lib.dir"
+ location="lib"/>
+ <property name="aspectjrt.jar"
+ location="${aspectj.lib.dir}/aspectjrt.jar"/>
+ <available file="${aspectjrt.jar}"
+ property="aspectjrt.jar.available"/>
+ <fail unless="aspectjrt.jar.available"
+ message="expecting aspectjrt.jar at ${aspectjrt.jar}"/>
+
+ <property name="aspectjtools.jar"
+ location="${aspectj.lib.dir}/aspectjtools.jar"/>
+ <available file="${aspectjtools.jar}"
+ property="aspectjtools.jar.available"/>
+ <fail unless="aspectjtools.jar.available"
+ message="expecting aspectjtools.jar at ${aspectjtools.jar}"/>
+
+ <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <classpath>
+ <pathelement path="${aspectjtools.jar}"/>
+ </classpath>
+ </taskdef>
+
+ </target>
+ <target name="all" depends="init.variables"
+ description="build classes, required.jar and requiredAspects.jar">
+ <iajc outjar="${jar.dir}/required.jar"
+ sourceroots="${test.base.dir}/classpath-src/classjar">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ </classpath>
+ </iajc>
+
+ <iajc outjar="${jar.dir}/requiredAspects.jar"
+ sourceroots="${test.base.dir}/classpath-src/aspectjar">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ <pathelement path="${test.base.dir}/../../../lib/test/testing-client.jar"/>
+ </classpath>
+ </iajc>
+
+ <delete>
+ <fileset dir="${classes.dir}" includes="**/*"/>
+ </delete>
+ <iajc destdir="${classes.dir}"
+ sourceroots="${test.base.dir}/classpath-src/classesDir">
+ <classpath>
+ <pathelement path="${aspectjrt.jar}"/>
+ </classpath>
+ </iajc>
+ </target>
+
+</project>
diff --git a/tests/harness/classpathTest/classpath-src/classesDir/classfile/required/ClassFile.java b/tests/harness/classpathTest/classpath-src/classesDir/classfile/required/ClassFile.java
new file mode 100644
index 000000000..ff03425d5
--- /dev/null
+++ b/tests/harness/classpathTest/classpath-src/classesDir/classfile/required/ClassFile.java
@@ -0,0 +1,8 @@
+
+package classfile.required;
+
+public class ClassFile {
+ public static boolean isTrue() {
+ return (0l < System.currentTimeMillis());
+ }
+}
diff --git a/tests/harness/classpathTest/classpath-src/classjar/jar/required/Global.java b/tests/harness/classpathTest/classpath-src/classjar/jar/required/Global.java
new file mode 100644
index 000000000..60c95b4b1
--- /dev/null
+++ b/tests/harness/classpathTest/classpath-src/classjar/jar/required/Global.java
@@ -0,0 +1,8 @@
+
+package jar.required;
+
+public class Global {
+ public static boolean isTrue() {
+ return (0l < System.currentTimeMillis());
+ }
+}
diff --git a/tests/harness/classpathTest/jars/required.jar b/tests/harness/classpathTest/jars/required.jar
new file mode 100644
index 000000000..368789bd5
--- /dev/null
+++ b/tests/harness/classpathTest/jars/required.jar
Binary files differ
diff --git a/tests/harness/classpathTest/jars/requiredAspects.jar b/tests/harness/classpathTest/jars/requiredAspects.jar
new file mode 100644
index 000000000..952176904
--- /dev/null
+++ b/tests/harness/classpathTest/jars/requiredAspects.jar
Binary files differ
diff --git a/tests/harness/classpathTest/readme.txt b/tests/harness/classpathTest/readme.txt
new file mode 100644
index 000000000..c5eb33819
--- /dev/null
+++ b/tests/harness/classpathTest/readme.txt
@@ -0,0 +1,25 @@
+
+
+This contains artifacts for two harness test cases,
+for classpath (jar and dir) and aspectpath.
+
+Binaries are in jars/*, and classesDir/*, and
+binary sources and a build script are in classpath-src.
+
+Two test specifications are in tests/ajcHarnessTests.xml:
+
+ <ajc-test dir="harness/classpathTest"
+ title="specify jars and directories on classpath"
+ keywords="purejava">
+ <compile classpath="classesDir,jars/required.jar"
+ files="Main.java"/>
+ <run class="Main"/>
+ </ajc-test>
+
+ <ajc-test dir="harness/classpathTest"
+ title="specify aspectpath and classpath jars and directories">
+ <compile classpath="classesDir,jars/required.jar"
+ aspectpath="jars/requiredAspects.jar"
+ files="AspectMain.java"/>
+ <run class="AspectMain"/>
+ </ajc-test>