Search in sources :

Example 26 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class TaskQueryTest method testExtendingTaskQueryList_TaskDefinitionKeyIn.

public void testExtendingTaskQueryList_TaskDefinitionKeyIn() {
    // given
    String taskDefinitionKey = "assigneApprover";
    TaskQuery query = taskService.createTaskQuery();
    TaskQuery extendingQuery = taskService.createTaskQuery().taskDefinitionKeyIn(taskDefinitionKey);
    // when
    TaskQuery result = ((TaskQueryImpl) query).extend(extendingQuery);
    // then
    String[] key = ((TaskQueryImpl) result).getKeys();
    assertEquals(1, key.length);
    assertEquals(taskDefinitionKey, key[0]);
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Example 27 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class TaskQueryTest method testExtendTaskQueryList_ProcessDefinitionKeyIn.

public void testExtendTaskQueryList_ProcessDefinitionKeyIn() {
    // given
    String processDefinitionKey = "invoice";
    TaskQuery query = taskService.createTaskQuery().processDefinitionKeyIn(processDefinitionKey);
    TaskQuery extendingQuery = taskService.createTaskQuery();
    // when
    TaskQuery result = ((TaskQueryImpl) query).extend(extendingQuery);
    // then
    String[] processDefinitionKeys = ((TaskQueryImpl) result).getProcessDefinitionKeys();
    assertEquals(1, processDefinitionKeys.length);
    assertEquals(processDefinitionKey, processDefinitionKeys[0]);
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString)

Example 28 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class TaskQueryOrTest method shouldReturnTasksByExtendingQuery_OrInExtendingQuery.

@Test
public void shouldReturnTasksByExtendingQuery_OrInExtendingQuery() {
    // given
    TaskQuery extendedQuery = taskService.createTaskQuery().taskCandidateGroup("sales");
    TaskQuery extendingQuery = taskService.createTaskQuery().or().taskName("aTaskName").endOr().or().taskNameLike("anotherTaskName").endOr();
    // when
    TaskQueryImpl result = (TaskQueryImpl) ((TaskQueryImpl) extendedQuery).extend(extendingQuery);
    // then
    assertEquals("sales", result.getCandidateGroup());
    assertEquals("aTaskName", result.getQueries().get(1).getName());
    assertEquals("anotherTaskName", result.getQueries().get(2).getNameLike());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Example 29 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class TaskRestServiceQueryTest method testOrQuery.

@Test
public void testOrQuery() {
    TaskQueryDto queryDto = TaskQueryDto.fromQuery(new TaskQueryImpl().or().taskName(MockProvider.EXAMPLE_TASK_NAME).taskDescription(MockProvider.EXAMPLE_TASK_DESCRIPTION).endOr());
    given().contentType(POST_JSON_CONTENT_TYPE).header(ACCEPT_JSON_HEADER).body(queryDto).then().expect().statusCode(Status.OK.getStatusCode()).when().post(TASK_QUERY_URL);
    ArgumentCaptor<TaskQueryImpl> argument = ArgumentCaptor.forClass(TaskQueryImpl.class);
    verify(((TaskQueryImpl) mockQuery)).addOrQuery(argument.capture());
    assertEquals(MockProvider.EXAMPLE_TASK_NAME, argument.getValue().getName());
    assertEquals(MockProvider.EXAMPLE_TASK_DESCRIPTION, argument.getValue().getDescription());
}
Also used : TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQueryDto(org.camunda.bpm.engine.rest.dto.task.TaskQueryDto) Test(org.junit.Test)

Example 30 with TaskQueryImpl

use of org.camunda.bpm.engine.impl.TaskQueryImpl in project camunda-bpm-platform by camunda.

the class MultiTenancyFilterServiceTest method testCreateFilterWithTenantIdCriteria.

public void testCreateFilterWithTenantIdCriteria() {
    TaskQuery query = taskService.createTaskQuery().tenantIdIn(TENANT_IDS);
    filterId = createFilter(query);
    Filter savedFilter = filterService.getFilter(filterId);
    TaskQueryImpl savedQuery = savedFilter.getQuery();
    assertThat(savedQuery.getTenantIds(), is(TENANT_IDS));
}
Also used : Filter(org.camunda.bpm.engine.filter.Filter) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Aggregations

TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)60 Filter (org.camunda.bpm.engine.filter.Filter)26 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)25 Test (org.junit.Test)17 FilterEntity (org.camunda.bpm.engine.impl.persistence.entity.FilterEntity)12 MockProvider.mockFilter (org.camunda.bpm.engine.rest.helper.MockProvider.mockFilter)12 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)8 Map (java.util.Map)7 Response (com.jayway.restassured.response.Response)6 HashMap (java.util.HashMap)6 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)6 Matchers.anyString (org.mockito.Matchers.anyString)6 JSONObject (org.camunda.bpm.engine.impl.util.json.JSONObject)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 Date (java.util.Date)3 TaskQueryVariableValue (org.camunda.bpm.engine.impl.TaskQueryVariableValue)3 JsonTaskQueryConverter (org.camunda.bpm.engine.impl.json.JsonTaskQueryConverter)3 ArrayList (java.util.ArrayList)2 JSONArray (org.camunda.bpm.engine.impl.util.json.JSONArray)2 VariableQueryParameterDto (org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto)2