use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentProcessApplicationTest method definitionTwoPreviousDeploymentFirstDeploymentWithPA.
@Test
public void definitionTwoPreviousDeploymentFirstDeploymentWithPA() {
// given
// first deployment
MyEmbeddedProcessApplication application1 = new MyEmbeddedProcessApplication();
Deployment deployment1 = repositoryService.createDeployment(application1.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
assertEquals(3, testProvider.countDefinitionsByKey(definitionKey1));
// when
testProvider.createInstanceByDefinitionKey(definitionKey1);
// then
assertTrue(application1.isCalled());
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentProcessApplicationTest method definitionTwoPreviousDeploymentsWithDifferentPA.
@Test
public void definitionTwoPreviousDeploymentsWithDifferentPA() {
// given
// first deployment
MyEmbeddedProcessApplication application1 = new MyEmbeddedProcessApplication();
Deployment deployment1 = repositoryService.createDeployment(application1.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).addClasspathResource(resource2).deploy();
// second deployment
MyEmbeddedProcessApplication application2 = new MyEmbeddedProcessApplication();
Deployment deployment2 = repositoryService.createDeployment(application2.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// third deployment
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
assertEquals(3, testProvider.countDefinitionsByKey(definitionKey1));
assertEquals(2, testProvider.countDefinitionsByKey(definitionKey2));
// when (1)
testProvider.createInstanceByDefinitionKey(definitionKey1);
// then (1)
assertFalse(application1.isCalled());
assertTrue(application2.isCalled());
// reset flag
application2.setCalled(false);
// when (2)
testProvider.createInstanceByDefinitionKey(definitionKey2);
// then (2)
assertTrue(application1.isCalled());
assertFalse(application2.isCalled());
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentProcessApplicationTest method definitionTwoPreviousDeploymentUnregisterSecondPA.
@Test
public void definitionTwoPreviousDeploymentUnregisterSecondPA() {
// given
// first deployment
MyEmbeddedProcessApplication application1 = new MyEmbeddedProcessApplication();
Deployment deployment1 = repositoryService.createDeployment(application1.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
MyEmbeddedProcessApplication application2 = new MyEmbeddedProcessApplication();
Deployment deployment2 = repositoryService.createDeployment(application2.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
Deployment deployment3 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
assertEquals(3, testProvider.countDefinitionsByKey(definitionKey1));
// when
managementService.unregisterProcessApplication(deployment2.getId(), true);
testProvider.createInstanceByDefinitionKey(definitionKey1);
// then
assertTrue(application1.isCalled());
assertFalse(application2.isCalled());
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentProcessApplicationTest method definitionOnePreviousDeploymentWithPA.
@Test
public void definitionOnePreviousDeploymentWithPA() {
// given
MyEmbeddedProcessApplication application = new MyEmbeddedProcessApplication();
// first deployment
Deployment deployment1 = repositoryService.createDeployment(application.getReference()).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
assertEquals(2, testProvider.countDefinitionsByKey(definitionKey1));
// when
testProvider.createInstanceByDefinitionKey(definitionKey1);
// then
assertTrue(application.isCalled());
deleteDeployments(deployment1, deployment2);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationNotFoundWhenDeletingDeployment.
@Test
public void registrationNotFoundWhenDeletingDeployment() {
// given
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
ProcessApplicationReference reference2 = processApplication.getReference();
Deployment deployment2 = repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
// when (1)
// third deployment
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
// then (1)
assertEquals(reference2, getProcessApplicationForDefinition(firstDefinitionId));
// when (2)
deleteDeployment(deployment2);
// then (2)
assertNull(getProcessApplicationForDefinition(firstDefinitionId));
}
Aggregations