Author: mattmann
Date: Sun Apr 29 03:44:02 2012
New Revision: 1331867

URL: http://svn.apache.org/viewvc?rev=1331867&view=rev
Log:
- fix for OODT-421: Make WorkflowLifecycleManager understand WorkflowStates

Modified:
    oodt/trunk/CHANGES.txt
    
oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/lifecycle/TestWorkflowLifecycleManager.java

Modified: oodt/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1331867&r1=1331866&r2=1331867&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sun Apr 29 03:44:02 2012
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.4: Current Development
 --------------------------------------------
 
+* OODT-421 Make WorkflowLifecycleManager understand 
+  WorkflowStates (mattmann)
+
 * OODT-440 Replace legacy getMetadata("UUID") calls with 
   getMetadata("CAS." + CoreMetKeys.PRODUCT_ID) (thomas)
 

Modified: 
oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/lifecycle/TestWorkflowLifecycleManager.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/lifecycle/TestWorkflowLifecycleManager.java?rev=1331867&r1=1331866&r2=1331867&view=diff
==============================================================================
--- 
oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/lifecycle/TestWorkflowLifecycleManager.java
 (original)
+++ 
oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/lifecycle/TestWorkflowLifecycleManager.java
 Sun Apr 29 03:44:02 2012
@@ -39,7 +39,7 @@ public class TestWorkflowLifecycleManage
   public void testStages() {
     assertNotNull(this.lifecycle.getDefaultLifecycle());
     assertNotNull(this.lifecycle.getDefaultLifecycle().getStages());
-    assertEquals(this.lifecycle.getDefaultLifecycle().getStages().size(), 5);
+    assertEquals(this.lifecycle.getDefaultLifecycle().getStages().size(), 7);
   }
 
   public void readNewStateFormat() {
@@ -64,8 +64,34 @@ public class TestWorkflowLifecycleManage
     assertTrue(gotNull && gotLoaded);
   }
 
-  public void XreadOldStateFormat() {
-    assertTrue(false); // TODO: add test to verify back compat
+  public void readOldStateFormat() throws InstantiationException {
+    this.lifecycle = new WorkflowLifecycleManager("./src/main/resources"
+        + "/examples/workflow-lifecycle.xml");
+    assertNotNull(this.lifecycle);
+    assertNotNull(this.lifecycle.getDefaultLifecycle());
+    assertNotNull(this.lifecycle.getDefaultLifecycle().getStages());
+    assertEquals(this.lifecycle.getDefaultLifecycle().getStages().size(), 5);
+    assertNotNull(this.lifecycle.getDefaultLifecycle().getCategoryByName(
+        "workflow_start"));
+    assertNotNull(this.lifecycle.getDefaultLifecycle()
+        .getCategoryByName("workflow_start").getStates());
+    assertEquals(
+        this.lifecycle.getDefaultLifecycle()
+            .getCategoryByName("workflow_start").getStates().size(), 2);
+    boolean gotRsubmit = false, gotStarted = false;
+
+    for (WorkflowState state : this.lifecycle.getDefaultLifecycle()
+        .getCategoryByName("workflow_start").getStates()) {
+      if (state.getName().equals("RSUBMIT")) {
+        gotRsubmit = true;
+      }
+
+      if (state.getName().equals("STARTED")) {
+        gotStarted = true;
+      }
+    }
+
+    assertTrue(gotRsubmit && gotStarted);
   }
 
   /*


Reply via email to