Search in sources :

Example 11 with DeploymentWithDefinitions

use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.

the class ProcessEngineTestRule method deploy.

public DeploymentWithDefinitions deploy(DeploymentBuilder deploymentBuilder) {
    DeploymentWithDefinitions deployment = deploymentBuilder.deployWithResult();
    processEngineRule.manageDeployment(deployment);
    return deployment;
}
Also used : DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions)

Example 12 with DeploymentWithDefinitions

use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.

the class DeploymentResourceImpl method redeploy.

public DeploymentDto redeploy(UriInfo uriInfo, RedeploymentDto redeployment) {
    DeploymentWithDefinitions deployment = null;
    try {
        deployment = tryToRedeploy(redeployment);
    } catch (NotFoundException e) {
        throw createInvalidRequestException("redeploy", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("redeploy", Status.BAD_REQUEST, e);
    }
    DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment);
    URI uri = uriInfo.getBaseUriBuilder().path(relativeRootResourcePath).path(DeploymentRestService.PATH).path(deployment.getId()).build();
    // GET /
    deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self");
    return deploymentDto;
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) DeploymentWithDefinitionsDto(org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) URI(java.net.URI) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions)

Example 13 with DeploymentWithDefinitions

use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.

the class DeploymentTest method shouldDeleteDeployment.

@Test
public void shouldDeleteDeployment() {
    BpmnModelInstance instance = Bpmn.createExecutableProcess("process").startEvent().endEvent().done();
    DeploymentWithDefinitions deployment = engineRule.getRepositoryService().createDeployment().addModelInstance("foo.bpmn", instance).deployWithResult();
    engineRule.getRepositoryService().deleteDeployment(deployment.getId(), true);
    long count = engineRule.getRepositoryService().createDeploymentQuery().count();
    assertEquals(0, count);
}
Also used : BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions) Test(org.junit.Test)

Example 14 with DeploymentWithDefinitions

use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.

the class ModificationExecutionSyncTest method createModificationWithNotMatchingProcessDefinitionId.

@Test
public void createModificationWithNotMatchingProcessDefinitionId() {
    DeploymentWithDefinitions deployment = testRule.deploy(instance);
    deployment.getDeployedProcessDefinitions().get(0);
    List<String> processInstanceIds = helper.startInstances("process1", 2);
    try {
        runtimeService.createModification("foo").cancelAllForActivity("activityId").processInstanceIds(processInstanceIds).execute();
        fail("Should not succed");
    } catch (ProcessEngineException e) {
        assertThat(e.getMessage(), containsString("processDefinition is null"));
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions) Test(org.junit.Test)

Example 15 with DeploymentWithDefinitions

use of org.camunda.bpm.engine.repository.DeploymentWithDefinitions in project camunda-bpm-platform by camunda.

the class ModificationExecutionSyncTest method testStartAfter.

@Test
public void testStartAfter() {
    DeploymentWithDefinitions deployment = testRule.deploy(instance);
    ProcessDefinition definition = deployment.getDeployedProcessDefinitions().get(0);
    List<String> processInstanceIds = helper.startInstances("process1", 2);
    runtimeService.createModification(definition.getId()).startAfterActivity("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("user3").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)

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