use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskDueDateExtensionsTest method testRelativeDueDateStringExtension.
@Deployment
public void testRelativeDueDateStringExtension() throws Exception {
Clock clock = processEngineConfiguration.getClock();
clock.setCurrentCalendar(new GregorianCalendar(2015, 0, 1));
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dateVariable", "P2DT5H40M");
// Start process-instance, passing ISO8601 duration formatted String that should be used to calculate dueDate
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dueDateExtension", variables);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task.getDueDate());
Period period = new Period(task.getCreateTime().getTime(), task.getDueDate().getTime());
assertEquals(2, period.getDays());
assertEquals(5, period.getHours());
assertEquals(40, period.getMinutes());
clock.reset();
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskDueDateExtensionsTest method testRelativeDueDateStringWithCalendarNameExtension.
@Deployment
public void testRelativeDueDateStringWithCalendarNameExtension() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dateVariable", "P2DT5H40M");
// Start process-instance, passing ISO8601 duration formatted String that should be used to calculate dueDate
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dueDateExtension", variables);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task.getDueDate());
assertThat(task.getDueDate(), is(new Date(0)));
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskPriorityExtensionsTest method testPriorityExtensionString.
@Deployment
public void testPriorityExtensionString() throws Exception {
final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskPriorityExtensionString");
final Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertEquals(42, task.getPriority());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class UserTaskTest method testTaskPropertiesNotNull.
@Deployment
public void testTaskPropertiesNotNull() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task.getId());
assertEquals("my task", task.getName());
assertEquals("Very important", task.getDescription());
assertTrue(task.getPriority() > 0);
assertEquals("kermit", task.getAssignee());
assertEquals(processInstance.getId(), task.getProcessInstanceId());
assertEquals(processInstance.getId(), task.getExecutionId());
assertNotNull(task.getProcessDefinitionId());
assertNotNull(task.getTaskDefinitionKey());
assertNotNull(task.getCreateTime());
// the next test verifies that if an execution creates a task, that no events are created during creation of the task.
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
assertEquals(0, taskService.getTaskEvents(task.getId()).size());
}
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class UserTaskTest method testCompleteAfterParallelGateway.
@Deployment
public void testCompleteAfterParallelGateway() throws InterruptedException {
// related to https://activiti.atlassian.net/browse/ACT-1054
// start the process
runtimeService.startProcessInstanceByKey("ForkProcess");
List<Task> taskList = taskService.createTaskQuery().list();
assertNotNull(taskList);
assertEquals(2, taskList.size());
// make sure user task exists
Task task = taskService.createTaskQuery().taskDefinitionKey("SimpleUser").singleResult();
assertNotNull(task);
// attempt to complete the task and get PersistenceException pointing to "referential integrity constraint violation"
taskService.complete(task.getId());
}
Aggregations