You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tc...@apache.org on 2010/01/06 00:16:04 UTC

svn commit: r896264 - in /commons/sandbox/javaflow/trunk: ./ src/test/java/org/apache/commons/javaflow/ src/test/java/org/apache/commons/javaflow/rewrite/ src/test/java/org/apache/commons/javaflow/suite/

Author: tcurdt
Date: Tue Jan  5 23:15:46 2010
New Revision: 896264

URL: http://svn.apache.org/viewvc?rev=896264&view=rev
Log:
Fixed some testcases. All ASM test are green now. Only a few BCEL ones still broken (but BCEL is depracted anyway),
Activated the tests in the POM but maven still refuses to run the test suites properly.
Updated the TODO,


Modified:
    commons/sandbox/javaflow/trunk/.project
    commons/sandbox/javaflow/trunk/TODO.txt
    commons/sandbox/javaflow/trunk/pom.xml
    commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/AsmTestSuite.java
    commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/BcelTestSuite.java
    commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/rewrite/RewriteBugs.java
    commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/SerializationTestCase.java
    commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/VerificationTestCase.java

Modified: commons/sandbox/javaflow/trunk/.project
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/.project?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/.project (original)
+++ commons/sandbox/javaflow/trunk/.project Tue Jan  5 23:15:46 2010
@@ -19,10 +19,15 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
 	</natures>
 </projectDescription>

Modified: commons/sandbox/javaflow/trunk/TODO.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/TODO.txt?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/TODO.txt (original)
+++ commons/sandbox/javaflow/trunk/TODO.txt Tue Jan  5 23:15:46 2010
@@ -1,33 +1,11 @@
-In no particular order:
-
-o integrate just4log into the build system
+Must:
 o testcases!!!!
 o documentation of the rewriting process
-o fix rewriting bugs/limitations:
-  o fix unintialized objects for method/constructor calls
-  o inner classes
-  o try/catch/finally
-  o synchronized(obj)
-  o accessing .class
-  o new Object() without assignment
-o only wrap the function calls
-  that may lead to a suspend (control
-  flow analysis) requires 2-pass
-  analysing/rewriting
-o maybe: evaluate making the Stack class use a hierarchical
-  approach to support differential continuations
-o maybe: asm implementation instead of BCEL
-
-o BCEL
-  o commit bug fixes in BCEL
-
-   http://issues.apache.org/bugzilla/show_bug.cgi?id=27646
-   http://issues.apache.org/bugzilla/show_bug.cgi?id=27854
-   http://issues.apache.org/bugzilla/show_bug.cgi?id=27855
-
-  o get rid of the static repository approach
-   http://issues.apache.org/bugzilla/show_bug.cgi?id=38057
+o fix the maven build so the test suites run properly (some classloader issues)
 
+Maybe:
+o integrate just4log into the build system
+o only wrap the function calls that may lead to a suspend (control flow analysis) requires 2-pass analysing/rewriting
+o evaluate making the Stack class use a hierarchical approach to support differential continuations
 o talk to the RIFE guys about joining forces
-o talk to the aspectwerkz and aspectj folks
-  about working together
+o talk to the aspectwerkz and aspectj folks about working together

Modified: commons/sandbox/javaflow/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/pom.xml?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/pom.xml (original)
+++ commons/sandbox/javaflow/trunk/pom.xml Tue Jan  5 23:15:46 2010
@@ -104,12 +104,12 @@
     <dependency>
       <groupId>org.apache.ant</groupId>
       <artifactId>ant</artifactId>
-      <version>1.7.0</version>
+      <version>1.7.1</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.1</version>
+      <version>3.8.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -127,33 +127,20 @@
 
   <build>
     <plugins>
-
       <plugin>     
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <forkMode>never</forkMode>
           <includes>
-            <include>**/*TestCase.java</include>
+            <include>**/*TestSuite.java</include>
           </includes>
           <excludes>
             <exclude>**/Abstract*</exclude>
           </excludes>
           <testFailureIgnore>true</testFailureIgnore>
-          <!-- <skip>true</skip> -->
         </configuration>
       </plugin>
-
     </plugins>
-
-<!--
-    <extensions>
-      <extension>
-        <groupId>org.apache.maven.wagon</groupId>
-        <artifactId>wagon-ssh-external</artifactId>
-        <version>1.0-alpha-2</version>
-      </extension>
-    </extensions>
--->
   </build>
 
 </project>

