Search in sources :

Example 1 with ExtendedUser

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

the class LookupByPrimaryIndexTests method loadUsesPrimaryIndexWhenPresentOnSuperclass.

@Test
public void loadUsesPrimaryIndexWhenPresentOnSuperclass() {
    ExtendedUser user1 = new ExtendedUser("login2", "Name 2", "password");
    session.save(user1);
    final Session session2 = sessionFactory.openSession();
    final User retrievedUser1 = session2.load(ExtendedUser.class, "login2");
    assertThat(retrievedUser1).isNotNull();
    assertThat(retrievedUser1.getLogin()).isEqualTo(user1.getLogin());
}
Also used : User(org.neo4j.ogm.domain.cineasts.annotated.User) ExtendedUser(org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser) ExtendedUser(org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser) Session(org.neo4j.ogm.session.Session) Test(org.junit.Test)

Example 2 with ExtendedUser

use of org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser 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

Test (org.junit.Test)2 ExtendedUser (org.neo4j.ogm.domain.cineasts.annotated.ExtendedUser)2 User (org.neo4j.ogm.domain.cineasts.annotated.User)2 Session (org.neo4j.ogm.session.Session)1