public virtual void testTaskFilter() { string testString = "test"; int? testInteger = 1; DelegationState testDelegationState = DelegationState.PENDING; DateTime testDate = new DateTime(); string[] testActivityInstances = new string[] { "a", "b", "c" }; string[] testKeys = new string[] { "d", "e" }; IList <string> testCandidateGroups = new List <string>(); testCandidateGroups.Add("group"); testCandidateGroups.Add("anotherGroup"); string[] variableNames = new string[] { "a", "b", "c", "d", "e", "f" }; object[] variableValues = new object[] { 1, 2, "3", "4", 5, 6 }; QueryOperator[] variableOperators = new QueryOperator[] { QueryOperator.EQUALS, QueryOperator.GREATER_THAN_OR_EQUAL, QueryOperator.LESS_THAN, QueryOperator.LIKE, QueryOperator.NOT_EQUALS, QueryOperator.LESS_THAN_OR_EQUAL }; bool[] isTaskVariable = new bool[] { true, true, false, false, false, false }; bool[] isProcessVariable = new bool[] { false, false, true, true, false, false }; TaskQueryImpl expectedOrderingPropertiesQuery = new TaskQueryImpl(); expectedOrderingPropertiesQuery.orderByExecutionId().desc(); expectedOrderingPropertiesQuery.orderByDueDate().asc(); expectedOrderingPropertiesQuery.orderByProcessVariable("var", ValueType.STRING).desc(); IList <QueryOrderingProperty> expectedOrderingProperties = expectedOrderingPropertiesQuery.OrderingProperties; Filter filter = engineRule.FilterService.createTaskFilterQuery().filterName("filter").singleResult(); TaskQueryImpl query = filter.Query; assertEquals(testString, query.TaskId); assertEquals(testString, query.Name); assertEquals(testString, query.NameNotEqual); assertEquals(testString, query.NameNotLike); assertEquals(testString, query.NameLike); assertEquals(testString, query.Description); assertEquals(testString, query.DescriptionLike); assertEquals(testInteger, query.Priority); assertEquals(testInteger, query.MinPriority); assertEquals(testInteger, query.MaxPriority); assertEquals(testString, query.Assignee); assertEquals(testString, query.Expressions["taskAssignee"]); assertEquals(testString, query.AssigneeLike); assertEquals(testString, query.Expressions["taskAssigneeLike"]); assertEquals(testString, query.InvolvedUser); assertEquals(testString, query.Expressions["taskInvolvedUser"]); assertEquals(testString, query.Owner); assertEquals(testString, query.Expressions["taskOwner"]); assertTrue(query.Unassigned); assertTrue(query.Assigned); assertEquals(testDelegationState, query.DelegationState); assertEquals(testCandidateGroups, query.CandidateGroups); assertTrue(query.WithCandidateGroups); assertTrue(query.WithoutCandidateGroups); assertTrue(query.WithCandidateUsers); assertTrue(query.WithoutCandidateUsers); assertEquals(testString, query.Expressions["taskCandidateGroupIn"]); assertEquals(testString, query.ProcessInstanceId); assertEquals(testString, query.ExecutionId); assertEquals(testActivityInstances.Length, query.ActivityInstanceIdIn.Length); for (int i = 0; i < query.ActivityInstanceIdIn.Length; i++) { assertEquals(testActivityInstances[i], query.ActivityInstanceIdIn[i]); } assertEquals(testDate, query.CreateTime); assertEquals(testString, query.Expressions["taskCreatedOn"]); assertEquals(testDate, query.CreateTimeBefore); assertEquals(testString, query.Expressions["taskCreatedBefore"]); assertEquals(testDate, query.CreateTimeAfter); assertEquals(testString, query.Expressions["taskCreatedAfter"]); assertEquals(testString, query.Key); assertEquals(testKeys.Length, query.Keys.Length); for (int i = 0; i < query.Keys.Length; i++) { assertEquals(testKeys[i], query.Keys[i]); } assertEquals(testString, query.KeyLike); assertEquals(testString, query.ProcessDefinitionKey); for (int i = 0; i < query.ProcessDefinitionKeys.Length; i++) { assertEquals(testKeys[i], query.ProcessDefinitionKeys[i]); } assertEquals(testString, query.ProcessDefinitionId); assertEquals(testString, query.ProcessDefinitionName); assertEquals(testString, query.ProcessDefinitionNameLike); assertEquals(testString, query.ProcessInstanceBusinessKey); assertEquals(testString, query.Expressions["processInstanceBusinessKey"]); for (int i = 0; i < query.ProcessInstanceBusinessKeys.Length; i++) { assertEquals(testKeys[i], query.ProcessInstanceBusinessKeys[i]); } assertEquals(testString, query.ProcessInstanceBusinessKeyLike); assertEquals(testString, query.Expressions["processInstanceBusinessKeyLike"]); // variables IList <TaskQueryVariableValue> variables = query.Variables; for (int i = 0; i < variables.Count; i++) { TaskQueryVariableValue variable = variables[i]; assertEquals(variableNames[i], variable.Name); assertEquals(variableValues[i], variable.Value); assertEquals(variableOperators[i], variable.Operator); assertEquals(isTaskVariable[i], variable.Local); assertEquals(isProcessVariable[i], variable.ProcessInstanceVariable); } assertEquals(testDate, query.DueDate); assertEquals(testString, query.Expressions["dueDate"]); assertEquals(testDate, query.DueBefore); assertEquals(testString, query.Expressions["dueBefore"]); assertEquals(testDate, query.DueAfter); assertEquals(testString, query.Expressions["dueAfter"]); assertEquals(testDate, query.FollowUpDate); assertEquals(testString, query.Expressions["followUpDate"]); assertEquals(testDate, query.FollowUpBefore); assertEquals(testString, query.Expressions["followUpBefore"]); assertEquals(testDate, query.FollowUpAfter); assertEquals(testString, query.Expressions["followUpAfter"]); assertTrue(query.ExcludeSubtasks); assertEquals(org.camunda.bpm.engine.impl.persistence.entity.SuspensionState_Fields.SUSPENDED, query.SuspensionState); assertEquals(testString, query.CaseDefinitionKey); assertEquals(testString, query.CaseDefinitionId); assertEquals(testString, query.CaseDefinitionName); assertEquals(testString, query.CaseDefinitionNameLike); assertEquals(testString, query.CaseInstanceId); assertEquals(testString, query.CaseInstanceBusinessKey); assertEquals(testString, query.CaseInstanceBusinessKeyLike); assertEquals(testString, query.CaseExecutionId); // ordering verifyOrderingProperties(expectedOrderingProperties, query.OrderingProperties); }
public void execute(ProcessEngine engine, string scenarioName) { string testString = "test"; int? testInteger = 1; DelegationState testDelegationState = DelegationState.PENDING; DateTime testDate = new DateTime(); string[] testActivityInstances = new string[] { "a", "b", "c" }; string[] testKeys = new string[] { "d", "e" }; IList <string> testCandidateGroups = new List <string>(); string[] variableNames = new string[] { "a", "b", "c", "d", "e", "f" }; object[] variableValues = new object[] { 1, 2, "3", "4", 5, 6 }; testCandidateGroups.Add("group"); testCandidateGroups.Add("anotherGroup"); TaskQueryImpl query = new TaskQueryImpl(); query.taskId(testString); query.taskName(testString); query.taskNameNotEqual(testString); query.taskNameLike(testString); query.taskNameNotLike(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.taskAssigned(); query.taskDelegationState(testDelegationState); query.taskCandidateGroupIn(testCandidateGroups); query.taskCandidateGroupInExpression(testString); query.withCandidateGroups(); query.withoutCandidateGroups(); query.withCandidateUsers(); query.withoutCandidateUsers(); 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.taskDefinitionKeyIn(testKeys); query.taskDefinitionKeyLike(testString); query.processDefinitionKey(testString); query.processDefinitionKeyIn(testKeys); query.processDefinitionId(testString); query.processDefinitionName(testString); query.processDefinitionNameLike(testString); query.processInstanceBusinessKey(testString); query.processInstanceBusinessKeyExpression(testString); query.processInstanceBusinessKeyIn(testKeys); query.processInstanceBusinessKeyLike(testString); query.processInstanceBusinessKeyLikeExpression(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); query.orderByExecutionId().desc(); query.orderByDueDate().asc(); query.orderByProcessVariable("var", ValueType.STRING).desc(); // save filter Filter filter = engine.FilterService.newTaskFilter("filter"); filter.Query = query; engine.FilterService.saveFilter(filter); }