]> source.dussan.org Git - aspectj.git/commitdiff
231396: mainline code moved to test area
authoraclement <aclement>
Fri, 30 May 2008 17:28:08 +0000 (17:28 +0000)
committeraclement <aclement>
Fri, 30 May 2008 17:28:08 +0000 (17:28 +0000)
weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java [new file with mode: 0644]

index 9a822b78ec93dc6f19f6ee80172f60e53d1dce54..8e2a540426ddeb3a8fd5a69be98ec8d1f69d0a8c 100644 (file)
@@ -33,7 +33,7 @@ public class AfterThrowingWeaveTestCase extends WeaveTestCase {
         BcelWorld world = new BcelWorld();
         
         ShadowMunger myMunger = 
-            world.shadowMunger("afterThrowing(): get(* *.out) -> static void Aspect.ajc_afterThrowing_field_get(java.lang.Throwable)",
+            TestUtils.shadowMunger(world,"afterThrowing(): get(* *.out) -> static void Aspect.ajc_afterThrowing_field_get(java.lang.Throwable)",
                         Advice.ExtraArgument);
         ShadowMunger cm = myMunger.concretize(ResolvedType.MISSING, world, null);
 
index 3d6f540d879a2e263aa0fa0609d93d52cd1227b1..c2ab22991613300a31140b65f8b67fc643c5f921 100644 (file)
@@ -19,6 +19,7 @@ import java.util.Arrays;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.MemberImpl;
+import org.aspectj.weaver.TestUtils;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.UnresolvedType;
 
@@ -46,7 +47,7 @@ public class TjpWeaveTestCase extends WeaveTestCase {
        BcelAdvice munger = new BcelAdvice(
                AdviceKind.stringToKind("before"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
+               TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
                Advice.ThisJoinPointStaticPart, -1, -1, null, null);
        
         weaveTest("HelloWorld", "StaticTjpBeforeHelloWorld", munger);
@@ -57,7 +58,7 @@ public class TjpWeaveTestCase extends WeaveTestCase {
        BcelAdvice munger = new BcelAdvice(
                AdviceKind.stringToKind("before"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
+               TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint$StaticPart)"),
                Advice.ThisEnclosingJoinPointStaticPart, -1, -1, null, null);
        
         weaveTest("HelloWorld", "StaticEnclosingTjpBeforeHelloWorld", munger);
@@ -68,7 +69,7 @@ public class TjpWeaveTestCase extends WeaveTestCase {
        BcelAdvice munger = new BcelAdvice(
                AdviceKind.stringToKind("before"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint)"),
+               TestUtils.methodFromString("static void Aspect.ajc_before(org.aspectj.lang.JoinPoint)"),
                Advice.ThisJoinPoint, -1, -1, null, null);
        
         weaveTest("HelloWorld", "TjpBeforeHelloWorld", munger);
@@ -78,7 +79,7 @@ public class TjpWeaveTestCase extends WeaveTestCase {
        BcelAdvice munger = new BcelAdvice(
                AdviceKind.stringToKind("around"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+               TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
                Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null, null);
        
         weaveTest("HelloWorld", "TjpAroundHelloWorld", munger);
@@ -90,14 +91,14 @@ public class TjpWeaveTestCase extends WeaveTestCase {
        BcelAdvice munger1 = new BcelAdvice(
                AdviceKind.stringToKind("around"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+               TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
                Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null, 
                rtx);
        
        BcelAdvice munger2 = new BcelAdvice(
                AdviceKind.stringToKind("around"),
                makePointcutAll(), 
-               MemberImpl.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
+               TestUtils.methodFromString("static java.lang.Object Aspect.ajc_around(org.aspectj.runtime.internal.AroundClosure, org.aspectj.lang.JoinPoint)"),
                Advice.ThisJoinPoint | Advice.ExtraArgument, -1, -1, null, 
                rtx);
        
index 8bbbdbe0d122ad123be49b96e2c622636468b9b5..05ff1257ecaecc0993cba0e18d63320f67666d0a 100644 (file)
@@ -189,7 +189,7 @@ public abstract class WeaveTestCase extends TestCase {
 
     protected ShadowMunger makeConcreteAdvice(String mungerString, int extraArgFlag, PerClause perClause) {
         Advice myMunger = 
-            world.shadowMunger(mungerString, extraArgFlag);
+               TestUtils.shadowMunger(world,mungerString, extraArgFlag);
             
 //        PerSingleton s = new PerSingleton();
 //        s.concretize(world.resolve("Aspect"));
index 253768b5891dfc10b5335bb2925c90287f7f6e9e..ccfcee9543a88ec34fd3371d40431daa0658f17c 100644 (file)
@@ -38,7 +38,7 @@ public class WorldTestCase extends AbstractWorldTestCase {
         ResolvedType trace = world.resolve(UnresolvedType.forName("Trace"),true);
         assertTrue("Couldnt find type Trace",!trace.isMissing());
         fieldsTest(trace, Member.NONE);
-        /*Member constr = */MemberImpl.methodFromString("void Trace.<init>()"); 
+        /*Member constr = */TestUtils.methodFromString("void Trace.<init>()"); 
         //XXX need attribute fix - 
         //methodsTest(trace, new Member[] { constr });
 
@@ -58,13 +58,13 @@ public class WorldTestCase extends AbstractWorldTestCase {
         
         mungersTest(trace, 
             new ShadowMunger[] {
-                               world.shadowMunger("before(foo): traced(foo) -> void Trace.ajc_before_4(java.lang.Object))",
+                       TestUtils.shadowMunger(world,"before(foo): traced(foo) -> void Trace.ajc_before_4(java.lang.Object))",
                                                0),
-                               world.shadowMunger("afterReturning(foo): traced(foo) -> void Trace.ajc_afterreturning_3(java.lang.Object, java.lang.Object))",
+                                               TestUtils.shadowMunger(world,"afterReturning(foo): traced(foo) -> void Trace.ajc_afterreturning_3(java.lang.Object, java.lang.Object))",
                                                Advice.ExtraArgument),
-                               world.shadowMunger("around(): execution(* doit(..)) -> java.lang.Object Trace.ajc_around_2(org.aspectj.runtime.internal.AroundClosure))",
+                                               TestUtils.shadowMunger(world,"around(): execution(* doit(..)) -> java.lang.Object Trace.ajc_around_2(org.aspectj.runtime.internal.AroundClosure))",
                                                Advice.ExtraArgument),
-                               world.shadowMunger("around(foo): traced(foo) -> java.lang.Object Trace.ajc_around_1(java.lang.Object, org.aspectj.runtime.internal.AroundClosure))",
+                                               TestUtils.shadowMunger(world,"around(foo): traced(foo) -> java.lang.Object Trace.ajc_around_1(java.lang.Object, org.aspectj.runtime.internal.AroundClosure))",
                                                Advice.ExtraArgument),
             });
         
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java b/weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java
new file mode 100644 (file)
index 0000000..3be5ae3
--- /dev/null
@@ -0,0 +1,39 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * 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: 
+ *     PARC     initial implementation 
+ * ******************************************************************/
+
+
+package org.aspectj.weaver.bcel;
+
+import java.io.File;
+import java.io.IOException;
+
+
+//XXX delete very soon
+public class ZipFileWeaver {
+       File inFile;
+       public ZipFileWeaver(File inFile) {
+               super();
+               this.inFile = inFile;
+       }
+
+       public void weave(BcelWeaver weaver, File outFile) throws IOException {
+               int count = 0;
+               long startTime = System.currentTimeMillis();
+               weaver.addJarFile(inFile, new File("."),false);
+               weaver.weave(outFile);
+               long stopTime = System.currentTimeMillis();
+               
+               
+               System.out.println("handled " + count + " entries, in " + 
+                               (stopTime-startTime)/1000. + " seconds");
+       }
+}