use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class ProcessEngineTestRule method completeTask.
public void completeTask(String taskKey) {
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().taskDefinitionKey(taskKey).singleResult();
assertNotNull("Expected a task with key '" + taskKey + "' to exist", task);
taskService.complete(task.getId());
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class ProcessEngineTestRule method completeAnyTask.
public void completeAnyTask(String taskKey) {
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery().taskDefinitionKey(taskKey).list();
assertTrue(!tasks.isEmpty());
taskService.complete(tasks.get(0).getId());
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class ProcessEngineRuleParameterizedJunit4Test method ruleUsageExample.
/**
* Unnamed @Deployment annotations don't work with parameterized Unit tests
*/
@Ignore
@Test
@Deployment
public void ruleUsageExample() {
RuntimeService runtimeService = engineRule.getRuntimeService();
runtimeService.startProcessInstanceByKey("ruleUsage");
TaskService taskService = engineRule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class BusinessProcessBeanTest method testGetVariableLocal.
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/BusinessProcessBeanTest.test.bpmn20.xml")
public void testGetVariableLocal() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
ProcessInstance processInstance = businessProcess.startProcessByKey("businessProcessBeanTest");
TaskService taskService = getBeanInstance(TaskService.class);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task);
businessProcess.startTask(task.getId());
businessProcess.setVariableLocal("aVariableName", "aVariableValue");
// Flushing and re-getting should retain the value (CAM-1806):
businessProcess.flushVariableCache();
assertTrue(businessProcess.getCachedLocalVariableMap().isEmpty());
assertEquals("aVariableValue", businessProcess.getVariableLocal("aVariableName"));
}
use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class MockedProcessEngineProvider method mockServices.
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);
ExternalTaskService externalTaskService = mock(ExternalTaskService.class);
when(engine.getRepositoryService()).thenReturn(repoService);
when(engine.getIdentityService()).thenReturn(identityService);
when(engine.getTaskService()).thenReturn(taskService);
when(engine.getRuntimeService()).thenReturn(runtimeService);
when(engine.getFormService()).thenReturn(formService);
when(engine.getHistoryService()).thenReturn(historyService);
when(engine.getManagementService()).thenReturn(managementService);
when(engine.getCaseService()).thenReturn(caseService);
when(engine.getFilterService()).thenReturn(filterService);
when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
Aggregations