Search in sources :

Example 71 with RuntimeService

use of org.activiti.engine.RuntimeService in project Activiti by Activiti.

the class ActivitiRuleJunit4Test method ruleUsageExample.

@Test
@Deployment
public void ruleUsageExample() {
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    runtimeService.startProcessInstanceByKey("ruleUsage");
    TaskService taskService = activitiRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertThat(task.getName()).isEqualTo("My Task");
    taskService.complete(task.getId());
    assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0);
}
Also used : Task(org.activiti.engine.task.Task) RuntimeService(org.activiti.engine.RuntimeService) TaskService(org.activiti.engine.TaskService) Test(org.junit.Test) Deployment(org.activiti.engine.test.Deployment)

Example 72 with RuntimeService

use of org.activiti.engine.RuntimeService in project Activiti by Activiti.

the class GetVariableLocalTask method execute.

@Override
public void execute(DelegateExecution execution) {
    RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService();
    runtimeService.getVariableLocal(execution.getProcessInstanceId(), "Variable-That-Does-Not-Exist");
}
Also used : RuntimeService(org.activiti.engine.RuntimeService)

Example 73 with RuntimeService

use of org.activiti.engine.RuntimeService in project Activiti by Activiti.

the class StartProcessInstanceTestDelegate method execute.

public void execute(DelegateExecution execution) {
    RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService();
    runtimeService.startProcessInstanceByKey("oneTaskProcess");
}
Also used : RuntimeService(org.activiti.engine.RuntimeService)

Example 74 with RuntimeService

use of org.activiti.engine.RuntimeService in project Activiti by Activiti.

the class StartProcessInstanceTestDelegate method execute.

public void execute(DelegateExecution execution) {
    RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService();
    runtimeService.startProcessInstanceByKey("oneTaskProcess");
}
Also used : RuntimeService(org.activiti.engine.RuntimeService)

Example 75 with RuntimeService

use of org.activiti.engine.RuntimeService in project tutorials by eugenp.

the class ProcessExecutionIntegrationTest method givenProcessDefinition_whenStartProcessInstance_thenProcessRunning.

@Test
public void givenProcessDefinition_whenStartProcessInstance_thenProcessRunning() {
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RepositoryService repositoryService = processEngine.getRepositoryService();
    repositoryService.createDeployment().addClasspathResource("org/activiti/test/vacationRequest.bpmn20.xml").deploy();
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("employeeName", "Kermit");
    variables.put("numberOfDays", new Integer(4));
    variables.put("vacationMotivation", "I'm really tired!");
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("vacationRequest", variables);
    Long count = runtimeService.createProcessInstanceQuery().count();
    assertTrue(count >= 1);
}
Also used : HashMap(java.util.HashMap) RuntimeService(org.activiti.engine.RuntimeService) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) ProcessEngine(org.activiti.engine.ProcessEngine) RepositoryService(org.activiti.engine.RepositoryService) Test(org.junit.Test)

Aggregations

RuntimeService (org.activiti.engine.RuntimeService)77 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)32 ProcessEngine (org.activiti.engine.ProcessEngine)16 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)15 Test (org.junit.Test)14 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)14 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)13 RestVariable (org.wso2.carbon.bpmn.rest.engine.variable.RestVariable)12 RepositoryService (org.activiti.engine.RepositoryService)10 TaskService (org.activiti.engine.TaskService)10 HashMap (java.util.HashMap)8 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)8 ArrayList (java.util.ArrayList)7 Path (javax.ws.rs.Path)7 HistoricProcessInstanceQuery (org.activiti.engine.history.HistoricProcessInstanceQuery)7 Execution (org.activiti.engine.runtime.Execution)7 Produces (javax.ws.rs.Produces)6 Task (org.activiti.engine.task.Task)6 BPMNInstance (org.wso2.carbon.bpmn.core.mgt.model.BPMNInstance)6 ActivitiException (org.activiti.engine.ActivitiException)5