Browse Source

133770 'call and ltw': testcode

tags/post_pr_153572
aclement 17 years ago
parent
commit
0dde33db74

+ 27
- 13
tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java View File

@@ -29,6 +29,7 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml");
}


public void test001(){
@@ -112,17 +113,31 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("JDK14 LTW with ASPECTPATH");
}
// separate bugzilla patch has this one... commented out
// public void testSeparateCompilationDeclareParentsCall() {
// runTest("Separate compilation with ltw: declare parents and call");
// }
//
// public void testChildAspectDoesntWeaveParentDeclareParentsCall() {
// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
// setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true");
// runTest("Child loader aspect won't weave parent loader: declare parents and call");
// }

//public void testDiscardingWovenTypes() {
// runTest("discarding woven types - 1");
//}
public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770() {
runTest("aggressive ltw - decp");
}

public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770_Deactivate() {
runTest("aggressive ltw - decp - deactivate");
}

public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Nested_pr133770() {
runTest("aggressive ltw - decp - 2");
}
public void testWeavingTargetOfCallAggressivelyInLTW_DeclareAnnotation_pr133770() {
runTest("aggressive ltw - deca");
}
public void testSeparateCompilationDeclareParentsCall_pr133770() {
runTest("separate compilation with ltw: declare parents and call");
}
/*
* Allow system properties to be set and restored
* TODO maw move to XMLBasedAjcTestCase or RunSpec
@@ -159,5 +174,4 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
else systemProperties.setProperty(key,value);
}
}
}

}

+ 94
- 65
tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml View File

@@ -109,7 +109,84 @@
</stderr>
</run>
</ajc-test>
<!-- type discarding tests, investigating call munging -->
<ajc-test dir="ltw/callMunging" title="discarding woven types - 1">
<compile files="A.java,B.java,T.java,Main.java" outjar="classes.jar"/>
<compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>
<run class="Main" ltw="aop.xml">
<stdout>
<line text="into:main"/>
<line text="A.method() running"/>
<line text="advice running"/>
<line text="T.m1() running"/>
<line text="B.method() running"/>
<line text="advice running"/>
<line text="T.m2() running"/>
<line text="leave:main"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="ltw/callMunging/case1" title="aggressive ltw - decp">
<compile files="A.java,T.java,Main.java" outjar="classes.jar"/>
<compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>
<run class="Main" ltw="aop.xml">
<stdout>
<line text="into:main"/>
<line text="A.method() running"/>
<line text="advice running"/>
<line text="T.m1() running"/>
<line text="leave:main"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="ltw/callMunging/case1" title="aggressive ltw - decp - deactivate">
<compile files="A.java,T.java,Main.java" outjar="classes.jar"/>
<compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>
<run class="Main" ltw="aop2.xml">
<stdout>
<line text="into:main"/>
<line text="A.method() running"/>
<line text="T.m1() running"/>
<line text="leave:main"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="ltw/callMunging/case3" title="aggressive ltw - decp - 2">
<compile files="A.java,T.java,S.java,Main.java" outjar="classes.jar"/>
<compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-Xlint:ignore"/>
<run class="Main" ltw="aop.xml">
<stdout>
<line text="into:main"/>
<line text="A.method() running"/>
<line text="advice running"/>
<line text="T.m1() running"/>
<line text="leave:main"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="ltw/callMunging/case2" title="aggressive ltw - deca">
<compile files="A.java,T.java,Main.java,MarkerAnnotation.java" outjar="classes.jar" options="-1.5"/>
<compile files="X.java" outjar="aspects.jar" classpath="classes.jar" options="-1.5 -Xlint:ignore"/>
<run class="Main" ltw="aop.xml">
<stdout>
<line text="into:main"/>
<line text="A.method() running"/>
<line text="advice running"/>
<line text="T.m1() running"/>
<line text="leave:main"/>
</stdout>
</run>
</ajc-test>

<!-- end of discarding type tests -->

<ajc-test dir="ltw"
title="Define concrete sub-aspect using aop.xml"
@@ -270,6 +347,23 @@
</run>
</ajc-test>
<ajc-test dir="ltw/hier" title="separate compilation with ltw: declare parents and call" keywords="ltw">
<compile files="util/A.aj,util/T.aj"/>
<compile files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj">
<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
</compile>
<run class="top.SimpleMain" ltw="aop-single.xml">
<stdout>
<line text="T call"/>
</stdout>
<stderr>
<line text="weaveinfo Join point 'method-call(void util.A.foo())' in Type 'child.Executor' (Executor.aj:18) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
<line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
<line text="weaveinfo Extending interface set for type 'child.Advisor' (Advisor.aj) to include 'util.T' (Advisor.aj)"/>
</stderr>
</run>
</ajc-test>
<ajc-test dir="ltw"
title="Warning when advice doesn't match suppressed for LTW"
keywords="xlint, ltw">
@@ -427,71 +521,6 @@
</run>
</ajc-test>

<!--
commented out: reported in another bugzilla bug...

<ajc-test dir="ltw/hier"
title="Separate compilation with ltw: declare parents and call"
keywords="ltw">
<compile
files="util/A.aj,util/T.aj"
/>
<compile
files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
>
<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
</compile>
<run class="top.SimpleMain" ltw="aop-single.xml">
<stdout>
<line text="T call"/>
</stdout>
<stderr>
<line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
< - - TODO: fix up any errors in the expected output when the join point actually matches - - >
<line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
</stderr>
</run>
</ajc-test>

<ajc-test dir="ltw/hier"
title="Child loader aspect won't weave parent loader: declare parents and call"
keywords="ltw">
<compile
files="top/HierMain.aj"
/>
<compile
files="util/A.aj,util/T.aj"
outjar="util.jar"
/>
<compile
files="child/Executor.aj,child/Advisor.aj"
classpath="util.jar"
options="-outxml"
outjar="child.zip"
>
<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
</compile>
< - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
since we don't want any top-level aspects, we deploy an empty one!
the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
<run class="top.HierMain" ltw="null-aop.xml">
<stdout/>
<stderr>
<line text="info AspectJ Weaver Version"/>
<line text="info register classloader"/>
<line text="info using"/>
<line text="info weaving 'top.HierMain'"/>
<line text="info AspectJ Weaver Version"/>
<line text="info register classloader"/>
<line text="info using"/>
<line text="info using file:"/>
<line text="info register aspect child.Advisor"/>
<line text="info weaving 'child.Executor'"/>
<line text="info weaving 'util.A'"/>
</stderr>
</run>
</ajc-test>
-->
<ajc-test dir="ltw" title="JDK14 LTW with XML" keywords="ltw">
<compile files="HelloWorld.java" options="-outjar hello.jar"/>
<compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/>

Loading…
Cancel
Save