Search in sources :

Example 1 with LoadStrategy

use of org.neo4j.ogm.session.LoadStrategy in project neo4j-ogm by neo4j.

the class QueryCapabilityTest method bothLoadStrategiesShouldBeAbleToDealWithPaths.

@Test
public void bothLoadStrategiesShouldBeAbleToDealWithPaths() {
    for (LoadStrategy strategy : new LoadStrategy[] { LoadStrategy.PATH_LOAD_STRATEGY, LoadStrategy.SCHEMA_LOAD_STRATEGY }) {
        SessionFactory localSessionFactory = new SessionFactory(getDriver(), "org.neo4j.ogm.domain.gh851");
        localSessionFactory.setLoadStrategy(strategy);
        Session session = localSessionFactory.openSession();
        Filter f = new Filter("code", ComparisonOperator.EQUALS, "LAX");
        Collection<Airport> airports = session.loadAll(Airport.class, f);
        assertThat(airports).hasSize(1).first().extracting(Airport::getName).isEqualTo("Los Angeles");
        session.clear();
    // Keep the local session factory open, otherwise closing it will mess up the driver.
    }
}
Also used : SessionFactory(org.neo4j.ogm.session.SessionFactory) Filter(org.neo4j.ogm.cypher.Filter) LoadStrategy(org.neo4j.ogm.session.LoadStrategy) Airport(org.neo4j.ogm.domain.gh851.Airport) Neo4jSession(org.neo4j.ogm.session.Neo4jSession) Session(org.neo4j.ogm.session.Session) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Filter (org.neo4j.ogm.cypher.Filter)1 Airport (org.neo4j.ogm.domain.gh851.Airport)1 LoadStrategy (org.neo4j.ogm.session.LoadStrategy)1 Neo4jSession (org.neo4j.ogm.session.Neo4jSession)1 Session (org.neo4j.ogm.session.Session)1 SessionFactory (org.neo4j.ogm.session.SessionFactory)1