Modified: commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/AsmTestSuite.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/AsmTestSuite.java?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/AsmTestSuite.java (original)
+++ commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/AsmTestSuite.java Tue Jan  5 23:15:46 2010
@@ -10,7 +10,6 @@
 import org.apache.commons.javaflow.rewrite.ClassAccess2;
 import org.apache.commons.javaflow.rewrite.CounterFlow;
 import org.apache.commons.javaflow.rewrite.DefaultConstructor;
-import org.apache.commons.javaflow.rewrite.Invoker;
 import org.apache.commons.javaflow.rewrite.NewObject;
 import org.apache.commons.javaflow.rewrite.NoReference;
 import org.apache.commons.javaflow.rewrite.RewriteBugs;
@@ -24,7 +23,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.impl.SimpleLog;
 
-public class AsmTestSuite {
+public class AsmTestSuite extends TestSuite {
 
 	public static Test suite() throws Exception {
 
@@ -41,7 +40,6 @@
             			CounterFlow.class,
             			DefaultConstructor.class,
             			Simple.class,
-            			Invoker.class,
             			NewObject.class,
             			NoReference.class,
             			SimpleSerializable.class,

Modified: commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/BcelTestSuite.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/BcelTestSuite.java?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/BcelTestSuite.java (original)
+++ commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/BcelTestSuite.java Tue Jan  5 23:15:46 2010
@@ -10,7 +10,6 @@
 import org.apache.commons.javaflow.rewrite.ClassAccess2;
 import org.apache.commons.javaflow.rewrite.CounterFlow;
 import org.apache.commons.javaflow.rewrite.DefaultConstructor;
-import org.apache.commons.javaflow.rewrite.Invoker;
 import org.apache.commons.javaflow.rewrite.NewObject;
 import org.apache.commons.javaflow.rewrite.NoReference;
 import org.apache.commons.javaflow.rewrite.RewriteBugs;
@@ -22,7 +21,7 @@
 import org.apache.commons.javaflow.suite.SerializationTestCase;
 import org.apache.commons.javaflow.suite.VerificationTestCase;
 
-public class BcelTestSuite {
+public class BcelTestSuite extends TestSuite {
 
 	public static Test suite() throws Exception {
 
@@ -36,7 +35,6 @@
             			CounterFlow.class,
             			DefaultConstructor.class,
             			Simple.class,
-            			Invoker.class,
             			NewObject.class,
             			NoReference.class,
             			SimpleSerializable.class,

Modified: commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/rewrite/RewriteBugs.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/rewrite/RewriteBugs.java?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/rewrite/RewriteBugs.java (original)
+++ commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/rewrite/RewriteBugs.java Tue Jan  5 23:15:46 2010
@@ -10,8 +10,11 @@
 import java.util.List;
 import java.util.Map;
 
-public class RewriteBugs
-{
+public final class RewriteBugs implements Runnable {
+
+    public void run() {
+        RewriteBugs.calculateCartesianProduct(new String[]{"a","b"}, new Object[]{"1","2"});
+    }
 
 	/**
 	 * 

Modified: commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/SerializationTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/SerializationTestCase.java?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/SerializationTestCase.java (original)
+++ commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/SerializationTestCase.java Tue Jan  5 23:15:46 2010
@@ -124,5 +124,8 @@
         Continuation c3 = Continuation.startWith(new Invoker(r3));
         assertTrue(c3 != null);
         assertTrue(c3.isSerializable());
+        // the invoker should not appear on the stack as it should not be instrumented
+        // and by that not hinder serialization (in cocoon the continuation is always called
+        // through such an invoker)
     }
 }

Modified: commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/VerificationTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/VerificationTestCase.java?rev=896264&r1=896263&r2=896264&view=diff
==============================================================================
--- commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/VerificationTestCase.java (original)
+++ commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite/VerificationTestCase.java Tue Jan  5 23:15:46 2010
@@ -11,7 +11,6 @@
 import org.apache.commons.javaflow.rewrite.Invoker;
 import org.apache.commons.javaflow.rewrite.NewObject;
 import org.apache.commons.javaflow.rewrite.NoReference;
-import org.apache.commons.javaflow.rewrite.RewriteBugs;
 import org.apache.commons.javaflow.rewrite.Simple;
 import org.apache.commons.javaflow.rewrite.SimpleSerializable;
 import org.apache.commons.javaflow.rewrite.SimpleSynchronized;
@@ -117,10 +116,6 @@
         assertTrue(r.l == 2);
     }
 
-    public void testASMRewriteBug() throws Exception {
-        //final RewriteBugs r = new RewriteBugs();
-        RewriteBugs.calculateCartesianProduct(new String[]{"a","b"}, new Object[]{"1","2"});
-    }
     public void testSimpleSuspend() throws Exception {
         final Simple r = new Simple();
         final Continuation c = Continuation.startWith(r);
@@ -131,8 +126,8 @@
         final SimpleTryCatch r = new SimpleTryCatch(false);
         Continuation c;
 
-        c = Continuation.startWith(r);
-        assertTrue(c != null);
+        c = Continuation.startWith(r); // suspend within the try/catch
+        assertTrue(c != null); 
         assertTrue(r.a);
         assertFalse(r.b);
         assertFalse(r.c);
@@ -140,8 +135,8 @@
         assertFalse(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
-        assertTrue(c == null);
+        c = Continuation.continueWith(c); // continue without exception and end in finally
+        assertTrue(c != null);
         assertTrue(r.a);
         assertTrue(r.b);
         assertFalse(r.c);
@@ -149,31 +144,22 @@
         assertTrue(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
-        assertTrue(c != null);
-        assertTrue(r.a);
-        assertFalse(r.b);
-        assertTrue(r.c);
-        assertTrue(r.d);
-        assertTrue(r.e);
-        assertFalse(r.f);    
-
-
-        c = Continuation.continueWith(c);
+        c = Continuation.continueWith(c); // continue within the finally and end in return
         assertTrue(c == null);
         assertTrue(r.a);
-        assertFalse(r.b);
-        assertTrue(r.c);
-        assertTrue(r.d);
+        assertTrue(r.b);
+        assertFalse(r.c);
+        assertFalse(r.d);
         assertTrue(r.e);
         assertTrue(r.f);    
+
     }
 
     public void testSimpleTryCatchWithException() throws Exception {
         final SimpleTryCatch r = new SimpleTryCatch(true);
         Continuation c;
 
-        c = Continuation.startWith(r);
+        c = Continuation.startWith(r); // suspend in the try/catch
         assertTrue(c != null);
         assertTrue(r.a);
         assertFalse(r.b);
@@ -182,7 +168,7 @@
         assertFalse(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
+        c = Continuation.continueWith(c); // exception jumps into exception block and suspends
         assertTrue(c != null);
         assertTrue(r.a);
         assertFalse(r.b);
@@ -191,12 +177,21 @@
         assertFalse(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
+        c = Continuation.continueWith(c); // continue in the exception block and then suspends in finally
         assertTrue(c != null);
         assertTrue(r.a);
-        assertTrue(r.b);
-        assertFalse(r.c);
-        assertFalse(r.d);
+        assertFalse(r.b);
+        assertTrue(r.c);
+        assertTrue(r.d);
+        assertTrue(r.e);
+        assertFalse(r.f);    
+
+        c = Continuation.continueWith(c); // continue in finally
+        assertTrue(c == null);
+        assertTrue(r.a);
+        assertFalse(r.b);
+        assertTrue(r.c);
+        assertTrue(r.d);
         assertTrue(r.e);
         assertTrue(r.f);    
     }
@@ -205,7 +200,7 @@
         final SimpleSynchronized r = new SimpleSynchronized();
         Continuation c;
 
-        c = Continuation.startWith(r);
+        c = Continuation.startWith(r); // suspend right away
         assertTrue(c != null);
         assertTrue(r.a);
         assertFalse(r.b);
@@ -214,8 +209,8 @@
         assertFalse(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
-        assertTrue(c == null);
+        c = Continuation.continueWith(c); // resume and run into synchronized block where we suspend again
+        assertTrue(c != null);
         assertTrue(r.a);
         assertTrue(r.b);
         assertTrue(r.c);
@@ -223,7 +218,7 @@
         assertFalse(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
+        c = Continuation.continueWith(c); // continue inside the synchronized block and suspend after
         assertTrue(c != null);
         assertTrue(r.a);
         assertTrue(r.b);
@@ -232,8 +227,8 @@
         assertTrue(r.e);
         assertFalse(r.f);
 
-        c = Continuation.continueWith(c);
-        assertTrue(c != null);
+        c = Continuation.continueWith(c); // resume and then return
+        assertTrue(c == null);
         assertTrue(r.a);
         assertTrue(r.b);
         assertTrue(r.c);
@@ -245,7 +240,7 @@
     public void testStack() throws Exception {
         final Runnable r = new Stack();
         final Continuation c = Continuation.startWith(r);
-        assertNotNull(c);
+        assertNull(c); // does not have a suspend
     }
 
 }