Search in sources :

Example 6 with MetaLookup

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

Example 7 with MetaLookup

use of io.crnk.meta.MetaLookup in project crnk-framework by crnk-project.

the class AnyTypeUtilsTest method setup.

@Before
public void setup() {
    metaProvider = new JpaMetaProvider(Collections.<Class>emptySet());
    MetaLookup lookup = new MetaLookup();
    lookup.addProvider(metaProvider);
    metaProvider.discoverMeta(TestAnyType.class);
}
Also used : MetaLookup(io.crnk.meta.MetaLookup) JpaMetaProvider(io.crnk.jpa.meta.JpaMetaProvider) Before(org.junit.Before)

Example 8 with MetaLookup

use of io.crnk.meta.MetaLookup in project crnk-framework by crnk-project.

the class MetaKeyImplTest method test.

@Test
public void test() {
    JpaMetaProvider metaProvider = new JpaMetaProvider((Set) Collections.emptySet());
    MetaLookup lookup = new MetaLookup();
    lookup.addProvider(metaProvider);
    MetaEntity meta = metaProvider.discoverMeta(TestEntity.class);
    MetaKey primaryKey = meta.getPrimaryKey();
    Assert.assertTrue(primaryKey.isUnique());
    Assert.assertEquals("TestEntity$primaryKey", primaryKey.getName());
    Assert.assertEquals(1, primaryKey.getElements().size());
}
Also used : MetaLookup(io.crnk.meta.MetaLookup) MetaKey(io.crnk.meta.model.MetaKey) Test(org.junit.Test)

Example 9 with MetaLookup

use of io.crnk.meta.MetaLookup in project crnk-framework by crnk-project.

the class JpaResourceInformationProviderTest method setup.

@Before
public void setup() {
    jpaMetaProvider = new JpaMetaProvider(Collections.<Class>emptySet());
    lookup = new MetaLookup();
    lookup.addProvider(jpaMetaProvider);
    builder = new JpaResourceInformationProvider(new NullPropertiesProvider());
    builder.init(new DefaultResourceInformationProviderContext(builder, new DefaultInformationBuilder(new TypeParser()), new TypeParser(), new ObjectMapper()));
}
Also used : JpaResourceInformationProvider(io.crnk.jpa.internal.JpaResourceInformationProvider) MetaLookup(io.crnk.meta.MetaLookup) DefaultInformationBuilder(io.crnk.core.engine.internal.information.DefaultInformationBuilder) TypeParser(io.crnk.core.engine.parser.TypeParser) JpaMetaProvider(io.crnk.jpa.meta.JpaMetaProvider) NullPropertiesProvider(io.crnk.core.engine.properties.NullPropertiesProvider) DefaultResourceInformationProviderContext(io.crnk.legacy.registry.DefaultResourceInformationProviderContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 10 with MetaLookup

use of io.crnk.meta.MetaLookup in project crnk-framework by crnk-project.

the class JpaNullabilityMetaTest method setup.

@Before
public void setup() {
    metaProvider = new JpaMetaProvider(Collections.<Class>emptySet());
    MetaLookup lookup = new MetaLookup();
    lookup.addProvider(metaProvider);
}
Also used : MetaLookup(io.crnk.meta.MetaLookup) Before(org.junit.Before)

Aggregations

MetaLookup (io.crnk.meta.MetaLookup)19 Before (org.junit.Before)6 JpaMetaProvider (io.crnk.jpa.meta.JpaMetaProvider)5 MetaElement (io.crnk.meta.model.MetaElement)3 CrnkBoot (io.crnk.core.boot.CrnkBoot)2 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)2 ResourceNotFoundException (io.crnk.core.exception.ResourceNotFoundException)2 MetaModule (io.crnk.meta.MetaModule)2 MetaKey (io.crnk.meta.model.MetaKey)2 MetaPartition (io.crnk.meta.provider.MetaPartition)2 EntityManager (javax.persistence.EntityManager)2 Test (org.junit.Test)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DefaultInformationBuilder (io.crnk.core.engine.internal.information.DefaultInformationBuilder)1 TypeParser (io.crnk.core.engine.parser.TypeParser)1 NullPropertiesProvider (io.crnk.core.engine.properties.NullPropertiesProvider)1 ModuleRegistry (io.crnk.core.module.ModuleRegistry)1 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)1 AbstractJpaJerseyTest (io.crnk.jpa.AbstractJpaJerseyTest)1 JpaResourceInformationProvider (io.crnk.jpa.internal.JpaResourceInformationProvider)1