use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithVariableTypeSorting.
@Test
public void testGetFilterWithVariableTypeSorting() {
TaskQuery query = new TaskQueryImpl().orderByExecutionVariable("foo", ValueType.STRING).asc().orderByProcessVariable("foo", ValueType.STRING).asc().orderByTaskVariable("foo", ValueType.STRING).asc().orderByCaseExecutionVariable("foo", ValueType.STRING).asc().orderByCaseInstanceVariable("foo", ValueType.STRING).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(5);
assertSorting(sortings.get(0), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(1), SORT_BY_PROCESS_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(2), SORT_BY_TASK_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(3), SORT_BY_CASE_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(4), SORT_BY_CASE_INSTANCE_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithVariableSortOrderSorting.
@Test
public void testGetFilterWithVariableSortOrderSorting() {
TaskQuery query = new TaskQueryImpl().orderByExecutionVariable("foo", ValueType.STRING).asc().orderByExecutionVariable("foo", ValueType.STRING).desc();
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(2);
assertSorting(sortings.get(0), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(1), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_DESC_VALUE, "foo", ValueType.STRING);
}
use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithMultipleSorting.
@Test
public void testGetFilterWithMultipleSorting() {
TaskQuery query = new TaskQueryImpl().orderByDueDate().asc().orderByCaseExecutionId().desc();
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(2);
assertSorting(sortings.get(0), SORT_BY_DUE_DATE_VALUE, SORT_ORDER_ASC_VALUE);
assertSorting(sortings.get(1), SORT_BY_CASE_EXECUTION_ID_VALUE, SORT_ORDER_DESC_VALUE);
}
use of org.camunda.bpm.engine.task.TaskQuery 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.task.TaskQuery in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExecuteTaskQuerySingleResult.
public void testExecuteTaskQuerySingleResult() {
TaskQuery query = taskService.createTaskQuery();
query.taskDelegationState(DelegationState.PENDING);
saveQuery(query);
Task task = filterService.singleResult(filter.getId());
assertNotNull(task);
assertEquals("Task 1", task.getName());
}
Aggregations