Search in sources :

Example 66 with Filter

use of org.camunda.bpm.engine.filter.Filter in project camunda-bpm-platform by camunda.

the class FilterRestServiceInteractionTest method testGetFilterWithoutTenantIdQuery.

@Test
public void testGetFilterWithoutTenantIdQuery() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.withoutTenantId();
    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.withoutTenantId", is(true)).when().get(SINGLE_FILTER_URL);
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) Filter(org.camunda.bpm.engine.filter.Filter) MockProvider.mockFilter(org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter) FilterEntity(org.camunda.bpm.engine.impl.persistence.entity.FilterEntity) Test(org.junit.Test)

Example 67 with Filter

use of org.camunda.bpm.engine.filter.Filter in project camunda-bpm-platform by camunda.

the class FilterRestServiceInteractionTest method testGetFilterWithFollowUpBeforeOrNotExistentExpression.

@Test
public void testGetFilterWithFollowUpBeforeOrNotExistentExpression() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.followUpBeforeOrNotExistentExpression("#{now()}");
    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.followUpBeforeOrNotExistentExpression", equalTo("#{now()}")).when().get(SINGLE_FILTER_URL);
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) Filter(org.camunda.bpm.engine.filter.Filter) MockProvider.mockFilter(org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter) FilterEntity(org.camunda.bpm.engine.impl.persistence.entity.FilterEntity) Test(org.junit.Test)

Example 68 with Filter

use of org.camunda.bpm.engine.filter.Filter in project camunda-bpm-platform by camunda.

the class FilterRestServiceInteractionTest method testGetFilterWithSingleSorting.

@Test
public void testGetFilterWithSingleSorting() {
    TaskQuery query = new TaskQueryImpl().orderByTaskName().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(1);
    assertSorting(sortings.get(0), SORT_BY_NAME_VALUE, SORT_ORDER_DESC_VALUE);
}
Also used : Response(com.jayway.restassured.response.Response) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) Filter(org.camunda.bpm.engine.filter.Filter) MockProvider.mockFilter(org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter) FilterEntity(org.camunda.bpm.engine.impl.persistence.entity.FilterEntity) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Matchers.isEmptyOrNullString(org.hamcrest.Matchers.isEmptyOrNullString) Matchers.anyString(org.mockito.Matchers.anyString) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 69 with Filter

use of org.camunda.bpm.engine.filter.Filter in project camunda-bpm-platform by camunda.

the class FilterRestServiceInteractionTest method testGetFilterWithoutSorting.

@Test
public void testGetFilterWithoutSorting() {
    TaskQuery query = new TaskQueryImpl();
    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.sorting", isEmptyOrNullString()).when().get(SINGLE_FILTER_URL);
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) Filter(org.camunda.bpm.engine.filter.Filter) MockProvider.mockFilter(org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter) FilterEntity(org.camunda.bpm.engine.impl.persistence.entity.FilterEntity) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Aggregations

Filter (org.camunda.bpm.engine.filter.Filter)69 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)26 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)26 MockProvider.mockFilter (org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter)15 FilterEntity (org.camunda.bpm.engine.impl.persistence.entity.FilterEntity)14 Test (org.junit.Test)14 HashMap (java.util.HashMap)10 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)9 Matchers.anyString (org.mockito.Matchers.anyString)9 Map (java.util.Map)7 Response (com.jayway.restassured.response.Response)6 ArrayList (java.util.ArrayList)5 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 Date (java.util.Date)3 FilterService (org.camunda.bpm.engine.FilterService)3 NotValidException (org.camunda.bpm.engine.exception.NotValidException)3 FilterQuery (org.camunda.bpm.engine.filter.FilterQuery)3 User (org.camunda.bpm.engine.identity.User)3 Task (org.camunda.bpm.engine.task.Task)3