use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity 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.persistence.entity.FilterEntity 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.persistence.entity.FilterEntity 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);
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterAuthorizationsTest method testSaveFilterNotPermitted.
public void testSaveFilterNotPermitted() {
Filter filter = new FilterEntity(EntityTypes.TASK);
try {
filterService.saveFilter(filter);
fail("Exception expected");
} catch (AuthorizationException e) {
// expected
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterAuthorizationsTest method testSaveFilterPermitted.
public void testSaveFilterPermitted() {
Filter filter = new FilterEntity(EntityTypes.TASK).setName("testFilter");
grantCreateFilter();
filterService.saveFilter(filter);
assertNotNull(filter.getId());
}
Aggregations