commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r956973 - in /commons/sandbox/javaflow/trunk/src/test/java/org/apache/commons/javaflow/suite: SerializationTestCase.java VerificationTestCase.java
Date Tue, 22 Jun 2010 18:52:32 GMT
Author: tcurdt
Date: Tue Jun 22 18:52:31 2010
New Revision: 956973

URL: http://svn.apache.org/viewvc?rev=956973&view=rev
Log:
make sure test are execute from within the right classloader


Modified:
    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/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=956973&r1=956972&r2=956973&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 Jun 22 18:52:31 2010
@@ -23,8 +23,13 @@ public class SerializationTestCase exten
 
     private File output;
 
+    private boolean fromSuite() {
+        final String cl = this.getClass().getClassLoader().getClass().getName();
+        return cl.contains("ClassTransformerClassLoader");
+    }
 
     public void testSuspend() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleSerializable r = new SimpleSerializable();
         assertTrue(r.g == -1);
         assertTrue(r.l == -1);
@@ -82,6 +87,7 @@ public class SerializationTestCase exten
     }
     
     public void testResume() throws Exception {
+        assertTrue(fromSuite());        
         testSuspend();
         assertTrue("suspend must succeed to create the output first", output != null);
 
@@ -110,6 +116,7 @@ public class SerializationTestCase exten
 
 
     public void testSerializableCheck() throws Exception {
+        assertTrue(fromSuite());        
         final Runnable r1 = new Simple();
         Continuation c1 = Continuation.startWith(r1);
         assertTrue(c1 != null);

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=956973&r1=956972&r2=956973&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 Jun 22 18:52:31 2010
@@ -19,7 +19,13 @@ import org.apache.commons.javaflow.rewri
 
 public class VerificationTestCase extends TestCase {
 
-    public void testBlackRed2() {
+    private boolean fromSuite() {
+        final String cl = this.getClass().getClassLoader().getClass().getName();
+        return cl.contains("ClassTransformerClassLoader");
+    }
+    
+    public void testBlackRed2() {        
+        assertTrue(fromSuite());        
         final Runnable r = new BlackRed();
         final Continuation c1 = Continuation.startWith(r);
         assertTrue(c1 != null);
@@ -28,18 +34,21 @@ public class VerificationTestCase extend
     }
 
     public void testClassAccess1() throws Exception {
+        assertTrue(fromSuite());        
         final ClassAccess1 r = new ClassAccess1();
         final Continuation c = Continuation.startWith(r);
         assertTrue(c != null);
     }
     
     public void testClassAccess2() throws Exception {
+        assertTrue(fromSuite());        
         final ClassAccess2 r = new ClassAccess2();
         final Continuation c = Continuation.startWith(r);
         assertTrue(c != null);
     }
 
     public void testCounter() {
+        assertTrue(fromSuite());        
         final int count = 5;
         final Runnable r = new CounterFlow(count);
         int i = 0;
@@ -52,12 +61,14 @@ public class VerificationTestCase extend
     }
 
     public void testInvoker() {
+        assertTrue(fromSuite());        
         Runnable o = new DefaultConstructor();
         Continuation c = Continuation.startWith(o);
         assertTrue(c == null);
     }
 
     public void testInvoker2() {
+        assertTrue(fromSuite());        
         final Runnable r = new Simple();
         final Runnable o = new Invoker(r);
         final Continuation c = Continuation.startWith(o);
@@ -65,17 +76,20 @@ public class VerificationTestCase extend
     }
 
     public void testNewObject() throws Exception {
+        assertTrue(fromSuite());        
         final Runnable r = new NewObject();
         final Continuation c = Continuation.startWith(r);
         assertTrue(c == null);
     }
 
     public void testNoReference() throws Exception {
+        assertTrue(fromSuite());        
         final Runnable r = new NoReference();
         final Continuation c = Continuation.startWith(r);
         assertTrue(c != null);
     }
     public void testSimpleSuspendResume() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleSerializable r = new SimpleSerializable();
         assertTrue(r.g == -1);
         assertTrue(r.l == -1);
@@ -95,6 +109,7 @@ public class VerificationTestCase extend
 
 
     public void testContinuationBranching() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleSerializable r = new SimpleSerializable();
         assertTrue(r.g == -1);
         assertTrue(r.l == -1);
@@ -117,12 +132,14 @@ public class VerificationTestCase extend
     }
 
     public void testSimpleSuspend() throws Exception {
+        assertTrue(fromSuite());        
         final Simple r = new Simple();
         final Continuation c = Continuation.startWith(r);
         assertTrue(c != null);
     }
 
     public void testSimpleTryCatchWithoutException() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleTryCatch r = new SimpleTryCatch(false);
         Continuation c;
 
@@ -156,6 +173,7 @@ public class VerificationTestCase extend
     }
 
     public void testSimpleTryCatchWithException() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleTryCatch r = new SimpleTryCatch(true);
         Continuation c;
 
@@ -197,6 +215,7 @@ public class VerificationTestCase extend
     }
 
     public void testSimpleSynchronized() throws Exception {
+        assertTrue(fromSuite());        
         final SimpleSynchronized r = new SimpleSynchronized();
         Continuation c;
 
@@ -238,6 +257,7 @@ public class VerificationTestCase extend
     }
 
     public void testStack() throws Exception {
+        assertTrue(fromSuite());        
         final Runnable r = new Stack();
         final Continuation c = Continuation.startWith(r);
         assertNull(c); // does not have a suspend



Mime
View raw message