Search in sources :

Example 11 with ProcessApplicationService

use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.

the class TestWarDeploymentResumePreviousOnProcessDefinitionKey method testDeployProcessArchive.

@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
    assertThat(processEngine, is(notNullValue()));
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
    assertThat(count, is(2L));
    // validate registrations:
    ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
    Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
    // we have two PAs, one from the first deployment and one from the second and only one (the second) is allowed to have two deployments
    boolean resumedRegistrationFound = false;
    for (String paName : processApplicationNames) {
        ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
        List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
        if (deploymentInfo.size() == 2) {
            if (resumedRegistrationFound) {
                fail("Cannot have two registrations");
            }
            resumedRegistrationFound = true;
        }
    }
    assertThat("Previous version of the deployment was not resumed", resumedRegistrationFound, is(true));
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationService(org.camunda.bpm.ProcessApplicationService) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) RepositoryService(org.camunda.bpm.engine.RepositoryService) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Aggregations

ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)11 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)10 Test (org.junit.Test)8 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)7 RepositoryService (org.camunda.bpm.engine.RepositoryService)6 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)6 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)5 RuntimeContainerDelegate (org.camunda.bpm.container.RuntimeContainerDelegate)3 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)3 Before (org.junit.Before)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Response (com.jayway.restassured.response.Response)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 FormService (org.camunda.bpm.engine.FormService)1 HistoryService (org.camunda.bpm.engine.HistoryService)1 IdentityService (org.camunda.bpm.engine.IdentityService)1