Examples of RuntimeService


Examples of org.activiti.engine.RuntimeService

    private static final String PROCESS_IDS = "process_ids";

    @Test
    public void testWithAListOfEndedProcesses() throws Exception {
        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ true),
            "2", mockProcessInstance(/* ended= */ true)
        ));
        verify(runtimeService, never()).deleteProcessInstance(anyString(), anyString());
    }
View Full Code Here

Examples of org.activiti.engine.RuntimeService

        verify(runtimeService, never()).deleteProcessInstance(anyString(), anyString());
    }

    @Test
    public void testWithAListOfActiveProcesses() throws Exception {
        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ false),
            "2", mockProcessInstance(/* ended= */ false)
        ));
        verify(runtimeService, times(2)).deleteProcessInstance(anyString(), anyString());
    }
View Full Code Here

Examples of org.activiti.engine.RuntimeService

        verify(runtimeService, times(2)).deleteProcessInstance(anyString(), anyString());
    }

    @Test
    public void testWithAListOfActiveAndInactiveProcesses() throws Exception {
        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "2"), ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ true),
            "2", mockProcessInstance(/* ended= */ false)
        ));

        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
View Full Code Here

Examples of org.activiti.engine.RuntimeService

        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
    }

    @Test
    public void testWithAListOfActiveAndInvalidProcesses() throws Exception {
        RuntimeService runtimeService = runTest(Lists.newArrayList("1", "invalid"), ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ false)));
        verify(runtimeService, times(1)).deleteProcessInstance(anyString(), anyString());
    }
View Full Code Here

Examples of org.activiti.engine.RuntimeService

        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(processIds);

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(processMap, "invalid");

        JavaDelegate delegate = new KillMachineSetUpProcesses(runtimeService, PROCESS_IDS);
        delegate.execute(execution);

        return runtimeService;
View Full Code Here

Examples of org.activiti.engine.RuntimeService

     *
     * @see <a href="http://www.activiti.org/userguide/index.html#bpmnSignalEventDefinition" />
     * @see CoreSignals
     */
    protected void triggerSignalEvent(ProcessEngine processEngine, String businessKey, String signalName) {
        RuntimeService runtimeService = processEngine.getRuntimeService();

        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
            .processInstanceBusinessKey(businessKey).singleResult();

        List<Execution> executions = runtimeService.createExecutionQuery()
            .processInstanceId(processInstance.getProcessInstanceId())
            .signalEventSubscriptionName(signalName).list();

        if (executions.isEmpty()) {
            throw new NoSuchElementException(String.format("No executions found waiting " +
                "for signal '%s' on process %s", signalName, businessKey));
        }
        for (Execution execution : executions) {
            LOG.info("Sending '{}' signal to execution {} for process {}",
                new Object[]{signalName, execution.getId(), businessKey});
            runtimeService.signalEventReceived(signalName, execution.getId());

        }
    }
View Full Code Here

Examples of org.activiti.engine.RuntimeService

        when(execution.getVariable(eq(PROCESS_IDS))).thenReturn(Lists.newArrayList("1", "2"));

        ProcessVariablesCollector collector = new ProcessVariablesCollector();
        collector.install(execution);

        RuntimeService runtimeService = mockRuntimeService(ImmutableMap.of(
            "1", mockProcessInstance(/* ended= */ true),
            "2", mockProcessInstance(/* ended= */ true)
        ));

        JavaDelegate delegate = new CheckProcessesEnded(runtimeService, PROCESS_IDS, RESULT);
View Full Code Here

Examples of org.camunda.bpm.engine.RuntimeService

  private void mockServices(ProcessEngine engine) {
    RepositoryService repoService = mock(RepositoryService.class);
    IdentityService identityService = mock(IdentityService.class);
    TaskService taskService = mock(TaskService.class);
    RuntimeService runtimeService = mock(RuntimeService.class);
    FormService formService = mock(FormService.class);
    HistoryService historyService = mock(HistoryService.class);
    ManagementService managementService = mock(ManagementService.class);
    CaseService caseService = mock(CaseService.class);
    FilterService filterService = mock(FilterService.class);
View Full Code Here

Examples of org.camunda.bpm.engine.RuntimeService

      String businessKey = this.processBusinessKey(invocation);

      log.info("variables for the started process: " + vars.toString());

      RuntimeService runtimeService = this.processEngine.getRuntimeService();
      ProcessInstance pi ;
      if (null != businessKey && StringUtils.hasText(businessKey)) {
        pi = runtimeService.startProcessInstanceByKey(processKey, businessKey, vars);
        log.info("the business key for the started process is '" + businessKey + "' ");
      } else {
        pi = runtimeService.startProcessInstanceByKey(processKey, vars);
      }

      String pId = pi.getId();

      if (invocation.getMethod().getReturnType().equals(void.class))
View Full Code Here

Examples of org.camunda.bpm.engine.RuntimeService

      .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/cache/originalProcess.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/cache/revisedProcess.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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.