Search in sources :

Example 1 with MetaData

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

the class LabelDeterminationTest method metaDataWithImplicitParentPackageShouldWork.

// GH-619
@Test
public void metaDataWithImplicitParentPackageShouldWork() {
    MetaData metaData = new MetaData("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 2 with MetaData

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

the class LabelDeterminationTest method metaDataFromParentPackageShouldWork.

// GH-619
@Test
public void metaDataFromParentPackageShouldWork() {
    MetaData metaData = new MetaData("org.neo4j.ogm.domain.gh619");
    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 3 with MetaData

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

the class PetIntegrationTest method shouldResolveMetadataCorrectly.

/**
 * @see issue #40
 */
@Test
public void shouldResolveMetadataCorrectly() {
    MetaData metaData = new MetaData("org.neo4j.ogm.domain.pets");
    assertThat(metaData.resolve("Animal").name()).isEqualTo("org.neo4j.ogm.domain.pets.Animal");
    assertThat(metaData.resolve("Mammal", "Animal").name()).isEqualTo("org.neo4j.ogm.domain.pets.Mammal");
    assertThat(metaData.resolve("Mammal", "Animal", "Dog").name()).isEqualTo("org.neo4j.ogm.domain.pets.Dog");
    assertThat(metaData.resolve("Dog", "Mammal", "Animal").name()).isEqualTo("org.neo4j.ogm.domain.pets.Dog");
}
Also used : MetaData(org.neo4j.ogm.metadata.MetaData) Test(org.junit.Test)

Example 4 with MetaData

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

the class MovieTest method testDeserialiseMovie.

@Test
public void testDeserialiseMovie() {
    MetaData metadata = new MetaData("org.neo4j.ogm.domain.cineasts.annotated");
    Neo4jSession session = new Neo4jSession(metadata, true, new MoviesRequest());
    Movie movie = session.load(Movie.class, UUID.fromString("38ebe777-bc85-4810-8217-096f29a361f1"), 1);
    assertThat(movie.getTitle()).isEqualTo("Pulp Fiction");
    assertThat(movie.getRatings()).isNotNull();
    assertThat(movie.getRatings()).hasSize(1);
    Rating rating = movie.getRatings().iterator().next();
    assertThat(rating.getUser().getName()).isEqualTo("Michal");
    assertThat(rating.getMovie().getTitle()).isEqualTo("Pulp Fiction");
}
Also used : Movie(org.neo4j.ogm.domain.cineasts.annotated.Movie) MetaData(org.neo4j.ogm.metadata.MetaData) Neo4jSession(org.neo4j.ogm.session.Neo4jSession) Rating(org.neo4j.ogm.domain.cineasts.annotated.Rating) Test(org.junit.Test)

Example 5 with MetaData

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

the class BookmarkTest method setUp.

@Before
public void setUp() {
    BoltDriver driver = new BoltDriver(nativeDriver);
    session = new Neo4jSession(new MetaData("org.neo4j.ogm.empty"), true, driver);
}
Also used : BoltDriver(org.neo4j.ogm.drivers.bolt.driver.BoltDriver) MetaData(org.neo4j.ogm.metadata.MetaData) Before(org.junit.Before)

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