AdministratorGeoStoreClient extends GeoStoreClient { public UserList getUsers() { return getBaseWebResource("users").header("Content-Type", MediaType.TEXT_XML).accept(MediaType.TEXT_XML).get(UserList.class); }  User getUser(long id); User getUser(String name); User getUser(long id, Boolean includeAttributes); UserList getUsers(); UserList getUsers(Integer page, Integer entries); User getUserDetails(); Long insert(User user); void deleteUser(Long id); void update(Long id, User user); long insertUserGroup(UserGroup usergroup); void deleteUserGroup(long usergroupId); void assignUserGroup(long userId, long usergroupId); void deassignUserGroup(long userId, long usergroupId); RESTUserGroup getUserGroup(long usergroupId); UserGroupList getUserGroups(Integer page, Integer entries, boolean all); ShortResourceList updateSecurityRules(ShortResourceList resourcesToSet, Long groupId,
            boolean canRead, boolean canWrite); RESTUserGroup getUserGroup(String name);  }
@Test public void getUsersTest() { try { UserList users = geoStoreClient.getUsers(1, 1); UserGroup ug1 = new UserGroup(); ug1.setGroupName("testGroup1"); ug1.setDescription("testGroup1-Description"); UserGroup ug2 = new UserGroup(); ug2.setGroupName("testGroup2"); ug2.setDescription("testGroup2-Description"); UserGroup ug3 = new UserGroup(); ug3.setGroupName("testGroup3"); ug3.setDescription("testGroup3-Description"); geoStoreClient.insertUserGroup(ug1); geoStoreClient.insertUserGroup(ug2); geoStoreClient.insertUserGroup(ug3); Set<UserGroup> ugs = new HashSet<UserGroup>(); ugs.add(ug1); ugs.add(ug2); ugs.add(ug3); User user = new User(); user.setName("testuser111"); user.setRole(Role.USER); user.setNewPassword("testpw"); UserAttribute email = new UserAttribute(); email.setName("email"); email.setValue("test@geo-solutions.it"); user.setGroups(ugs); geoStoreClient.insert(user); users = geoStoreClient.getUsers(0, 3); for(RESTUser u : users.getList()){ if("testuser111".equals(u.getName())){ assertEquals(3,u.getGroupsNames().size()); } } } catch (Exception e) { fail(); } }
@Test public void testUserInitialization(){ UserList ul = geoStoreClient.getUsers(0,100); assertEquals(1, ul.getList().size()); for(RESTUser u : ul.getList()){ assertNull(u.getGroupsNames()); } }