diff options
author | wisberg <wisberg> | 2003-01-06 23:09:44 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-01-06 23:09:44 +0000 |
commit | fa63eb539504e91b3d070d5cf723346b9a86d0aa (patch) | |
tree | 80390181d48071851226277fed93460c0cc5109c /tests | |
parent | 47b257cb438cc74cf708d7edbb4beb11405402f6 (diff) | |
download | aspectj-fa63eb539504e91b3d070d5cf723346b9a86d0aa.tar.gz aspectj-fa63eb539504e91b3d070d5cf723346b9a86d0aa.zip |
two harness test cases, for classpath (jar and dir)
and aspectpath.
Binaries are checked in, as are binary sources
and a build script.
Test specifications are in tests/ajcHarnessTests.xml.
(also checked in) with the build script
Diffstat (limited to 'tests')
-rw-r--r-- | tests/harness/classpathTest/AspectMain.java | 15 | ||||
-rw-r--r-- | tests/harness/classpathTest/Main.java | 11 | ||||
-rw-r--r-- | tests/harness/classpathTest/classesDir/classfile/required/ClassFile.class | bin | 0 -> 421 bytes | |||
-rw-r--r-- | tests/harness/classpathTest/classpath-src/aspectjar/testaspect/SignalMainRunnable.java | 17 | ||||
-rw-r--r-- | tests/harness/classpathTest/classpath-src/build.xml | 81 | ||||
-rw-r--r-- | tests/harness/classpathTest/classpath-src/classesDir/classfile/required/ClassFile.java | 8 | ||||
-rw-r--r-- | tests/harness/classpathTest/classpath-src/classjar/jar/required/Global.java | 8 | ||||
-rw-r--r-- | tests/harness/classpathTest/jars/required.jar | bin | 0 -> 448 bytes | |||
-rw-r--r-- | tests/harness/classpathTest/jars/requiredAspects.jar | bin | 0 -> 898 bytes | |||
-rw-r--r-- | tests/harness/classpathTest/readme.txt | 25 |
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 Binary files differnew file mode 100644 index 000000000..3093b6805 --- /dev/null +++ b/tests/harness/classpathTest/classesDir/classfile/required/ClassFile.class 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 Binary files differnew file mode 100644 index 000000000..368789bd5 --- /dev/null +++ b/tests/harness/classpathTest/jars/required.jar diff --git a/tests/harness/classpathTest/jars/requiredAspects.jar b/tests/harness/classpathTest/jars/requiredAspects.jar Binary files differnew file mode 100644 index 000000000..952176904 --- /dev/null +++ b/tests/harness/classpathTest/jars/requiredAspects.jar 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> |