use of org.activiti.engine.test.Deployment 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());
}
use of org.activiti.engine.test.Deployment 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.test.Deployment 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.test.Deployment 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.test.Deployment 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());
}
}
Aggregations