Search in sources :

Example 1 with MetaResourceBase

use of io.crnk.meta.model.resource.MetaResourceBase in project crnk-framework by crnk-project.

the class ValidationMetaProviderTest method testNotNullDisablesNullablity.

@Test
public void testNotNullDisablesNullablity() {
    setup(true);
    MetaResourceBase meta = resourceMetaProvider.getMeta(Task.class);
    MetaAttribute attr = meta.getAttribute("name");
    Assert.assertFalse(attr.isNullable());
}
Also used : MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaResourceBase(io.crnk.meta.model.resource.MetaResourceBase) Test(org.junit.Test)

Example 2 with MetaResourceBase

use of io.crnk.meta.model.resource.MetaResourceBase in project crnk-framework by crnk-project.

the class JpaMetaEndToEndTest method testProjectedLobOnMappedSuperclass.

@Test
public void testProjectedLobOnMappedSuperclass() {
    MetaResourceBase metaResource = resourceMetaProvider.getMeta(AnnotationMappedSubtypeEntity.class);
    MetaAttribute lobAttr = metaResource.getAttribute("lobValue");
    Assert.assertTrue(lobAttr.isLob());
}
Also used : MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaResourceBase(io.crnk.meta.model.resource.MetaResourceBase) Test(org.junit.Test) AbstractJpaJerseyTest(io.crnk.jpa.AbstractJpaJerseyTest)

Example 3 with MetaResourceBase

use of io.crnk.meta.model.resource.MetaResourceBase in project crnk-framework by crnk-project.

the class JpaMetaEndToEndTest method testProjectedColumnAnnotatedValueIsNullable.

@Test
public void testProjectedColumnAnnotatedValueIsNullable() {
    MetaResourceBase meta = resourceMetaProvider.getMeta(AnnotationTestEntity.class);
    MetaAttribute field = meta.getAttribute("nullableValue");
    Assert.assertTrue(field.isNullable());
}
Also used : MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaResourceBase(io.crnk.meta.model.resource.MetaResourceBase) Test(org.junit.Test) AbstractJpaJerseyTest(io.crnk.jpa.AbstractJpaJerseyTest)

Example 4 with MetaResourceBase

use of io.crnk.meta.model.resource.MetaResourceBase 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());
}
Also used : MetaResource(io.crnk.meta.model.resource.MetaResource) MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaResourceBase(io.crnk.meta.model.resource.MetaResourceBase) Test(org.junit.Test) AbstractJpaJerseyTest(io.crnk.jpa.AbstractJpaJerseyTest)

Example 5 with MetaResourceBase

use of io.crnk.meta.model.resource.MetaResourceBase in project crnk-framework by crnk-project.

the class JpaMetaEndToEndTest method testProjectedColumnAnnotatedValueIsNotNullable.

@Test
public void testProjectedColumnAnnotatedValueIsNotNullable() {
    MetaResourceBase meta = resourceMetaProvider.getMeta(AnnotationTestEntity.class);
    MetaAttribute field = meta.getAttribute("notNullableValue");
    Assert.assertFalse(field.isNullable());
}
Also used : MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaResourceBase(io.crnk.meta.model.resource.MetaResourceBase) Test(org.junit.Test) AbstractJpaJerseyTest(io.crnk.jpa.AbstractJpaJerseyTest)

Aggregations

MetaAttribute (io.crnk.meta.model.MetaAttribute)7 MetaResourceBase (io.crnk.meta.model.resource.MetaResourceBase)7 Test (org.junit.Test)6 AbstractJpaJerseyTest (io.crnk.jpa.AbstractJpaJerseyTest)4 MetaResource (io.crnk.meta.model.resource.MetaResource)2 ResourceField (io.crnk.core.engine.information.resource.ResourceField)1 ResourceFieldType (io.crnk.core.engine.information.resource.ResourceFieldType)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 MetaCollectionType (io.crnk.meta.model.MetaCollectionType)1 MetaDataObject (io.crnk.meta.model.MetaDataObject)1 MetaElement (io.crnk.meta.model.MetaElement)1 MetaListType (io.crnk.meta.model.MetaListType)1 MetaPrimaryKey (io.crnk.meta.model.MetaPrimaryKey)1 MetaSetType (io.crnk.meta.model.MetaSetType)1 MetaJsonObject (io.crnk.meta.model.resource.MetaJsonObject)1 MetaResourceField (io.crnk.meta.model.resource.MetaResourceField)1 Type (java.lang.reflect.Type)1