@Test public void deleteRoleInBackground() throws Exception { NCMBRoleService roleService = getRoleService(); String roleId = "dummyRoleId"; roleService.deleteRoleInBackground(roleId, new DoneCallback() { @Override public void done(NCMBException e) { Assert.assertEquals(e, null); callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(callbackFlag); }
public void deleteRoleInBackground(String roleId, DoneCallback callback) throws NCMBException { RequestParams reqParams = deleteRoleParams(roleId); sendRequestAsync(reqParams, new RoleServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(null); } @Override public void handleError(NCMBException e) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(e); } }); }
NCMBRoleService extends NCMBService { public void deleteRoleInBackground(String roleId, DoneCallback callback) throws NCMBException { RequestParams reqParams = deleteRoleParams(roleId); sendRequestAsync(reqParams, new RoleServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(null); } @Override public void handleError(NCMBException e) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(e); } }); } }
NCMBRoleService extends NCMBService { public void deleteRoleInBackground(String roleId, DoneCallback callback) throws NCMBException { RequestParams reqParams = deleteRoleParams(roleId); sendRequestAsync(reqParams, new RoleServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(null); } @Override public void handleError(NCMBException e) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(e); } }); } NCMBRoleService(NCMBContext context); }
NCMBRoleService extends NCMBService { public void deleteRoleInBackground(String roleId, DoneCallback callback) throws NCMBException { RequestParams reqParams = deleteRoleParams(roleId); sendRequestAsync(reqParams, new RoleServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(null); } @Override public void handleError(NCMBException e) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(e); } }); } 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); }
NCMBRoleService extends NCMBService { public void deleteRoleInBackground(String roleId, DoneCallback callback) throws NCMBException { RequestParams reqParams = deleteRoleParams(roleId); sendRequestAsync(reqParams, new RoleServiceCallback(this, callback) { @Override public void handleResponse(NCMBResponse response) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(null); } @Override public void handleError(NCMBException e) { DoneCallback doneCallback = (DoneCallback) mCallback; doneCallback.done(e); } }); } 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; }