public virtual void testPvmAutomatic() { PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("a").initial().behavior(new Automatic()).transition("b").endActivity().createActivity("b").behavior(new Automatic()).transition("c").endActivity().createActivity("c").behavior(new WaitState()).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = processDefinition.createProcessInstance(); processInstance.start(); assertNotNull(processInstance.findExecution("c")); }
/// <summary> /// +----+ /// +--->|end1| /// | +----+ /// | /// +-----+ +----+ /// |start|-->|fork| /// +-----+ +----+ /// | /// | +----+ /// +--->|end2| /// +----+ /// </summary> public virtual void testParallelEnd() { PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).transition("fork").endActivity().createActivity("fork").behavior(new ParallelGateway()).transition("end1").transition("end2").endActivity().createActivity("end1").behavior(new End()).endActivity().createActivity("end2").behavior(new End()).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = processDefinition.createProcessInstance(); processInstance.start(); assertTrue(processInstance.Ended); }
public virtual void testReusableSubProcess() { PvmProcessDefinition subProcessDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).transition("subEnd").endActivity().createActivity("subEnd").behavior(new End()).endActivity().buildProcessDefinition(); PvmProcessDefinition superProcessDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).transition("subprocess").endActivity().createActivity("subprocess").behavior(new ReusableSubProcess(subProcessDefinition)).transition("superEnd").endActivity().createActivity("superEnd").behavior(new End()).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = superProcessDefinition.createProcessInstance(); processInstance.start(); assertTrue(processInstance.Ended); }
/// <summary> /// +-------+ +-----+ /// | start |-->| end | /// +-------+ +-----+ /// </summary> public virtual void testSingleEnd() { ActivityInstanceVerification verifier = new ActivityInstanceVerification(); PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).transition("end").endActivity().createActivity("end").behavior(new End()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = processDefinition.createProcessInstance(); processInstance.start(); verifier.assertNonCompletingActivityInstance("start", 1); verifier.assertIsCompletingActivityInstance("end", 1); }
public virtual void testPvmDecision() { PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).transition("checkCredit").endActivity().createActivity("checkCredit").behavior(new Decision()).transition("askDaughterOut", "wow").transition("takeToGolf", "nice").transition("ignore", "default").endActivity().createActivity("takeToGolf").behavior(new WaitState()).endActivity().createActivity("askDaughterOut").behavior(new WaitState()).endActivity().createActivity("ignore").behavior(new WaitState()).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = processDefinition.createProcessInstance(); processInstance.setVariable("creditRating", "Aaa-"); processInstance.start(); assertNotNull(processInstance.findExecution("takeToGolf")); processInstance = processDefinition.createProcessInstance(); processInstance.setVariable("creditRating", "AAA+"); processInstance.start(); assertNotNull(processInstance.findExecution("askDaughterOut")); processInstance = processDefinition.createProcessInstance(); processInstance.setVariable("creditRating", "bb-"); processInstance.start(); assertNotNull(processInstance.findExecution("ignore")); }
/// <summary> /// +----------+ /// | userTask | /// | | /// +-----+ | | +------+ /// |start|-->| |--->| end1 | /// +-----+ | +-----+ | /// +-|timer|--+ /// +-----+ /// | +------+ /// +--------->| end2 | /// +------+ /// </summary> public virtual void testBoundaryEvent() { ActivityInstanceVerification verifier = new ActivityInstanceVerification(); PvmProcessDefinition processDefinition = (new ProcessDefinitionBuilder()).createActivity("start").initial().behavior(new Automatic()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).transition("userTask").endActivity().createActivity("userTask").scope().behavior(new EmbeddedSubProcess()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).transition("end1").endActivity().createActivity("timer").behavior(new WaitState()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).attachedTo("userTask", true).transition("end2").endActivity().createActivity("end1").behavior(new End()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).endActivity().createActivity("end2").behavior(new End()).executionListener([email protected]_Fields.EVENTNAME_END, verifier).endActivity().buildProcessDefinition(); PvmProcessInstance processInstance = processDefinition.createProcessInstance(); processInstance.start(); PvmExecution userTaskExecution = processInstance.findExecution("userTask"); ((PvmExecutionImpl)userTaskExecution).executeActivity(processDefinition.findActivity("timer")); PvmExecution timerExecution = processInstance.findExecution("timer"); timerExecution.signal(null, null); verifier.assertNonCompletingActivityInstance("start", 1); verifier.assertNonCompletingActivityInstance("userTask", 1); verifier.assertIsCompletingActivityInstance("end2", 1); }