krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test WorkFlowManagerTestCase.java,1.1,1.2 workflow.xconf,1.3,1.4
[email protected] Sat, 15 Mar 2003 10:44:40 -0800
Newsgroups
gmane.comp.krysalis.sandbox
Message-ID
<[email protected] >
Update of /cvsroot/metamorphosis/krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test
In directory sc8-pr-cvs1:/tmp/cvs-serv10961/workflow/src/test/org/krysalis/workflow/test
Modified Files:
WorkFlowManagerTestCase.java workflow.xconf
Log Message:
First tests of the event processing.
Index: WorkFlowManagerTestCase.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test/WorkFlowManagerTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WorkFlowManagerTestCase.java 14 Mar 2003 15:06:10 -0000 1.1
--- WorkFlowManagerTestCase.java 15 Mar 2003 18:44:38 -0000 1.2
***************
*** 35,41 ****
*
*/
! public void testWorkFlow()
{
WorkFlowManager workflow = null;
try
--- 35,42 ----
*
*/
! public void testInitialWorkFlowState()
{
WorkFlowManager workflow = null;
+ WorkFlowState state = null;
try
***************
*** 47,51 ****
String resource = "article/test1.xml";
! WorkFlowState state = workflow.lookup(resource);
assertNotNull("Test lookup of the workflow state", state);
--- 48,52 ----
String resource = "article/test1.xml";
! state = workflow.lookup(resource);
assertNotNull("Test lookup of the workflow state", state);
***************
*** 66,69 ****
--- 67,121 ----
workflow.release(state);
+ resource = "test3.xml";
+
+ state = workflow.lookup(resource);
+ assertNull("Test lookup of the workflow state", state);
+
+ }
+ catch (ComponentException ce)
+ {
+ getLogger().error("Could not retrieve component", ce);
+ fail("Could not retrieve component:"+ce.toString());
+ }
+ finally
+ {
+ if (state!=null)
+ workflow.release(state);
+ if (workflow!=null)
+ this.manager.release(workflow);
+ }
+ }
+
+ public void testProcessingEvents()
+ {
+ WorkFlowManager workflow = null;
+ WorkFlowState state = null;
+
+ try
+ {
+
+ workflow = (WorkFlowManager) this.manager.lookup(WorkFlowManager.ROLE);
+ assertNotNull("Test lookup of the workflow manager", workflow);
+
+ String resource = "article/test1.xml";
+
+ state = workflow.lookup(resource);
+ assertNotNull("Test lookup of the workflow state", state);
+ assertEquals("Test of the workflow state resource", resource,
+ state.getResource());
+ assertEquals("Test of the intial workflow state", "authoring",
+ state.getState());
+ workflow.release(state);
+
+
+ workflow.process(new DefaultWorkFlowEvent(resource, "post"));
+
+ state = workflow.lookup(resource);
+ assertNotNull("Test lookup of the workflow state", state);
+ assertEquals("Test of the workflow state resource", resource,
+ state.getResource());
+ assertEquals("Test of the intial workflow state", "proof-reading",
+ state.getState());
+ workflow.release(state);
}
catch (ComponentException ce)
***************
*** 74,77 ****
--- 126,131 ----
finally
{
+ if (state!=null)
+ workflow.release(state);
if (workflow!=null)
this.manager.release(workflow);
Index: workflow.xconf
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test/workflow.xconf,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** workflow.xconf 14 Mar 2003 15:06:11 -0000 1.3
--- workflow.xconf 15 Mar 2003 18:44:38 -0000 1.4
***************
*** 2,5 ****
--- 2,10 ----
<wf>
+ <actions>
+ <action name="log" class="org.krysalis.workflow.action.LogAction"
+ logger="workflow.standard-article"/>
+ </actions>
+
<stores default="memory">
<store name="memory" class="org.krysalis.workflow.store.MemoryStore"/>
***************
*** 9,31 ****
<workflow name="standard-article">
<state name="authoring">
! <transition ref="proof-reading"/>
</state>
<state name="proof-reading">
! <transition ref="authoring"/>
! <transition ref="ready-to-publish"/>
</state>
<state name="ready-to-publish">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
! <transition ref="live"/>
</state>
<state name="live">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
! <transition ref="archived"/>
</state>
<state name="archived">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
</state>
</workflow>
--- 14,58 ----
<workflow name="standard-article">
<state name="authoring">
! <transition ref="proof-reading" event="post">
! <action type="log" message="authoring -> proof-reading"/>
! </transition>
</state>
<state name="proof-reading">
! <transition ref="authoring" event="revert">
! <action type="log" message="proof-reading -> authoring"/>
! </transition>
! <transition ref="ready-to-publish" event="post">
! <action type="log" message="proof-reading -> ready-to-publish"/>
! </transition>
</state>
<state name="ready-to-publish">
! <transition ref="authoring" event="reset">
! <action type="log" message="ready-to-publish -> authoring"/>
! </transition>
! <transition ref="proof-reading" event="revert">
! <action type="log" message="ready-to-publish -> proof-reading"/>
! </transition>
! <transition ref="live" event="post">
! <action type="log" message="ready-to-publish -> live"/>
! </transition>
</state>
<state name="live">
! <transition ref="authoring" event="reset">
! <action type="log" message="live -> authoring"/>
! </transition>
! <transition ref="proof-reading" event="revert">
! <action type="log" message="live -> proof-reading"/>
! </transition>
! <transition ref="archived" event="archieve">
! <action type="log" message="live -> archived"/>
! </transition>
</state>
<state name="archived">
! <transition ref="authoring" event="reset">
! <action type="log" message="archived -> authoring"/>
! </transition>
! <transition ref="proof-reading" event="revert">
! <action type="log" message="archived -> proof-reading"/>
! </transition>
</state>
</workflow>
***************
*** 33,55 ****
<workflow name="headline">
<state name="authoring">
! <transition ref="proof-reading"/>
</state>
<state name="proof-reading">
! <transition ref="authoring"/>
! <transition ref="ready-to-publish"/>
</state>
<state name="ready-to-publish">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
! <transition ref="live"/>
</state>
<state name="live">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
! <transition ref="archived"/>
</state>
<state name="archived">
! <transition ref="authoring"/>
! <transition ref="proof-reading"/>
</state>
</workflow>
--- 60,82 ----
<workflow name="headline">
<state name="authoring">
! <transition ref="proof-reading" event="post"/>
</state>
<state name="proof-reading">
! <transition ref="authoring" event="revert"/>
! <transition ref="ready-to-publish" event="post"/>
</state>
<state name="ready-to-publish">
! <transition ref="authoring" event="reset"/>
! <transition ref="proof-reading" event="revert"/>
! <transition ref="live" event="post"/>
</state>
<state name="live">
! <transition ref="authoring" event="reset"/>
! <transition ref="proof-reading" event="revert"/>
! <transition ref="archived" event="archieve"/>
</state>
<state name="archived">
! <transition ref="authoring" event="reset"/>
! <transition ref="proof-reading" event="revert"/>
</state>
</workflow>
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en