use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaIntTest method testFetchResourcesWithNestedAttributesAndTypes.
@Test
public void testFetchResourcesWithNestedAttributesAndTypes() {
QuerySpec querySpec = new QuerySpec(MetaResource.class);
QuerySpec dataObjectSpec = querySpec.getOrCreateQuerySpec(MetaDataObject.class);
dataObjectSpec.includeRelation(Arrays.asList("attributes"));
QuerySpec attrSpec = querySpec.getOrCreateQuerySpec(MetaAttribute.class);
attrSpec.includeRelation(Arrays.asList("type"));
QuerySpec typeSpec = querySpec.getOrCreateQuerySpec(MetaType.class);
typeSpec.includeRelation(Arrays.asList("attributes", "type", "elementType", "attributes"));
typeSpec.includeRelation(Arrays.asList("elementType"));
typeSpec.includeRelation(Arrays.asList("superType"));
ResourceList<MetaResource> list = client.getRepositoryForType(MetaResource.class).findAll(querySpec);
Assert.assertFalse(list.isEmpty());
for (MetaResource elem : list) {
checkDataObjectLoaded(elem, new HashSet<String>());
}
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaDataObjectTest method checkResolveInvalidPath.
@Test(expected = IllegalArgumentException.class)
public void checkResolveInvalidPath() {
MetaResource meta = resourceProvider.getMeta(Project.class);
meta.resolvePath(Arrays.asList("name", "doesNotExist"));
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaDataObjectTest method checkResolveSubtypeAttribute.
@Test
public void checkResolveSubtypeAttribute() {
MetaResource meta = resourceProvider.getMeta(Task.class);
Assert.assertNotNull(meta.findAttribute("subTypeValue", true));
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaRelationshipRepositoryImplTest method findManyTargetReturnsResult.
@Test
public void findManyTargetReturnsResult() {
MetaResource resource = resourceProvider.getMeta(Task.class);
ResourceList<MetaElement> children = repo.findManyTargets(resource.getId(), "children", new QuerySpec(MetaElement.class));
Assert.assertNotEquals(0, children.size());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaRelationshipRepositoryImplTest method findOneTargetReturnsNull.
@Test
public void findOneTargetReturnsNull() {
MetaResource resource = resourceProvider.getMeta(Task.class);
resource.setPrimaryKey(null);
MetaKey key = (MetaKey) repo.findOneTarget(resource.getId(), "primaryKey", new QuerySpec(MetaElement.class));
Assert.assertNull(key);
}
Aggregations