aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/ajc172
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
commit2b24e7377da7c849fe7f9f4fa06a701664f9d27d (patch)
tree64c36c8fcf29633af7a5e2f7405b94cbec629ca8 /tests/src/test/java/org/aspectj/systemtest/ajc172
parentd60de8d0b3e62eb36b612a824bb9345d865c0155 (diff)
downloadaspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.tar.gz
aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.zip
mavenizing tests - wip
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc172')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java210
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java25
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml204
3 files changed, 439 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java
new file mode 100644
index 000000000..c4c10d1fa
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Contributors
+ * 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:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc172;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ public void testUnsupportedShouldBeNormalError_pr391384() {
+ runTest("unsupported should be normal error");
+ }
+
+ // if the test is failing because the classes won't run, remove the run blocks from the ajc172.xml entry and re-run to check signatures.
+ public void testSignatures_pr394535() throws Exception {
+ runTest("signatures");
+
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Bug2$ClassA2"); // the working one
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T::LBug2$Interface12;:LBug2$Interface22;>Ljava/lang/Object;Ljava/io/Serializable;", sss);
+
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Bug$ClassA");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T::LBug$Interface1;:LBug$Interface2;>Ljava/lang/Object;Ljava/io/Serializable;", sss);
+ }
+
+ // extends
+ public void testPSignatures_pr399590() throws Exception {
+ runTest("p signatures 1");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage");
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal<+LCage<TT;>;>;>LBar;", sss);
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal2<+LCage2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss);
+ }
+
+ // extends two classes
+ public void testPSignatures_pr399590_2() throws Exception {
+ runTest("p signatures 2");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage");
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal<+LCage<TT;LIntf;>;LIntf;>;Q:Ljava/lang/Object;>LBar;", sss);
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal2<+LCage2<TT;LIntf2;>;LIntf2;>;Q:Ljava/lang/Object;>LBar2;Ljava/io/Serializable;", sss);
+ }
+
+ // super
+ public void testPSignatures_pr399590_3() throws Exception {
+ runTest("p signatures 3");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage");
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal<-LXXX<TT;>;>;>LBar;", sss);
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal2<-LXXX2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss);
+ }
+
+ // super
+ public void testPSignatures_pr399590_4() throws Exception {
+ runTest("p signatures 4");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage");
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal<-LXXX<TT;>;LYYY;>;>LBar;", sss);
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal2<-LXXX2<TT;>;LYYY2;>;>LBar2;Ljava/io/Serializable;", sss);
+ }
+
+ // unbound
+ public void testPSignatures_pr399590_5() throws Exception {
+ runTest("p signatures 5");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage");
+ String sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal<*>;>LBar;", sss);
+ jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2");
+ sss = jc.getSignatureAttribute().getSignature();
+ assertEquals("<T:LAnimal2<*>;>LBar2;Ljava/io/Serializable;", sss);
+ }
+
+ public void testIfPointcutNames_pr398246() throws Exception {
+ runTest("if pointcut names");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$andy", m.getName());
+ }
+
+ public void testIfPointcutNames_pr398246_2() throws Exception {
+ runTest("if pointcut names 2");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$fred", m.getName());
+ }
+
+ // fully qualified annotation name is used
+ public void testIfPointcutNames_pr398246_3() throws Exception {
+ runTest("if pointcut names 3");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$barney", m.getName());
+ }
+
+ // compiling a class later than the initial build - does it pick up the
+ // right if clause name?
+ public void testIfPointcutNames_pr398246_4() throws Exception {
+ runTest("if pointcut names 4");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$sid", m.getName());
+ }
+
+ // new style generated names
+ public void testIfPointcutNames_pr398246_5() throws Exception {
+ runTest("if pointcut names 5");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$ac0cb804", m.getName());
+
+ jc = getClassFrom(ajc.getSandboxDirectory(), "X2");
+ m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$ac0cb804", m.getName());
+ }
+
+ // new style generated names - multiple ifs in one pointcut
+ public void testIfPointcutNames_pr398246_6() throws Exception {
+ runTest("if pointcut names 6");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if",1);
+ assertEquals("ajc$if$aac93da8", m.getName());
+ m = getMethodStartsWith(jc, "ajc$if",2);
+ assertEquals("ajc$if$1$ae5e778a", m.getName());
+ }
+
+ // new style generated names - multiple ifs in one advice
+ public void testIfPointcutNames_pr398246_7() throws Exception {
+ runTest("if pointcut names 7");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if",1);
+ assertEquals("ajc$if$1$ac0607c", m.getName());
+ m = getMethodStartsWith(jc, "ajc$if",2);
+ assertEquals("ajc$if$1$1$4d4baf36", m.getName());
+ }
+
+ public void testOptionalAspects_pr398588() {
+ runTest("optional aspects");
+ }
+
+ public void testInconsistentClassFile_pr389750() {
+ runTest("inconsistent class file");
+ }
+
+ public void testInconsistentClassFile_pr389750_2() {
+ runTest("inconsistent class file 2");
+ }
+
+ public void testInconsistentClassFile_pr389750_3() {
+ runTest("inconsistent class file 3");
+ }
+
+ public void testInconsistentClassFile_pr389750_4() {
+ runTest("inconsistent class file 4");
+ }
+
+ public void testAnnotationValueError_pr389752_1() {
+ runTest("annotation value error 1");
+ }
+
+ public void testAnnotationValueError_pr389752_2() {
+ runTest("annotation value error 2");
+ }
+
+ // this needs some cleverness to fix... the annotation value is parsed as a
+ // string and then not checked
+ // to see if the user is accidentally supplying, for example, an enum value.
+ // Due to the use of strings, it
+ // is hard to check. The verification code might go here:
+ // WildAnnotationTypePattern, line 205 (the string case)
+ // public void testAnnotationValueError_pr389752_3() {
+ // runTest("annotation value error 3");
+ // }
+
+ // ---
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc172Tests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("ajc172.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java b/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java
new file mode 100644
index 000000000..b79cc40fa
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Contributors
+ * 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:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc172;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ172 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.7.2 tests");
+ // $JUnit-BEGIN$
+ suite.addTest(Ajc172Tests.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml
new file mode 100644
index 000000000..3eb4f2cb3
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml
@@ -0,0 +1,204 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="bugs172/pr391384" title="unsupported should be normal error">
+ <compile files="Code.java" options="-1.5">
+ <message kind="error" text="Compiler limitation: annotation value support not implemented for type java.lang.String[]"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr394535" title="signatures">
+ <compile files="Bug.java" options="-1.5"/>
+ <compile files="Bug2.java" options="-1.5"/>
+ <run class="Bug2"/>
+ <run class="Bug"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr399590" title="p signatures 1">
+ <compile files="Cage.java" options="-1.5"/>
+ <compile files="Cage2.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr399590/two" title="p signatures 2">
+ <compile files="Cage.java" options="-1.5"/>
+ <compile files="Cage2.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr399590/three" title="p signatures 3">
+ <compile files="Cage.java" options="-1.5"/>
+ <compile files="Cage2.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr399590/four" title="p signatures 4">
+ <compile files="Cage.java" options="-1.5"/>
+ <compile files="Cage2.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr399590/five" title="p signatures 5">
+ <compile files="Cage.java" options="-1.5"/>
+ <compile files="Cage2.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398588" title="optional aspects">
+ <compile files="Anno.java Anno2.java" outjar="anno.jar" options="-1.5"/>
+ <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/>
+ <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/>
+ <compile files="Code.java Blah.java" classpath="aspect.jar;aspect2.jar" options="-1.5"/>
+ <compile files="AspectC.java" classpath="$sandbox" outjar="aspect3.jar" options="-Xlint:ignore -1.5"/>
+ <compile files="AspectD.java" classpath="anno.jar" outjar="aspect4.jar" options="-Xlint:ignore -1.5"/>
+
+ <file deletefile="anno.jar"/>
+ <run class="Code" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar;aspectj3.jar;aspect4.jar">
+ <stderr>
+ <line text="AspectJ Weaver Version"/>
+ <line text="register classloader"/>
+ <line text="using configuration"/>
+ <line text="register aspect AspectA"/>
+ <line text="deactivating aspect"/>
+ <line text="register aspect AspectB"/>
+ <line text="register aspect AspectC"/>
+ <line text="register aspect AspectD"/>
+ <line text="deactivating aspect 'AspectD' as it requires type 'a.b.c.Anno2' which cannot be found on the classpath"/>
+ <line text="Join point 'method-execution(void Code.main(java.lang.String[]))' in Type 'Code' (Code.java:7) advised by before advice from 'AspectC'"/>
+ <line text="Join point 'staticinitialization(void Code.&lt;clinit&gt;())' in Type 'Code' (Code.java) advised by before advice from 'AspectB'"/>
+ <line text="processing reweavable"/>
+ <line text="processing reweavable"/>
+ </stderr>
+ <stdout>
+ <line text="staticinitialization"/>
+ <line text="C"/>
+ <line text="abcde"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names">
+ <compile files="Code.java" options="-1.5">
+ </compile>
+ <run class="Code" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 2">
+ <compile files="Code2.java" options="-1.5">
+ </compile>
+ <run class="Code2" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 3">
+ <compile files="Code3.java" options="-1.5">
+ </compile>
+ <run class="Code3" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 4">
+ <compile files="Code4.java" options="-1.5"></compile>
+ <compile files="Code4.java" options="-1.5" outjar="aspects.jar"/>
+ <run class="Code4" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ <compile files="CodeExtra4.java" aspectpath="aspects.jar" options="-1.5"></compile>
+ <run class="CodeExtra4" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 5">
+ <compile files="Code5.java Code5a.java" options="-1.5">
+ </compile>
+ <run class="Code5" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 6">
+ <compile files="Code6.java" options="-1.5">
+ </compile>
+ <run class="Code6" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 7">
+ <compile files="Code7.java" options="-1.5">
+ </compile>
+ <run class="Code7" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389750" title="inconsistent class file">
+ <compile files="Code.aj" options="-1.5">
+ </compile>
+ <compile files="Clazz.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389750" title="inconsistent class file 2">
+ <compile files="Code2.aj" outjar="azpect.jar" options="-1.5">
+ </compile>
+ <compile files="Clazz2.java" aspectpath="azpect.jar" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389750" title="inconsistent class file 3">
+ <compile files="Code3.aj" outjar="azpect.jar" options="-1.5">
+ </compile>
+ <compile files="Clazz3.java" aspectpath="azpect.jar" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389750" title="inconsistent class file 4">
+ <compile files="Code4.aj" outjar="azpect.jar" options="-1.5">
+ </compile>
+ <compile files="Clazz4.java" aspectpath="azpect.jar" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389752" title="annotation value error 1">
+ <compile files="Code.java" options="-1.5">
+ <message kind="error" text="Invalid annotation value 'AA', expected enum value"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389752" title="annotation value error 2">
+ <compile files="Code2.java" options="-1.5">
+ <message kind="error" text="Invalid annotation value 'AA', expected enum value"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr389752" title="annotation value error 3">
+ <compile files="Code3.java" options="-1.5">
+ <message kind="error" text="Invalid annotation value 'AA', expected enum value"/>
+ </compile>
+ </ajc-test>
+
+</suite>