public DeployedProcessArchive(ProcessApplicationDeployment deployment) { primaryDeploymentId = deployment.getId(); ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration(); allDeploymentIds = registration.getDeploymentIds(); processEngineName = registration.getProcessEngineName(); }
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); } } }
for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) { ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl(); deploymentInfo.setDeploymentId(deploymentId);
public void testEnabledPaEnvScriptCaching() { // given EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication(); ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .addClasspathResource(PROCESS_PATH) .deploy(); // when executeScript(processApplication); // then Map<String, List<ExecutableScript>> environmentScripts = processApplication.getEnvironmentScripts(); assertNotNull(environmentScripts); List<ExecutableScript> groovyEnvScripts = environmentScripts.get(SCRIPT_LANGUAGE); assertNotNull(groovyEnvScripts); assertFalse(groovyEnvScripts.isEmpty()); assertEquals(processEngineConfiguration.getEnvScriptResolvers().size(), groovyEnvScripts.size()); repositoryService.deleteDeployment(deployment.getId(), true); }
for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) { ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl(); deploymentInfo.setDeploymentId(deploymentId);
public void testDisabledPaEnvScriptCaching() { // given processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(false); EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication(); ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .addClasspathResource(PROCESS_PATH) .deploy(); // when executeScript(processApplication); // then Map<String, List<ExecutableScript>> environmentScripts = processApplication.getEnvironmentScripts(); assertNotNull(environmentScripts); assertNull(environmentScripts.get(SCRIPT_LANGUAGE)); repositoryService.deleteDeployment(deployment.getId(), true); processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(true); }
public DeployedProcessArchive(ProcessApplicationDeployment deployment) { primaryDeploymentId = deployment.getId(); ProcessApplicationRegistration registration = deployment.getProcessApplicationRegistration(); allDeploymentIds = registration.getDeploymentIds(); processEngineName = registration.getProcessEngineName(); }
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); } } }
for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) { ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl(); deploymentInfo.setDeploymentId(deploymentId);
public void testDisableFetchScriptEngineFromProcessApplication() { // when processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(false); EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication(); ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .addClasspathResource(PROCESS_PATH) .deploy(); // when ScriptEngine engine = getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication); // then assertNotNull(engine); assertEquals(engine, getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication)); // not cached in pa assertFalse(engine.equals(processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, true))); repositoryService.deleteDeployment(deployment.getId(), true); processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(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); } } }
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 testFetchScriptEngineFromPaDisableCaching() { // then processEngineConfiguration.setEnableScriptEngineCaching(false); getScriptingEngines().setEnableScriptEngineCaching(false); EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication(); ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .addClasspathResource(PROCESS_PATH) .deploy(); // when ScriptEngine engine = getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication); // then assertNotNull(engine); assertFalse(engine.equals(getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication))); // not cached in pa assertFalse(engine.equals(processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, false))); repositoryService.deleteDeployment(deployment.getId(), true); processEngineConfiguration.setEnableScriptEngineCaching(true); getScriptingEngines().setEnableScriptEngineCaching(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); } } }
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 testVariableInstanceQuery() { ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()) .addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") .deploy(); VariableMap variables = Variables.createVariables().putValue("my-variable", "a-value"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", variables); // variable instance query List<VariableInstance> result = runtimeService.createVariableInstanceQuery().list(); assertEquals(1, result.size()); VariableInstance variableInstance = result.get(0); assertEquals("my-variable", variableInstance.getName()); // get variable assertNotNull(runtimeService.getVariable(processInstance.getId(), "my-variable")); // get variable local assertNotNull(runtimeService.getVariableLocal(processInstance.getId(), "my-variable")); repositoryService.deleteDeployment(deployment.getId(), true); }
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); }
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); } } }