Esempio n. 1
0
 @GET
 @Path("{userId}/search")
 public Response searchUsers(
     @PathParam("userId") String userId, @QueryParam(SEARCH_QPARAM) String searchString) {
   List<User> users = userDao.search(searchString, userId);
   List<com.campusconnect.neo4j.types.web.User> returnUsers = new ArrayList<>(users.size());
   for (User user : users) {
     returnUsers.add(Neo4jToWebMapper.mapUserNeo4jToWeb(user));
   }
   return Response.ok().entity(new UsersPage(0, returnUsers.size(), returnUsers)).build();
 }
Esempio n. 2
0
  @Test
  public void testUserSearch() throws Exception {
    // reindex all the data
    dao.reindex();

    List<User> found = dao.search("Matt");
    assertEquals(1, found.size());
    User user = found.get(0);
    assertEquals("Matt", user.getFirstName());

    // test mirroring
    user = dao.get(-2L);
    user.setFirstName("MattX");
    dao.saveUser(user);
    flush();
    flushSearchIndexes();

    // now verify it is reflected in the index
    found = dao.search("MattX");
    assertEquals(1, found.size());
    user = found.get(0);
    assertEquals("MattX", user.getFirstName());
  }