]> source.dussan.org Git - aspectj.git/commitdiff
testcode for 125475/125480 (from matthew) and for enh 123423 (expose PTW type)
authoraclement <aclement>
Mon, 30 Jan 2006 10:22:10 +0000 (10:22 +0000)
committeraclement <aclement>
Mon, 30 Jan 2006 10:22:10 +0000 (10:22 +0000)
12 files changed:
tests/bugs151/pr125475/Test.java [new file with mode: 0644]
tests/bugs151/pr125475/TestAspect.aj [new file with mode: 0644]
tests/bugs151/pr125475/TestEmptyPointcutAtAspect.java
tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java [new file with mode: 0644]
tests/bugs151/pr125475/aop.xml [new file with mode: 0644]
tests/bugs151/pr125480/AbstractMethods.aj [new file with mode: 0644]
tests/bugs151/pr125480/AtAspectTestConcreteMethods.java [new file with mode: 0644]
tests/bugs151/pr125480/ConcreteMethods.aj [new file with mode: 0644]
tests/bugs151/pr125480/HelloWorld.java [new file with mode: 0644]
tests/bugs151/pr125480/aop-tracing.xml [new file with mode: 0644]
tests/features151/ptw/ExposedType.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml

diff --git a/tests/bugs151/pr125475/Test.java b/tests/bugs151/pr125475/Test.java
new file mode 100644 (file)
index 0000000..b8ad663
--- /dev/null
@@ -0,0 +1,3 @@
+public class Test {
+       public static void main (String[] args) {}
+}
diff --git a/tests/bugs151/pr125475/TestAspect.aj b/tests/bugs151/pr125475/TestAspect.aj
new file mode 100644 (file)
index 0000000..ad5cbd6
--- /dev/null
@@ -0,0 +1,4 @@
+public abstract aspect TestAspect {
+       
+       protected abstract pointcut scope (); 
+}
index 12334f4b9c880840d19fd29b1e8430b5cbbec327..d249621b00ee04d8466ad9e1994cf70a2aa453c0 100644 (file)
@@ -1,6 +1,12 @@
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
 @Aspect
 public class TestEmptyPointcutAtAspect {
 
-       @Pointcut("")
-       protected void scope () {}
+       @Pointcut("")
+       protected void scope () {}
+       
+       @Pointcut
+       protected void scope2() {}
 }
