Search in sources :

Example 6 with MetaType

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

the class MetaLookupTest method testPrimitiveShort.

@Test
public void testPrimitiveShort() {
    MetaType meta = resourceProvider.getMeta(Short.class);
    Assert.assertEquals("base.short", meta.getId());
    Assert.assertEquals(Short.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(short.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 7 with MetaType

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

the class MetaLookupTest method testPrimitiveDouble.

@Test
public void testPrimitiveDouble() {
    MetaType meta = resourceProvider.getMeta(Double.class);
    Assert.assertEquals("base.double", meta.getId());
    Assert.assertEquals(Double.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(double.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 8 with MetaType

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

the class MetaLookupTest method testOffsetDateTime.

@Test
// add with Java 8
@Ignore
public void testOffsetDateTime() throws ClassNotFoundException {
    if (ClassUtils.existsClass("java.time.OffsetDateTime")) {
        Class<?> offsetDateTimeClass = Class.forName("java.time.OffsetDateTime");
        MetaType meta = resourceProvider.getMeta(offsetDateTimeClass);
        Assert.assertEquals("base.offsetDateTime", meta.getId());
        Assert.assertEquals(offsetDateTimeClass, meta.getImplementationClass());
    }
}
Also used : MetaType(io.crnk.meta.model.MetaType) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with MetaType

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

the class MetaLookupTest method testPrimitiveLong.

@Test
public void testPrimitiveLong() {
    MetaType meta = resourceProvider.getMeta(Long.class);
    Assert.assertEquals("base.long", meta.getId());
    Assert.assertEquals(Long.class, meta.getImplementationClass());
    MetaType primitiveMeta = resourceProvider.getMeta(long.class);
    Assert.assertSame(meta, primitiveMeta);
}
Also used : MetaType(io.crnk.meta.model.MetaType) Test(org.junit.Test)

Example 10 with MetaType

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

Aggregations

MetaType (io.crnk.meta.model.MetaType)21 Test (org.junit.Test)16 MetaAttribute (io.crnk.meta.model.MetaAttribute)5 MetaDataObject (io.crnk.meta.model.MetaDataObject)3 TSField (io.crnk.gen.typescript.model.TSField)2 MetaResource (io.crnk.meta.model.resource.MetaResource)2 Type (java.lang.reflect.Type)2 ResourceFieldType (io.crnk.core.engine.information.resource.ResourceFieldType)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)1 ResourceRegistry (io.crnk.core.engine.registry.ResourceRegistry)1 SerializeType (io.crnk.core.resource.annotations.SerializeType)1 TSParameterizedType (io.crnk.gen.typescript.model.TSParameterizedType)1 TSType (io.crnk.gen.typescript.model.TSType)1 MetaJpaDataObject (io.crnk.jpa.meta.MetaJpaDataObject)1 TestEntity (io.crnk.jpa.model.TestEntity)1 MetaArrayType (io.crnk.meta.model.MetaArrayType)1 MetaMapType (io.crnk.meta.model.MetaMapType)1 MetaResourceField (io.crnk.meta.model.resource.MetaResourceField)1 ParameterizedType (java.lang.reflect.ParameterizedType)1