Search in sources :

Example 16 with MetaData

use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.

the class EntityFactoryTest method setUp.

@Before
public void setUp() {
    MetaData metadata = new MetaData("org.neo4j.ogm.domain.social", "org.neo4j.ogm.domain.canonical");
    this.entityFactory = new EntityFactory(metadata, new ReflectionEntityInstantiator(metadata));
}
Also used : MetaData(org.neo4j.ogm.metadata.MetaData) Before(org.junit.Before)

Example 17 with MetaData

use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.

the class EntityGraphMapperTest method setUpTestDatabase.

@BeforeClass
public static void setUpTestDatabase() {
    mappingMetadata = new MetaData("org.neo4j.ogm.domain.education", "org.neo4j.ogm.domain.forum", "org.neo4j.ogm.domain.social", "org.neo4j.ogm.domain.policy");
    mappingContext = new MappingContext(mappingMetadata);
}
Also used : MappingContext(org.neo4j.ogm.context.MappingContext) MetaData(org.neo4j.ogm.metadata.MetaData) BeforeClass(org.junit.BeforeClass)

Example 18 with MetaData

use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.

the class LabelDeterminationTest method metaDataWithExplicitPackagesShouldWork.

// GH-619
@Test
public void metaDataWithExplicitPackagesShouldWork() {
    MetaData metaData = new MetaData("org.neo4j.ogm.domain.gh619.base", "org.neo4j.ogm.domain.gh619.model");
    Collection<String> labels = EntityUtils.labels(new RealNode(), metaData);
    assertThat(labels).hasSize(1).containsExactly("real");
}
Also used : RealNode(org.neo4j.ogm.domain.gh619.model.RealNode) MetaData(org.neo4j.ogm.metadata.MetaData) Test(org.junit.Test)

Example 19 with MetaData

use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.

the class NumberConversionTest method assertHasCompositeConverter.

@Test
public void assertHasCompositeConverter() {
    MetaData restaurantMetadata = new MetaData("org.neo4j.ogm.domain.restaurant");
    ClassInfo restaurantInfo = restaurantMetadata.classInfo("Restaurant");
    assertThat(restaurantInfo.propertyField("location").hasCompositeConverter()).isTrue();
}
Also used : MetaData(org.neo4j.ogm.metadata.MetaData) ClassInfo(org.neo4j.ogm.metadata.ClassInfo) Test(org.junit.Test)

Example 20 with MetaData

use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.

the class SingleUseEntityMapperTest method shouldLookupCorrectRootClass.

// GH-552
@Test
public void shouldLookupCorrectRootClass() {
    MetaData metaData = new MetaData("org.neo4j.ogm.domain.gh552");
    String propertyKey = "notAName";
    Map<String, Object> properties = Collections.singletonMap(propertyKey, "NOT A NAME!!!");
    SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(metaData, new ReflectionEntityInstantiator(metaData));
    Thing thing = entityMapper.map(Thing.class, properties);
    assertThat(thing.getNotAName()).isEqualTo(properties.get(propertyKey));
}
Also used : MetaData(org.neo4j.ogm.metadata.MetaData) ReflectionEntityInstantiator(org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator) AnotherThing(org.neo4j.ogm.domain.gh551.AnotherThing) Thing(org.neo4j.ogm.domain.gh552.Thing) Test(org.junit.Test)

Aggregations

MetaData (org.neo4j.ogm.metadata.MetaData)21 Test (org.junit.Test)11 ClassInfo (org.neo4j.ogm.metadata.ClassInfo)6 MappingContext (org.neo4j.ogm.context.MappingContext)5 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 BeforeClass (org.junit.BeforeClass)3 RealNode (org.neo4j.ogm.domain.gh619.model.RealNode)3 Neo4jSession (org.neo4j.ogm.session.Neo4jSession)3 Map (java.util.Map)2 ReflectionEntityInstantiator (org.neo4j.ogm.metadata.reflect.ReflectionEntityInstantiator)2 Serializable (java.io.Serializable)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1