diff --git a/tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java b/tests/bugs151/pr125475/TestEmptyPointcutAtAspect2.java
new file mode 100644 (file)
index 0000000..7b92bd0
--- /dev/null
@@ -0,0 +1,28 @@
+import org.aspectj.lang.annotation.*;
+
+@Aspect
+public class TestEmptyPointcutAtAspect2 {
+
+       @Pointcut("")
+       protected void scope () {}
+       
+       @Before("within(*) && scope()")
+       public void m() {
+               System.err.println("Here!");
+       }
+}
+
+class A {
+       
+       String s;
+       int i;
+       
+       public static void main(String[] args) {
+               new A().foo();
+       } 
+       
+       public void foo() {
+               i=4;
+               s="hello";
+       }
+}
\ No newline at end of file
diff --git a/tests/bugs151/pr125475/aop.xml b/tests/bugs151/pr125475/aop.xml
new file mode 100644 (file)
index 0000000..5b9dd55
--- /dev/null
@@ -0,0 +1,14 @@
+<aspectj>
+       <aspects>
+<!--   
+        <concrete-aspect name="TraceHelloWorld" extends="org.aspectj.lib.tracing.SimpleTracing">
+               <pointcut name="tracingScope" expression="within(*)"/>
+        </concrete-aspect>
+-->        
+        <concrete-aspect name="TestSubAtAspect" extends="TestAspect">
+               <pointcut name="scope" expression=""/>
+        </concrete-aspect>
+       </aspects>
+    
+    <weaver options="-verbose"/>
+</aspectj>
diff --git a/tests/bugs151/pr125480/AbstractMethods.aj b/tests/bugs151/pr125480/AbstractMethods.aj
new file mode 100644 (file)
index 0000000..e37065c
--- /dev/null
@@ -0,0 +1,13 @@
+
+
+public abstract aspect AbstractMethods {
+
+       protected abstract pointcut tracingScope ();
+       
+       before () : tracingScope () {
+               test();
+       }
+       
+       protected abstract void test ();
+//     protected void test () {}
+}
diff --git a/tests/bugs151/pr125480/AtAspectTestConcreteMethods.java b/tests/bugs151/pr125480/AtAspectTestConcreteMethods.java
new file mode 100644 (file)
index 0000000..90e4cc3
--- /dev/null
@@ -0,0 +1,6 @@
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class AtAspectTestConcreteMethods extends ConcreteMethods {
+
+}
diff --git a/tests/bugs151/pr125480/ConcreteMethods.aj b/tests/bugs151/pr125480/ConcreteMethods.aj
new file mode 100644 (file)
index 0000000..efc23b5
--- /dev/null
@@ -0,0 +1,7 @@
+
+
+public abstract aspect ConcreteMethods extends AbstractMethods {
+
+       protected void test () {}
+
+}
diff --git a/tests/bugs151/pr125480/HelloWorld.java b/tests/bugs151/pr125480/HelloWorld.java
new file mode 100644 (file)
index 0000000..f741a2c
--- /dev/null
@@ -0,0 +1,11 @@
+public class HelloWorld {
+
+       public static void main(String[] args) {
+               new HelloWorld().println();
+       }
+
+       public void println() {
+               System.out.print("Hello World!");
+       }
+
+}
diff --git a/tests/bugs151/pr125480/aop-tracing.xml b/tests/bugs151/pr125480/aop-tracing.xml
new file mode 100644 (file)
index 0000000..e31e52c
--- /dev/null
@@ -0,0 +1,10 @@
+<aspectj>
+       <aspects>
+        <concrete-aspect name="TraceHelloWorld" extends="ConcreteMethods">
+               <pointcut name="tracingScope" expression="within(*)"/>
+        </concrete-aspect>
+       </aspects>
+    
+    <weaver options="-verbose"/>
+</aspectj>
+
diff --git a/tests/features151/ptw/ExposedType.java b/tests/features151/ptw/ExposedType.java
new file mode 100644 (file)
index 0000000..daa2974
--- /dev/null
@@ -0,0 +1,25 @@
+public class ExposedType {
+       public static void main(String[] args) {
+               new ExposedTypeOne().foo();
+               new ExposedTypeTwo().foo();
+               new ExposedTypeThree().foo();
+       }
+}
+
+class ExposedTypeOne {
+       public void foo() {     }
+}
+
+class ExposedTypeTwo {
+       public void foo() {     }
+}
+
+class ExposedTypeThree {
+       public void foo() {     }
+}
+
+aspect X pertypewithin(Exposed*) {
+       before(): execution(* foo(..)) {
+               System.err.println("here I am "+thisJoinPoint+": for class "+getWithinType());
+       }
+}
\ No newline at end of file
index 212ac55894e299c8d2763fb9c99ade9bd48c350c..99c2698d1f5d8b9778604a3b1f1673a3203fa508 100644 (file)
     <ajc-test dir="bugs151/pr125295" title="new IProgramElement methods">
         <compile files="pkg/C.java,pkg/A.aj" options="-emacssym"/>
     </ajc-test>
-
-    <ajc-test dir="bugs151/pr125475" title="empty pointcut in atAJ">
+    
+    <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation">
         <compile files="TestEmptyPointcutAtAspect.java" options="-1.5"/>
     </ajc-test>
+    
+    <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation - 2">
+        <compile files="TestEmptyPointcutAtAspect2.java" options="-1.5 -showWeaveInfo">
+          <message kind="warning" line="10" text="advice defined in TestEmptyPointcutAtAspect2 has not been applied [Xlint:adviceDidNotMatch]"/>
+        </compile>
+    </ajc-test>
+
+    <ajc-test dir="bugs151/pr125475" title="define empty pointcut using aop.xml">
+        <compile files="Test.java TestAspect.aj"/>
+        <run class="Test" ltw="aop.xml"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs151/pr125480" title="aop.xml aspect inherits abstract method that has concrete implementation in parent">
+        <compile files="HelloWorld.java"/>
+        <compile files="AbstractMethods.aj, ConcreteMethods.aj"/>
+        <run class="HelloWorld" ltw="aop-tracing.xml"/>
+    </ajc-test>
+
+    
+    <!-- New features down here... when they arent big enough to have their own test file -->
+    
+    <ajc-test dir="features151/ptw" title="exposing withintype">
+        <compile files="ExposedType.java" options="-1.5"/>
+        <run class="ExposedType">
+          <stderr>
+            <line text="here I am execution(void ExposedTypeOne.foo()): for class ExposedTypeOne"/>
+            <line text="here I am execution(void ExposedTypeTwo.foo()): for class ExposedTypeTwo"/>
+            <line text="here I am execution(void ExposedTypeThree.foo()): for class ExposedTypeThree"/>
+          </stderr>
+        </run>
+    </ajc-test>  
 
 </suite>
\ No newline at end of file