Search in sources :

Example 46 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class TaskQueryTest method testQueryByNameInIgnoreCase.

public void testQueryByNameInIgnoreCase() {
    final List<String> taskNameList = new ArrayList<String>(2);
    taskNameList.add("testtask");
    taskNameList.add("gonzotask");
    TaskQuery query = taskService.createTaskQuery().taskNameInIgnoreCase(taskNameList);
    assertEquals(7, query.list().size());
    assertEquals(7, query.count());
    try {
        query.singleResult();
        fail("expected exception");
    } catch (ActivitiException e) {
    // OK
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskQuery(org.activiti.engine.task.TaskQuery) ArrayList(java.util.ArrayList)

Example 47 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class TaskQueryTest method testQueryByPriority.

public void testQueryByPriority() {
    TaskQuery query = taskService.createTaskQuery().taskPriority(10);
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
    try {
        query.singleResult();
        fail();
    } catch (ActivitiException e) {
    }
    query = taskService.createTaskQuery().taskPriority(100);
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    query = taskService.createTaskQuery().taskMinPriority(50);
    assertEquals(3, query.list().size());
    query = taskService.createTaskQuery().taskMinPriority(10);
    assertEquals(5, query.list().size());
    query = taskService.createTaskQuery().taskMaxPriority(10);
    assertEquals(9, query.list().size());
    query = taskService.createTaskQuery().taskMaxPriority(3);
    assertEquals(6, query.list().size());
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskQuery(org.activiti.engine.task.TaskQuery)

Example 48 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class TaskQueryTest method testQueryByPriorityOr.

public void testQueryByPriorityOr() {
    TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskPriority(10);
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
    try {
        query.singleResult();
        fail();
    } catch (ActivitiException e) {
    }
    query = taskService.createTaskQuery().or().taskId("invalid").taskPriority(100);
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    query = taskService.createTaskQuery().or().taskId("invalid").taskMinPriority(50);
    assertEquals(3, query.list().size());
    query = taskService.createTaskQuery().or().taskId("invalid").taskMinPriority(10);
    assertEquals(5, query.list().size());
    query = taskService.createTaskQuery().or().taskId("invalid").taskMaxPriority(10);
    assertEquals(9, query.list().size());
    query = taskService.createTaskQuery().or().taskId("invalid").taskMaxPriority(3);
    assertEquals(6, query.list().size());
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskQuery(org.activiti.engine.task.TaskQuery)

Example 49 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class TaskQueryTest method testQueryByNameOr.

public void testQueryByNameOr() {
    TaskQuery query = taskService.createTaskQuery().or().taskName("testTask").taskId("invalid");
    assertEquals(6, query.list().size());
    assertEquals(6, query.count());
    try {
        query.singleResult();
        fail("expected exception");
    } catch (ActivitiException e) {
    // OK
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskQuery(org.activiti.engine.task.TaskQuery)

Example 50 with TaskQuery

use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.

the class TaskQueryTest method testQueryByInvalidTaskId.

public void testQueryByInvalidTaskId() {
    TaskQuery query = taskService.createTaskQuery().taskId("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    try {
        taskService.createTaskQuery().taskId(null);
        fail("expected exception");
    } catch (ActivitiIllegalArgumentException e) {
    // OK
    }
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Aggregations

TaskQuery (org.activiti.engine.task.TaskQuery)92 Task (org.activiti.engine.task.Task)32 Deployment (org.activiti.engine.test.Deployment)29 ActivitiException (org.activiti.engine.ActivitiException)19 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)19 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)12 ArrayList (java.util.ArrayList)10 SimpleDateFormat (java.text.SimpleDateFormat)8 Date (java.util.Date)7 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)6 DelegateTask (org.activiti.engine.delegate.DelegateTask)3 HistoricVariableInstance (org.activiti.engine.history.HistoricVariableInstance)3 HistoricVariableInstanceEntity (org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity)3 Job (org.activiti.engine.runtime.Job)3 HashMap (java.util.HashMap)2 TaskService (org.activiti.engine.TaskService)2 Test (org.testng.annotations.Test)2 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 PrismValue (com.evolveum.midpoint.prism.PrismValue)1