NCMBRoleService extends NCMBService { public JSONObject addUserRelations(String roleId, List<NCMBUser> users) throws NCMBException { RequestParams reqParams = userRelationsParams(roleId, users, true); NCMBResponse response = sendRequest(reqParams); updateRoleCheckResponse(response); return response.responseData; } NCMBRoleService(NCMBContext context); JSONObject createRole(String roleName); void createRoleInBackground(String roleName, ExecuteServiceCallback callback); void deleteRole(String roleId); void deleteRoleInBackground(String roleId, DoneCallback callback); RequestParams getRoleParams(String roleId); NCMBRole fetchRole(String roleId); void fetchRoleInBackground(String objectId, final FetchCallback callback); ArrayList<NCMBRole> searchRole(JSONObject conditions); void searchRoleInBackground(JSONObject conditions, SearchRoleCallback callback); ArrayList<String> findBelongUser(String roleId); JSONObject addUserRelations(String roleId, List<NCMBUser> users); void addUserRelationsInBackground(String roleId, List<NCMBUser> users,
                                             ExecuteServiceCallback callback); JSONObject removeUserRelations(String roleId, List<NCMBUser> users); void removeUserRelationsInBackground(String roleId, List<NCMBUser> users,
                                                ExecuteServiceCallback callback); JSONObject addRoleRelations(String roleId, List<NCMBRole> roles); void addRoleRelationsInBackground(String roleId, List<NCMBRole> roles,
                                             ExecuteServiceCallback callback); JSONObject removeRoleRelations(String roleId, List<NCMBRole> roles); void removeRoleRelationsInBackground(String roleId, List<NCMBRole> roles,
                                                ExecuteServiceCallback callback); void updateAcl(String roleId, NCMBAcl acl); void updateAclInBackground(String roleId, NCMBAcl acl, DoneCallback callback); static final String SERVICE_PATH; static final int HTTP_STATUS_ROLE_CREATED; static final int HTTP_STATUS_ROLE_UPDATED; static final int HTTP_STATUS_ROLE_DELETED; }
@Test public void addUserRelations() throws Exception { NCMBRoleService roleService = getRoleService(); String roleId = "dummyRoleId"; try { int numUsers = 2; ArrayList<NCMBUser> users = generateUsers(numUsers); JSONObject response = roleService.addUserRelations(roleId, users); Assert.assertEquals("2014-06-04T11:28:30.348Z", response.getString("updateDate")); } catch (NCMBException e) { Assert.fail(e.getMessage()); } }