Search in sources :

Example 46 with User

use of org.neo4j.ogm.domain.cineasts.annotated.User in project neo4j-ogm by neo4j.

the class QueryCapabilityTest method testQueryWithProjection.

// GH-496
@Test
public void testQueryWithProjection() {
    Assume.assumeFalse(isHttpDriver());
    Iterable<User> results = session.query(User.class, "MATCH (u:User) where u.name=$name return u " + ",[[(u)-[r:EXTENDED_FRIEND]->(e) | [r, e   ]    ]  ]  ", Collections.singletonMap("name", "Vince"));
    assertThat(results).size().isEqualTo(1);
    User user = results.iterator().next();
    assertThat(user.getName()).isEqualTo("Vince");
    assertThat(user.getExtendedFriends()).isNotEmpty();
    assertThat(user.getExtendedFriends()).contains(new ExtendedUser(null, "extended", null));
}
Also used : ExtendedUser(org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser) User(org.neo4j.ogm.domain.cineasts.annotated.User) ExtendedUser(org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser) Test(org.junit.Test)

Aggregations

User (org.neo4j.ogm.domain.cineasts.annotated.User)46 Test (org.junit.Test)45 Movie (org.neo4j.ogm.domain.cineasts.annotated.Movie)25 Rating (org.neo4j.ogm.domain.cineasts.annotated.Rating)24 Filter (org.neo4j.ogm.cypher.Filter)19 ExtendedUser (org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser)17 Map (java.util.Map)12 HashMap (java.util.HashMap)11 HashSet (java.util.HashSet)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Filters (org.neo4j.ogm.cypher.Filters)3 Pet (org.neo4j.ogm.domain.cineasts.annotated.Pet)3 Pagination (org.neo4j.ogm.cypher.query.Pagination)2 SortOrder (org.neo4j.ogm.cypher.query.SortOrder)2 Plays (org.neo4j.ogm.domain.cineasts.annotated.Plays)2 Result (org.neo4j.ogm.model.Result)2 Session (org.neo4j.ogm.session.Session)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URL (java.net.URL)1