use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class JpaMetaEndToEndTest method testProjectedVersion.
@Test
public void testProjectedVersion() {
MetaResource metaResource = resourceMetaProvider.getMeta(VersionedEntity.class);
MetaAttribute versionAttr = metaResource.getAttribute("version");
Assert.assertTrue(versionAttr.isVersion());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class JpaMetaEndToEndTest method test.
@Test
public void test() {
MetaResource testMeta = resourceMetaProvider.getMeta(TestEntity.class);
Assert.assertNotNull(testMeta);
MetaAttribute embAttrMeta = testMeta.getAttribute(TestEntity.ATTR_embValue);
Assert.assertEquals(MetaJsonObject.class, embAttrMeta.getType().getClass());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class DtoMappingTest method testDtoMeta.
@Test
public void testDtoMeta() {
MetaLookup lookup = metaModule.getLookup();
MetaResource meta = (MetaResource) lookup.getMetaById().get("resources.testDTO");
MetaKey primaryKey = meta.getPrimaryKey();
Assert.assertNotNull(primaryKey);
Assert.assertEquals(1, primaryKey.getElements().size());
Assert.assertEquals("id", primaryKey.getElements().get(0).getName());
MetaAttribute oneRelatedAttr = meta.getAttribute("oneRelatedValue");
Assert.assertTrue(oneRelatedAttr.isAssociation());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class JpaMetaEndToEndTest method testAttributeInsertableUpdatable.
@Test
public void testAttributeInsertableUpdatable() {
MetaResource versionMeta = resourceMetaProvider.getMeta(VersionedEntity.class);
MetaAttribute idAttr = versionMeta.getAttribute("id");
MetaAttribute valueAttr = versionMeta.getAttribute("longValue");
Assert.assertTrue(idAttr.isInsertable());
Assert.assertFalse(idAttr.isUpdatable());
Assert.assertTrue(valueAttr.isInsertable());
Assert.assertTrue(valueAttr.isUpdatable());
MetaResourceBase annotationMeta = resourceMetaProvider.getMeta(AnnotationTestEntity.class);
MetaAttribute fieldAnnotatedAttr = annotationMeta.getAttribute("fieldAnnotatedValue");
MetaAttribute columnAnnotatedAttr = annotationMeta.getAttribute("columnAnnotatedValue");
Assert.assertTrue(fieldAnnotatedAttr.isInsertable());
Assert.assertFalse(fieldAnnotatedAttr.isUpdatable());
Assert.assertFalse(fieldAnnotatedAttr.isSortable());
Assert.assertFalse(fieldAnnotatedAttr.isFilterable());
Assert.assertFalse(columnAnnotatedAttr.isInsertable());
Assert.assertTrue(columnAnnotatedAttr.isUpdatable());
Assert.assertTrue(columnAnnotatedAttr.isSortable());
Assert.assertTrue(columnAnnotatedAttr.isFilterable());
MetaAttribute embeddableValueAttr = annotationMeta.getAttribute("embeddableValue");
Assert.assertFalse(embeddableValueAttr.isInsertable());
Assert.assertTrue(embeddableValueAttr.isUpdatable());
Assert.assertTrue(embeddableValueAttr.isSortable());
Assert.assertFalse(embeddableValueAttr.isFilterable());
MetaResourceBase superMeta = resourceMetaProvider.getMeta(AnnotationMappedSubtypeEntity.class);
fieldAnnotatedAttr = superMeta.getAttribute("fieldAnnotatedValue");
columnAnnotatedAttr = superMeta.getAttribute("columnAnnotatedValue");
MetaAttribute lobAttr = superMeta.getAttribute("lobValue");
Assert.assertTrue(fieldAnnotatedAttr.isInsertable());
Assert.assertFalse(fieldAnnotatedAttr.isUpdatable());
Assert.assertFalse(fieldAnnotatedAttr.isSortable());
Assert.assertFalse(fieldAnnotatedAttr.isFilterable());
Assert.assertFalse(columnAnnotatedAttr.isInsertable());
Assert.assertTrue(columnAnnotatedAttr.isUpdatable());
Assert.assertTrue(columnAnnotatedAttr.isSortable());
Assert.assertTrue(columnAnnotatedAttr.isFilterable());
Assert.assertTrue(lobAttr.isInsertable());
Assert.assertTrue(lobAttr.isUpdatable());
Assert.assertFalse(lobAttr.isSortable());
Assert.assertFalse(lobAttr.isFilterable());
}
use of io.crnk.meta.model.resource.MetaResource in project crnk-framework by crnk-project.
the class JpaMetaEndToEndTest method testProjectedLob.
@Test
public void testProjectedLob() {
MetaResource metaResource = resourceMetaProvider.getMeta(AnnotationTestEntity.class);
MetaAttribute lobAttr = metaResource.getAttribute("lobValue");
Assert.assertTrue(lobAttr.isLob());
}
Aggregations