use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployFormDifferentDeploymentsSameResourceName.
public void testRedeployFormDifferentDeploymentsSameResourceName() {
// given
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-1").addModelInstance(RESOURCE_1_NAME, model1).deploy();
// second deployment
BpmnModelInstance model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-2").addModelInstance(RESOURCE_1_NAME, model2).deploy();
// when
try {
repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-3").addDeploymentResources(deployment1.getId()).addDeploymentResources(deployment2.getId()).deploy();
fail("It should not be possible to deploy different resources with same name.");
} catch (NotValidException e) {
// expected
}
deleteDeployments(deployment1, deployment2);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployEnableDuplcateChecking.
public void testRedeployEnableDuplcateChecking() {
// given
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_1_NAME, model1).deploy();
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
// when
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).enableDuplicateFiltering(true).deploy();
assertEquals(deployment1.getId(), deployment2.getId());
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
deleteDeployments(deployment1);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployDeploymentName.
public void testRedeployDeploymentName() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
assertEquals(DEPLOYMENT_NAME, deployment1.getName());
// when
Deployment deployment2 = repositoryService.createDeployment().nameFromDeployment(deployment1.getId()).addDeploymentResources(deployment1.getId()).deploy();
// then
assertNotNull(deployment2);
assertEquals(deployment1.getName(), deployment2.getName());
deleteDeployments(deployment1, deployment2);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeploySetDeploymentSourceProperty.
public void testRedeploySetDeploymentSourceProperty() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).source("my-deployment-source").addModelInstance(RESOURCE_NAME, model).deploy();
assertEquals("my-deployment-source", deployment1.getSource());
// when
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).source("my-another-deployment-source").deploy();
// then
assertNotNull(deployment2);
assertEquals("my-another-deployment-source", deployment2.getSource());
deleteDeployments(deployment1, deployment2);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployFormDifferentDeploymentsByName.
public void testRedeployFormDifferentDeploymentsByName() {
// given
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
BpmnModelInstance model1 = createProcessWithServiceTask(PROCESS_1_KEY);
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-1").addModelInstance(RESOURCE_1_NAME, model1).deploy();
assertEquals(1, repositoryService.getDeploymentResources(deployment1.getId()).size());
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
// second deployment
BpmnModelInstance model2 = createProcessWithReceiveTask(PROCESS_2_KEY);
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-2").addModelInstance(RESOURCE_2_NAME, model2).deploy();
assertEquals(1, repositoryService.getDeploymentResources(deployment2.getId()).size());
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
// when
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-3").addDeploymentResourceByName(deployment1.getId(), RESOURCE_1_NAME).addDeploymentResourceByName(deployment2.getId(), RESOURCE_2_NAME).deploy();
assertEquals(2, repositoryService.getDeploymentResources(deployment3.getId()).size());
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 2);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 2);
deleteDeployments(deployment1, deployment2, deployment3);
}
Aggregations