Search in sources :

Example 1 with ProcessApplicationRegistration

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

the class DeploymentAuthorizationTest method testRegisterProcessApplicationAsCamundaAdmin.

public void testRegisterProcessApplicationAsCamundaAdmin() {
    // given
    identityService.setAuthentication(userId, Collections.singletonList(Groups.CAMUNDA_ADMIN));
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    ProcessApplicationReference reference = processApplication.getReference();
    String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
    // when
    ProcessApplicationRegistration registration = managementService.registerProcessApplication(deploymentId, reference);
    // then
    assertNotNull(registration);
    assertNotNull(getProcessApplicationForDeployment(deploymentId));
    deleteDeployment(deploymentId);
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication)

Example 2 with ProcessApplicationRegistration

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

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentNoResume.

public void testProcessApplicationDeploymentNoResume() {
    // 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").enableDuplicateFiltering(false).addClasspathResource("org/camunda/bpm/engine/test/api/repository/version2.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(2, processDefinitions.get(1).getVersion());
    // old deployment was NOT resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, 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)

Example 3 with ProcessApplicationRegistration

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

the class RedeploymentTest method testRedeployProcessApplicationDeploymentResumePreviousVersions.

public void testRedeployProcessApplicationDeploymentResumePreviousVersions() {
    // 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().addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
    // then
    // old deployments 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 4 with ProcessApplicationRegistration

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

the class ProcessApplicationDeploymentTest method testPartialChangesResumePreviousVersion.

public void testPartialChangesResumePreviousVersion() {
    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).deploy();
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").enableDuplicateFiltering(true).resumePreviousVersions().addModelInstance("process1.bpmn20.xml", model1).addModelInstance("process2.bpmn20.xml", model2).deploy();
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    assertEquals(2, registration.getDeploymentIds().size());
    deleteDeployments(deployment1, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 5 with ProcessApplicationRegistration

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

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName.

public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName() {
    // 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").enableDuplicateFiltering(false).resumePreviousVersions().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addClasspathResource("org/camunda/bpm/engine/test/api/repository/version2.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(2, 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(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