use of org.neo4j.ogm.domain.restaurant.Restaurant in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldFilterByPropertyIn.
/**
* @see DATAGRAPH-904
*/
@Test
public void shouldFilterByPropertyIn() {
Restaurant sfo = new Restaurant("San Francisco International Airport (SFO)", 72.4);
sfo.setLaunchDate(new Date(1000));
session.save(sfo);
Restaurant kuroda = new Restaurant("Kuroda", 80.5);
kuroda.setLaunchDate(new Date(2000));
session.save(kuroda);
Filter filter = new Filter("name", ComparisonOperator.IN, new String[] { "Kuroda", "Foo", "Bar" });
Collection<Restaurant> results = session.loadAll(Restaurant.class, new Filters().add(filter));
assertThat(results).isNotNull();
assertThat(results).hasSize(1);
assertThat(results.iterator().next().getName()).isEqualTo("Kuroda");
}
use of org.neo4j.ogm.domain.restaurant.Restaurant in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldFilterByPropertyWithConverter.
/**
* @see DATAGRAPH-904
*/
@Test
public void shouldFilterByPropertyWithConverter() {
Restaurant kuroda = new Restaurant("Kuroda", 72.4);
kuroda.setLaunchDate(new Date(1000));
session.save(kuroda);
Restaurant cyma = new Restaurant("Cyma", 80.5);
cyma.setLaunchDate(new Date(2000));
session.save(cyma);
Filter launchDateFilter = new Filter("launchDate", ComparisonOperator.LESS_THAN, new Date(1001));
Collection<Restaurant> results = session.loadAll(Restaurant.class, new Filters().add(launchDateFilter));
assertThat(results).isNotNull();
assertThat(results).hasSize(1);
assertThat(results.iterator().next().getName()).isEqualTo("Kuroda");
Filter anotherFilter = new Filter("launchDate", ComparisonOperator.EQUALS, new Date(999));
results = session.loadAll(Restaurant.class, new Filters().add(anotherFilter));
assertThat(results).isNotNull();
assertThat(results).isEmpty();
}
use of org.neo4j.ogm.domain.restaurant.Restaurant in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldFilterByPropertyContaining.
/**
* @see DATAGRAPH-904
*/
@Test
public void shouldFilterByPropertyContaining() {
Restaurant sfo = new Restaurant("San Francisco International Airport (SFO)", 72.4);
sfo.setLaunchDate(new Date(1000));
session.save(sfo);
Restaurant kuroda = new Restaurant("Kuroda", 80.5);
kuroda.setLaunchDate(new Date(2000));
session.save(kuroda);
Filter filter = new Filter("name", ComparisonOperator.CONTAINING, "International Airport");
Collection<Restaurant> results = session.loadAll(Restaurant.class, new Filters().add(filter));
assertThat(results).isNotNull();
assertThat(results).hasSize(1);
assertThat(results.iterator().next().getName()).isEqualTo("San Francisco International Airport (SFO)");
}
use of org.neo4j.ogm.domain.restaurant.Restaurant in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldFilterByPropertyEndingWith.
/**
* @see DATAGRAPH-904
*/
@Test
public void shouldFilterByPropertyEndingWith() {
Restaurant sfo = new Restaurant("San Francisco International Airport (SFO)", 72.4);
sfo.setLaunchDate(new Date(1000));
session.save(sfo);
Restaurant kuroda = new Restaurant("Kuroda", 80.5);
kuroda.setLaunchDate(new Date(2000));
session.save(kuroda);
Filter filter = new Filter("name", ComparisonOperator.ENDING_WITH, "Airport (SFO)");
Collection<Restaurant> results = session.loadAll(Restaurant.class, new Filters().add(filter));
assertThat(results).isNotNull();
assertThat(results).hasSize(1);
assertThat(results.iterator().next().getName()).isEqualTo("San Francisco International Airport (SFO)");
}
use of org.neo4j.ogm.domain.restaurant.Restaurant in project neo4j-ogm by neo4j.
the class RestaurantIntegrationTest method shouldQueryByDistance.
@Test
public void shouldQueryByDistance() {
Restaurant restaurant = new Restaurant("San Francisco International Airport (SFO)", new Location(37.61649, -122.38681), 94128);
session.save(restaurant);
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("distance", 1000);
Restaurant found = session.queryForObject(Restaurant.class, "MATCH (r:Restaurant) " + "WHERE distance(point({latitude: r.latitude, longitude:r.longitude}),point({latitude:37.0, longitude:-118.0, crs: 'WGS-84'})) < $distance*1000 RETURN r;", parameters);
assertThat(found).isNotNull();
}
Aggregations