Author: sb
Date: Sat Dec  1 10:31:14 2007
New Revision: 6898

Log:
- Add tests.

Added:
    trunk/Workflow/tests/data/ParallelSplitSynchronization2.dot   (with props)
    trunk/Workflow/tests/data/ParallelSplitSynchronization2_1.xml   (with props)
    trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization2.log   
(with props)
Modified:
    trunk/Workflow/tests/case.php
    trunk/Workflow/tests/definition_xml_test.php
    trunk/Workflow/tests/execution_test.php
    trunk/Workflow/tests/visitor_visualization_test.php
    trunk/WorkflowDatabaseTiein/tests/execution_test.php
    trunk/WorkflowEventLogTiein/tests/listener_test.php

Modified: trunk/Workflow/tests/case.php
==============================================================================
--- trunk/Workflow/tests/case.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/case.php [iso-8859-1] Sat Dec  1 10:31:14 2007
@@ -295,6 +295,28 @@
         $synchronization->addInNode( $actionNodeA );
         $synchronization->addInNode( $actionNodeB );
         $synchronization->addInNode( $actionNodeC );
+
+        $this->startNode->addOutNode( $this->branchNode );
+        $this->endNode->addInNode( $synchronization );
+    }
+
+    protected function setUpParallelSplitSynchronization2()
+    {
+        $this->workflow = new ezcWorkflow( 'ParallelSplitSynchronization2' );
+        $this->setUpReferences();
+
+        $this->branchNode = new ezcWorkflowNodeParallelSplit;
+
+        $foo = new ezcWorkflowNodeInput( array( 'foo' => new 
ezcWorkflowConditionIsString ) );
+        $bar = new ezcWorkflowNodeInput( array( 'bar' => new 
ezcWorkflowConditionIsString ) );
+
+        $this->branchNode->addOutNode( $foo );
+        $this->branchNode->addOutNode( $bar );
+
+        $synchronization = new ezcWorkflowNodeSynchronization;
+
+        $synchronization->addInNode( $foo );
+        $synchronization->addInNode( $bar );
 
         $this->startNode->addOutNode( $this->branchNode );
         $this->endNode->addInNode( $synchronization );

Added: trunk/Workflow/tests/data/ParallelSplitSynchronization2.dot
==============================================================================
--- trunk/Workflow/tests/data/ParallelSplitSynchronization2.dot (added)
+++ trunk/Workflow/tests/data/ParallelSplitSynchronization2.dot [iso-8859-1] 
Sat Dec  1 10:31:14 2007
@@ -1,0 +1,15 @@
+digraph ParallelSplitSynchronization2 {
+node1 [label="Start"]
+node2 [label="Parallel Split"]
+node3 [label="Input"]
+node4 [label="Synchronization"]
+node5 [label="End"]
+node6 [label="Input"]
+
+node1 -> node2
+node2 -> node3
+node2 -> node6
+node3 -> node4
+node4 -> node5
+node6 -> node4
+}

Propchange: trunk/Workflow/tests/data/ParallelSplitSynchronization2.dot
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Workflow/tests/data/ParallelSplitSynchronization2_1.xml
==============================================================================
--- trunk/Workflow/tests/data/ParallelSplitSynchronization2_1.xml (added)
+++ trunk/Workflow/tests/data/ParallelSplitSynchronization2_1.xml [iso-8859-1] 
Sat Dec  1 10:31:14 2007
@@ -1,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow name="ParallelSplitSynchronization2" version="1">
+  <node id="1" type="Start">
+    <outNode id="2"/>
+  </node>
+  <node id="2" type="ParallelSplit">
+    <outNode id="3"/>
+    <outNode id="6"/>
+  </node>
+  <node id="3" type="Input">
+    <variable name="foo">
+      <condition type="IsString"/>
+    </variable>
+    <outNode id="4"/>
+  </node>
+  <node id="4" type="Synchronization">
+    <outNode id="5"/>
+  </node>
+  <node id="5" type="End"/>
+  <node id="6" type="Input">
+    <variable name="bar">
+      <condition type="IsString"/>
+    </variable>
+    <outNode id="4"/>
+  </node>
+</workflow>

Propchange: trunk/Workflow/tests/data/ParallelSplitSynchronization2_1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/Workflow/tests/definition_xml_test.php
==============================================================================
--- trunk/Workflow/tests/definition_xml_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/definition_xml_test.php [iso-8859-1] Sat Dec  1 
10:31:14 2007
@@ -141,6 +141,17 @@
         );
     }
 
+    public function testSaveParallelSplitSynchronization2()
+    {
+        $this->setUpParallelSplitSynchronization2();
+        $this->definition->save( $this->workflow );
+
+        $this->assertEquals(
+          $this->readExpected( 'ParallelSplitSynchronization2' ),
+          $this->readActual( 'ParallelSplitSynchronization2' )
+        );
+    }
+
     public function testSaveMultiChoiceSynchronizingMerge()
     {
         $this->setUpMultiChoice( 'SynchronizingMerge' );

Modified: trunk/Workflow/tests/execution_test.php
==============================================================================
--- trunk/Workflow/tests/execution_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/execution_test.php [iso-8859-1] Sat Dec  1 10:31:14 
2007
@@ -286,6 +286,18 @@
         $this->assertFalse( $this->execution->isSuspended() );
     }
 
