* @author Tom Baeyens
*/
public class _03_BasicGraphExecutionText extends TestCase {
public void testBuildFirstProcessGraph() {
ProcessDefinition processDefinition = ProcessFactory.build()
.node("accept loan request").initial().behaviour(new WaitState())
.transition().to("loan evaluation")
.node("loan evaluation").behaviour(new WaitState())
.transition("approve").to("wire the money")
.transition("reject").to("end")
.node("wire the money").behaviour(new Display("automatic payment"))
.transition().to("end")
.node("end").behaviour(new WaitState())
.done();
Execution execution = processDefinition.startExecution();
assertEquals("accept loan request", execution.getNode().getName());
execution.signal();
assertEquals("loan evaluation", execution.getNode().getName());
execution.signal("approve");
assertEquals("end", execution.getNode().getName());
execution = processDefinition.startExecution();
assertEquals("accept loan request", execution.getNode().getName());
execution.signal();
assertEquals("loan evaluation", execution.getNode().getName());
execution.signal("reject");
assertEquals("end", execution.getNode().getName());