]> source.dussan.org Git - aspectj.git/commitdiff
helens testcode from 129163 for the recent AJDT integration probs.
authoraclement <aclement>
Fri, 10 Mar 2006 15:33:50 +0000 (15:33 +0000)
committeraclement <aclement>
Fri, 10 Mar 2006 15:33:50 +0000 (15:33 +0000)
tests/multiIncremental/PR129163_2/base/tjp/Demo.java [new file with mode: 0644]
tests/multiIncremental/PR129163_2/base/tjp/GetInfo.aj [new file with mode: 0644]
tests/multiIncremental/PR129163_2/inc1/tjp/Demo.java [new file with mode: 0644]
tests/multiIncremental/PR129163_2/inc1/tjp/GetInfo.aj [new file with mode: 0644]
tests/multiIncremental/PR129163_3/base/pack/C.java [new file with mode: 0644]
tests/multiIncremental/PR129163_3/inc1/pack/C.java [new file with mode: 0644]
tests/multiIncremental/PR129163_4/base/p/A1.aj [new file with mode: 0644]
tests/multiIncremental/PR129163_4/base/p/C1.java [new file with mode: 0644]
tests/multiIncremental/PR129163_4/inc1/p/A1.aj [new file with mode: 0644]
tests/multiIncremental/PR129163_4/inc1/p/C1.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/PR129163_2/base/tjp/Demo.java b/tests/multiIncremental/PR129163_2/base/tjp/Demo.java
new file mode 100644 (file)
index 0000000..64d249c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002.  All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted.  Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package tjp;
+
+public class Demo {
+    static Demo d;
+
+    public static void main(String[] args){
+        new Demo().go();
+    }
+
+    void go(){
+        d = new Demo();
+        d.foo(1,d);
+        System.out.println(d.bar(new Integer(3)));
+    }
+
+    void foo(int i, Object o){
+        System.out.println("Demo.foo(" + i + ", " + o + ")\n");
+    }
+
+    String bar (Integer j){
+        System.out.println("Demo.bar(" + j + ")\n");
+        return "Demo.bar(" + j  + ")";
+    }
+}
diff --git a/tests/multiIncremental/PR129163_2/base/tjp/GetInfo.aj b/tests/multiIncremental/PR129163_2/base/tjp/GetInfo.aj
new file mode 100644 (file)
index 0000000..0d38a37
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002.  All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted.  Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tjp;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+
+aspect GetInfo {
+
+   static final void println(String s){ System.out.println(s); }
+
+   pointcut goCut(): cflow(this(Demo) && execution(void go()));
+
+   pointcut demoExecs(): within(Demo) && execution(* *(..));
+
+   Object around(): demoExecs() && !execution(* go()) && goCut() {
+      println("Intercepted message: " +
+          thisJoinPointStaticPart.getSignature().getName());
+      println("in class: " +
+          thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+      printParameters(thisJoinPoint);
+      println("Running original method: \n" );
+      Object result = proceed();
+      println("  result: " + result );
+      return result;
+   }
+
+   static private void printParameters(JoinPoint jp) {
+      println("Arguments: " );
+      Object[] args = jp.getArgs();
+      String[] names = ((CodeSignature)jp.getSignature()).getParameterNames();
+      Class[] types = ((CodeSignature)jp.getSignature()).getParameterTypes();
+      for (int i = 0; i < args.length; i++) {
+         println("  "  + i + ". " + names[i] +
+             " : " +            types[i].getName() +
+             " = " +            args[i]);
+      }
+   }
+}
diff --git a/tests/multiIncremental/PR129163_2/inc1/tjp/Demo.java b/tests/multiIncremental/PR129163_2/inc1/tjp/Demo.java
new file mode 100644 (file)
index 0000000..b31b9e7
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+
+Copyright (c) Xerox Corporation 1998-2002.  All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted.  Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package tjp;
+
+public class Demo {
+    static Demo d;
+    /* blah blah blah */
+    public static void main(String[] args){
+        new Demo().go();
+    }
+
+    void go(){
+        d = new Demo();
+        d.foo(1,d);
+        System.out.println(d.bar(new Integer(3)));
+    }
+
+    void foo(int i, Object o){
+        System.out.println("Demo.foo(" + i + ", " + o + ")\n");
+    }
+
+    String bar (Integer j){
+        System.out.println("Demo.bar(" + j + ")\n");
+        return "Demo.bar(" + j  + ")";
+    }
+}
diff --git a/tests/multiIncremental/PR129163_2/inc1/tjp/GetInfo.aj b/tests/multiIncremental/PR129163_2/inc1/tjp/GetInfo.aj
new file mode 100644 (file)
index 0000000..0d38a37
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+Copyright (c) Xerox Corporation 1998-2002.  All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted.  Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tjp;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+
+aspect GetInfo {
+
+   static final void println(String s){ System.out.println(s); }
+
+   pointcut goCut(): cflow(this(Demo) && execution(void go()));
+
+   pointcut demoExecs(): within(Demo) && execution(* *(..));
+
+   Object around(): demoExecs() && !execution(* go()) && goCut() {
+      println("Intercepted message: " +
+          thisJoinPointStaticPart.getSignature().getName());
+      println("in class: " +
+          thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+      printParameters(thisJoinPoint);
+      println("Running original method: \n" );
+      Object result = proceed();
+      println("  result: " + result );
+      return result;
+   }
+
+   static private void printParameters(JoinPoint jp) {
+      println("Arguments: " );
+      Object[] args = jp.getArgs();
+      String[] names = ((CodeSignature)jp.getSignature()).getParameterNames();
+      Class[] types = ((CodeSignature)jp.getSignature()).getParameterTypes();
+      for (int i = 0; i < args.length; i++) {
+         println("  "  + i + ". " + names[i] +
+             " : " +            types[i].getName() +
+             " = " +            args[i]);
+      }
+   }
+}
diff --git a/tests/multiIncremental/PR129163_3/base/pack/C.java b/tests/multiIncremental/PR129163_3/base/pack/C.java
new file mode 100644 (file)
index 0000000..42f29a6
--- /dev/null
@@ -0,0 +1,7 @@
+package pack;
+import p.C1;
+public class C {
+       public void m() {
+               new C1().m1();
+       }
+}
diff --git a/tests/multiIncremental/PR129163_3/inc1/pack/C.java b/tests/multiIncremental/PR129163_3/inc1/pack/C.java
new file mode 100644 (file)
index 0000000..42f29a6
--- /dev/null
@@ -0,0 +1,7 @@
+package pack;
+import p.C1;
+public class C {
+       public void m() {
+               new C1().m1();
+       }
+}
diff --git a/tests/multiIncremental/PR129163_4/base/p/A1.aj b/tests/multiIncremental/PR129163_4/base/p/A1.aj
new file mode 100644 (file)
index 0000000..cabc414
--- /dev/null
@@ -0,0 +1,6 @@
+package p;
+
+public aspect A1 {
+
+       
+}
diff --git a/tests/multiIncremental/PR129163_4/base/p/C1.java b/tests/multiIncremental/PR129163_4/base/p/C1.java
new file mode 100644 (file)
index 0000000..26f2aea
--- /dev/null
@@ -0,0 +1,11 @@
+package p;
+
+public class C1 {
+       public void m1() {
+               
+       }
+
+       public void m2() {
+               
+       }
+}
diff --git a/tests/multiIncremental/PR129163_4/inc1/p/A1.aj b/tests/multiIncremental/PR129163_4/inc1/p/A1.aj
new file mode 100644 (file)
index 0000000..cabc414
--- /dev/null
@@ -0,0 +1,6 @@
+package p;
+
+public aspect A1 {
+
+       
+}
diff --git a/tests/multiIncremental/PR129163_4/inc1/p/C1.java b/tests/multiIncremental/PR129163_4/inc1/p/C1.java
new file mode 100644 (file)
index 0000000..bad0eaa
--- /dev/null
@@ -0,0 +1,11 @@
+package p;
+
+public class C1 {
+       public void m1() {
+               System.out.println("Hello");
+       }
+
+       public void m2() {
+               
+       }
+}
index 7e74e84aff309d93c7745e75c1cf05309d1674c9..f307df72b294968628578349013a6b6371d36078 100644 (file)
@@ -619,6 +619,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                }
        }
        
