Search in sources :

Example 16 with MetaAttribute

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

Example 17 with MetaAttribute

use of io.crnk.meta.model.MetaAttribute 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 18 with MetaAttribute

use of io.crnk.meta.model.MetaAttribute 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 19 with MetaAttribute

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

the class JpaNullabilityMetaTest method testObjectValueNullable.

@Test
public void testObjectValueNullable() {
    MetaEntity meta = metaProvider.discoverMeta(TestEntity.class);
    MetaAttribute field = meta.getAttribute("stringValue");
    Assert.assertTrue(field.isNullable());
}
Also used : MetaAttribute(io.crnk.meta.model.MetaAttribute) Test(org.junit.Test)

Example 20 with MetaAttribute

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

the class JpaNullabilityMetaTest method testPrimaryKeyNotNullable.

@Test
public void testPrimaryKeyNotNullable() {
    MetaEntity meta = metaProvider.discoverMeta(TestEntity.class);
    MetaKey primaryKey = meta.getPrimaryKey();
    MetaAttribute idField = primaryKey.getElements().get(0);
    Assert.assertFalse(idField.isNullable());
}
Also used : MetaKey(io.crnk.meta.model.MetaKey) MetaAttribute(io.crnk.meta.model.MetaAttribute) Test(org.junit.Test)

Aggregations

MetaAttribute (io.crnk.meta.model.MetaAttribute)54 Test (org.junit.Test)32 MetaResource (io.crnk.meta.model.resource.MetaResource)16 AbstractJpaJerseyTest (io.crnk.jpa.AbstractJpaJerseyTest)9 MetaDataObject (io.crnk.meta.model.MetaDataObject)7 MetaKey (io.crnk.meta.model.MetaKey)7 MetaResourceBase (io.crnk.meta.model.resource.MetaResourceBase)7 FilterSpec (io.crnk.core.queryspec.FilterSpec)5 MetaType (io.crnk.meta.model.MetaType)5 ResourceField (io.crnk.core.engine.information.resource.ResourceField)4 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)4 QuerySpec (io.crnk.core.queryspec.QuerySpec)4 MetaElement (io.crnk.meta.model.MetaElement)4 EntityManager (javax.persistence.EntityManager)4 Type (java.lang.reflect.Type)3 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)2 TSField (io.crnk.gen.typescript.model.TSField)2 MetaEntity (io.crnk.jpa.meta.MetaEntity)2 MetaJpaDataObject (io.crnk.jpa.meta.MetaJpaDataObject)2 NamingTestEntity (io.crnk.jpa.model.NamingTestEntity)2