[jboss-user] [JBoss jBPM] - Re: fork and join childeren

tbeernot do-not-reply at jboss.com
Thu Nov 13 10:54:21 EST 2008


"salaboy21" wrote : First of all, great ASCII graphic!!
  | 

Ah well ;-)

I'm building up unit test to slow work jbpm into my application. This is the one where I'm trying out parallel flows. I have written the output as comment next to the println's.


  | 	/**
  | 	 */
  | 	@Test
  | 	public void test() 
  | 	{
  | 		// Declare a process with a fork
  | 		//       S
  | 		//       |
  | 		//       F
  | 		//      / \
  | 		//     s1 s2
  | 		//      \ /
  | 		//       J
  | 		//       |
  | 		//       E
  | 		ProcessDefinition lProcessDefinition = ProcessDefinition.parseXmlString(
  | 			"<process-definition>" +
  | 			"   <start-state name=\"start\">" + 
  | 			"		<transition to=\"fork1\"></transition>" + 
  | 			"	</start-state>" + 
  | 			"   <fork name=\"fork1\">" + 
  | 			"		<transition to=\"state1\"></transition>" + 
  | 			"		<transition to=\"state2\"></transition>" + 
  | 			"	</fork>" + 
  | 			"	<state name=\"state1\">" + 
  | 			"		<transition to=\"join1\"></transition>" + 
  | 			"	</state>" + 
  | 			"	<state name=\"state2\">" + 
  | 			"		<transition to=\"join1\"></transition>" + 
  | 			"	</state>" + 
  | 			"	<join name=\"join1\">" + 
  | 			"		<transition to=\"end\"></transition>" + 
  | 			"	</join>" + 
  | 			"   <end-state name=\"end\"></end-state>" +
  | 			"</process-definition>"
  | 		);
  | 		
  | 		// Start a process
  | 		ProcessInstance lProcessInstance = new ProcessInstance(lProcessDefinition);
  | 		
  | 		// Get the token
  | 		Token lToken = lProcessInstance.getRootToken();
  | 		System.out.println(lToken.getNode() + "/"  + lToken.getChildren()); // start
  | 		if (lToken.getChildren() != null) System.out.println( " -"  + ((Token)lToken.getChildren().get(lToken.getChildren().keySet().iterator().next())).getNode() );
  | 		
  | 		// Goto the next 
  | 		lToken.signal();
  | 		System.out.println(lToken.getNode() + "/"  + lToken.getChildren()); // fork1
  | 		if (lToken.getChildren() != null) System.out.println( " -"  + ((Token)lToken.getChildren().get(lToken.getChildren().keySet().iterator().next())).getNode() );
  | 
  | 		// Goto the next 
  | 		lToken.signal();
  | 		System.out.println(lToken.getNode() + "/"  + lToken.getChildren()); // state1
  | 		if (lToken.getChildren() != null) System.out.println( " -"  + ((Token)lToken.getChildren().get(lToken.getChildren().keySet().iterator().next())).getNode() );		
  | 		
  | 		//Goto the next 
  | 		lToken.signal();
  | 		System.out.println(lToken.getNode() + "/"  + lToken.getChildren()); // join1
  | 		if (lToken.getChildren() != null) System.out.println( " -"  + ((Token)lToken.getChildren().get(lToken.getChildren().keySet().iterator().next())).getNode() );		
  | 		
  | 		//Goto the next 
  | 		lToken.signal();
  | 		System.out.println(lToken.getNode() + "/"  + lToken.getChildren()); // end
  | 		if (lToken.getChildren() != null) System.out.println( " -"  + ((Token)lToken.getChildren().get(lToken.getChildren().keySet().iterator().next())).getNode() );		
  | 	}
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4189135#4189135

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4189135



More information about the jboss-user mailing list