From: mwebster Date: Mon, 6 Nov 2006 13:50:14 +0000 (+0000) Subject: Bug 155033 "Use ajcore for LTW problems" (add ajcore LTW testcases) X-Git-Tag: V1_5_3rc1~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=36ba801b8f3f45f8c9acd2af2b03489958b97b55;p=aspectj.git Bug 155033 "Use ajcore for LTW problems" (add ajcore LTW testcases) --- diff --git a/tests/bugs153/pr155033/Annotation.java b/tests/bugs153/pr155033/Annotation.java new file mode 100644 index 000000000..12f6811c7 --- /dev/null +++ b/tests/bugs153/pr155033/Annotation.java @@ -0,0 +1 @@ +@interface Annotation {} \ No newline at end of file diff --git a/tests/bugs153/pr155033/Aspect.aj b/tests/bugs153/pr155033/Aspect.aj new file mode 100644 index 000000000..60b1b57c2 --- /dev/null +++ b/tests/bugs153/pr155033/Aspect.aj @@ -0,0 +1,9 @@ +public aspect Aspect { + + declare @method : public static void main(String[]) : @Annotation; + + before () : execution(public Class*.new()) { + System.out.println("? Aspect.before()"); + } + +} \ No newline at end of file diff --git a/tests/bugs153/pr155033/Class1.java b/tests/bugs153/pr155033/Class1.java new file mode 100644 index 000000000..aae2faf15 --- /dev/null +++ b/tests/bugs153/pr155033/Class1.java @@ -0,0 +1,8 @@ +public class Class1 /*implements MissingInterface*/ { + + @Annotation + public static void main(String[] args) { + System.out.println("? Class1.main()"); + new Class1(); + } +} \ No newline at end of file diff --git a/tests/bugs153/pr155033/Class2.java b/tests/bugs153/pr155033/Class2.java new file mode 100644 index 000000000..bfbd85e6d --- /dev/null +++ b/tests/bugs153/pr155033/Class2.java @@ -0,0 +1,8 @@ +public class Class2 /*implements MissingInterface*/ { + + @Annotation + public static void main(String[] args) { + System.out.println("? Class2.main()"); + new Class2(); + } +} \ No newline at end of file diff --git a/tests/bugs153/pr155033/Class3.java b/tests/bugs153/pr155033/Class3.java new file mode 100644 index 000000000..9577464dd --- /dev/null +++ b/tests/bugs153/pr155033/Class3.java @@ -0,0 +1,7 @@ +public class Class3 { + + public static void main(String[] args) { + System.out.println("? Class3.main()"); + new Class3(); + } +} \ No newline at end of file diff --git a/tests/bugs153/pr155033/MultipleDumpTest.java b/tests/bugs153/pr155033/MultipleDumpTest.java new file mode 100644 index 000000000..554460bb1 --- /dev/null +++ b/tests/bugs153/pr155033/MultipleDumpTest.java @@ -0,0 +1,24 @@ +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class MultipleDumpTest { + + public static void main(String[] args) throws Exception { + System.out.println("? MultipleDumpTest.main()"); + invokeMain("Class1",args); + invokeMain("Class2",args); + invokeMain("Class3",args); + } + + private static void invokeMain (String className, String[] args) throws Exception + { + Class clazz = Class.forName(className); + Class[] paramTypes = new Class[1]; + paramTypes[0] = args.getClass(); + + Method method = clazz.getDeclaredMethod("main",paramTypes); + Object[] params = new Object[1]; + params[0] = args; + method.invoke(null,params); + } +} \ No newline at end of file diff --git a/tests/bugs153/pr155033/ant.xml b/tests/bugs153/pr155033/ant.xml new file mode 100644 index 000000000..5995cb9d5 --- /dev/null +++ b/tests/bugs153/pr155033/ant.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/bugs153/pr155033/aop-multipledumponerror.xml b/tests/bugs153/pr155033/aop-multipledumponerror.xml new file mode 100644 index 000000000..c3c75fb47 --- /dev/null +++ b/tests/bugs153/pr155033/aop-multipledumponerror.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/ltw/HelloWorld.java b/tests/ltw/HelloWorld.java deleted file mode 100644 index 9c810cf25..000000000 --- a/tests/ltw/HelloWorld.java +++ /dev/null @@ -1,8 +0,0 @@ -public class HelloWorld { - - public static void main (String[] args) throws Exception { - System.out.println("Hello World!"); - throw new Exception(); - } - -} \ No newline at end of file diff --git a/tests/ltw/HelloWorldWithException.java b/tests/ltw/HelloWorldWithException.java new file mode 100644 index 000000000..b043000a1 --- /dev/null +++ b/tests/ltw/HelloWorldWithException.java @@ -0,0 +1,8 @@ +public class HelloWorldWithException { + + public static void main (String[] args) throws Exception { + System.out.println("Hello World!"); + throw new Exception(); + } + +} \ No newline at end of file diff --git a/tests/ltw/ant.xml b/tests/ltw/ant.xml index e1cb0a6bd..dff2071e7 100644 --- a/tests/ltw/ant.xml +++ b/tests/ltw/ant.xml @@ -8,7 +8,7 @@ - + @@ -24,7 +24,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -68,7 +68,7 @@ SecurityManager that will be loaded _before_ the class loader hierarch is fully initialized. --> - + @@ -97,7 +97,7 @@ - + @@ -105,4 +105,18 @@ + + + + + + + + + + + + + diff --git a/tests/ltw/aop-dumponerror.xml b/tests/ltw/aop-dumponerror.xml new file mode 100644 index 000000000..8115618bc --- /dev/null +++ b/tests/ltw/aop-dumponerror.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/ltw/server-helloworld.properties b/tests/ltw/server-helloworld.properties index baf42dbe0..09ec740a7 100644 --- a/tests/ltw/server-helloworld.properties +++ b/tests/ltw/server-helloworld.properties @@ -2,4 +2,4 @@ loader.application=Application,hello.jar;handler.jar # main=Class,Loader -main=HelloWorld,Application \ No newline at end of file +main=HelloWorldWithException,Application \ No newline at end of file diff --git a/tests/ltw/server-parentandchild.properties b/tests/ltw/server-parentandchild.properties index d0a7af85e..b917f564e 100644 --- a/tests/ltw/server-parentandchild.properties +++ b/tests/ltw/server-parentandchild.properties @@ -3,4 +3,4 @@ loader.parent=Parent,parent.jar loader.child=Child,child.jar,Parent # main=Class,Loader -main=Child,Child \ No newline at end of file +main=HelloWorldWithException,Child \ 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 267593468..79f793b32 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -150,13 +150,29 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testConfigutationSystemProperty_pr149289 () { runTest("override default path using -Dorg.aspectj.weaver.loadtime.configuration"); - } public void testSimpleLTW_pr159854 () { runTest("simple LTW"); - } + + public void testDumpOnError_pr155033 () { + runTest("dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),1,cff.getCount()); + } + + public void testMultipleDumpOnError_pr155033 () { + runTest("multiple dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),2,cff.getCount()); + } /* * Allow system properties to be set and restored 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 59bb176bd..a58fc0b45 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -536,7 +536,7 @@ - + @@ -549,7 +549,7 @@ - + @@ -562,7 +562,7 @@ - + @@ -573,7 +573,7 @@ - + + + + + + + + + + + + + - + @@ -645,7 +658,7 @@ - + @@ -653,5 +666,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file