Java Code Examples for org.activiti.engine.RuntimeService#deleteProcessInstance()

The following examples show how to use org.activiti.engine.RuntimeService#deleteProcessInstance() . 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: MuleHttpTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void http() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment()
      .addClasspathResource("org/activiti5/mule/testHttp.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(20, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 2
Source File: MuleHttpBasicAuthTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void httpWithBasicAuth() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService()
      .createDeployment()
      .addClasspathResource("org/activiti5/mule/testHttpBasicAuth.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(10, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 3
Source File: MuleVMTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void send() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  RepositoryService repositoryService = processEngine.getRepositoryService();
  Deployment deployment = repositoryService.createDeployment()
      .addClasspathResource("org/activiti5/mule/testVM.bpmn20.xml")
      .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE)
      .deploy();

  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(30, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");

  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  repositoryService.deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 4
Source File: MuleHttpTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void http() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttp.bpmn20.xml").deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(20, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 5
Source File: MuleHttpBasicAuthTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void httpWithBasicAuth() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  Deployment deployment = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/activiti/mule/testHttpBasicAuth.bpmn20.xml").deploy();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(10, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");
  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  processEngine.getRepositoryService().deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 6
Source File: MuleVMTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Test
public void send() throws Exception {
  Assert.assertTrue(muleContext.isStarted());

  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
  RepositoryService repositoryService = processEngine.getRepositoryService();
  Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/mule/testVM.bpmn20.xml").deploy();

  RuntimeService runtimeService = processEngine.getRuntimeService();
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
  Assert.assertFalse(processInstance.isEnded());
  Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
  Assert.assertEquals(30, result);
  runtimeService.deleteProcessInstance(processInstance.getId(), "test");

  processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
  repositoryService.deleteDeployment(deployment.getId());
  assertAndEnsureCleanDb(processEngine);
  ProcessEngines.destroy();
}
 
Example 7
Source File: ActivitiSmokeTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void testDeploy() throws Exception
    {
        ProcessEngine engine = buildProcessEngine();

        RepositoryService repoService = engine.getRepositoryService();

        Deployment deployment = deployDefinition(repoService);

        assertNotNull(deployment);

        RuntimeService runtimeService = engine.getRuntimeService();
        try
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey("testTask");
            assertNotNull(instance);
            
            String instanceId = instance.getId();
            ProcessInstance instanceInDb = findProcessInstance(runtimeService, instanceId);
            assertNotNull(instanceInDb);
            runtimeService.deleteProcessInstance(instanceId, "");
        }
        finally
        {
            
//            List<Deployment> deployments = repoService.createDeploymentQuery().list();
//            for (Deployment deployment2 : deployments)
//            {
//                repoService.deleteDeployment(deployment2.getId());
//            }
            
            repoService.deleteDeployment(deployment.getId());
        }
    }
 
Example 8
Source File: ActivitiTestBase.java    From crnk-framework with Apache License 2.0 5 votes vote down vote up
@After
public void teardown() {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list();
    for (ProcessInstance processInstance : processInstances) {
        runtimeService.deleteProcessInstance(processInstance.getId(), "");
    }

    TaskService taskService = processEngine.getTaskService();
    List<Task> tasks = taskService.createTaskQuery().list();
    for (Task task : tasks) {
        taskService.deleteTask(task.getId());
    }
}
 
Example 9
Source File: ConsoleController.java    From lemon with Apache License 2.0 5 votes vote down vote up
/**
 * 删除流程实例.
 */
@RequestMapping("console-removeProcessInstance")
public String removeProcessInstance(
        @RequestParam("processInstanceId") String processInstanceId,
        @RequestParam("deleteReason") String deleteReason) {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    runtimeService.deleteProcessInstance(processInstanceId, deleteReason);

    return "redirect:/bpm/console-listProcessInstances.do";
}