diff options
author | hsestupin <stupin.sergey@gmail.com> | 2014-08-14 12:54:28 +0400 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-08-14 11:11:08 -0700 |
commit | 66469244e4aa352f0db6d91854541a85d68e7032 (patch) | |
tree | cd942afb3382dcfbbb831e4468db450168d3f4ec /tests/src | |
parent | ac48f780a46720f201ac893c8fbf9b1e17cc60d4 (diff) | |
download | aspectj-66469244e4aa352f0db6d91854541a85d68e7032.tar.gz aspectj-66469244e4aa352f0db6d91854541a85d68e7032.zip |
add APT test generating Java files
Signed-off-by: hsestupin <stupin.sergey@gmail.com>
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/org/aspectj/systemtest/apt/AptTests.java | 50 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/apt/apt-spec.xml | 32 |
2 files changed, 49 insertions, 33 deletions
diff --git a/tests/src/org/aspectj/systemtest/apt/AptTests.java b/tests/src/org/aspectj/systemtest/apt/AptTests.java index 7781ff013..af8df5e8c 100644 --- a/tests/src/org/aspectj/systemtest/apt/AptTests.java +++ b/tests/src/org/aspectj/systemtest/apt/AptTests.java @@ -23,28 +23,32 @@ import java.io.File; */ public class AptTests extends XMLBasedAjcTestCase { - public void testAptWithSpecifiedProcessor() { - runTest("annotation processing with specified processor"); - } - - /** - * SPI - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html - */ - public void testAptUsingSPI() { - runTest("annotation processing in action using SPI"); - } - - public void testDisabledApt() { - runTest("disabled annotation processing"); - } - - public static Test suite() { - return XMLBasedAjcTestCase.loadSuite(AptTests.class); - } - - @Override - protected File getSpecFile() { - return getClassResource("apt-spec.xml"); - } + public void testAptWithSpecifiedProcessor() { + runTest("annotation processing with specified processor"); + } + + /** + * SPI - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html + */ + public void testAptUsingSPI() { + runTest("annotation processing in action using SPI"); + } + + public void testDisabledApt() { + runTest("disabled annotation processing"); + } + + public void testAptWithJavaFilesAsAspects() { + runTest("annotation processing generating java files with aspects"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AptTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("apt-spec.xml"); + } } diff --git a/tests/src/org/aspectj/systemtest/apt/apt-spec.xml b/tests/src/org/aspectj/systemtest/apt/apt-spec.xml index c1d34bd23..d2aa1cd79 100644 --- a/tests/src/org/aspectj/systemtest/apt/apt-spec.xml +++ b/tests/src/org/aspectj/systemtest/apt/apt-spec.xml @@ -2,8 +2,8 @@ <suite> - <ajc-test dir="apt" title="annotation processing with specified processor"> - <compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java" + <ajc-test dir="apt/test1" title="annotation processing with specified processor"> + <compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processor.jar"/> <!-- SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: @@ -15,7 +15,7 @@ } } --> - <compile options="-1.8 -processor test.SimpleProcessor -s generated -showWeaveInfo" files="src/Some.java" + <compile options="-1.8 -processor test.SimpleProcessor -s generated -showWeaveInfo" files="Some.java" classpath="annotation_processor.jar" outjar="code.jar"> <message kind="weave" text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/> @@ -30,12 +30,12 @@ </run> </ajc-test> - <ajc-test dir="apt" title="annotation processing in action using SPI"> + <ajc-test dir="apt/test1" title="annotation processing in action using SPI"> <!-- what is SPI is described here - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html --> - <!--<compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java" outjar="annotation_processors_with_spi.jar"/>--> - <compile options="-1.8 -sourceroots processor" inpath="processor/" outjar="annotation_processor.jar"/> + <!--<compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processors_with_spi.jar"/>--> + <compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processor.jar"/> <!-- SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event. @@ -48,7 +48,7 @@ --> <!--apt_service_description.jar contains only SPI descrition file - META-INF/services/javax.annotation.processing.Processor--> - <compile options="-1.8 -s generated -showWeaveInfo" files="src/Some.java" + <compile options="-1.8 -s generated -showWeaveInfo" files="Some.java" classpath="annotation_processor.jar;apt_service_description.jar" outjar="code.jar"> <message kind="weave" text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/> @@ -64,8 +64,8 @@ </run> </ajc-test> - <ajc-test dir="apt" title="disabled annotation processing"> - <compile options="-1.8" files="processor/Event.java processor/SimpleProcessor.java" + <ajc-test dir="apt/test1" title="disabled annotation processing"> + <compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processor.jar"/> <!-- SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: @@ -78,11 +78,23 @@ } --> - <compile options="-1.8 -s generated -showWeaveInfo -proc:none" files="src/Some.java" + <compile options="-1.8 -s generated -showWeaveInfo -proc:none" files="Some.java" classpath="annotation_processor.jar" outjar="code.jar"> <!--field was not injected, so error should occur--> <message kind="error" text="OnMethod1Event cannot be resolved or is not a field"/> </compile> </ajc-test> + <ajc-test dir="apt/test2" title="annotation processing generating java files with aspects"> + <compile options="-1.6" files="DemoProcessor.java Marker.java" /> + <compile options="-1.6 -showWeaveInfo -processor DemoProcessor -s generated" files="Code.java"> + <message kind="warning" text="Generated aspect to advise too"/> + <message kind="warning" text="Generated aspect to advise boo"/> + <message kind="weave" + text="Join point 'method-execution(void Code.boo())' in Type 'Code' (Code.java:6) advised by before advice from 'Advise_boo' (Advise_boo.java:2)"/> + <message kind="weave" + text="Join point 'method-execution(void Code.too())' in Type 'Code' (Code.java:9) advised by before advice from 'Advise_too' (Advise_too.java:2)"/> + </compile> + </ajc-test> + </suite> |