Search in sources :

Example 21 with ProcessApplicationDeployment

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

the class RedeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName.

public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName() {
    // given
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    // first deployment
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_NAME);
    // second deployment
    model = createProcessWithUserTask(PROCESS_KEY);
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
    // when
    ProcessApplicationDeployment deployment3 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).resumePreviousVersions().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
    // then
    // old deployment was resumed
    ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(3, deploymentIds.size());
    deleteDeployments(deployment1, deployment2, deployment3);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) Resource(org.camunda.bpm.engine.repository.Resource) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 22 with ProcessApplicationDeployment

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

the class RedeploymentTest method testSimpleProcessApplicationDeployment.

public void testSimpleProcessApplicationDeployment() {
    // given
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_NAME);
    // when
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
    // then
    // registration was performed:
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, deploymentIds.size());
    assertTrue(deploymentIds.contains(deployment2.getId()));
    deleteDeployments(deployment1, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) Resource(org.camunda.bpm.engine.repository.Resource) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 23 with ProcessApplicationDeployment

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

the class ProcessApplicationDeploymentTest method testNullAndNotNullDeploymentSourceShouldDeployNewVersion.

public void testNullAndNotNullDeploymentSourceShouldDeployNewVersion() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(name).source("my-source2").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(2, processDefinitionQuery.count());
    assertEquals(2, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 24 with ProcessApplicationDeployment

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

the class ProcessApplicationDeploymentTest method testProcessApplicationAndNullDeploymentSourceAwareDuplicateFilter.

public void testProcessApplicationAndNullDeploymentSourceAwareDuplicateFilter() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 25 with ProcessApplicationDeployment

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

the class ProcessApplicationDeploymentTest method testSameDeploymentSourceAwareDuplicateFilter.

public void testSameDeploymentSourceAwareDuplicateFilter() {
    // given
    String key = "process";
    String name = "my-deployment";
    BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key);
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name);
    // when
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(name).source("cockpit").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("my-deployment").source("cockpit").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy();
    // then
    assertEquals(1, processDefinitionQuery.count());
    assertEquals(1, deploymentQuery.count());
    deleteDeployments(deployment1, deployment2);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Aggregations

ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)31 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)17 ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)15 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)8 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)8 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)8 ScriptEngine (javax.script.ScriptEngine)3 Resource (org.camunda.bpm.engine.repository.Resource)3 List (java.util.List)2 ArrayList (java.util.ArrayList)1 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)1 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)1 ProcessApplicationDeploymentInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl)1 ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)1 SourceExecutableScript (org.camunda.bpm.engine.impl.scripting.SourceExecutableScript)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1