use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithCandidateGroupQuery.
@Test
public void testGetFilterWithCandidateGroupQuery() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateGroup("abc");
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.candidateGroup", equalTo("abc")).body("query.containsKey('candidateGroups')", is(false)).body("query.containsKey('includeAssignedTasks')", is(false)).when().get(SINGLE_FILTER_URL);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithAllPropertiesSorting.
@Test
public void testGetFilterWithAllPropertiesSorting() {
TaskQuery query = new TaskQueryImpl().orderByProcessInstanceId().asc().orderByCaseInstanceId().asc().orderByDueDate().asc().orderByFollowUpDate().asc().orderByExecutionId().asc().orderByCaseExecutionId().asc().orderByTaskAssignee().asc().orderByTaskCreateTime().asc().orderByTaskDescription().asc().orderByTaskId().asc().orderByTaskName().asc().orderByTaskNameCaseInsensitive().asc().orderByTaskPriority().asc().orderByTenantId().asc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(14);
assertSorting(sortings.get(0), SORT_BY_PROCESS_INSTANCE_ID_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(1), SORT_BY_CASE_INSTANCE_ID_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(2), SORT_BY_DUE_DATE_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(3), SORT_BY_FOLLOW_UP_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(4), SORT_BY_EXECUTION_ID_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(5), SORT_BY_CASE_EXECUTION_ID_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(6), SORT_BY_ASSIGNEE_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(7), SORT_BY_CREATE_TIME_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(8), SORT_BY_DESCRIPTION_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(9), SORT_BY_ID_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(10), SORT_BY_NAME_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(11), SORT_BY_NAME_CASE_INSENSITIVE_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(12), SORT_BY_PRIORITY_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(13), SORT_BY_TENANT_ID_VALUE, SORT_ORDER_ASC_VALUE);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithCandidateUserQuery.
@Test
public void testGetFilterWithCandidateUserQuery() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateUser("abc");
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.candidateUser", equalTo("abc")).body("query.containsKey('candidateGroups')", is(false)).body("query.containsKey('includeAssignedTasks')", is(false)).when().get(SINGLE_FILTER_URL);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithTaskQuery.
@Test
public void testGetFilterWithTaskQuery() {
TaskQueryImpl query = mock(TaskQueryImpl.class);
when(query.getAssignee()).thenReturn(MockProvider.EXAMPLE_TASK_ASSIGNEE_NAME);
when(query.getAssigneeLike()).thenReturn(MockProvider.EXAMPLE_TASK_ASSIGNEE_NAME);
when(query.getCaseDefinitionId()).thenReturn(MockProvider.EXAMPLE_CASE_DEFINITION_ID);
when(query.getCaseDefinitionKey()).thenReturn(MockProvider.EXAMPLE_CASE_DEFINITION_KEY);
when(query.getCaseDefinitionName()).thenReturn(MockProvider.EXAMPLE_CASE_DEFINITION_NAME);
when(query.getCaseDefinitionNameLike()).thenReturn(MockProvider.EXAMPLE_CASE_DEFINITION_NAME_LIKE);
when(query.getCaseExecutionId()).thenReturn(MockProvider.EXAMPLE_CASE_EXECUTION_ID);
when(query.getCaseInstanceBusinessKey()).thenReturn(MockProvider.EXAMPLE_CASE_INSTANCE_BUSINESS_KEY);
when(query.getCaseInstanceBusinessKeyLike()).thenReturn(MockProvider.EXAMPLE_CASE_INSTANCE_BUSINESS_KEY_LIKE);
when(query.getCaseInstanceId()).thenReturn(MockProvider.EXAMPLE_CASE_INSTANCE_ID);
when(query.getCandidateUser()).thenReturn(MockProvider.EXAMPLE_USER_ID);
when(query.getCandidateGroup()).thenReturn(MockProvider.EXAMPLE_GROUP_ID);
when(query.getProcessInstanceBusinessKey()).thenReturn(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY);
when(query.getProcessInstanceBusinessKeyLike()).thenReturn(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY_LIKE);
when(query.getProcessDefinitionKey()).thenReturn(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY);
when(query.getProcessDefinitionKeys()).thenReturn(new String[] { MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY });
when(query.getProcessDefinitionId()).thenReturn(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
when(query.getExecutionId()).thenReturn(MockProvider.EXAMPLE_EXECUTION_ID);
when(query.getProcessDefinitionName()).thenReturn(MockProvider.EXAMPLE_PROCESS_DEFINITION_NAME);
when(query.getProcessDefinitionNameLike()).thenReturn(MockProvider.EXAMPLE_PROCESS_DEFINITION_NAME_LIKE);
when(query.getProcessInstanceId()).thenReturn(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
when(query.getKey()).thenReturn(MockProvider.EXAMPLE_TASK_DEFINITION_KEY);
when(query.getKeys()).thenReturn(new String[] { MockProvider.EXAMPLE_TASK_DEFINITION_KEY, MockProvider.EXAMPLE_TASK_DEFINITION_KEY });
when(query.getKeyLike()).thenReturn(MockProvider.EXAMPLE_TASK_DEFINITION_KEY);
when(query.getDescription()).thenReturn(MockProvider.EXAMPLE_TASK_DESCRIPTION);
when(query.getDescriptionLike()).thenReturn(MockProvider.EXAMPLE_TASK_DESCRIPTION);
when(query.getInvolvedUser()).thenReturn(MockProvider.EXAMPLE_USER_ID);
when(query.getPriority()).thenReturn(1);
when(query.getMaxPriority()).thenReturn(2);
when(query.getMinPriority()).thenReturn(3);
when(query.getName()).thenReturn(MockProvider.EXAMPLE_TASK_NAME);
when(query.getNameLike()).thenReturn(MockProvider.EXAMPLE_TASK_NAME);
when(query.getOwner()).thenReturn(MockProvider.EXAMPLE_TASK_OWNER);
when(query.getParentTaskId()).thenReturn(MockProvider.EXAMPLE_TASK_PARENT_TASK_ID);
when(query.getTenantIds()).thenReturn(MockProvider.EXAMPLE_TENANT_ID_LIST.split(","));
when(query.isTenantIdSet()).thenReturn(true);
filterMock = MockProvider.createMockFilter(EXAMPLE_FILTER_ID, query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filterMock);
given().pathParam("id", MockProvider.EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.assignee", equalTo(MockProvider.EXAMPLE_TASK_ASSIGNEE_NAME)).body("query.assigneeLike", equalTo(MockProvider.EXAMPLE_TASK_ASSIGNEE_NAME)).body("query.caseDefinitionId", equalTo(MockProvider.EXAMPLE_CASE_DEFINITION_ID)).body("query.caseDefinitionKey", equalTo(MockProvider.EXAMPLE_CASE_DEFINITION_KEY)).body("query.caseDefinitionName", equalTo(MockProvider.EXAMPLE_CASE_DEFINITION_NAME)).body("query.caseDefinitionNameLike", equalTo(MockProvider.EXAMPLE_CASE_DEFINITION_NAME_LIKE)).body("query.caseExecutionId", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ID)).body("query.caseInstanceBusinessKey", equalTo(MockProvider.EXAMPLE_CASE_INSTANCE_BUSINESS_KEY)).body("query.caseInstanceBusinessKeyLike", equalTo(MockProvider.EXAMPLE_CASE_INSTANCE_BUSINESS_KEY_LIKE)).body("query.caseInstanceId", equalTo(MockProvider.EXAMPLE_CASE_INSTANCE_ID)).body("query.candidateUser", equalTo(MockProvider.EXAMPLE_USER_ID)).body("query.candidateGroup", equalTo(MockProvider.EXAMPLE_GROUP_ID)).body("query.processInstanceBusinessKey", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY)).body("query.processInstanceBusinessKeyLike", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY_LIKE)).body("query.processDefinitionKey", equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY)).body("query.processDefinitionKeyIn", hasItems(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY)).body("query.processDefinitionId", equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).body("query.executionId", equalTo(MockProvider.EXAMPLE_EXECUTION_ID)).body("query.processDefinitionName", equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_NAME)).body("query.processDefinitionNameLike", equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_NAME_LIKE)).body("query.processInstanceId", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)).body("query.taskDefinitionKey", equalTo(MockProvider.EXAMPLE_TASK_DEFINITION_KEY)).body("query.taskDefinitionKeyIn", hasItems(MockProvider.EXAMPLE_TASK_DEFINITION_KEY, MockProvider.EXAMPLE_TASK_DEFINITION_KEY)).body("query.taskDefinitionKeyLike", equalTo(MockProvider.EXAMPLE_TASK_DEFINITION_KEY)).body("query.description", equalTo(MockProvider.EXAMPLE_TASK_DESCRIPTION)).body("query.descriptionLike", equalTo(MockProvider.EXAMPLE_TASK_DESCRIPTION)).body("query.involvedUser", equalTo(MockProvider.EXAMPLE_USER_ID)).body("query.priority", equalTo(1)).body("query.maxPriority", equalTo(2)).body("query.minPriority", equalTo(3)).body("query.name", equalTo(MockProvider.EXAMPLE_TASK_NAME)).body("query.nameLike", equalTo(MockProvider.EXAMPLE_TASK_NAME)).body("query.owner", equalTo(MockProvider.EXAMPLE_TASK_OWNER)).body("query.parentTaskId", equalTo(MockProvider.EXAMPLE_TASK_PARENT_TASK_ID)).body("query.tenantIdIn", hasItems(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID)).when().get(SINGLE_FILTER_URL);
}
use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithCandidateIncludeAssignedTasks.
@Test
public void testGetFilterWithCandidateIncludeAssignedTasks() {
TaskQueryImpl query = new TaskQueryImpl();
query.taskCandidateUser("abc").includeAssignedTasks();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.candidateUser", equalTo("abc")).body("query.containsKey('candidateGroups')", is(false)).body("query.includeAssignedTasks", is(true)).when().get(SINGLE_FILTER_URL);
}
Aggregations