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();
}
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);
}
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);
}
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);
}
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());
}
Aggregations