use of org.neo4j.ogm.domain.restaurant.Location in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldSaveBranchWitlCompositeLocationConverter.
@Test
public void shouldSaveBranchWitlCompositeLocationConverter() throws Exception {
Franchise franchise = new Franchise();
Restaurant restaurant = new Restaurant();
Branch branch = new Branch(new Location(37.61649, -122.38681), franchise, restaurant);
session.save(branch);
session.clear();
Branch loaded = session.load(Branch.class, branch.getId());
assertThat(loaded.getLocation().getLatitude()).isCloseTo(37.61649, within(0.00001));
assertThat(loaded.getLocation().getLongitude()).isCloseTo(-122.38681, within(0.00001));
}
use of org.neo4j.ogm.domain.restaurant.Location in project neo4j-ogm by neo4j.
the class CompilerTest method createSingleStatementForLabelsInDifferentOrder.
@Test
public void createSingleStatementForLabelsInDifferentOrder() throws Exception {
Franchise franchise = new Franchise();
Restaurant r1 = new Restaurant();
r1.setName("La Strada Tooting");
r1.labels = Arrays.asList("Delicious", "Foreign");
Restaurant r2 = new Restaurant();
r2.setName("La Strada Brno");
r2.labels = Arrays.asList("Foreign", "Delicious");
franchise.addBranch(new Branch(new Location(0.0, 0.0), franchise, r1));
franchise.addBranch(new Branch(new Location(0.0, 0.0), franchise, r2));
Compiler compiler = mapAndCompile(franchise, -1);
assertThat(compiler.createNodesStatements()).extracting(Statement::getStatement).containsOnly("UNWIND $rows as row CREATE (n:`Franchise`) SET n=row.props RETURN row.nodeRef as ref, ID(n) as id, $type as type", // the point is only one query for this combination of labels
"UNWIND $rows as row CREATE (n:`Delicious`:`Foreign`:`Restaurant`) SET n=row.props RETURN row.nodeRef as ref, ID(n) as id, $type as type");
}
Aggregations