use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaMetaTest method testAttributesProperlyDeclaredAndNotInherited.
@Test
public void testAttributesProperlyDeclaredAndNotInherited() {
MetaResource elementMeta = resourceProvider.getMeta(MetaElement.class);
MetaResource dataMeta = resourceProvider.getMeta(MetaDataObject.class);
Assert.assertSame(elementMeta.getAttribute("id"), dataMeta.getAttribute("id"));
Assert.assertSame(elementMeta.getPrimaryKey(), dataMeta.getPrimaryKey());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaMetaTest method testMetaElementImmutable.
@Test
public void testMetaElementImmutable() {
MetaResource dataMeta = resourceProvider.getMeta(MetaDataObject.class);
Assert.assertFalse(dataMeta.isUpdatable());
Assert.assertFalse(dataMeta.isInsertable());
Assert.assertFalse(dataMeta.isDeletable());
Assert.assertNotEquals(0, dataMeta.getAttributes().size());
for (MetaAttribute attr : dataMeta.getAttributes()) {
Assert.assertFalse(attr.isUpdatable());
Assert.assertFalse(attr.isInsertable());
}
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaMetaTest method testMetaDataObjectMeta.
@Test
public void testMetaDataObjectMeta() {
MetaResource meta = resourceProvider.getMeta(MetaDataObject.class);
MetaAttribute elementTypeAttr = meta.getAttribute("elementType");
Assert.assertNotNull(elementTypeAttr);
Assert.assertNotNull(elementTypeAttr.getType());
Assert.assertEquals("resources.meta.type.elementType", elementTypeAttr.getId());
MetaAttribute attrsAttr = meta.getAttribute("attributes");
Assert.assertNotNull(attrsAttr.getType());
MetaAttribute childrenAttr = meta.getAttribute("children");
Assert.assertEquals("resources.meta.element.children", childrenAttr.getId());
Assert.assertEquals("resources.meta.element$list", childrenAttr.getType().getId());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class MetaMetaTest method testMetaNaming.
@Test
public void testMetaNaming() {
MetaResource taskMeta = resourceProvider.getMeta(Task.class);
MetaAttribute metaInformation = taskMeta.getAttribute("metaInformation");
MetaType type = metaInformation.getType();
Assert.assertEquals(type.getId(), "resources.tasks$meta");
Assert.assertEquals(type.getName(), "TaskMeta");
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class JpaMetaEndToEndTest method testRenameResourceType.
@Test
public void testRenameResourceType() {
MetaResource metaResource = resourceMetaProvider.getMeta(RenamedTestEntity.class);
Assert.assertEquals("renamedResource", metaResource.getResourceType());
RenamedTestEntity test = new RenamedTestEntity();
test.setId(1L);
ResourceRepositoryV2<RenamedTestEntity, Serializable> repository = client.getRepositoryForType(RenamedTestEntity.class);
repository.create(test);
Assert.assertEquals(1, repository.findAll(new QuerySpec(RenamedTestEntity.class)).size());
repository.delete(1L);
Assert.assertEquals(0, repository.findAll(new QuerySpec(RenamedTestEntity.class)).size());
}
Aggregations