use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeployDeploymentAuthorizationTest method testRedeploy.
@Test
public void testRedeploy() {
// given
RepositoryService repositoryService = engineRule.getRepositoryService();
BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
// first deployment
Deployment deployment1 = repositoryService.createDeployment().addModelInstance("process1.bpmn", model1).addModelInstance("process2.bpmn", model2).deploy();
// when
authRule.init(scenario).withUser("userId").bindResource("deploymentId", deployment1.getId()).start();
Deployment deployment2 = repositoryService.createDeployment().addDeploymentResources(deployment1.getId()).deploy();
// then
if (authRule.assertScenario(scenario)) {
Assert.assertEquals(2, repositoryService.createDeploymentQuery().count());
deleteDeployments(deployment2);
deleteAuthorizations();
}
deleteDeployments(deployment1);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class NestedExecutionAPIInvocationTest method init.
@Before
public void init() {
StartProcessOnAnotherEngineDelegate.engine = engine2BootstrapRule.getProcessEngine();
NestedProcessStartDelegate.engine = engineRule1.getProcessEngine();
// given
Deployment deployment1 = engineRule1.getRepositoryService().createDeployment().addModelInstance("foo.bpmn", PROCESS_MODEL).deploy();
Deployment deployment2 = engineRule1.getRepositoryService().createDeployment().addModelInstance("boo.bpmn", PROCESS_MODEL_2).deploy();
engineRule1.manageDeployment(deployment1);
engineRule1.manageDeployment(deployment2);
Deployment deployment3 = engineRule2.getProcessEngine().getRepositoryService().createDeployment().addModelInstance("joo.bpmn", ONE_TASK_PROCESS_MODEL).deploy();
engineRule2.manageDeployment(deployment3);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployNewDeployment.
public void testRedeployNewDeployment() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentName(DEPLOYMENT_NAME);
assertNotNull(deployment1.getId());
verifyQueryResults(query, 1);
// when
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
// then
assertNotNull(deployment2);
assertNotNull(deployment2.getId());
assertFalse(deployment1.getId().equals(deployment2.getId()));
verifyQueryResults(query, 2);
deleteDeployments(deployment1, deployment2);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployUnexistingDeploymentResource.
public void testRedeployUnexistingDeploymentResource() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).deploy();
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceByName(deployment.getId(), "not-existing-resource.bpmn").deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesByName(deployment.getId(), Arrays.asList("not-existing-resource.bpmn")).deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment.getId(), "not-existing-resource-id").deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
try {
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResourcesById(deployment.getId(), Arrays.asList("not-existing-resource-id")).deploy();
fail("It should not be possible to re-deploy a not existing deployment resource");
} catch (NotFoundException e) {
// then
// expected
}
deleteDeployments(deployment);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testRedeployFormDifferentDeploymentsById.
public void testRedeployFormDifferentDeploymentsById() {
// 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());
Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_1_NAME);
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());
Resource resource2 = getResourceByName(deployment2.getId(), RESOURCE_2_NAME);
verifyQueryResults(query.processDefinitionKey(PROCESS_1_KEY), 1);
verifyQueryResults(query.processDefinitionKey(PROCESS_2_KEY), 1);
// when
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME + "-3").addDeploymentResourceById(deployment1.getId(), resource1.getId()).addDeploymentResourceById(deployment2.getId(), resource2.getId()).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