Search in sources :

Example 86 with Deployment

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

the class RedeploymentTest method testRedeployMultipleDeploymentResourcesById.

public void testRedeployMultipleDeploymentResourcesById() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
    BpmnModelInstance model3 = createProcessWithScriptTask(PROCESS_3_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 1);
    Resource resource11 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
    Resource resource13 = getResourceByName(deployment1.getId(), RESOURCE_3_NAME);
    // second deployment
    model1 = createProcessWithScriptTask(PROCESS_1_KEY);
    model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    model3 = createProcessWithUserTask(PROCESS_3_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 2);
    Resource resource21 = getResourceByName(deployment2.getId(), RESOURCE_1_NAME);
    Resource resource23 = getResourceByName(deployment2.getId(), RESOURCE_3_NAME);
    // when (1)
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource11.getId()).addDeploymentResourceById(deployment1.getId(), resource13.getId()).deploy();
    // then (1)
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 3);
    // when (2)
    Deployment deployment4 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesById(deployment2.getId(), Arrays.asList(resource21.getId(), resource23.getId())).deploy();
    // then (2)
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 4);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 4);
    deleteDeployments(deployment1, deployment2, deployment3, deployment4);
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 87 with Deployment

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

the class RedeploymentTest method testRedeployMultipleDeploymentResourcesByName.

public void testRedeployMultipleDeploymentResourcesByName() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
    BpmnModelInstance model3 = createProcessWithScriptTask(PROCESS_3_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 1);
    // second deployment
    model1 = createProcessWithScriptTask(PROCESS_1_KEY);
    model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    model3 = createProcessWithUserTask(PROCESS_3_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 2);
    // when (1)
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceByName(deployment1.getId(), RESOURCE_1_NAME).addDeploymentResourceByName(deployment1.getId(), RESOURCE_3_NAME).deploy();
    // then (1)
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 3);
    // when (2)
    Deployment deployment4 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesByName(deployment2.getId(), Arrays.asList(RESOURCE_1_NAME, RESOURCE_3_NAME)).deploy();
    // then (2)
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 4);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 4);
    deleteDeployments(deployment1, deployment2, deployment3, deployment4);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 88 with Deployment

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

the class RedeploymentTest method testRedeployFormDifferentDeploymentsByNameAndId.

public void testRedeployFormDifferentDeploymentsByNameAndId() {
    // given
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
    // first deployment
    Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-1").addModelInstance(RESOURCE_1_NAME, model1).deploy();
    assertEquals(1, repositoryService.getDeploymentResources(deployment1.getId()).size());
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    // second deployment
    BpmnModelInstance model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-2").addModelInstance(RESOURCE_2_NAME, model2).deploy();
    assertEquals(1, repositoryService.getDeploymentResources(deployment2.getId()).size());
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
    // when
    Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-3").addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourceByName(deployment2.getId(), RESOURCE_2_NAME).deploy();
    assertEquals(2, repositoryService.getDeploymentResources(deployment3.getId()).size());
    verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
    verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
    deleteDeployments(deployment1, deployment2, deployment3);
}
Also used : Resource(org.camunda.bpm.engine.repository.Resource) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 89 with Deployment

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

the class ProcessApplicationDeploymentTest method testUnregisterProcessApplicationOnDeploymentDeletion.

public void testUnregisterProcessApplicationOnDeploymentDeletion() {
    // given a deployment with a process application registration
    Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", Bpmn.createExecutableProcess("foo").done()).deploy();
    // and a process application registration
    managementService.registerProcessApplication(deployment.getId(), processApplication.getReference());
    // when deleting the deploymen
    repositoryService.deleteDeployment(deployment.getId(), true);
    // then the registration is removed
    assertNull(managementService.getProcessApplicationForDeployment(deployment.getId()));
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 90 with Deployment

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

the class ProcessApplicationDeploymentTest method testDeploymentSourceShouldNotBeNull.

public void testDeploymentSourceShouldNotBeNull() {
    String key = "process";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    Deployment deployment1 = repositoryService.createDeployment().name("first-deployment-without-a-source").source("my-first-deployment-source").addModelInstance("process.bpmn", model).deploy();
    assertEquals("my-first-deployment-source", deploymentQuery.deploymentName("first-deployment-without-a-source").singleResult().getSource());
    Deployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("second-deployment-with-a-source").source("my-second-deployment-source").addModelInstance("process.bpmn", model).deploy();
    assertEquals("my-second-deployment-source", deploymentQuery.deploymentName("second-deployment-with-a-source").singleResult().getSource());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Aggregations

Deployment (org.camunda.bpm.engine.repository.Deployment)137 Test (org.junit.Test)62 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)39 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)36 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)19 Resource (org.camunda.bpm.engine.repository.Resource)19 InputStream (java.io.InputStream)14 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)11 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)11 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)10 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)8 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Job (org.camunda.bpm.engine.runtime.Job)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2