use of io.crnk.core.queryspec.FilterSpec in project crnk-framework by crnk-project.
the class MetaFilteringTest method checkResourceMeta.
private void checkResourceMeta(boolean readable, boolean insertable, boolean updatable, boolean deletable) throws IOException {
QuerySpec querySpec = new QuerySpec(MetaResource.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("name"), FilterOperator.EQ, "Tasks"));
ResourceList<MetaResource> list = repository.findAll(querySpec);
boolean filtered = !readable && !insertable && !updatable && !deletable;
Assert.assertEquals(filtered, list.isEmpty());
if (!filtered) {
MetaResource metaResource = list.get(0);
Assert.assertEquals(readable, metaResource.isReadable());
Assert.assertEquals(deletable, metaResource.isDeletable());
Assert.assertEquals(insertable, metaResource.isInsertable());
Assert.assertEquals(updatable, metaResource.isUpdatable());
MetaAttribute idAttr = metaResource.getAttribute("id");
Assert.assertNotNull(idAttr);
}
}
Aggregations