Package org.activiti.engine.task

Examples of org.activiti.engine.task.Task


    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());

    assertNotNull(taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult());
    assertNotNull(taskService.createTaskQuery().taskCandidateUser("kafeitu").singleResult());

    Task singleResult = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
    taskService.complete(singleResult.getId());

    assertNull(taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult());
    assertNull(taskService.createTaskQuery().taskCandidateUser("kafeitu").singleResult());
  }
View Full Code Here


    String taskId = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult().getId();
    taskService.addCandidateUser(taskId, "runtimeUser");

    assertNotNull(taskService.createTaskQuery().taskCandidateUser("runtimeUser").singleResult());

    Task singleResult = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
    taskService.complete(singleResult.getId());

    assertNull(taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult());
    assertNull(taskService.createTaskQuery().taskCandidateUser("kafeitu").singleResult());
  }
View Full Code Here

 
  @Deployment
  public void testReleaseTask() throws Exception {
    runtimeService.startProcessInstanceByKey("releaseTaskProcess");
   
    Task task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
    assertNotNull(task);
    String taskId = task.getId();
   
    // Set assignee to null
    taskService.setAssignee(taskId, null);
   
    task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
    assertNull(task);
   
    task = taskService.createTaskQuery().taskId(taskId).singleResult();
    assertNotNull(task);
    assertNull(task.getAssignee());
  }
View Full Code Here

  @Delete
  public void deleteTask(Representation entity) {
    if(authenticate() == false) return;
    String taskId = (String) getRequest().getAttributes().get("taskId");
   
    Task task = ActivitiUtil.getTaskService().createTaskQuery().taskId(taskId).singleResult();
   
    if(task == null) {
      throw new ActivitiException("Task not found for id " + taskId);
    }
   
View Full Code Here

    // If variable value == 'throw-exception', process executes
    // service task, which generates and catches exception,
    // and takes sequence flow to user task
    vars.put("var", "throw-exception");
    runtimeService.startProcessInstanceByKey("exceptionHandling", vars);
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("Fix Exception", task.getName());
  }
View Full Code Here

public class TaskListenerTest extends PluggableActivitiTestCase {
 
  @Deployment(resources = {"org/activiti/examples/bpmn/tasklistener/TaskListenerTest.bpmn20.xml"})
  public void testTaskCreateListener() {
    runtimeService.startProcessInstanceByKey("taskListenerProcess");
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("Schedule meeting", task.getName());
    assertEquals("TaskCreateListener is listening!", task.getDescription());
  }
View Full Code Here

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskListenerProcess");
    assertEquals(null, runtimeService.getVariable(processInstance.getId(), "greeting"));
    assertEquals(null, runtimeService.getVariable(processInstance.getId(), "expressionValue"));
   
    // Completing first task will change the description
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
   
    assertEquals("Hello from The Process", runtimeService.getVariable(processInstance.getId(), "greeting"));
    assertEquals("Act", runtimeService.getVariable(processInstance.getId(), "shortName"));
  }
View Full Code Here

  public void testTaskListenerWithExpression() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskListenerProcess");
    assertEquals(null, runtimeService.getVariable(processInstance.getId(), "greeting2"));
   
    // Completing first task will change the description
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
   
    assertEquals("Write meeting notes", runtimeService.getVariable(processInstance.getId(), "greeting2"));
  }
View Full Code Here

public class ScriptTaskListenerTest extends PluggableActivitiTestCase {

  @Deployment(resources = { "org/activiti/examples/bpmn/tasklistener/ScriptTaskListenerTest.bpmn20.xml" })
  public void testScriptTaskListener() {
    runtimeService.startProcessInstanceByKey("scriptTaskListenerProcess");
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("Name does not match", "All your base are belong to us", task.getName());
   
    taskService.complete(task.getId());

    Task task2 = taskService.createTaskQuery().singleResult();
    assertEquals("Task name not set with 'bar' variable", "BAR", task2.getName());
   
    Object bar = runtimeService.getVariable(task2.getExecutionId(), "bar");
    assertNull("Expected 'bar' variable to be local to script", bar);
   
    Object foo = runtimeService.getVariable(task2.getExecutionId(), "foo");
    assertEquals("Could not find the 'foo' variable in variable scope", "FOO", foo);
  }
View Full Code Here

    String businessKey = (String) runtimeService.getVariable(processInstance.getId(), "businessKeyInExecution");
    assertNotNull(businessKey);
    assertEquals("businessKey123", businessKey);
   
    // Transition take executionListener will set 2 variables
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(task);
    taskService.complete(task.getId());
   
    varSetInExecutionListener = (String) runtimeService.getVariable(processInstance.getId(), "variableSetInExecutionListener");
   
    assertNotNull(varSetInExecutionListener);
    assertEquals("secondValue", varSetInExecutionListener);

    ExampleExecutionListenerPojo myPojo = new ExampleExecutionListenerPojo();
    runtimeService.setVariable(processInstance.getId(), "myPojo", myPojo);
   
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(task);
    taskService.complete(task.getId());
   
    // First usertask uses a method-expression as executionListener: ${myPojo.myMethod(execution.eventName)}
    ExampleExecutionListenerPojo pojoVariable = (ExampleExecutionListenerPojo) runtimeService.getVariable(processInstance.getId(), "myPojo");
    assertNotNull(pojoVariable.getReceivedEventName());
    assertEquals("end", pojoVariable.getReceivedEventName());
   
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(task);
    taskService.complete(task.getId());
   
    assertProcessEnded(processInstance.getId());
  }
View Full Code Here

TOP

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

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.