use of org.jbpm.ruleflow.core.RuleFlowProcess in project jbpm by kiegroup.
the class MapPersistenceTest method processWithNotNullStartDateTest.
@Test
public void processWithNotNullStartDateTest() {
String processId = "signalProcessTest";
String eventType = "myEvent";
RuleFlowProcess process = ProcessCreatorForHelp.newSimpleEventProcess(processId, eventType);
KieBase kbase = createKieBase(process);
StatefulKnowledgeSession crmPersistentSession = createSession(kbase);
RuleFlowProcessInstance processInstance = (RuleFlowProcessInstance) crmPersistentSession.startProcess(processId);
InternalKnowledgeRuntime kruntime = processInstance.getKnowledgeRuntime();
Assert.assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo(processInstance);
processInstance = (RuleFlowProcessInstance) processInstanceInfo.getProcessInstance(kruntime, crmPersistentSession.getEnvironment());
Assert.assertNotNull(processInstance.getStartDate());
Assert.assertEquals(processInstance.getStartDate(), processInstanceInfo.getStartDate());
}
use of org.jbpm.ruleflow.core.RuleFlowProcess in project jbpm by kiegroup.
the class MapPersistenceTest method multipleSessionsWithSameProcessAndDifferentIdTest.
@Test
public void multipleSessionsWithSameProcessAndDifferentIdTest() {
String processId = "signalProcessTest";
String eventType = "myEvent";
RuleFlowProcess process1 = ProcessCreatorForHelp.newSimpleEventProcess(processId, eventType);
RuleFlowProcess process2 = ProcessCreatorForHelp.newSimpleEventProcess(processId, eventType);
KieBase kbase1 = createKieBase(process1);
KieBase kbase2 = createKieBase(process2);
StatefulKnowledgeSession ksession1 = createSession(kbase1);
StatefulKnowledgeSession ksession2 = createSession(kbase2);
Assert.assertNotSame(ksession1.getIdentifier(), ksession2.getIdentifier());
Long processInstance1Id = ksession1.startProcess(processId).getId();
Long processInstance2Id = ksession2.startProcess(processId).getId();
Assert.assertNotSame(processInstance1Id, processInstance2Id);
}
use of org.jbpm.ruleflow.core.RuleFlowProcess in project jbpm by kiegroup.
the class ProcessCreatorForHelp method newSimpleEventProcess.
public static RuleFlowProcess newSimpleEventProcess(String processId, String eventType) {
RuleFlowProcess process = new RuleFlowProcess();
process.setId(processId);
StartNode startNode = new StartNode();
startNode.setName("Start");
startNode.setId(1);
EventNode eventNode = new EventNode();
eventNode.setName("EventNode");
eventNode.setId(2);
eventNode.setScope("external");
EventTypeFilter eventFilter = new EventTypeFilter();
eventFilter.setType(eventType);
eventNode.addEventFilter(eventFilter);
EndNode endNode = new EndNode();
endNode.setName("End");
endNode.setId(3);
connect(startNode, eventNode);
connect(eventNode, endNode);
process.addNode(startNode);
process.addNode(eventNode);
process.addNode(endNode);
return process;
}
use of org.jbpm.ruleflow.core.RuleFlowProcess in project jbpm by kiegroup.
the class ProcessCreatorForHelp method newProcessWithOneVariableAndOneWork.
public static RuleFlowProcess newProcessWithOneVariableAndOneWork(String processId, String variableName, String workName) {
RuleFlowProcess process = new RuleFlowProcess();
process.setId(processId);
List<Variable> variables = new ArrayList<Variable>();
Variable variable = new Variable();
variable.setName(variableName);
ObjectDataType extendingSerializableDataType = new ObjectDataType();
extendingSerializableDataType.setClassName(Person.class.getName());
variable.setType(extendingSerializableDataType);
variables.add(variable);
process.getVariableScope().setVariables(variables);
StartNode startNode = new StartNode();
startNode.setName("Start");
startNode.setId(1);
WorkItemNode workItemNode = new WorkItemNode();
workItemNode.setName("workItemNode");
workItemNode.setId(2);
Work work = new WorkImpl();
work.setName(workName);
workItemNode.setWork(work);
EndNode endNode = new EndNode();
endNode.setName("EndNode");
endNode.setId(4);
connect(startNode, workItemNode);
connect(workItemNode, endNode);
process.addNode(startNode);
process.addNode(workItemNode);
process.addNode(endNode);
return process;
}
use of org.jbpm.ruleflow.core.RuleFlowProcess in project jbpm by kiegroup.
the class ProcessCreatorForHelp method newShortestProcess.
public static RuleFlowProcess newShortestProcess(String processId) {
StartNode startNode = new StartNode();
startNode.setName("Start");
startNode.setId(1);
EndNode endNode = new EndNode();
endNode.setName("EndNode");
endNode.setId(2);
connect(startNode, endNode);
RuleFlowProcess process = new RuleFlowProcess();
process.setId(processId);
process.addNode(startNode);
process.addNode(endNode);
return process;
}
Aggregations