use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.
the class ProcessApplicationStartService method start.
@Override
public void start(StartContext context) throws StartException {
ManagedReference reference = null;
try {
// get the process application component
ProcessApplicationInterface processApplication = null;
ComponentView componentView = paComponentViewInjector.getOptionalValue();
if (componentView != null) {
reference = componentView.createInstance();
processApplication = (ProcessApplicationInterface) reference.getInstance();
} else {
processApplication = noViewProcessApplication.getValue();
}
// create & populate the process application info object
processApplicationInfo = new ProcessApplicationInfoImpl();
processApplicationInfo.setName(processApplication.getName());
processApplicationInfo.setProperties(processApplication.getProperties());
referencedProcessEngines = new HashSet<ProcessEngine>();
List<ProcessApplicationDeploymentInfo> deploymentInfos = new ArrayList<ProcessApplicationDeploymentInfo>();
for (ServiceName deploymentServiceName : deploymentServiceNames) {
ProcessApplicationDeploymentService value = getDeploymentService(context, deploymentServiceName);
referencedProcessEngines.add(value.getProcessEngineInjector().getValue());
ProcessApplicationDeployment deployment = value.getDeployment();
if (deployment != null) {
for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) {
ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
deploymentInfo.setDeploymentId(deploymentId);
deploymentInfo.setProcessEngineName(value.getProcessEngineName());
deploymentInfos.add(deploymentInfo);
}
}
}
processApplicationInfo.setDeploymentInfo(deploymentInfos);
notifyBpmPlatformPlugins(platformPluginsInjector.getValue(), processApplication);
if (postDeployDescription != null) {
invokePostDeploy(processApplication);
}
// install the ManagedProcessApplication Service as a child to this service
// if this service stops (at undeployment) the ManagedProcessApplication service is removed as well.
ServiceName serviceName = ServiceNames.forManagedProcessApplication(processApplicationInfo.getName());
MscManagedProcessApplication managedProcessApplication = new MscManagedProcessApplication(processApplicationInfo, processApplication.getReference());
context.getChildTarget().addService(serviceName, managedProcessApplication).install();
} catch (StartException e) {
throw e;
} catch (Exception e) {
throw new StartException(e);
} finally {
if (reference != null) {
reference.release();
}
}
}
use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.
the class CmmnDisabledTest method testVariableInstanceQuery.
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);
}
use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.
the class CmmnDisabledTest method testCmmnDisabled.
public void testCmmnDisabled() {
ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml").deploy();
// process is deployed:
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertNotNull(processDefinition);
assertEquals(1, processDefinition.getVersion());
try {
repositoryService.createCaseDefinitionQuery().singleResult();
fail("Cmmn Disabled: It should not be possible to query for a case definition.");
} catch (Exception e) {
// expected
}
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment 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);
}
use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment 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);
}
Aggregations