assertNotNull(filter.getQuery());
}
public void testTaskQuery() {
// create query
TaskQueryImpl query = new TaskQueryImpl();
query.taskId(testString);
query.taskName(testString);
query.taskNameLike(testString);
query.taskDescription(testString);
query.taskDescriptionLike(testString);
query.taskPriority(testInteger);
query.taskMinPriority(testInteger);
query.taskMaxPriority(testInteger);
query.taskAssignee(testString);
query.taskAssigneeExpression(testString);
query.taskAssigneeLike(testString);
query.taskAssigneeLikeExpression(testString);
query.taskInvolvedUser(testString);
query.taskInvolvedUserExpression(testString);
query.taskOwner(testString);
query.taskOwnerExpression(testString);
query.taskUnassigned();
query.taskDelegationState(testDelegationState);
query.taskCandidateGroupIn(testCandidateGroups);
query.taskCandidateGroupInExpression(testString);
query.processInstanceId(testString);
query.executionId(testString);
query.activityInstanceIdIn(testActivityInstances);
query.taskCreatedOn(testDate);
query.taskCreatedOnExpression(testString);
query.taskCreatedBefore(testDate);
query.taskCreatedBeforeExpression(testString);
query.taskCreatedAfter(testDate);
query.taskCreatedAfterExpression(testString);
query.taskDefinitionKey(testString);
query.taskDefinitionKeyLike(testString);
query.processDefinitionKey(testString);
query.processDefinitionId(testString);
query.processDefinitionName(testString);
query.processDefinitionNameLike(testString);
query.processInstanceBusinessKey(testString);
query.processInstanceBusinessKeyLike(testString);
// variables
query.taskVariableValueEquals(variableNames[0], variableValues[0]);
query.taskVariableValueGreaterThanOrEquals(variableNames[1], variableValues[1]);
query.processVariableValueLessThan(variableNames[2], variableValues[2]);
query.processVariableValueLike(variableNames[3], (String) variableValues[3]);
query.caseInstanceVariableValueNotEquals(variableNames[4], variableValues[4]);
query.caseInstanceVariableValueLessThanOrEquals(variableNames[5], variableValues[5]);
query.dueDate(testDate);
query.dueDateExpression(testString);
query.dueBefore(testDate);
query.dueBeforeExpression(testString);
query.dueAfter(testDate);
query.dueAfterExpression(testString);
query.followUpDate(testDate);
query.followUpDateExpression(testString);
query.followUpBefore(testDate);
query.followUpBeforeExpression(testString);
query.followUpAfter(testDate);
query.followUpAfterExpression(testString);
query.excludeSubtasks();
query.suspended();
query.caseDefinitionKey(testString);
query.caseDefinitionId(testString);
query.caseDefinitionName(testString);
query.caseDefinitionNameLike(testString);
query.caseInstanceId(testString);
query.caseInstanceBusinessKey(testString);
query.caseInstanceBusinessKeyLike(testString);
query.caseExecutionId(testString);
// ordering
query.orderByExecutionId().desc();
query.orderByDueDate().asc();
// save filter
filter.setQuery(query);
filterService.saveFilter(filter);
// fetch from db
filter = filterService.createTaskFilterQuery().singleResult();
// test query
query = filter.getQuery();
assertEquals(testString, query.getTaskId());
assertEquals(testString, query.getName());
assertEquals(testString, query.getNameLike());
assertEquals(testString, query.getDescription());
assertEquals(testString, query.getDescriptionLike());
assertEquals(testInteger, query.getPriority());
assertEquals(testInteger, query.getMinPriority());
assertEquals(testInteger, query.getMaxPriority());
assertEquals(testString, query.getAssignee());
assertEquals(testString, query.getExpressions().get("taskAssignee"));
assertEquals(testString, query.getAssigneeLike());
assertEquals(testString, query.getExpressions().get("taskAssigneeLike"));
assertEquals(testString, query.getInvolvedUser());
assertEquals(testString, query.getExpressions().get("taskInvolvedUser"));
assertEquals(testString, query.getOwner());
assertEquals(testString, query.getExpressions().get("taskOwner"));
assertTrue(query.isUnassigned());
assertEquals(testDelegationState, query.getDelegationState());
assertEquals(testCandidateGroups, query.getCandidateGroups());
assertEquals(testString, query.getExpressions().get("taskCandidateGroupIn"));
assertEquals(testString, query.getProcessInstanceId());
assertEquals(testString, query.getExecutionId());
assertEquals(testActivityInstances.length, query.getActivityInstanceIdIn().length);
for (int i = 0; i < query.getActivityInstanceIdIn().length; i++) {
assertEquals(testActivityInstances[i], query.getActivityInstanceIdIn()[i]);
}
assertEquals(testDate, query.getCreateTime());
assertEquals(testString, query.getExpressions().get("taskCreatedOn"));
assertEquals(testDate, query.getCreateTimeBefore());
assertEquals(testString, query.getExpressions().get("taskCreatedBefore"));
assertEquals(testDate, query.getCreateTimeAfter());
assertEquals(testString, query.getExpressions().get("taskCreatedAfter"));
assertEquals(testString, query.getKey());
assertEquals(testString, query.getKeyLike());
assertEquals(testString, query.getProcessDefinitionKey());
assertEquals(testString, query.getProcessDefinitionId());
assertEquals(testString, query.getProcessDefinitionName());
assertEquals(testString, query.getProcessDefinitionNameLike());
assertEquals(testString, query.getProcessInstanceBusinessKey());
assertEquals(testString, query.getProcessInstanceBusinessKeyLike());
// variables
List<TaskQueryVariableValue> variables = query.getVariables();
for (int i = 0; i < variables.size(); i++) {
TaskQueryVariableValue variable = variables.get(i);
assertEquals(variableNames[i], variable.getName());
assertEquals(variableValues[i], variable.getValue());
assertEquals(variableOperators[i].toString(), variable.getOperator());
assertEquals(isTaskVariable[i], variable.isLocal());
assertEquals(isProcessVariable[i], variable.isProcessInstanceVariable());
}
assertEquals(testDate, query.getDueDate());
assertEquals(testString, query.getExpressions().get("dueDate"));
assertEquals(testDate, query.getDueBefore());
assertEquals(testString, query.getExpressions().get("dueBefore"));
assertEquals(testDate, query.getDueAfter());
assertEquals(testString, query.getExpressions().get("dueAfter"));
assertEquals(testDate, query.getFollowUpDate());
assertEquals(testString, query.getExpressions().get("followUpDate"));
assertEquals(testDate, query.getFollowUpBefore());
assertEquals(testString, query.getExpressions().get("followUpBefore"));
assertEquals(testDate, query.getFollowUpAfter());
assertEquals(testString, query.getExpressions().get("followUpAfter"));
assertTrue(query.isExcludeSubtasks());
assertEquals(SuspensionState.SUSPENDED, query.getSuspensionState());
assertEquals(testString, query.getCaseDefinitionKey());
assertEquals(testString, query.getCaseDefinitionId());
assertEquals(testString, query.getCaseDefinitionName());
assertEquals(testString, query.getCaseDefinitionNameLike());
assertEquals(testString, query.getCaseInstanceId());
assertEquals(testString, query.getCaseInstanceBusinessKey());
assertEquals(testString, query.getCaseInstanceBusinessKeyLike());
assertEquals(testString, query.getCaseExecutionId());
// ordering
assertEquals(testOrderBy, query.getOrderBy());
}