+       // test for comment #31 - NPE
        public void testPr129163() {
                configureBuildStructureModel(true);
                initialiseProject("PR129613");
@@ -634,6 +635,58 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                configureBuildStructureModel(false);
        }
        
+       // test for comment #0 - adding a comment to a class file shouldn't
+       // cause us to go back to source and recompile everything. To force this
+       // to behave like AJDT we need to include the aspect in 'inc1' so that
+       // when AjState looks at its timestamp it thinks the aspect has been modified. 
+       // The logic within CrosscuttingMembers should then work out correctly 
+       // that there haven't really been any changes within the aspect and so 
+       // we shouldn't go back to source.
+       public void testPr129163_2() {
+               // want to behave like AJDT
+               configureBuildStructureModel(true);
+               initialiseProject("pr129163_2");
+               build("pr129163_2");
+               checkWasFullBuild();
+               alter("pr129163_2","inc1");
+               build("pr129163_2");
+               checkWasntFullBuild(); // shouldn't be a full build because the 
+                                      // aspect hasn't changed
+               configureBuildStructureModel(false);
+       }
+       
+       // test for comment #6 - simulates AJDT core builder test testBug99133a -
+       // changing the contents of a method within a class shouldn't force a 
+       // full build of a dependant project. To force this to behave like AJDT
+       // 'inc1' of the dependant project should just be a copy of 'base' so that
+       // AjState thinks somethings changed within the dependant project and 
+       // we do a build. Similarly, 'inc1' of the project depended on should 
+       // include the aspect even though nothing's changed within it. This causes
+       // AjState to think that the aspect has changed. Together its then up to 
+       // logic within CrosscuttingMembers and various equals methods to decide
+       // correctly that we don't have to go back to source.
+       public void testPr129163_3() {
+               configureBuildStructureModel(true);
+               initialiseProject("PR129163_4");
+               build("PR129163_4");
+               checkWasFullBuild(); // should be a full build because initializing project
+               initialiseProject("PR129163_3");
+               configureNewProjectDependency("PR129163_3","PR129163_4");
+               build("PR129163_3");
+               checkWasFullBuild(); // should be a full build because initializing project
+               alter("PR129163_4","inc1");
+               build("PR129163_4");
+               checkWasntFullBuild(); // should be an incremental build because although
+                                      // "inc1" includes the aspect A1.aj, it actually hasn't
+                                                          // changed so we shouldn't go back to source
+               alter("PR129163_3","inc1");
+               build("PR129163_3");
+               checkWasntFullBuild(); // should be an incremental build because nothing has
+                                          // changed within the class and no aspects have changed
+                                      // within the running of the test
+               configureBuildStructureModel(false);
+       }
+       
        // other possible tests:
        // - memory usage (freemem calls?)
        // - relationship map