]> source.dussan.org Git - aspectj.git/commitdiff
testcode for 149305, 149096, 149305
authoraclement <aclement>
Tue, 4 Jul 2006 16:53:37 +0000 (16:53 +0000)
committeraclement <aclement>
Tue, 4 Jul 2006 16:53:37 +0000 (16:53 +0000)
tests/bugs153/pr148693/MyAspect.java [new file with mode: 0644]
tests/bugs153/pr149096/SimpleTracing.aj [new file with mode: 0644]
tests/bugs153/pr149096/TestMain.aj [new file with mode: 0644]
tests/bugs153/pr149096/aop-pr149096.xml [new file with mode: 0644]
tests/bugs153/pr149305/case1/AbstractOzonator.java [new file with mode: 0644]
tests/bugs153/pr149305/case1/IdentityOzonator.java [new file with mode: 0644]
tests/bugs153/pr149305/case1/User.java [new file with mode: 0644]
tests/bugs153/pr149305/case2/com/codesrc/ozonator/AbstractOzonator.java [new file with mode: 0644]
tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/IdentityOzonator.java [new file with mode: 0644]
tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/User.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml

diff --git a/tests/bugs153/pr148693/MyAspect.java b/tests/bugs153/pr148693/MyAspect.java
new file mode 100644 (file)
index 0000000..b4fa5bb
--- /dev/null
@@ -0,0 +1,19 @@
+package mypackage; 
+
+public aspect MyAspect { 
+
+    pointcut executeMethod(): within(TestClass) && execution(* *(..)); 
+
+    before(): executeMethod() { 
+     System.out.println("Enter "+thisJoinPointStaticPart); 
+    } 
+    after(): executeMethod() { 
+     System.out.println("Leave "+thisJoinPointStaticPart); 
+    } 
+} 
+
+class TestClass { 
+
+public static void main(String[] args) { } 
+
+} 
diff --git a/tests/bugs153/pr149096/SimpleTracing.aj b/tests/bugs153/pr149096/SimpleTracing.aj
new file mode 100644 (file)
index 0000000..a865ed9
--- /dev/null
@@ -0,0 +1,32 @@
+import org.aspectj.lang.JoinPoint;
+
+public abstract aspect SimpleTracing {
+    private Tracer tracer = new Tracer();
+       
+    public abstract pointcut scope();
+       
+    public pointcut anyExec() :
+        execution(* *(..)) || execution(new(..)) || adviceexecution();
+       
+    public pointcut inTracing() : anyExec() && cflow(within(Tracer));
+    
+    public pointcut trace() : scope() && anyExec() && !inTracing();
+
+    before() : trace() {
+       tracer.enter(thisJoinPoint);
+    }
+    
+    after() : trace() {
+       tracer.exit(thisJoinPoint);
+    }
+    
+    class Tracer {
+       public void enter(JoinPoint jp) {
+               System.out.println("trace enter: " + jp.getSignature().toString());
+       }
+       
+       public void exit(JoinPoint jp) {
+               System.out.println("trace exit: " + jp.getSignature().toString());
+       }
+    }
+}
diff --git a/tests/bugs153/pr149096/TestMain.aj b/tests/bugs153/pr149096/TestMain.aj
new file mode 100644 (file)
index 0000000..90b1cf6
--- /dev/null
@@ -0,0 +1,16 @@
+public class TestMain {
+    public static void main(String args[]) {
+        TestMain main = new TestMain();
+        System.out.println(main.foo());
+        System.out.println(main.foo());
+        System.out.println(new TestMain().foo());
+        System.out.println(main.foo());
+    }
+
+    public Object foo() {
+        return ctr;
+    }
+
+    Integer ctr = new Integer(0);
+}
+
diff --git a/tests/bugs153/pr149096/aop-pr149096.xml b/tests/bugs153/pr149096/aop-pr149096.xml
new file mode 100644 (file)
index 0000000..ba987f8
--- /dev/null
@@ -0,0 +1,10 @@
+<aspectj>
+  <weaver>
+    <dump within="*"/>
+  </weaver>
+  <aspects>
+    <concrete-aspect name="TestTracing" extends="SimpleTracing">
+      <pointcut name="scope" expression="within(TestMain)"/>
+    </concrete-aspect>
+  </aspects>
+</aspectj>
diff --git a/tests/bugs153/pr149305/case1/AbstractOzonator.java b/tests/bugs153/pr149305/case1/AbstractOzonator.java
new file mode 100644 (file)
index 0000000..ccd5004
--- /dev/null
@@ -0,0 +1,26 @@
+package ajtest2;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+public abstract class AbstractOzonator
+{
+
+  @Pointcut("")
+  protected abstract void readMethodExecution();
+
+  @Pointcut("readMethodExecution() && this(ozonated)")
+  private void ozonatedReadExecution(Object ozonated){};
+
+  @Around("ozonatedReadExecution(ozonated)")
+  public Object aroundGetterCallNoRecurse( ProceedingJoinPoint thisJoinPoint,
+      Object ozonated) throws Throwable
+  {
+    System.out.println("thisJoinPoint="+thisJoinPoint+", ozonated="+ozonated);
+      return thisJoinPoint.proceed();
+  }
+
+}
diff --git a/tests/bugs153/pr149305/case1/IdentityOzonator.java b/tests/bugs153/pr149305/case1/IdentityOzonator.java
new file mode 100644 (file)
index 0000000..dd64977
--- /dev/null
@@ -0,0 +1,11 @@
+package ajtest2;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+public class IdentityOzonator extends AbstractOzonator 
+{
+    @Pointcut("execution(public *  ajtest2.User+.get*(..)) ")
+       protected void readMethodExecution() {}
+}
diff --git a/tests/bugs153/pr149305/case1/User.java b/tests/bugs153/pr149305/case1/User.java
new file mode 100644 (file)
index 0000000..8cba506
--- /dev/null
@@ -0,0 +1,24 @@
+package ajtest2;
+
+public class User
+{
+  private String name;
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName( String name)
+  {
+    this.name = name;
+  }
+
+  static public void main(String args[])
+  {
+    User u = new User();
+    System.out.println(u.getName());
+    u.setName("blah blah");
+    System.out.println(u.getName());
+  }
+}
diff --git a/tests/bugs153/pr149305/case2/com/codesrc/ozonator/AbstractOzonator.java b/tests/bugs153/pr149305/case2/com/codesrc/ozonator/AbstractOzonator.java
new file mode 100644 (file)
index 0000000..6b0890f
--- /dev/null
@@ -0,0 +1,27 @@
+package com.codesrc.ozonator;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import com.codesrc.ozonator.identity.User;
+
+@Aspect
+public abstract class AbstractOzonator
+{
+
+  @Pointcut("")
+  protected abstract void readMethodExecution();
+
+  @Pointcut("readMethodExecution() && this(ozonated)")
+  private void ozonatedReadExecution(Object ozonated){};
+
+  @Around("ozonatedReadExecution(ozonated)")
+  public Object aroundGetterCallNoRecurse( ProceedingJoinPoint thisJoinPoint,
+      Object ozonated) throws Throwable
+  {
+    System.out.println("thisJoinPoint="+thisJoinPoint+", ozonated="+ozonated);
+      return thisJoinPoint.proceed();
+  }
+
+}
diff --git a/tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/IdentityOzonator.java b/tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/IdentityOzonator.java
new file mode 100644 (file)
index 0000000..31e0209
--- /dev/null
@@ -0,0 +1,13 @@
+package com.codesrc.ozonator.identity;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+import com.codesrc.ozonator.AbstractOzonator;
+
+@Aspect
+public class IdentityOzonator extends AbstractOzonator 
+{
+    @Pointcut("execution(public *  com.codesrc.ozonator.identity.User+.get*(..)) ")
+       protected void readMethodExecution() {}
+}
diff --git a/tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/User.java b/tests/bugs153/pr149305/case2/com/codesrc/ozonator/identity/User.java
new file mode 100644 (file)
index 0000000..9ac828c
--- /dev/null
@@ -0,0 +1,25 @@
+package com.codesrc.ozonator.identity;
+
+public class User
+{
+  private String name;
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setName( String name)
+  {
+    this.name = name;
+  }
+
+  static public void main(String args[])
+  {
+    User u = new User();
+    System.out.println(u.getName());
+    u.setName("blah blah");
+    System.out.println(u.getName());
+  }
+  
+}
index ae3f14d8756e344832798d467943ed3acdcd3855..c2722fc740ddac47688c52f10b976a4c3b65d171 100644 (file)
         <message kind="warning" line="18" text="advice defined in TestAspect has not been applied"/>
       </compile>
     </ajc-test>
+         
+    <ajc-test dir="bugs153/pr149096" title="cflow xml concrete aspect">
+               <compile files="SimpleTracing.aj" outjar="out.jar"/>
+               <compile files="TestMain.aj"/>
+               <run class="TestMain" ltw="aop-pr149096.xml"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs153/pr149305/case1" title="ataj inheritance - 1">
+               <compile files="AbstractOzonator.java,IdentityOzonator.java,User.java" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs153/pr149305/case2" title="ataj inheritance - 2">
+               <compile files="com/codesrc/ozonator/identity/IdentityOzonator.java,com/codesrc/ozonator/identity/User.java,com/codesrc/ozonator/AbstractOzonator.java" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs153/pr149305/case2" title="ataj inheritance - 3">
+               <compile files="com/codesrc/ozonator/AbstractOzonator.java,com/codesrc/ozonator/identity/IdentityOzonator.java,com/codesrc/ozonator/identity/User.java" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs153/pr148693" title="verification problem">
+               <compile files="MyAspect.java" options="-1.5 -XterminateAfterCompilation=true"/>
+    </ajc-test>
+    
     
 </suite>
\ No newline at end of file