public DeployedProcessArchive(ProcessApplicationDeployment deployment) { primaryDeploymentId = deployment.getId(); ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration(); allDeploymentIds = registration.getDeploymentIds(); processEngineName = registration.getProcessEngineName(); }
public DeployedProcessArchive(ProcessApplicationDeployment deployment) { primaryDeploymentId = deployment.getId(); ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration(); allDeploymentIds = registration.getDeploymentIds(); processEngineName = registration.getProcessEngineName(); }
@Override public void cancelOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); ProcessEngine processEngine = getProcessEngine(serviceContainer); // if a registration was performed, remove it. if (deployment != null && deployment.getProcessApplicationRegistration() != null) { processEngine.getManagementService().unregisterProcessApplication(deployment.getProcessApplicationRegistration().getDeploymentIds(), true); } // delete deployment if we were able to create one AND if // isDeleteUponUndeploy is set. if (deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { if (processEngine != null) { processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true); } } }
@Override public void cancelOperationStep(DeploymentOperation operationContext) { final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer(); ProcessEngine processEngine = getProcessEngine(serviceContainer); // if a registration was performed, remove it. if (deployment != null && deployment.getProcessApplicationRegistration() != null) { processEngine.getManagementService().unregisterProcessApplication(deployment.getProcessApplicationRegistration().getDeploymentIds(), true); } // delete deployment if we were able to create one AND if // isDeleteUponUndeploy is set. if (deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { if (processEngine != null) { processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true); } } }
protected void performUndeployment() { final ProcessEngine processEngine = processEngineInjector.getValue(); try { if(deployment != null) { // always unregister Set<String> deploymentIds = deployment.getProcessApplicationRegistration().getDeploymentIds(); processEngine.getManagementService().unregisterProcessApplication(deploymentIds, true); } } catch(Exception e) { LOGGER.log(Level.SEVERE, "Exception while unregistering process application with the process engine."); } // delete the deployment only if requested in metadata if(deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { try { LOGGER.info("Deleting cascade deployment with name '"+deployment.getName()+"/"+deployment.getId()+"'."); // always cascade & skip custom listeners processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true, true); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while deleting process engine deployment", e); } } }
protected void performUndeployment() { final ProcessEngine processEngine = processEngineInjector.getValue(); try { if(deployment != null) { // always unregister Set<String> deploymentIds = deployment.getProcessApplicationRegistration().getDeploymentIds(); processEngine.getManagementService().unregisterProcessApplication(deploymentIds, true); } } catch(Exception e) { LOGGER.log(Level.SEVERE, "Exception while unregistering process application with the process engine."); } // delete the deployment only if requested in metadata if(deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { try { LOGGER.info("Deleting cascade deployment with name '"+deployment.getName()+"/"+deployment.getId()+"'."); // always cascade & skip custom listeners processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true, true); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while deleting process engine deployment", e); } } }
protected void performUndeployment() { final ProcessEngine processEngine = processEngineInjector.getValue(); try { if(deployment != null) { // always unregister Set<String> deploymentIds = deployment.getProcessApplicationRegistration().getDeploymentIds(); processEngine.getManagementService().unregisterProcessApplication(deploymentIds, true); } } catch(Exception e) { LOGGER.log(Level.SEVERE, "Exception while unregistering process application with the process engine."); } // delete the deployment only if requested in metadata if(deployment != null && PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DELETE_UPON_UNDEPLOY, false)) { try { LOGGER.info("Deleting cascade deployment with name '"+deployment.getName()+"/"+deployment.getId()+"'."); // always cascade & skip custom listeners processEngine.getRepositoryService().deleteDeployment(deployment.getId(), true, true); } catch (Exception e) { LOGGER.log(Level.WARNING, "Exception while deleting process engine deployment", e); } } }
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); }
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); }
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); }
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); }
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); }
public void testProcessApplicationDeploymentResumePreviousVersions() { // 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() .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); }
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); }
public void testProcessApplicationDeploymentNoChanges() { // create initial deployment ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .name("deployment") .addClasspathResource("org/camunda/bpm/engine/test/api/repository/version1.bpmn20.xml") .deploy(); assertThatOneProcessIsDeployed(); // deploy update with no changes: deployment = repositoryService.createDeployment(processApplication.getReference()) .name("deployment") .enableDuplicateFiltering(false) .addClasspathResource("org/camunda/bpm/engine/test/api/repository/version1.bpmn20.xml") .deploy(); // no changes assertThatOneProcessIsDeployed(); ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration(); Set<String> deploymentIds = registration.getDeploymentIds(); assertEquals(1, deploymentIds.size()); assertEquals(processEngine.getName(), registration.getProcessEngineName()); deleteDeployments(deployment); }
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); }
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); }
public void testPartialChangesResumePreviousVersionByDeploymentName() { 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() .resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME) .addModelInstance("process1.bpmn20.xml", model1) .addModelInstance("process2.bpmn20.xml", model2) .deploy(); ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration(); assertEquals(2, registration.getDeploymentIds().size()); deleteDeployments(deployment1, deployment2); }
ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration(); Set<String> deploymentIds = registration.getDeploymentIds(); assertEquals(3, deploymentIds.size());
ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration(); Set<String> deploymentIds = registration.getDeploymentIds(); assertEquals(3, deploymentIds.size());