+    public function testExecuteParallelSplitSynchronization2()
+    {
+        $this->setUpParallelSplitSynchronization2();
+        $this->execution->workflow = $this->workflow;
+        $this->execution->setVariables( array( 'foo' => 'bar', 'bar' => 'foo' 
) );
+        $this->execution->start();
+
+        $this->assertTrue( $this->execution->hasEnded() );
+        $this->assertFalse( $this->execution->isResumed() );
+        $this->assertFalse( $this->execution->isSuspended() );
+    }
+
     public function testExecuteParallelSplitInvalidSynchronization()
     {
         $this->setUpParallelSplitInvalidSynchronization();

Modified: trunk/Workflow/tests/visitor_visualization_test.php
==============================================================================
--- trunk/Workflow/tests/visitor_visualization_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/visitor_visualization_test.php [iso-8859-1] Sat Dec  1 
10:31:14 2007
@@ -139,6 +139,17 @@
         );
     }
 
+    public function testVisitParallelSplitSynchronization2()
+    {
+        $this->setUpParallelSplitSynchronization2();
+        $this->workflow->accept( $this->visitor );
+
+        $this->assertEquals(
+          $this->readExpected( 'ParallelSplitSynchronization2' ),
+          (string)$this->visitor
+        );
+    }
+
     public function testVisitExclusiveChoiceSimpleMerge()
     {
         $this->setUpExclusiveChoiceSimpleMerge();

Modified: trunk/WorkflowDatabaseTiein/tests/execution_test.php
==============================================================================
--- trunk/WorkflowDatabaseTiein/tests/execution_test.php [iso-8859-1] (original)
+++ trunk/WorkflowDatabaseTiein/tests/execution_test.php [iso-8859-1] Sat Dec  
1 10:31:14 2007
@@ -38,6 +38,33 @@
 
         $execution = new ezcWorkflowDatabaseExecution( $this->db, $id );
         $execution->resume( array( 'variable' => 'value' ) );
+        $this->assertTrue( $execution->hasEnded() );
+        $this->assertFalse( $execution->isResumed() );
+        $this->assertFalse( $execution->isSuspended() );
+    }
+
+    public function testParallelSplitSynchronization()
+    {
+        $this->setUpParallelSplitSynchronization2();
+        $this->definition->save( $this->workflow );
+
+        $execution = new ezcWorkflowDatabaseExecution( $this->db );
+        $execution->workflow = $this->workflow;
+
+        $id = $execution->start();
+        $this->assertNotNull( $id );
+        $this->assertFalse( $execution->hasEnded() );
+        $this->assertFalse( $execution->isResumed() );
+        $this->assertTrue( $execution->isSuspended() );
+
+        $execution = new ezcWorkflowDatabaseExecution( $this->db, $id );
+        $execution->resume( array( 'foo' => 'bar' ) );
+        $this->assertFalse( $execution->hasEnded() );
+        $this->assertFalse( $execution->isResumed() );
+        $this->assertTrue( $execution->isSuspended() );
+
+        $execution = new ezcWorkflowDatabaseExecution( $this->db, $id );
+        $execution->resume( array( 'bar' => 'foo' ) );
         $this->assertTrue( $execution->hasEnded() );
         $this->assertFalse( $execution->isResumed() );
         $this->assertFalse( $execution->isSuspended() );

Added: trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization2.log
==============================================================================
--- trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization2.log 
(added)
+++ trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization2.log 
[iso-8859-1] Sat Dec  1 10:31:14 2007
@@ -1,0 +1,26 @@
+MMM DD HH:MM:SS [Info] [default] [default] Started execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#1(ezcWorkflowNodeStart) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #0 (1 sibling(s)) 
for execution #1 of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#1(ezcWorkflowNodeStart) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #1 (2 sibling(s)) 
for execution #1 of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#3(ezcWorkflowNodeInput) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #2 (2 sibling(s)) 
for execution #1 of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#6(ezcWorkflowNodeInput) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#2(ezcWorkflowNodeParallelSplit) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Suspended execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "foo" to "bar" for 
execution #1 of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Resumed execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#4(ezcWorkflowNodeSynchronization) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#3(ezcWorkflowNodeInput) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Suspended execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "bar" to "foo" for 
execution #1 of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Resumed execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#6(ezcWorkflowNodeInput) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #1 for execution #1 
of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #2 for execution #1 
of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node 
#5(ezcWorkflowNodeEnd) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#4(ezcWorkflowNodeSynchronization) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node 
#5(ezcWorkflowNodeEnd) for instance #1 of workflow 
"ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #0 for execution #1 
of workflow "ParallelSplitSynchronization2" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Ended execution #1 of workflow 
"ParallelSplitSynchronization2" (version 1).

Propchange: 
trunk/WorkflowEventLogTiein/tests/data/ParallelSplitSynchronization2.log
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/WorkflowEventLogTiein/tests/listener_test.php
==============================================================================
--- trunk/WorkflowEventLogTiein/tests/listener_test.php [iso-8859-1] (original)
+++ trunk/WorkflowEventLogTiein/tests/listener_test.php [iso-8859-1] Sat Dec  1 
10:31:14 2007
@@ -144,6 +144,21 @@
         );
     }
 
+    public function testLogParallelSplitSynchronization2()
+    {
+        $this->setUpParallelSplitSynchronization2();
+        $this->definition->save( $this->workflow );
+        $this->execution->workflow = $this->workflow;
+        $this->execution->start();
+        $this->execution->resume( array( 'foo' => 'bar' ) );
+        $this->execution->resume( array( 'bar' => 'foo' ) );
+
+        $this->assertEquals(
+          $this->readExpected( 'ParallelSplitSynchronization2' ),
+          $this->readActual()
+        );
+    }
+
     public function testLogExclusiveChoiceSimpleMerge()
     {
         $this->setUpExclusiveChoiceSimpleMerge();


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to