]> source.dussan.org Git - aspectj.git/commitdiff
292584, 295491, 298388: testcode
authoraclement <aclement>
Mon, 25 Jan 2010 22:47:06 +0000 (22:47 +0000)
committeraclement <aclement>
Mon, 25 Jan 2010 22:47:06 +0000 (22:47 +0000)
tests/bugs169/pr292584/AbstractAspect.java [new file with mode: 0644]
tests/bugs169/pr292584/ClassWithJoinPoint.java [new file with mode: 0644]
tests/bugs169/pr292584/ConcreteAspect.java [new file with mode: 0644]
tests/bugs169/pr295491/SpringConfigurableMixin.java [new file with mode: 0644]
tests/bugs169/pr298388/PR298388.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java
tests/src/org/aspectj/systemtest/ajc169/ajc169.xml

diff --git a/tests/bugs169/pr292584/AbstractAspect.java b/tests/bugs169/pr292584/AbstractAspect.java
new file mode 100644 (file)
index 0000000..767be60
--- /dev/null
@@ -0,0 +1,13 @@
+
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public abstract class AbstractAspect {
+    @Around("execution(* ClassWithJoinPoint.getValue(..))")
+    public Object ClassWithJoinPoint_getValue() {
+        return getValueReplacement();
+    }
+
+    protected abstract Boolean getValueReplacement();
+}
\ No newline at end of file
diff --git a/tests/bugs169/pr292584/ClassWithJoinPoint.java b/tests/bugs169/pr292584/ClassWithJoinPoint.java
new file mode 100644 (file)
index 0000000..32b646f
--- /dev/null
@@ -0,0 +1,17 @@
+
+public class ClassWithJoinPoint {
+    public Boolean getValue() {
+        return Boolean.FALSE;
+    }
+
+   public static void main(String[] arguments) {
+/*
+        System.out.println("Testing aspect style (should print \"true\"):");
+        System.out.println(new aspect_style.ClassWithJoinPoint().getValue());
+        
+        System.out.println();
+*/
+        System.out.println("Testing annotation style (should print \"true\"):");
+        System.out.println(new ClassWithJoinPoint().getValue());
+    }
+}
diff --git a/tests/bugs169/pr292584/ConcreteAspect.java b/tests/bugs169/pr292584/ConcreteAspect.java
new file mode 100644 (file)
index 0000000..0f0f020
--- /dev/null
@@ -0,0 +1,10 @@
+
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class ConcreteAspect extends AbstractAspect {
+    @Override
+    protected Boolean getValueReplacement() {
+        return Boolean.TRUE;
+    }
+}
diff --git a/tests/bugs169/pr295491/SpringConfigurableMixin.java b/tests/bugs169/pr295491/SpringConfigurableMixin.java
new file mode 100644 (file)
index 0000000..bfcda0f
--- /dev/null
@@ -0,0 +1,30 @@
+package com.j4fe.aspects;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Entity;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public aspect SpringConfigurableMixin {
+
+    public static interface EntityManagerAware {
+      EntityManager getEntityManager();
+    }
+
+
+    // not working 
+    // declare @type : (@Entity *) : @Configurable(autowire = Autowire.BY_TYPE, preConstruction = true);
+
+    // also not working
+    // declare @type : (@Entity *) : @Configurable
+
+    declare parents : (@Entity *) implements EntityManagerAware;
+
+    @PersistenceContext
+    transient private EntityManager EntityManagerAware.entityManager;
+
+    public EntityManager EntityManagerAware.getEntityManager() {
+       return entityManager;
+    }    
+}
diff --git a/tests/bugs169/pr298388/PR298388.java b/tests/bugs169/pr298388/PR298388.java
new file mode 100644 (file)
index 0000000..dae3c10
--- /dev/null
@@ -0,0 +1,42 @@
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareMixin;
+
+@Aspect
+public class PR298388 {
+
+       @DeclareMixin("Thing2")
+       public static <T> Thing<T> createThingImplementation() {
+               return new ThingImpl<T>();
+       }
+       
+       public static void main(String[] args) {
+               Thing<String> ts = (Thing<String>) new Thing2<String>();
+               ts.wibble();
+               ts.wibble("abc");
+               String s = ts.wibbleBack("wobble");
+               System.out.println("done");
+       }
+       
+}
+
+class Thing2<X> {
+}
+
+interface Thing<X> {
+       void wibble();
+       void wibble(X x);
+       X wibbleBack(X x);
+}
+
+class ThingImpl<X> implements Thing<X> {
+       ThingImpl() {
+       }
+
+       public void wibble() {
+       }
+       
+       public void wibble(X x) {}
+       
+       public X wibbleBack(X x) { return x;}
+
+}
index 501325f11dd6651ffed0ae3eb417a936ec87ab44..54872e40df5fe0d5a9c42c988efee0e30c13f7dd 100644 (file)
@@ -18,6 +18,14 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc169Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       public void testPr298388() {
+               runTest("declare mixin and generics");
+       }
+
+       public void testPr292584() {
+               runTest("annotation around advice verifyerror");
+       }
+
        // ---
 
        public static Test suite() {
@@ -26,7 +34,7 @@ public class Ajc169Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
        @Override
        protected File getSpecFile() {
-               return new File("../tests/src/org/aspectj/systemtest/ajc167/ajc167.xml");
+               return new File("../tests/src/org/aspectj/systemtest/ajc169/ajc169.xml");
        }
 
 }
\ No newline at end of file
index a701d65b85a5276655eae17dc20ab92f267aa8a9..9f2408c2a0a3685ddc0918e1fe80e571cb66b3b4 100644 (file)
@@ -2,4 +2,27 @@
 
 <suite>
    
+   <ajc-test dir="bugs169/pr298388" title="declare mixin and generics">
+     <compile files="PR298388.java" options="-1.5"/>
+     <run class="PR298388">
+       <stdout>
+         <line text="done"/>
+       </stdout>
+     </run>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr295491" title="model annotation npe">
+     <compile files="SpringConfigurableMixin.java" options="-1.5 -emacssym"/>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr292584" title="annotation around advice verifyerror">
+     <compile files="AbstractAspect.java,ClassWithJoinPoint.java,ConcreteAspect.java" options="-1.5"/>
+     <run class="ClassWithJoinPoint">
+       <stdout>
+         <line text="Testing annotation style (should print &quot;true&quot;):"/>
+         <line text="true"/>
+       </stdout>
+     </run>
+  </ajc-test>
+  
 </suite>
\ No newline at end of file