Search in sources :

Example 6 with Deployment

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);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 7 with Deployment

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);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 8 with Deployment

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);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 9 with Deployment

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);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 10 with Deployment

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));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Aggregations

Deployment (org.camunda.bpm.engine.repository.Deployment)137 Test (org.junit.Test)62 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)39 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)36 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)19 Resource (org.camunda.bpm.engine.repository.Resource)19 InputStream (java.io.InputStream)14 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)11 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)11 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)10 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)8 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Job (org.camunda.bpm.engine.runtime.Job)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2