Search in sources :

Example 16 with RepositoryService

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

the class UpgradedDBDropper method cleanDatabase.

public void cleanDatabase(ProcessEngine engine) {
    // delete all deployments
    RepositoryService repositoryService = engine.getRepositoryService();
    List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
    for (Deployment deployment : deployments) {
        repositoryService.deleteDeployment(deployment.getId(), true);
    }
    // drop DB
    ((ProcessEngineImpl) engine).getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(new Command<Void>() {

        public Void execute(CommandContext commandContext) {
            commandContext.getDbSqlSession().dbSchemaDrop();
            return null;
        }
    });
    engine.close();
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 17 with RepositoryService

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

the class TestJarDeployment method testDeployProcessArchive.

@Test
public void testDeployProcessArchive() {
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").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 18 with RepositoryService

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

the class TestWarDeploymentEmptyProcessesXml method testDeployProcessArchive.

@Test
public void testDeployProcessArchive() {
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").list();
    Assert.assertEquals(1, processDefinitions.size());
    org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(processDefinitions.get(0).getDeploymentId()).singleResult();
    Set<String> registeredProcessApplications = BpmPlatform.getProcessApplicationService().getProcessApplicationNames();
    boolean containsProcessApplication = false;
    // the process application name is used as name for the db deployment
    for (String appName : registeredProcessApplications) {
        if (appName.equals(deployment.getName())) {
            containsProcessApplication = true;
        }
    }
    assertTrue(containsProcessApplication);
    // manually delete process definition here (to clean up)
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) RepositoryService(org.camunda.bpm.engine.RepositoryService) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

Example 19 with RepositoryService

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

the class TestWarDeploymentResumePrevious method testDeployProcessArchive.

@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
    Assert.assertEquals(2, count);
    // validate registrations:
    ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
    Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
    boolean resumedRegistrationFound = false;
    for (String paName : processApplicationNames) {
        ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
        List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
        if (deploymentInfo.size() == 2) {
            if (resumedRegistrationFound) {
                Assert.fail("Cannot have two registrations");
            }
            resumedRegistrationFound = true;
        }
    }
    Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);
}
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 20 with RepositoryService

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

the class TestResourceName method testResourceName.

@Test
public void testResourceName() {
    ProcessEngine processEngine = ProgrammaticBeanLookup.lookup(ProcessEngine.class);
    Assert.assertNotNull(processEngine);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
    ProcessDefinition definition = query.processDefinitionKey("process-0").singleResult();
    Assert.assertEquals("process0.bpmn", definition.getResourceName());
    definition = query.processDefinitionKey("process-1").singleResult();
    Assert.assertEquals("processes/process1.bpmn", definition.getResourceName());
    definition = query.processDefinitionKey("process-2").singleResult();
    Assert.assertEquals("process2.bpmn", definition.getResourceName());
    definition = query.processDefinitionKey("process-3").singleResult();
    Assert.assertEquals("subDirectory/process3.bpmn", definition.getResourceName());
    definition = query.processDefinitionKey("process-4").singleResult();
    Assert.assertEquals("process4.bpmn", definition.getResourceName());
    definition = query.processDefinitionKey("process-5").singleResult();
    Assert.assertEquals("subDirectory/process5.bpmn", definition.getResourceName());
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) RepositoryService(org.camunda.bpm.engine.RepositoryService) Test(org.junit.Test) AbstractFoxPlatformIntegrationTest(org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)

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