use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkEqualId.
@Test
public void checkEqualId() {
QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("id"), FilterOperator.EQ, processInstance.getId()));
Assert.assertEquals(1, processRepository.findAll(querySpec).size());
querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("id"), FilterOperator.EQ, "doesNotExists"));
Assert.assertEquals(0, processRepository.findAll(querySpec).size());
}
use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class ProcessInstanceRepositoryTest method checkNotEqualsNotSupported.
@Test(expected = BadRequestException.class)
public void checkNotEqualsNotSupported() {
QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("id"), FilterOperator.NEQ, processInstance.getId()));
processRepository.findAll(querySpec);
}
use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkLikeAssignee.
@Test
public void checkLikeAssignee() {
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("assignee"), FilterOperator.LIKE, "%oh%"));
Assert.assertEquals(1, taskRepository.findAll(querySpec).size());
querySpec = new QuerySpec(TaskResource.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("assignee"), FilterOperator.LIKE, "%doesNotExists%"));
Assert.assertEquals(0, taskRepository.findAll(querySpec).size());
}
use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkNotEqualsNotSupported.
@Test(expected = BadRequestException.class)
public void checkNotEqualsNotSupported() {
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("id"), FilterOperator.NEQ, task.getId()));
taskRepository.findAll(querySpec).size();
}
use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class TaskResourceRepositoryTest method checkEqualsAssignee.
@Test
public void checkEqualsAssignee() {
QuerySpec querySpec = new QuerySpec(ApproveTask.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("assignee"), FilterOperator.EQ, "john"));
Assert.assertEquals(1, taskRepository.findAll(querySpec).size());
querySpec = new QuerySpec(TaskResource.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("assignee"), FilterOperator.EQ, "doesNotExists"));
Assert.assertEquals(0, taskRepository.findAll(querySpec).size());
}
Aggregations