Java Code Examples for org.camunda.bpm.engine.RepositoryService#deleteDeployment()
The following examples show how to use
org.camunda.bpm.engine.RepositoryService#deleteDeployment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpgradedDBDropper.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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(); }
Example 2
Source File: DeploymentResourceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public void deleteDeployment(String deploymentId, UriInfo uriInfo) { RepositoryService repositoryService = getProcessEngine().getRepositoryService(); Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(); if (deployment == null) { throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' do not exist"); } boolean cascade = isQueryPropertyEnabled(uriInfo, CASCADE); boolean skipCustomListeners = isQueryPropertyEnabled(uriInfo, "skipCustomListeners"); boolean skipIoMappings = isQueryPropertyEnabled(uriInfo, "skipIoMappings"); repositoryService.deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings); }
Example 3
Source File: TestWarDeploymentEmptyProcessesXml.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@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); }
Example 4
Source File: UndeployProcessArchiveStep.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void deleteDeployment(String deploymentId, RepositoryService repositoryService) { repositoryService.deleteDeployment(deploymentId, true, true); }
Example 5
Source File: RepositoryServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void testDeployRevisedProcessAfterDeleteOnOtherProcessEngine() { // Setup both process engines ProcessEngine processEngine1 = new StandaloneProcessEngineConfiguration() .setProcessEngineName("reboot-test-schema") .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE) .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000") .setJobExecutorActivate(false) .buildProcessEngine(); RepositoryService repositoryService1 = processEngine1.getRepositoryService(); ProcessEngine processEngine2 = new StandaloneProcessEngineConfiguration() .setProcessEngineName("reboot-test") .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE) .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000") .setJobExecutorActivate(false) .buildProcessEngine(); RepositoryService repositoryService2 = processEngine2.getRepositoryService(); RuntimeService runtimeService2 = processEngine2.getRuntimeService(); TaskService taskService2 = processEngine2.getTaskService(); // Deploy first version of process: start->originalTask->end on first process engine String deploymentId = repositoryService1.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v1.bpmn20.xml") .deploy() .getId(); // Start process instance on second engine String processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId(); runtimeService2.startProcessInstanceById(processDefinitionId); Task task = taskService2.createTaskQuery().singleResult(); assertEquals("original task", task.getName()); // Delete the deployment on second process engine repositoryService2.deleteDeployment(deploymentId, true); assertEquals(0, repositoryService2.createDeploymentQuery().count()); assertEquals(0, runtimeService2.createProcessInstanceQuery().count()); // deploy a revised version of the process: start->revisedTask->end on first process engine // // Before the bugfix, this would set the cache on the first process engine, // but the second process engine still has the original process definition in his cache. // Since there is a deployment delete in between, the new generated process definition id is the same // as in the original deployment, making the second process engine using the old cached process definition. deploymentId = repositoryService1.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v2.bpmn20.xml") .deploy() .getId(); // Start process instance on second process engine -> must use revised process definition processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId(); runtimeService2.startProcessInstanceByKey("oneTaskProcess"); task = taskService2.createTaskQuery().singleResult(); assertEquals("revised task", task.getName()); // cleanup repositoryService1.deleteDeployment(deploymentId, true); processEngine1.close(); processEngine2.close(); }