use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkDefaultsOnEnforcedAttributeOnCreate.
@Test
public void checkDefaultsOnEnforcedAttributeOnCreate() {
ApproveTask resource = new ApproveTask();
resource.setName("newTask");
// default will be set
resource.setDescription(null);
ApproveTask savedTask = taskRepository.create(resource);
Assert.assertEquals(ENFORCED_DESCRIPTION, savedTask.getDescription());
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method completeTask.
@Test
public void completeTask() {
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
ApproveTask resource = taskRepository.findOne(task.getId(), querySpec);
Assert.assertFalse(resource.isCompleted());
resource.setCompleted(true);
ApproveTask updatedResource = taskRepository.save(resource);
Assert.assertTrue(updatedResource.isCompleted());
try {
taskRepository.findOne(task.getId(), querySpec);
Assert.fail();
} catch (ResourceNotFoundException e) {
// ok
}
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkIsolation.
@Test
public void checkIsolation() {
addTask("otherTask1", 14);
addTask("otherTask2", 15);
addTask("otherTask3", 16);
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addSort(new SortSpec(Arrays.asList("priority"), Direction.ASC));
querySpec.setOffset(1);
querySpec.setLimit(2L);
ResourceList<ApproveTask> resources = taskRepository.findAll(querySpec);
Assert.assertEquals(2, resources.size());
Assert.assertEquals("otherTask1", resources.get(0).getName());
Assert.assertEquals("otherTask2", resources.get(1).getName());
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkPaging.
@Test
public void checkPaging() {
addTask("otherTask1", 14);
addTask("otherTask2", 15);
addTask("otherTask3", 16);
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addSort(new SortSpec(Arrays.asList("priority"), Direction.ASC));
querySpec.setOffset(1);
querySpec.setLimit(2L);
ResourceList<ApproveTask> resources = taskRepository.findAll(querySpec);
Assert.assertEquals(2, resources.size());
Assert.assertEquals("otherTask1", resources.get(0).getName());
Assert.assertEquals("otherTask2", resources.get(1).getName());
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class ApprovalIntTest method verifyApprovalCompleted.
private void verifyApprovalCompleted(Schedule schedule) {
QuerySpec taskQuery = new QuerySpec(ApproveTask.class);
taskQuery.includeRelation(Arrays.asList("form"));
// check approval completed
ResourceList<ApproveTask> tasks = taskRepo.findAll(taskQuery);
Assert.assertEquals(0, tasks.size());
// check no approval for schedule in progress
ScheduleApprovalProcessInstance scheduleApproval = approvalRelRepo.findOneTarget(schedule.getId().toString(), "approval", new QuerySpec(ScheduleApprovalProcessInstance.class));
// no approval in progress
Assert.assertNull(scheduleApproval);
}
Aggregations