use of org.camunda.bpm.engine.TaskService in project camunda-bpm-platform by camunda.
the class ProcessEngineRuleParameterizedJunit4Test method ruleUsageExampleWithNamedAnnotation.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleParameterizedJunit4Test.ruleUsageExample.bpmn20.xml")
public void ruleUsageExampleWithNamedAnnotation() {
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 FilterRestServiceInteractionTest method setUpRuntimeData.
@Before
@SuppressWarnings("unchecked")
public void setUpRuntimeData() {
filterServiceMock = mock(FilterService.class);
when(processEngine.getFilterService()).thenReturn(filterServiceMock);
FilterQuery filterQuery = MockProvider.createMockFilterQuery();
when(filterServiceMock.createFilterQuery()).thenReturn(filterQuery);
filterMock = MockProvider.createMockFilter();
when(filterServiceMock.newTaskFilter()).thenReturn(filterMock);
when(filterServiceMock.saveFilter(eq(filterMock))).thenReturn(filterMock);
when(filterServiceMock.getFilter(eq(EXAMPLE_FILTER_ID))).thenReturn(filterMock);
when(filterServiceMock.getFilter(eq(MockProvider.NON_EXISTING_ID))).thenReturn(null);
List<Object> mockTasks = Collections.<Object>singletonList(new TaskEntity());
when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID))).thenReturn(mockTasks.get(0));
when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID), any(Query.class))).thenReturn(mockTasks.get(0));
when(filterServiceMock.list(eq(EXAMPLE_FILTER_ID))).thenReturn(mockTasks);
when(filterServiceMock.list(eq(EXAMPLE_FILTER_ID), any(Query.class))).thenReturn(mockTasks);
when(filterServiceMock.listPage(eq(EXAMPLE_FILTER_ID), anyInt(), anyInt())).thenReturn(mockTasks);
when(filterServiceMock.listPage(eq(EXAMPLE_FILTER_ID), any(Query.class), anyInt(), anyInt())).thenReturn(mockTasks);
when(filterServiceMock.count(eq(EXAMPLE_FILTER_ID))).thenReturn((long) 1);
when(filterServiceMock.count(eq(EXAMPLE_FILTER_ID), any(Query.class))).thenReturn((long) 1);
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).singleResult(eq(MockProvider.NON_EXISTING_ID));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).singleResult(eq(MockProvider.NON_EXISTING_ID), any(Query.class));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).list(eq(MockProvider.NON_EXISTING_ID));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).list(eq(MockProvider.NON_EXISTING_ID), any(Query.class));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).listPage(eq(MockProvider.NON_EXISTING_ID), anyInt(), anyInt());
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).listPage(eq(MockProvider.NON_EXISTING_ID), any(Query.class), anyInt(), anyInt());
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).count(eq(MockProvider.NON_EXISTING_ID));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).count(eq(MockProvider.NON_EXISTING_ID), any(Query.class));
doThrow(new NullValueException("No filter found with given id")).when(filterServiceMock).deleteFilter(eq(MockProvider.NON_EXISTING_ID));
authorizationServiceMock = mock(AuthorizationServiceImpl.class);
identityServiceMock = mock(IdentityServiceImpl.class);
processEngineConfigurationMock = mock(ProcessEngineConfiguration.class);
when(processEngine.getAuthorizationService()).thenReturn(authorizationServiceMock);
when(processEngine.getIdentityService()).thenReturn(identityServiceMock);
when(processEngine.getProcessEngineConfiguration()).thenReturn(processEngineConfigurationMock);
TaskService taskService = processEngine.getTaskService();
when(taskService.createTaskQuery()).thenReturn(new TaskQueryImpl());
variableInstanceQueryMock = mock(VariableInstanceQuery.class);
when(processEngine.getRuntimeService().createVariableInstanceQuery()).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.variableScopeIdIn((String) anyVararg())).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.variableNameIn((String) anyVararg())).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.disableBinaryFetching()).thenReturn(variableInstanceQueryMock);
when(variableInstanceQueryMock.disableCustomObjectDeserialization()).thenReturn(variableInstanceQueryMock);
}
Aggregations