From: aclement Date: Fri, 30 May 2008 17:28:08 +0000 (+0000) Subject: 231396: mainline code moved to test area X-Git-Tag: V1_6_1rc1~176 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=84cc384edb9c8ce5a58fa6eecb2b87a92a1ac14f;p=aspectj.git 231396: mainline code moved to test area --- diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java index 9a822b78e..8e2a54042 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java @@ -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); diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java index 3d6f540d8..c2ab22991 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java @@ -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); diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java index 8bbbdbe0d..05ff1257e 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java @@ -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")); diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java index 253768b58..ccfcee954 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java @@ -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.()"); + /*Member constr = */TestUtils.methodFromString("void Trace.()"); //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 index 000000000..3be5ae332 --- /dev/null +++ b/weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java @@ -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"); + } +}