ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject [2/2] git commit: Testcase fix.
Date Thu, 15 Aug 2013 14:57:42 GMT
Testcase fix.


Project: http://git-wip-us.apache.org/repos/asf/ode-jacob/repo
Commit: http://git-wip-us.apache.org/repos/asf/ode-jacob/commit/4556e9bc
Tree: http://git-wip-us.apache.org/repos/asf/ode-jacob/tree/4556e9bc
Diff: http://git-wip-us.apache.org/repos/asf/ode-jacob/diff/4556e9bc

Branch: refs/heads/master
Commit: 4556e9bc97237c52c6e35106689b6d9cbc8cfc11
Parents: 0a14bc6
Author: Tammo van Lessen <vanto@apache.org>
Authored: Thu Aug 15 16:57:15 2013 +0200
Committer: Tammo van Lessen <vanto@apache.org>
Committed: Thu Aug 15 16:57:15 2013 +0200

----------------------------------------------------------------------
 .../ode/jacob/soup/jackson/JacksonSoupTest.java | 41 +++++++++++++++++++-
 1 file changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/4556e9bc/src/test/java/org/apache/ode/jacob/soup/jackson/JacksonSoupTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ode/jacob/soup/jackson/JacksonSoupTest.java b/src/test/java/org/apache/ode/jacob/soup/jackson/JacksonSoupTest.java
index 8a09f50..9b21b7c 100644
--- a/src/test/java/org/apache/ode/jacob/soup/jackson/JacksonSoupTest.java
+++ b/src/test/java/org/apache/ode/jacob/soup/jackson/JacksonSoupTest.java
@@ -27,6 +27,7 @@ import org.apache.ode.jacob.soup.jackson.JacobModule;
 import org.apache.ode.jacob.vpu.JacobVPU;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -76,7 +77,8 @@ public class JacksonSoupTest {
      * @throws Exception
      */
     @Test
-    public void testSimpleHelloWorldSerialize() throws Exception {
+    @Ignore("ignore this test until soup structure is stable")
+    public void testSimpleHelloWorldSerializeAndTestAgainstFixtures() throws Exception {
         JacobVPU vpu = new JacobVPU();
         vpu.setContext(queue);
         vpu.inject(new HelloWorld() {
@@ -103,7 +105,8 @@ public class JacksonSoupTest {
      * @throws Exception
      */
     @Test
-    public void testSimpleHelloWorldDeserialize() throws Exception {
+    @Ignore("ignore this test until soup structure is stable")
+    public void testSimpleHelloWorldDeserializeFromFixtures() throws Exception {
         JacobVPU vpu = new JacobVPU();
         
         for (String state : fixtures) {
@@ -116,6 +119,40 @@ public class JacksonSoupTest {
             // sum of pre-loaded & then-completed steps is always 8.
             Assert.assertEquals(8, i + fixtures.indexOf(state));
         }
+    }
+    
+    @Test
+    public void testSimpleHelloWorldSerializeAndDeserialize() throws Exception {
+        List<String> states = new ArrayList<String>();
+        
+        JacobVPU vpu = new JacobVPU();
+        vpu.setContext(queue);
+        vpu.inject(new HelloWorld() {
+            @Override
+            public void run() {
+                simpleHelloWorld();
+            }
+        });
         
+        int i = 0;
+        while (vpu.execute()) {
+            String ser = mapper.writeValueAsString(queue);
+            states.add(ser);
+            i++;
+        }
+        Assert.assertEquals(9, i);
+        
+        // deserialize
+        for (String state : states) {
+            vpu.setContext(mapper.readValue(state, JacksonExecutionQueueImpl.class));
+            i = 0;
+            while (vpu.execute()) {
+                i++;
+            }
+            
+            // sum of pre-loaded & then-completed steps is always 8.
+            Assert.assertEquals(8, i + states.indexOf(state));
+        }
     }
+
 }


Mime
View raw message