Search in sources :

Example 81 with TaskQuery

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

the class TaskQueryTest method testQueryByInvalidNameOr.

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

Example 82 with TaskQuery

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

the class TaskQueryTest method testQueryByInvalidDescriptionLike.

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

Example 83 with TaskQuery

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

the class TaskQueryTest method testQueryCreatedBefore.

public void testQueryCreatedBefore() throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
    // Should result in 7 tasks
    Date before = sdf.parse("03/02/2002 02:02:02.000");
    TaskQuery query = taskService.createTaskQuery().taskCreatedBefore(before);
    assertEquals(7, query.count());
    assertEquals(7, query.list().size());
    before = sdf.parse("01/01/2001 01:01:01.000");
    query = taskService.createTaskQuery().taskCreatedBefore(before);
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 84 with TaskQuery

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

the class TaskQueryTest method testQueryCreatedAfterOr.

public void testQueryCreatedAfterOr() throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
    // Should result in 3 tasks
    Date after = sdf.parse("03/03/2003 03:03:03.000");
    TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskCreatedAfter(after);
    assertEquals(3, query.count());
    assertEquals(3, query.list().size());
    after = sdf.parse("05/05/2005 05:05:05.000");
    query = taskService.createTaskQuery().or().taskId("invalid").taskCreatedAfter(after);
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 85 with TaskQuery

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

the class TaskQueryTest method testQueryByInvalidNameInIgnoreCase.

public void testQueryByInvalidNameInIgnoreCase() {
    final List<String> taskNameList = new ArrayList<String>(1);
    taskNameList.add("invalid");
    TaskQuery query = taskService.createTaskQuery().taskNameInIgnoreCase(taskNameList);
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    try {
        taskService.createTaskQuery().or().taskId("invalid").taskNameIn(null).singleResult();
        fail("expected exception");
    } catch (ActivitiIllegalArgumentException e) {
    // OK
    }
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ArrayList(java.util.ArrayList)

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