use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaDataObjectTest method checkCannotResolveSubtypeAttributeWithoutIncludingSubtypes.
@Test(expected = IllegalStateException.class)
public void checkCannotResolveSubtypeAttributeWithoutIncludingSubtypes() {
MetaResource meta = resourceProvider.getMeta(Task.class);
meta.findAttribute("subTypeValue", false);
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaDataObjectTest method checkResolveEmptyPath.
@Test
public void checkResolveEmptyPath() {
MetaResource meta = resourceProvider.getMeta(Task.class);
Assert.assertEquals(MetaAttributePath.EMPTY_PATH, meta.resolvePath(new ArrayList<String>()));
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaDataObjectTest method checkResolveInvalidAttribute.
@Test(expected = IllegalStateException.class)
public void checkResolveInvalidAttribute() {
MetaResource meta = resourceProvider.getMeta(Task.class);
Assert.assertNotNull(meta.findAttribute("doesNotExist", true));
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaRelationshipRepositoryImplTest method findOneTargetReturnsResult.
@Test
public void findOneTargetReturnsResult() {
MetaResource resource = resourceProvider.getMeta(Task.class);
MetaKey key = (MetaKey) repo.findOneTarget(resource.getId(), "primaryKey", new QuerySpec(MetaElement.class));
Assert.assertNotNull(key);
Assert.assertEquals("id", key.getUniqueElement().getName());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaFilteringTest method checkFilterRelationship.
@Test
public void checkFilterRelationship() throws IOException {
RegistryEntry projectEntry = boot.getResourceRegistry().getEntry(Project.class);
ResourceInformation projectResourceInformation = projectEntry.getResourceInformation();
Mockito.when(filter.filterResource(Mockito.eq(projectResourceInformation), Mockito.any(HttpMethod.class))).thenReturn(FilterBehavior.FORBIDDEN);
QuerySpec querySpec = new QuerySpec(MetaResource.class);
querySpec.addFilter(new FilterSpec(Arrays.asList("name"), FilterOperator.EQ, "Tasks"));
ResourceList<MetaResource> list = repository.findAll(querySpec);
Assert.assertEquals(1, list.size());
MetaResource taskMeta = list.get(0);
// project attribute not available as opposite project type not available
Assert.assertFalse(taskMeta.hasAttribute("project"));
}
Aggregations