Search in sources :

Example 6 with ProcessApplicationRegistration

use of org.camunda.bpm.application.ProcessApplicationRegistration in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentNameDeployDifferentProcesses.

public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentNameDeployDifferentProcesses() {
    BpmnModelInstance process1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance process2 = Bpmn.createExecutableProcess("process2").done();
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).name("deployment").addModelInstance("process1.bpmn", process1).deploy();
    assertThatOneProcessIsDeployed();
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").resumePreviousVersions().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addModelInstance("process2.bpmn", process2).deploy();
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().asc().list();
    // now there are 2 process definitions deployed but both with version 1
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals(1, processDefinitions.get(1).getVersion());
    // old deployment was resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(2, deploymentIds.size());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 7 with ProcessApplicationRegistration

use of org.camunda.bpm.application.ProcessApplicationRegistration in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testPartialChangesDeployAll.

public void testPartialChangesDeployAll() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").addModelInstance("process1.bpmn20.xml", model1).addModelInstance("process2.bpmn20.xml", model2).deploy();
    BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();
    // second deployment with partial changes:
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").enableDuplicateFiltering(false).resumePreviousVersions().addModelInstance("process1.bpmn20.xml", model1).addModelInstance("process2.bpmn20.xml", changedModel2).deploy();
    assertEquals(4, repositoryService.createProcessDefinitionQuery().count());
    List<ProcessDefinition> processDefinitionsModel1 = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").orderByProcessDefinitionVersion().asc().list();
    // now there are two versions of process1 deployed
    assertEquals(2, processDefinitionsModel1.size());
    assertEquals(1, processDefinitionsModel1.get(0).getVersion());
    assertEquals(2, processDefinitionsModel1.get(1).getVersion());
    // now there are two versions of process2 deployed
    List<ProcessDefinition> processDefinitionsModel2 = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").orderByProcessDefinitionVersion().asc().list();
    assertEquals(2, processDefinitionsModel2.size());
    assertEquals(1, processDefinitionsModel2.get(0).getVersion());
    assertEquals(2, processDefinitionsModel2.get(1).getVersion());
    // old deployment was resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(2, deploymentIds.size());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment1, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 8 with ProcessApplicationRegistration

use of org.camunda.bpm.application.ProcessApplicationRegistration in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testSimpleProcessApplicationDeployment.

public void testSimpleProcessApplicationDeployment() {
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource("org/camunda/bpm/engine/test/api/repository/version1.bpmn20.xml").deploy();
    // process is deployed:
    assertThatOneProcessIsDeployed();
    // registration was performed:
    ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, deploymentIds.size());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment)

Example 9 with ProcessApplicationRegistration

use of org.camunda.bpm.application.ProcessApplicationRegistration in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentNameNoResume.

public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentNameNoResume() {
    BpmnModelInstance process1 = Bpmn.createExecutableProcess("process1").done();
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).name("deployment").addModelInstance("process1.bpmn", process1).deploy();
    assertThatOneProcessIsDeployed();
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("anotherDeployment").resumePreviousVersions().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addModelInstance("process2.bpmn", process1).deploy();
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().asc().list();
    // there is a new version of the process
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals(2, processDefinitions.get(1).getVersion());
    // but the old deployment was not resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, deploymentIds.size());
    assertEquals(deployment2.getId(), deploymentIds.iterator().next());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 10 with ProcessApplicationRegistration

use of org.camunda.bpm.application.ProcessApplicationRegistration in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsDifferentKeys.

public void testProcessApplicationDeploymentResumePreviousVersionsDifferentKeys() {
    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").addClasspathResource("org/camunda/bpm/engine/test/api/repository/version1.bpmn20.xml").deploy();
    assertThatOneProcessIsDeployed();
    // deploy update with changes:
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").resumePreviousVersions().addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml").deploy();
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().asc().list();
    // now there are 2 process definitions deployed
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals(1, processDefinitions.get(1).getVersion());
    // and the old deployment was not resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, deploymentIds.size());
    assertEquals(deployment2.getId(), deploymentIds.iterator().next());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment1, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Aggregations

ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)17 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)15 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)9 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)8 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)4 Resource (org.camunda.bpm.engine.repository.Resource)3 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 DeploymentEntity (org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity)1 DeploymentManager (org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager)1 ProcessApplicationDeploymentImpl (org.camunda.bpm.engine.impl.persistence.entity.ProcessApplicationDeploymentImpl)1 ResourceEntity (org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)1