use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class CallActivityTest method testInstantiateProcessByMessage.
public void testInstantiateProcessByMessage() throws Exception {
BpmnModel messageTriggeredBpmnModel = loadBPMNModel(MESSAGE_TRIGGERED_PROCESS_RESOURCE);
Deployment messageTriggeredBpmnDeployment = processEngine.getRepositoryService().createDeployment().name("messageTriggeredProcessDeployment").addBpmnModel("messageTriggered.bpmn20.xml", messageTriggeredBpmnModel).deploy();
ProcessInstance childProcessInstance = runtimeService.startProcessInstanceByMessage("TRIGGER_PROCESS_MESSAGE");
assertNotNull(childProcessInstance);
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class CallActivityTest method testInstantiateSuspendedProcessByMessage.
public void testInstantiateSuspendedProcessByMessage() throws Exception {
BpmnModel messageTriggeredBpmnModel = loadBPMNModel(MESSAGE_TRIGGERED_PROCESS_RESOURCE);
Deployment messageTriggeredBpmnDeployment = processEngine.getRepositoryService().createDeployment().name("messageTriggeredProcessDeployment").addBpmnModel("messageTriggered.bpmn20.xml", messageTriggeredBpmnModel).deploy();
suspendProcessDefinitions(messageTriggeredBpmnDeployment);
try {
ProcessInstance childProcessInstance = runtimeService.startProcessInstanceByMessage("TRIGGER_PROCESS_MESSAGE");
fail("Exception expected");
} catch (ActivitiException ae) {
assertTextPresent("Cannot start process instance. Process definition Message Triggered Process", ae.getMessage());
}
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class CallActivityTest method testInheritVariablesSubprocess.
public void testInheritVariablesSubprocess() throws Exception {
BpmnModel mainBpmnModel = loadBPMNModel(INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE);
BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE);
processEngine.getRepositoryService().createDeployment().name("mainProcessDeployment").addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy();
processEngine.getRepositoryService().createDeployment().name("childProcessDeployment").addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("var1", "String test value");
variables.put("var2", true);
variables.put("var3", 12345);
variables.put("var4", 67890);
ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables);
HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery();
activityInstanceQuery.processInstanceId(mainProcessInstance.getId());
activityInstanceQuery.activityId("childProcessCall");
HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult();
String calledInstanceId = activityInstance.getCalledProcessInstanceId();
HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery();
List<HistoricVariableInstance> variableInstances = variableInstanceQuery.processInstanceId(calledInstanceId).list();
assertEquals(4, variableInstances.size());
for (HistoricVariableInstance variable : variableInstances) {
assertEquals(variables.get(variable.getVariableName()), variable.getValue());
}
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class CallActivityTest method testNotInheritVariablesSubprocess.
public void testNotInheritVariablesSubprocess() throws Exception {
BpmnModel mainBpmnModel = loadBPMNModel(NOT_INHERIT_VARIABLES_MAIN_PROCESS_RESOURCE);
BpmnModel childBpmnModel = loadBPMNModel(INHERIT_VARIABLES_CHILD_PROCESS_RESOURCE);
processEngine.getRepositoryService().createDeployment().name("childProcessDeployment").addBpmnModel("childProcess.bpmn20.xml", childBpmnModel).deploy();
processEngine.getRepositoryService().createDeployment().name("mainProcessDeployment").addBpmnModel("mainProcess.bpmn20.xml", mainBpmnModel).deploy();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("var1", "String test value");
variables.put("var2", true);
variables.put("var3", 12345);
variables.put("var4", 67890);
ProcessInstance mainProcessInstance = runtimeService.startProcessInstanceByKey("mainProcess", variables);
HistoricActivityInstanceQuery activityInstanceQuery = historyService.createHistoricActivityInstanceQuery();
activityInstanceQuery.processInstanceId(mainProcessInstance.getId());
activityInstanceQuery.activityId("childProcessCall");
HistoricActivityInstance activityInstance = activityInstanceQuery.singleResult();
String calledInstanceId = activityInstance.getCalledProcessInstanceId();
HistoricVariableInstanceQuery variableInstanceQuery = historyService.createHistoricVariableInstanceQuery();
variableInstanceQuery.processInstanceId(calledInstanceId);
List<HistoricVariableInstance> variableInstances = variableInstanceQuery.list();
assertEquals(0, variableInstances.size());
}
use of org.activiti.bpmn.model.BpmnModel in project Activiti by Activiti.
the class BpmnParseTest method testParseDiagramInterchangeElementsForUnknownModelElements.
@Deployment
public void testParseDiagramInterchangeElementsForUnknownModelElements() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("TestAnnotation").singleResult();
BpmnModel model = repositoryService.getBpmnModel(processDefinition.getId());
Process mainProcess = model.getMainProcess();
assertEquals(0, mainProcess.getExtensionElements().size());
}
Aggregations