use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class ProcessInstanceLogQueryTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
// Deploy test process
deployTwoTasksTestProcess();
// Start process instance
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("var1", "Hello");
vars.put("var2", 123);
this.processInstanceId = runtimeService.startProcessInstanceByKey("twoTasksProcess", vars).getId();
// Add some comments
taskService.addComment(null, processInstanceId, "Hello World");
taskService.addComment(null, processInstanceId, "Hello World2");
taskService.addComment(null, processInstanceId, "Hello World3");
// Change some variables
runtimeService.setVariable(processInstanceId, "var1", "new Value");
// Finish tasks
for (Task task : taskService.createTaskQuery().list()) {
taskService.complete(task.getId());
}
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricProcessInstanceQueryOrderBy.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testHistoricProcessInstanceQueryOrderBy() {
// With a clean ProcessEngine, no instances should be available
assertTrue(historyService.createHistoricProcessInstanceQuery().count() == 0);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(1, tasks.size());
taskService.complete(tasks.get(0).getId());
historyService.createHistoricTaskInstanceQuery().orderByDeleteReason().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByExecutionId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricActivityInstanceId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceStartTime().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceDuration().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceEndTime().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByProcessDefinitionId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByProcessInstanceId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskAssignee().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskDefinitionKey().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskDescription().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskName().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskOwner().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskPriority().asc().list();
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricVariableInstancesOnParallelExecution.
@Deployment(resources = { "org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml" })
public void testHistoricVariableInstancesOnParallelExecution() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("rootValue", "test");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("concurrent", vars);
List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();
for (Task task : tasks) {
Map<String, Object> variables = new HashMap<String, Object>();
// set token local variable
log.debug("setting variables on task {}, execution {}", task.getId(), task.getExecutionId());
runtimeService.setVariableLocal(task.getExecutionId(), "parallelValue1", task.getName());
runtimeService.setVariableLocal(task.getExecutionId(), "parallelValue2", "test");
taskService.complete(task.getId(), variables);
}
taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("rootValue", "test").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue1", "Receive Payment").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue1", "Ship Order").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue2", "test").count());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class ProcessInstanceIdentityLinkTest method testSetAuthenticatedUserAndCompleteLastTask.
// Test specific for fix introduced by https://activiti.atlassian.net/browse/ACT-1591
// (Referential integrity constraint violation on PROC_INST and IDENTITY_LINK)
@Deployment
public void testSetAuthenticatedUserAndCompleteLastTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("identityLinktest");
// There are two tasks
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(task.getId());
identityService.setAuthenticatedUserId("kermit");
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(task.getId());
identityService.setAuthenticatedUserId(null);
assertProcessEnded(processInstance.getId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskAssignmentExtensionsTest method testCandidateGroupsExtension.
@Deployment
public void testCandidateGroupsExtension() {
runtimeService.startProcessInstanceByKey("candidateGroupsExtension");
// Bugfix check: potentially the query could return 2 tasks since
// kermit is a member of the two candidate groups
List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("kermit").list();
assertEquals(1, tasks.size());
assertEquals("make profit", tasks.get(0).getName());
tasks = taskService.createTaskQuery().taskCandidateUser("fozzie").list();
assertEquals(1, tasks.size());
assertEquals("make profit", tasks.get(0).getName());
// Test the task query find-by-candidate-group operation
TaskQuery query = taskService.createTaskQuery();
assertEquals(1, query.taskCandidateGroup("management").count());
assertEquals(1, query.taskCandidateGroup("accountancy").count());
}
Aggregations