use of org.camunda.bpm.engine.repository.Resource in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployDeploymentResourceByIdAndName.
public void testRedeployDeploymentResourceByIdAndName() {
// given
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
Resource resource2 = getResourceByName(deployment1.getId(), RESOURCE_2_NAME);
// second deployment
model1 = createProcessWithScriptTask(PROCESS_1_KEY);
model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
// when
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourceByName(deployment1.getId(), resource2.getName()).deploy();
// then
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 3);
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Resource in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployOneDeploymentResourcesById.
public void testRedeployOneDeploymentResourcesById() {
// given
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
Resource resource = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
// second deployment
model1 = createProcessWithScriptTask(PROCESS_1_KEY);
model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
// when
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource.getId()).deploy();
// then
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Resource in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName.
public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName() {
// 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().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
// then
// old deployment was resumed
ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration();
Set<String> deploymentIds = registration.getDeploymentIds();
assertEquals(3, deploymentIds.size());
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Resource in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployMultipleDeploymentResourcesById.
public void testRedeployMultipleDeploymentResourcesById() {
// given
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
BpmnModelInstance model2 = createProcessWithUserTask(PROCESS_2_KEY);
BpmnModelInstance model3 = createProcessWithScriptTask(PROCESS_3_KEY);
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 1);
Resource resource11 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
Resource resource13 = getResourceByName(deployment1.getId(), RESOURCE_3_NAME);
// second deployment
model1 = createProcessWithScriptTask(PROCESS_1_KEY);
model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
model3 = createProcessWithUserTask(PROCESS_3_KEY);
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).addModelInstance(RESOURCE_2_NAME, model2).addModelInstance(RESOURCE_3_NAME, model3).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 2);
Resource resource21 = getResourceByName(deployment2.getId(), RESOURCE_1_NAME);
Resource resource23 = getResourceByName(deployment2.getId(), RESOURCE_3_NAME);
// when (1)
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource11.getId()).addDeploymentResourceById(deployment1.getId(), resource13.getId()).deploy();
// then (1)
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 3);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 3);
// when (2)
Deployment deployment4 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesById(deployment2.getId(), Arrays.asList(resource21.getId(), resource23.getId())).deploy();
// then (2)
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 4);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_3_KEY), 4);
deleteDeployments(deployment1, deployment2, deployment3, deployment4);
}
use of org.camunda.bpm.engine.repository.Resource in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testSimpleProcessApplicationDeployment.
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);
}
Aggregations