Procházet zdrojové kódy

Add Ajc164Tests::testMultipleXMLFiles

While researching how and what to document for AJJ option
'-xmlConfigured', I needed to find out what happens in case of multiple
XML config files. Result: They are merged. the new test case for the old
1.6.4 release verifies and documents that. It can also serve as an
example for reference in case of user questions.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tags/V1_9_21_2
Alexander Kriegisch před 2 měsíci
rodič
revize
fac5d8cb22

+ 3
- 0
tests/features164/aopconfig/one/A3.java Zobrazit soubor

@@ -0,0 +1,3 @@
aspect A3 {
before():staticinitialization(*) {}
}

+ 9
- 0
tests/features164/aopconfig/one/multi1.xml Zobrazit soubor

@@ -0,0 +1,9 @@
<aspectj>
<aspects>
<aspect name="A" scope="B"/>
</aspects>
<weaver>
<!-- Do not apply on any aspects -->
<exclude within="A*"/>
</weaver>
</aspectj>

+ 5
- 0
tests/features164/aopconfig/one/multi2.xml Zobrazit soubor

@@ -0,0 +1,5 @@
<aspectj>
<aspects>
<aspect name="A2" scope="B2"/>
</aspects>
</aspectj>

+ 5
- 0
tests/features164/aopconfig/one/multi3.xml Zobrazit soubor

@@ -0,0 +1,5 @@
<aspectj>
<aspects>
<aspect name="A3"/>
</aspects>
</aspectj>

+ 50
- 0
tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java Zobrazit soubor

@@ -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");
}

+ 10
- 0
tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml Zobrazit soubor

@@ -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.&lt;clinit&gt;())' in Type 'B' (B.java:1) advised by before advice from 'A3' (A3.java:2)"/>
<message kind="weave" text="Join point 'staticinitialization(void B.&lt;clinit&gt;())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/>
<message kind="weave" text="Join point 'staticinitialization(void B2.&lt;clinit&gt;())' in Type 'B2' (B2.java:1) advised by before advice from 'A3' (A3.java:2)"/>
<message kind="weave" text="Join point 'staticinitialization(void B2.&lt;clinit&gt;())' 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>

Načítá se…
Zrušit
Uložit