]> source.dussan.org Git - aspectj.git/commitdiff
support weaving of java. and javax. in ltw - risky business
authoraclement <aclement>
Mon, 21 Jan 2008 20:07:53 +0000 (20:07 +0000)
committeraclement <aclement>
Mon, 21 Jan 2008 20:07:53 +0000 (20:07 +0000)
tests/features160/weavingJavaxPackage/A.java [new file with mode: 0644]
tests/features160/weavingJavaxPackage/X.aj [new file with mode: 0644]
tests/features160/weavingJavaxPackage/aop1.xml [new file with mode: 0644]
tests/features160/weavingJavaxPackage/aop2.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java
tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc160/newfeatures-tests.xml [new file with mode: 0644]

diff --git a/tests/features160/weavingJavaxPackage/A.java b/tests/features160/weavingJavaxPackage/A.java
new file mode 100644 (file)
index 0000000..262767b
--- /dev/null
@@ -0,0 +1,11 @@
+package javax.foo;
+
+public class A {
+  public static void main(String []argv) throws Exception {
+    new A().foo();
+  }
+
+  public void foo() {
+         System.out.println("Method running");
+  }
+}
diff --git a/tests/features160/weavingJavaxPackage/X.aj b/tests/features160/weavingJavaxPackage/X.aj
new file mode 100644 (file)
index 0000000..8c52b24
--- /dev/null
@@ -0,0 +1,5 @@
+aspect X {
+  before(): execution(* f*(..)) {
+    System.out.println("advised");
+  }
+}
diff --git a/tests/features160/weavingJavaxPackage/aop1.xml b/tests/features160/weavingJavaxPackage/aop1.xml
new file mode 100644 (file)
index 0000000..4425615
--- /dev/null
@@ -0,0 +1,6 @@
+<aspectj>
+    <aspects>
+         <aspect name="X"/>
+    </aspects>
+    <weaver options="-verbose"/>
+</aspectj>
diff --git a/tests/features160/weavingJavaxPackage/aop2.xml b/tests/features160/weavingJavaxPackage/aop2.xml
new file mode 100644 (file)
index 0000000..196917a
--- /dev/null
@@ -0,0 +1,6 @@
+<aspectj>
+    <aspects>
+         <aspect name="X"/>
+    </aspects>
+    <weaver options="-verbose -Xset:weaveJavaxPackages=true"/>
+</aspectj>
index 9f2ce8cd86caf5de1753892f08953b57875ddf85..d9fab5cda9ad059019acd2846d62ad0c01d1f07f 100644 (file)
@@ -20,6 +20,7 @@ public class AllTestsAspectJ160 {
                TestSuite suite = new TestSuite("AspectJ 1.6.0 tests");
                //$JUnit-BEGIN$
                suite.addTest(SanityTests.suite());
+               suite.addTest(NewFeatures.suite());
         //$JUnit-END$
                return suite;
        }
diff --git a/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java b/tests/src/org/aspectj/systemtest/ajc160/NewFeatures.java
new file mode 100644 (file)
index 0000000..0fbb0e6
--- /dev/null
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * 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://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc160;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+  // Supporting -Xset:weaveJavaPackages=true and -Xset:weaveJavaxPackages=true
+  public void testWeaveJavaxClassesNo() { runTest("weave javax classes - no");}
+  public void testWeaveJavaxClassesYes() { runTest("weave javax classes - yes");}
+
+  /////////////////////////////////////////
+  public static Test suite() {
+    return XMLBasedAjcTestCase.loadSuite(NewFeatures.class);
+  }
+
+  protected File getSpecFile() {
+    return new File("../tests/src/org/aspectj/systemtest/ajc160/newfeatures-tests.xml");
+  }
+
+  
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc160/newfeatures-tests.xml b/tests/src/org/aspectj/systemtest/ajc160/newfeatures-tests.xml
new file mode 100644 (file)
index 0000000..b12520d
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.6.0 Tests -->
+<suite>
+
+    <ajc-test dir="features160/weavingJavaxPackage" title="weave javax classes - no">
+      <compile files="A.java" />
+      <compile files="X.aj" outjar="code.jar"/>
+      <run class="javax.foo.A" classpath="code.jar" ltw="aop1.xml">
+        <stdout>
+           <line text="Method running"/>
+        </stdout>
+      </run>
+    </ajc-test>
+    
+    <ajc-test dir="features160/weavingJavaxPackage" title="weave javax classes - yes">
+      <compile files="A.java" />
+      <compile files="X.aj" outjar="code.jar"/>
+      <run class="javax.foo.A" classpath="code.jar" ltw="aop2.xml">
+        <stdout>
+           <line text="advised"/>
+           <line text="Method running"/>
+        </stdout>
+      </run>
+    </ajc-test>
+
+</suite>