use of io.crnk.core.queryspec.QuerySpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkLEStartTime.
@Test
public void checkLEStartTime() {
QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("startTime"), FilterOperator.LT, OffsetDateTime.now().plusHours(1)));
Assert.assertEquals(1, processRepository.findAll(querySpec).size());
querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("startTime"), FilterOperator.LT, OffsetDateTime.now().minusHours(1)));
Assert.assertEquals(0, processRepository.findAll(querySpec).size());
}
use of io.crnk.core.queryspec.QuerySpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkGTStartTime.
@Test
public void checkGTStartTime() {
QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("startTime"), FilterOperator.GT, OffsetDateTime.now().minusHours(1)));
Assert.assertEquals(1, processRepository.findAll(querySpec).size());
querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("startTime"), FilterOperator.GT, OffsetDateTime.now().plusHours(1)));
Assert.assertEquals(0, processRepository.findAll(querySpec).size());
}
use of io.crnk.core.queryspec.QuerySpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkDelete.
@Test
public void checkDelete() {
ScheduleApprovalProcessInstance processInstance = postProcess(null, null, null);
processRepository.delete(processInstance.getId());
try {
processRepository.findOne(processInstance.getId(), new QuerySpec(ScheduleApprovalProcessInstance.class));
Assert.fail();
} catch (ResourceNotFoundException e) {
// ok
}
}
use of io.crnk.core.queryspec.QuerySpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkResourceMapping.
@Test
public void checkResourceMapping() {
QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
ScheduleApprovalProcessInstance resource = processRepository.findOne(processInstance.getId(), querySpec);
assertEqualsNotNull(processInstance.getId(), resource.getId());
assertEqualsNotNull(processInstance.getName(), resource.getName());
assertEqualsNotNull(processInstance.isEnded(), resource.isEnded());
assertEqualsNotNull(processInstance.isSuspended(), resource.isSuspended());
assertEqualsNotNull(processInstance.getBusinessKey(), resource.getBusinessKey());
assertEqualsNotNull(processInstance.getProcessDefinitionKey(), resource.getProcessDefinitionKey());
Map<String, Object> variables = processInstance.getProcessVariables();
assertEqualsNotNull(variables.get("newValues.name"), resource.getNewValues().getName());
assertEqualsNotNull(variables.get("resourceId"), resource.getResourceId());
assertEqualsNotNull(variables.get("resourceType"), resource.getResourceType());
}
use of io.crnk.core.queryspec.QuerySpec 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
}
}
Aggregations