Package org.activiti.engine.task

Examples of org.activiti.engine.task.TaskQuery


      // OK
    }
  }

  public void testQueryByTaskId() {
    TaskQuery query = taskService.createTaskQuery().taskId(taskIds.get(0));
    assertNotNull(query.singleResult());
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here


    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  public void testQueryByTaskIdOr() {
    TaskQuery query = taskService.createTaskQuery()
        .or()
          .taskId(taskIds.get(0))
          .taskName("INVALID NAME")
          .endOr();
    assertNotNull(query.singleResult());
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  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) {
View Full Code Here

      // OK
    }
  }
 
  public void testQueryByInvalidTaskIdOr() {
    TaskQuery query = taskService.createTaskQuery()
        .or()
          .taskId("invalid")
          .taskName("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
   
    try {
      taskService.createTaskQuery().taskId(null);
      fail("expected exception");
    } catch (ActivitiIllegalArgumentException e) {
View Full Code Here

      // OK
    }
  }
 
  public void testQueryByName() {
    TaskQuery query = taskService.createTaskQuery().taskName("testTask");
    assertEquals(6, query.list().size());
    assertEquals(6, query.count());
   
    try {
      query.singleResult();
      fail("expected exception");
    } catch (ActivitiException e) {
      // OK
    }
  }
View Full Code Here

      // OK
    }
  }
 
  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
    }
  }
View Full Code Here

  })
  public void testOrderProcessWithCallActivity() {
    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
      // 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();
      assertEquals("Verify credit history", verifyCreditTask.getName());
     
      // Verify with Query API
      ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
      assertNotNull(subProcessInstance);
      assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId());
     
      // 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());
    }
  }
View Full Code Here

      // OK
    }
  }
 
  public void testQueryByInvalidName() {
    TaskQuery query = taskService.createTaskQuery().taskName("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
   
    try {
      taskService.createTaskQuery()
        .or()
        .taskId("invalid")
View Full Code Here

 
  @Deployment
  public void testSimple() {
    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
      TaskQuery taskQuery = taskService.createTaskQuery();
      Task userTask = taskQuery.singleResult();
      assertEquals("userTask1", userTask.getName());
     
      taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
     
      assertProcessEnded(processInstance.getId());
View Full Code Here

 
  @Deployment
  public void testParallel() {
    if(processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
      ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
      TaskQuery taskQuery = taskService.createTaskQuery();
      Task userTask = taskQuery.singleResult();
      assertEquals("userTask1", userTask.getName());
     
      taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
     
      assertProcessEnded(processInstance.getId());
View Full Code Here

TOP

Related Classes of org.activiti.engine.task.TaskQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.