diff options
Diffstat (limited to 'tests')
6 files changed, 82 insertions, 0 deletions
diff --git a/tests/features164/aopconfig/one/A3.java b/tests/features164/aopconfig/one/A3.java new file mode 100644 index 000000000..9339f2044 --- /dev/null +++ b/tests/features164/aopconfig/one/A3.java @@ -0,0 +1,3 @@ +aspect A3 { + before():staticinitialization(*) {} +} diff --git a/tests/features164/aopconfig/one/multi1.xml b/tests/features164/aopconfig/one/multi1.xml new file mode 100644 index 000000000..0aeec1b08 --- /dev/null +++ b/tests/features164/aopconfig/one/multi1.xml @@ -0,0 +1,9 @@ +<aspectj> + <aspects> + <aspect name="A" scope="B"/> + </aspects> + <weaver> + <!-- Do not apply on any aspects --> + <exclude within="A*"/> + </weaver> +</aspectj> diff --git a/tests/features164/aopconfig/one/multi2.xml b/tests/features164/aopconfig/one/multi2.xml new file mode 100644 index 000000000..9c2c39ce3 --- /dev/null +++ b/tests/features164/aopconfig/one/multi2.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="A2" scope="B2"/> + </aspects> +</aspectj> diff --git a/tests/features164/aopconfig/one/multi3.xml b/tests/features164/aopconfig/one/multi3.xml new file mode 100644 index 000000000..18c1513fc --- /dev/null +++ b/tests/features164/aopconfig/one/multi3.xml @@ -0,0 +1,5 @@ +<aspectj> + <aspects> + <aspect name="A3"/> + </aspects> +</aspectj> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java index 04b4b15d3..d9cbd381c 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java @@ -221,6 +221,56 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("aop config - 5"); } + /** + * If multiple XML files are given together with {@code -xmlConfigured}, they will be logically merged into one. + * I.e., given the following three XML config files: + * + * <pre>{@code + * <aspectj> + * <aspects> + * <aspect name="A" scope="B"/> + * </aspects> + * <weaver> + * <exclude within="A*"/> + * </weaver> + * </aspectj> + * }</pre> + * + * <pre>{@code + * <aspectj> + * <aspects> + * <aspect name="A2" scope="B2"/> + * </aspects> + * </aspectj> + * }</pre> + * + * <pre>{@code + * <aspectj> + * <aspects> + * <aspect name="A3"/> + * </aspects> + * </aspectj> + * }</pre> + * + * The result will be as if only one XML config file with this content was specified: + * + * <pre>{@code + * <aspectj> + * <aspects> + * <aspect name="A" scope="B"/> + * <aspect name="A2" scope="B2"/> + * <aspect name="A3"/> + * </aspects> + * <weaver> + * <exclude within="A*"/> + * </weaver> + * </aspectj> + * }</pre> + */ + public void testMultipleXMLFiles() { + runTest("aop config - multiple XML files"); + } + public void testAjcThisNotRead() { runTest("ajcthis not read"); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml index a14d8d0e7..c59523f92 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml @@ -180,6 +180,16 @@ </compile> </ajc-test> + <ajc-test dir="features164/aopconfig/one" title="aop config - multiple XML files"> + <!-- Java, AspectJ and XML files can be specified in any order. See how they are mixed here. --> + <compile files="A.java A2.java A3.java multi1.xml multi2.xml B.java B2.java multi3.xml" options="-1.5 -showWeaveInfo -xmlConfigured"> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A3' (A3.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B2.<clinit>())' in Type 'B2' (B2.java:1) advised by before advice from 'A3' (A3.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B2.<clinit>())' in Type 'B2' (B2.java:1) advised by before advice from 'A2' (A2.java:2)"/> + </compile> + </ajc-test> + <ajc-test dir="bugs164/pr263310" title="inner handles"> <compile files="HandleTestingAspect.java" options="-1.5 -emacssym -Xlint:ignore"/> </ajc-test> |