Search in sources :

Example 6 with TaskQuery

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);
}
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 7 with TaskQuery

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);
}
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 8 with TaskQuery

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);
}
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 9 with TaskQuery

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);
}
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 10 with TaskQuery

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Aggregations

TaskQuery (org.camunda.bpm.engine.task.TaskQuery)517 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)230 Task (org.camunda.bpm.engine.task.Task)227 Test (org.junit.Test)224 Deployment (org.camunda.bpm.engine.test.Deployment)195 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)124 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)86 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)55 Filter (org.camunda.bpm.engine.filter.Filter)26 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)24 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)23 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)22 Execution (org.camunda.bpm.engine.runtime.Execution)22 Job (org.camunda.bpm.engine.runtime.Job)20 ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)17 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)15 Date (java.util.Date)12 HashMap (java.util.HashMap)12 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)12 CamundaExecutionListener (org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener)12