use of org.activiti.api.task.model.payloads.UpdateTaskPayload in project Activiti by Activiti.
the class TaskRuntimeUpdateTaskTest method createClaimAndAdminUpdateStandaloneTask.
@Test
public void createClaimAndAdminUpdateStandaloneTask() {
securityUtil.logInAs("garth");
// create
Task standaloneTask = taskRuntime.create(TaskPayloadBuilder.create().withName("test task update").withDescription("test task update description").withDueDate(new Date()).withPriority(50).build());
assertThat(RuntimeTestConfiguration.createdTasks).contains(standaloneTask.getId());
Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 50));
assertThat(tasks.getTotalItems()).isEqualTo(1);
assertThat(tasks.getContent()).extracting("status", "id").contains(tuple(Task.TaskStatus.CREATED, standaloneTask.getId()));
final UpdateTaskPayload updateTaskPayload = TaskPayloadBuilder.update().withTaskId(standaloneTask.getId()).withName(standaloneTask.getName() + " [UPDATED]").withPriority(60).withDueDate(new Date()).withDescription(standaloneTask.getDescription() + " [UPDATED]").build();
// admin should update a task
securityUtil.logInAs("admin");
final Task updatedTask = taskAdminRuntime.update(updateTaskPayload);
tasks = taskAdminRuntime.tasks(Pageable.of(0, 50));
assertThat(RuntimeTestConfiguration.updatedTasks).contains(updatedTask.getId());
assertThat(tasks.getContent()).extracting("id", "name", "description", "priority").contains(tuple(standaloneTask.getId(), updateTaskPayload.getName(), updateTaskPayload.getDescription(), updateTaskPayload.getPriority()));
}
Aggregations