Search in sources :

Example 41 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class TestWarDeploymentResumePreviousOnDeploymentName method testDeployProcessArchive.

@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
    assertThat(processEngine, is(notNullValue()));
    RepositoryService repositoryService = processEngine.getRepositoryService();
    // since we have two processes deployed for PA2 we gotta check that both are present
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
    assertThat(count, is(1L));
    count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testProcess").count();
    assertThat(count, is(1L));
    // 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)

Example 42 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class TestCustomProcessesXmlFileLocation method testDeployProcessArchive.

@Test
public void testDeployProcessArchive() {
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("invoice-it").count();
    Assert.assertEquals(1, count);
}
Also used : RepositoryService(org.camunda.bpm.engine.RepositoryService) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest) Test(org.junit.Test)

Example 43 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class TestFoxPlatformClientAsEjbModule_pasAsEjbModule method testPaAsEjbModule.

@Test
public void testPaAsEjbModule() {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("paAsEjbModule-process").count();
    Assert.assertEquals(1, count);
}
Also used : ProcessEngine(org.camunda.bpm.engine.ProcessEngine) RepositoryService(org.camunda.bpm.engine.RepositoryService) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 44 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class TestFoxPlatformClientAsLibInWebModule method testDeployProcessArchive.

@Test
public void testDeployProcessArchive() {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
    Assert.assertEquals(1, count);
}
Also used : ProcessEngine(org.camunda.bpm.engine.ProcessEngine) RepositoryService(org.camunda.bpm.engine.RepositoryService) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest) Test(org.junit.Test)

Example 45 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class DeploymentAwareJobExecutorTest method deployAndInstantiateWithNewEngineConfiguration.

private String deployAndInstantiateWithNewEngineConfiguration(String resource) {
    // 1. create another process engine
    try {
        otherProcessEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml").buildProcessEngine();
    } catch (RuntimeException ex) {
        if (ex.getCause() != null && ex.getCause() instanceof FileNotFoundException) {
            otherProcessEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
        } else {
            throw ex;
        }
    }
    // 2. deploy again
    RepositoryService otherRepositoryService = otherProcessEngine.getRepositoryService();
    String deploymentId = otherRepositoryService.createDeployment().addClasspathResource(resource).deploy().getId();
    // 3. start instance (i.e. create job)
    ProcessDefinition newDefinition = otherRepositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
    otherProcessEngine.getRuntimeService().startProcessInstanceById(newDefinition.getId());
    return deploymentId;
}
Also used : FileNotFoundException(java.io.FileNotFoundException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Aggregations

RepositoryService (org.camunda.bpm.engine.RepositoryService)57 Test (org.junit.Test)24 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)23 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)13 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)10 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)9 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)8 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)6 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)5 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)5 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)5 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)4 RuntimeService (org.camunda.bpm.engine.RuntimeService)4 Deployment (org.camunda.bpm.engine.repository.Deployment)4 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)4 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)3 NotValidException (org.camunda.bpm.engine.exception.NotValidException)3