use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class ActivitiTestBase method setup.
@Before
public void setup() {
processEngine = ProcessEngines.getDefaultProcessEngine();
processEngine.getRepositoryService().createDeployment().addClasspathResource("approval.bpmn20.xml").deploy();
boot = new CrnkBoot();
boot.addModule(new TestModule());
boot.addModule(createActivitiModule());
boot.boot();
taskRepository = (TaskResourceRepository<ApproveTask>) boot.getResourceRegistry().getEntry(ApproveTask.class).getResourceRepository().getResourceRepository();
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method deleteTask.
@Test
public void deleteTask() {
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
ApproveTask resource = taskRepository.findOne(task.getId(), querySpec);
taskRepository.delete(resource.getId());
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 checkFilterEnforcementOnCreate.
@Test(expected = BadRequestException.class)
public void checkFilterEnforcementOnCreate() {
ApproveTask resource = new ApproveTask();
resource.setName("testTask");
// must be set => due to chosen setup
resource.setDescription("invalid");
taskRepository.create(resource);
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method updateTask.
@Test
public void updateTask() {
QuerySpec querySpec = new QuerySpec(TaskResource.class);
OffsetDateTime updatedDueDate = OffsetDateTime.now().plusHours(12);
ApproveTask resource = taskRepository.findOne(task.getId(), querySpec);
resource.setName("updatedName");
resource.setPriority(101);
resource.setDueDate(updatedDueDate);
ApproveTask updatedResource = taskRepository.save(resource);
Assert.assertEquals("updatedName", updatedResource.getName());
Assert.assertEquals(101, updatedResource.getPriority());
Assert.assertEquals(updatedDueDate.toInstant(), updatedResource.getDueDate().toInstant());
updatedResource = taskRepository.findOne(task.getId(), querySpec);
Assert.assertEquals("updatedName", updatedResource.getName());
Assert.assertEquals(101, updatedResource.getPriority());
Assert.assertEquals(updatedDueDate.toInstant(), updatedResource.getDueDate().toInstant());
}
use of io.crnk.activiti.example.model.ApproveTask in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkOrderByPriorityDesc.
@Test
public void checkOrderByPriorityDesc() {
addTask("otherTask", 14);
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addSort(new SortSpec(Arrays.asList("priority"), Direction.DESC));
ResourceList<ApproveTask> resources = taskRepository.findAll(querySpec);
Assert.assertEquals(2, resources.size());
Assert.assertEquals("otherTask", resources.get(0).getName());
Assert.assertEquals("testTask", resources.get(1).getName());
}
Aggregations