Search in sources :

Example 1 with DeploymentWithDefinitions

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());
}
Also used : BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions)

Example 2 with DeploymentWithDefinitions

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());
}
Also used : ReadOnlyProcessDefinition(org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions)

Example 3 with DeploymentWithDefinitions

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());
    }
}
Also used : ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions) Test(org.junit.Test)

Example 4 with DeploymentWithDefinitions

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());
    }
}
Also used : ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions) Test(org.junit.Test)

Example 5 with DeploymentWithDefinitions

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions) Test(org.junit.Test)

Aggregations

DeploymentWithDefinitions (org.camunda.bpm.engine.repository.DeploymentWithDefinitions)21 Test (org.junit.Test)17 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)15 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)12 Batch (org.camunda.bpm.engine.batch.Batch)9 Job (org.camunda.bpm.engine.runtime.Job)7 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)3 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)2 Task (org.camunda.bpm.engine.task.Task)2 URI (java.net.URI)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 ReadOnlyProcessDefinition (org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition)1 DeploymentWithDefinitionsDto (org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1