use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.
the class SingleUseEntityMapperTest method shouldMapFromMap.
@Test
public void shouldMapFromMap() {
MetaData metaData = new MetaData("org.neo4j.ogm.context");
SingleUseEntityMapper entityMapper = new SingleUseEntityMapper(metaData, new ReflectionEntityInstantiator(metaData));
Collection<Object> toReturn = new ArrayList<>();
Iterable<Map<String, Object>> results = getQueryResults();
for (Map<String, Object> result : results) {
toReturn.add(entityMapper.map(UserResult.class, result));
}
assertThat(toReturn).hasSize(1);
assertThat(toReturn).first().isInstanceOf(UserResult.class);
UserResult userResult = (UserResult) toReturn.iterator().next();
assertThat(userResult.getProfile()).containsAllEntriesOf((Map<? extends String, ?>) results.iterator().next().get("profile"));
}
use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.
the class DirectRelationshipsTest method setUpTestDatabase.
@BeforeClass
public static void setUpTestDatabase() {
mappingMetadata = new MetaData("org.neo4j.ogm.domain.filesystem");
mappingContext = new MappingContext(mappingMetadata);
}
use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.
the class CompilerTest 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.domain.policy", "org.neo4j.ogm.domain.music", "org.neo4j.ogm.domain.restaurant", "org.neo4j.ogm.domain.travel");
mappingContext = new MappingContext(mappingMetadata);
}
use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.
the class CyclicStructureTest method mapAndCompile.
private static Compiler mapAndCompile(Neo4jSession session, Object object, int depth) {
final MetaData metaData = session.metaData();
final MappingContext mappingContext = new MappingContext(metaData);
EntityMapper mapper = new EntityGraphMapper(metaData, mappingContext);
CompileContext context = mapper.map(object, depth);
Compiler compiler = context.getCompiler();
compiler.useStatementFactory(new RowStatementFactory());
return compiler;
}
use of org.neo4j.ogm.metadata.MetaData in project neo4j-ogm by neo4j.
the class InvalidMetadataAutoIndexManagerTest method shouldCheckPropertiesMatchFieldNames.
@Test(expected = MetadataException.class)
public void shouldCheckPropertiesMatchFieldNames() {
MetaData metadata = new MetaData(WrongPropertyCompositeIndexEntity.class.getName());
ClassInfo classInfo = metadata.classInfo(WrongPropertyCompositeIndexEntity.class.getName());
classInfo.getCompositeIndexes();
}
Aggregations