Search in sources :

Example 76 with TaskQuery

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

the class HistoryServiceTest method testOrderProcessWithCallActivity.

@Deployment(resources = { "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml", "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml" })
public void testOrderProcessWithCallActivity() {
    // After the process has started, the 'verify credit history' task should be
    // active
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task verifyCreditTask = taskQuery.singleResult();
    // Completing the task with approval, will end the subprocess and continue
    // the original process
    taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
    Task prepareAndShipTask = taskQuery.singleResult();
    assertEquals("Prepare and Ship", prepareAndShipTask.getName());
    // verify
    HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
    assertNotNull(historicProcessInstance);
    assertTrue(historicProcessInstance.getProcessDefinitionId().contains("checkCreditProcess"));
}
Also used : Task(org.activiti.engine.task.Task) TaskQuery(org.activiti.engine.task.TaskQuery) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 77 with TaskQuery

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

the class TaskQueryTest method testQueryByUnassigned.

public void testQueryByUnassigned() {
    TaskQuery query = taskService.createTaskQuery().taskUnassigned();
    assertEquals(11, query.count());
    assertEquals(11, query.list().size());
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery)

Example 78 with TaskQuery

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

the class TaskQueryTest method testQueryByCandidateUser.

public void testQueryByCandidateUser() {
    TaskQuery query = taskService.createTaskQuery().taskCandidateUser("kermit");
    assertEquals(11, query.count());
    assertEquals(11, query.list().size());
    try {
        query.singleResult();
        fail("expected exception");
    } catch (ActivitiException e) {
    // OK
    }
    query = taskService.createTaskQuery().taskCandidateUser("fozzie");
    assertEquals(3, query.count());
    assertEquals(3, query.list().size());
    try {
        query.singleResult();
        fail("expected exception");
    } catch (ActivitiException e) {
    // OK
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) TaskQuery(org.activiti.engine.task.TaskQuery)

Example 79 with TaskQuery

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

the class TaskQueryTest method testQueryByDescriptionOr.

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

Example 80 with TaskQuery

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

the class TaskQueryTest method testQueryByAssignee.

public void testQueryByAssignee() {
    TaskQuery query = taskService.createTaskQuery().taskAssignee("gonzo");
    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
    assertNotNull(query.singleResult());
    query = taskService.createTaskQuery().taskAssignee("kermit");
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());
}
Also used : TaskQuery(org.activiti.engine.task.TaskQuery)

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