use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class BpmnDeploymentTest method testDeployNonExecutableProcess.
public void testDeployNonExecutableProcess() throws Exception {
// given non executable process definition
final BpmnModelInstance modelInstance = Bpmn.createProcess("foo").startEvent().userTask().endEvent().done();
// when process model is deployed
DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.bpmn", modelInstance).deployWithResult();
deploymentIds.add(deployment.getId());
// then deployment contains no deployed process definition
assertNull(deployment.getDeployedProcessDefinitions());
// and there exist no persisted process definitions
assertNull(repositoryService.createProcessDefinitionQuery().processDefinitionResourceName("foo.bpmn").singleResult());
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class BpmnDeploymentTest method testDeployAndGetProcessDefinition.
public void testDeployAndGetProcessDefinition() throws Exception {
// given process model
final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("foo").startEvent().userTask().endEvent().done();
// when process model is deployed
DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.bpmn", modelInstance).deployWithResult();
deploymentIds.add(deployment.getId());
// then deployment contains deployed process definitions
List<ProcessDefinition> deployedProcessDefinitions = deployment.getDeployedProcessDefinitions();
assertEquals(1, deployedProcessDefinitions.size());
assertNull(deployment.getDeployedCaseDefinitions());
assertNull(deployment.getDeployedDecisionDefinitions());
assertNull(deployment.getDeployedDecisionRequirementsDefinitions());
// and persisted process definition is equal to deployed process definition
ProcessDefinition persistedProcDef = repositoryService.createProcessDefinitionQuery().processDefinitionResourceName("foo.bpmn").singleResult();
assertEquals(persistedProcDef.getId(), deployedProcessDefinitions.get(0).getId());
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionSyncTest method testStartBefore.
@Test
public void testStartBefore() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition definition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 2);
runtimeService.createModification(definition.getId()).startBeforeActivity("user2").processInstanceIds(processInstanceIds).execute();
for (String processInstanceId : processInstanceIds) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.getId()).activity("user1").activity("user2").done());
}
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionSyncTest method testStartTransition.
@Test
public void testStartTransition() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition definition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 2);
runtimeService.createModification(definition.getId()).startTransition("seq").processInstanceIds(processInstanceIds).execute();
for (String processInstanceId : processInstanceIds) {
ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.getId()).activity("user1").activity("user2").done());
}
}
use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.
the class ModificationExecutionSyncTest method testDifferentStates.
@Test
public void testDifferentStates() {
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition definition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 1);
Task task = rule.getTaskService().createTaskQuery().singleResult();
rule.getTaskService().complete(task.getId());
List<String> anotherProcessInstanceIds = helper.startInstances("process1", 1);
processInstanceIds.addAll(anotherProcessInstanceIds);
runtimeService.createModification(definition.getId()).startBeforeActivity("user3").processInstanceIds(processInstanceIds).execute();
ActivityInstance updatedTree = null;
String processInstanceId = processInstanceIds.get(0);
updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.getId()).activity("user2").activity("user3").done());
processInstanceId = processInstanceIds.get(1);
updatedTree = runtimeService.getActivityInstance(processInstanceId);
assertNotNull(updatedTree);
assertEquals(processInstanceId, updatedTree.getProcessInstanceId());
assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.getId()).activity("user1").activity("user3").done());
}
Aggregations