Author: sb
Date: Tue Jul 31 08:56:44 2007
New Revision: 5760
Log:
- Add tests for mixing conditional and unconditional outgoing nodes.
Added:
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.dot
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge_1.xml
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.log
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2.log
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/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] Tue Jul 31 08:56:44 2007
@@ -285,6 +285,53 @@
$simpleMerge->addInNode( $actionNodeA );
$simpleMerge->addInNode( $actionNodeB );
+
+ $this->startNode->addOutNode( $this->branchNode );
+ $this->endNode->addInNode( $simpleMerge );
+ }
+
+ protected function
setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->workflow = new ezcWorkflow(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' );
+ $this->setUpReferences();
+
+ $setX = new ezcWorkflowNodeVariableSet(
+ array( 'x' => true )
+ );
+
+ $setY = new ezcWorkflowNodeVariableSet(
+ array( 'y' => true )
+ );
+
+ $setZ = new ezcWorkflowNodeVariableSet(
+ array( 'z' => true )
+ );
+
+ $this->branchNode = new ezcWorkflowNodeExclusiveChoice;
+
+ $this->branchNode->addConditionalOutNode(
+ new ezcWorkflowConditionVariable(
+ 'condition',
+ new ezcWorkflowConditionIsTrue
+ ),
+ $setX
+ );
+
+ $this->branchNode->addConditionalOutNode(
+ new ezcWorkflowConditionVariable(
+ 'condition',
+ new ezcWorkflowConditionIsFalse
+ ),
+ $setY
+ );
+
+ $this->branchNode->addOutNode( $setZ );
+
+ $simpleMerge = new ezcWorkflowNodeSimpleMerge;
+
+ $simpleMerge->addInNode( $setX )
+ ->addInNode( $setY )
+ ->addInNode( $setZ );
$this->startNode->addOutNode( $this->branchNode );
$this->endNode->addInNode( $simpleMerge );
Added:
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.dot
==============================================================================
---
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.dot
(added)
+++
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.dot
[iso-8859-1] Tue Jul 31 08:56:44 2007
@@ -1,0 +1,18 @@
+digraph ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge {
+node1 [label="Start"]
+node2 [label="Exclusive Choice"]
+node3 [label="x = <true>"]
+node4 [label="Simple Merge"]
+node5 [label="End"]
+node6 [label="y = <true>"]
+node7 [label="z = <true>"]
+
+node1 -> node2
+node2 -> node3 [label="condition is true"]
+node2 -> node6 [label="condition is false"]
+node2 -> node7
+node3 -> node4
+node4 -> node5
+node6 -> node4
+node7 -> node4
+}
Added:
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge_1.xml
==============================================================================
---
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge_1.xml
(added)
+++
trunk/Workflow/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge_1.xml
[iso-8859-1] Tue Jul 31 08:56:44 2007
@@ -1,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow name="ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge"
version="1">
+ <node id="1" type="Start">
+ <outNode id="2"/>
+ </node>
+ <node id="2" type="ExclusiveChoice">
+ <condition type="Variable" name="condition">
+ <condition type="IsTrue"/>
+ <outNode id="3"/>
+ </condition>
+ <condition type="Variable" name="condition">
+ <condition type="IsFalse"/>
+ <outNode id="6"/>
+ </condition>
+ <outNode id="7"/>
+ </node>
+ <node id="3" type="VariableSet">
+ <variable name="x">
+ <boolean>true</boolean>
+ </variable>
+ <outNode id="4"/>
+ </node>
+ <node id="4" type="SimpleMerge">
+ <outNode id="5"/>
+ </node>
+ <node id="5" type="End"/>
+ <node id="6" type="VariableSet">
+ <variable name="y">
+ <boolean>true</boolean>
+ </variable>
+ <outNode id="4"/>
+ </node>
+ <node id="7" type="VariableSet">
+ <variable name="z">
+ <boolean>true</boolean>
+ </variable>
+ <outNode id="4"/>
+ </node>
+</workflow>
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] Tue Jul 31
08:56:44 2007
@@ -163,6 +163,17 @@
);
}
+ public function
testSaveExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->definition->save( $this->workflow );
+
+ $this->assertEquals(
+ $this->readExpected(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' ),
+ $this->readActual(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' )
+ );
+ }
+
public function testSaveNestedExclusiveChoiceSimpleMerge()
{
$this->setUpNestedExclusiveChoiceSimpleMerge();
@@ -326,6 +337,19 @@
$this->assertEquals(
$this->readExpected( 'ExclusiveChoiceSimpleMerge' ),
$this->readActual( 'ExclusiveChoiceSimpleMerge' )
+ );
+ }
+
+ public function
testLoadExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->markTestIncomplete();
+
+ $this->workflow = $this->definition->loadByName(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' );
+ $this->definition->save( $this->workflow );
+
+ $this->assertEquals(
+ $this->readExpected(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' ),
+ $this->readActual(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' )
);
}
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] Tue Jul 31 08:56:44
2007
@@ -336,6 +336,36 @@
$this->assertFalse( $this->execution->isSuspended() );
}
+ public function testExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->execution->workflow = $this->workflow;
+ $this->execution->setVariables( array( 'condition' => false ) );
+ $this->execution->start();
+
+ $this->assertTrue( $this->execution->hasEnded() );
+ $this->assertFalse( $this->execution->isResumed() );
+ $this->assertFalse( $this->execution->isSuspended() );
+
+ $this->assertTrue( $this->execution->getVariable( 'y' ) );
+ $this->assertTrue( $this->execution->getVariable( 'z' ) );
+ }
+
+ public function testExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->execution->workflow = $this->workflow;
+ $this->execution->setVariables( array( 'condition' => true ) );
+ $this->execution->start();
+
+ $this->assertTrue( $this->execution->hasEnded() );
+ $this->assertFalse( $this->execution->isResumed() );
+ $this->assertFalse( $this->execution->isSuspended() );
+
+ $this->assertTrue( $this->execution->getVariable( 'x' ) );
+ $this->assertTrue( $this->execution->getVariable( 'z' ) );
+ }
+
public function testExecuteNestedExclusiveChoiceSimpleMerge()
{
$this->setUpNestedExclusiveChoiceSimpleMerge();
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] Tue Jul 31
08:56:44 2007
@@ -139,6 +139,17 @@
);
}
+ public function
testVisitExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->workflow->accept( $this->visitor );
+
+ $this->assertEquals(
+ $this->readExpected(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' ),
+ (string)$this->visitor
+ );
+ }
+
public function testVisitNestedExclusiveChoiceSimpleMerge()
{
$this->setUpNestedExclusiveChoiceSimpleMerge();
Added:
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.log
==============================================================================
---
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.log
(added)
+++
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge.log
[iso-8859-1] Tue Jul 31 08:56:44 2007
@@ -1,0 +1,22 @@
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "condition" to
"<false>" for execution #0 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Started execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#1(ezcWorkflowNodeStart) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #0 (1 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#2(ezcWorkflowNodeExclusiveChoice) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#1(ezcWorkflowNodeStart) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #1 (2 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#6(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #2 (2 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#7(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#2(ezcWorkflowNodeExclusiveChoice) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "y" to "<true>" for
execution #1 of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge"
(version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#4(ezcWorkflowNodeSimpleMerge) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#6(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "z" to "<true>" for
execution #1 of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge"
(version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#7(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #1 for execution #1
of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#5(ezcWorkflowNodeEnd) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#4(ezcWorkflowNodeSimpleMerge) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#5(ezcWorkflowNodeEnd) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #0 for execution #1
of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Ended execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
Added:
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2.log
==============================================================================
---
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2.log
(added)
+++
trunk/WorkflowEventLogTiein/tests/data/ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2.log
[iso-8859-1] Tue Jul 31 08:56:44 2007
@@ -1,0 +1,22 @@
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "condition" to
"<true>" for execution #0 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Started execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#1(ezcWorkflowNodeStart) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #0 (1 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#2(ezcWorkflowNodeExclusiveChoice) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#1(ezcWorkflowNodeStart) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #1 (2 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#3(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Started thread #2 (2 sibling(s))
for execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#7(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#2(ezcWorkflowNodeExclusiveChoice) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "x" to "<true>" for
execution #1 of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge"
(version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#4(ezcWorkflowNodeSimpleMerge) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#3(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Set variable "z" to "<true>" for
execution #1 of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge"
(version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#7(ezcWorkflowNodeVariableSet) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #1 for execution #1
of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Activated node
#5(ezcWorkflowNodeEnd) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#4(ezcWorkflowNodeSimpleMerge) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Executed node
#5(ezcWorkflowNodeEnd) for instance #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Debug] [default] [default] Ended thread #0 for execution #1
of workflow "ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
+MMM DD HH:MM:SS [Info] [default] [default] Ended execution #1 of workflow
"ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge" (version 1).
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] Tue Jul 31
08:56:44 2007
@@ -172,6 +172,34 @@
);
}
+ public function testLogExclusiveChoiceWithUnconditionalOutNodeSimpleMerge()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->definition->save( $this->workflow );
+ $this->execution->workflow = $this->workflow;
+ $this->execution->setVariables( array( 'condition' => false ) );
+ $this->execution->start();
+
+ $this->assertEquals(
+ $this->readExpected(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' ),
+ $this->readActual()
+ );
+ }
+
+ public function
testLogExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2()
+ {
+ $this->setUpExclusiveChoiceWithUnconditionalOutNodeSimpleMerge();
+ $this->definition->save( $this->workflow );
+ $this->execution->workflow = $this->workflow;
+ $this->execution->setVariables( array( 'condition' => true ) );
+ $this->execution->start();
+
+ $this->assertEquals(
+ $this->readExpected(
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge2' ),
+ $this->readActual()
+ );
+ }
+
public function testLogNestedExclusiveChoiceSimpleMerge()
{
$this->setUpNestedExclusiveChoiceSimpleMerge();
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components