@Test public void removeRoleInBackground() throws Exception { NCMBRole role1 = new NCMBRole("testRole1"); role1.setObjectId("dummyRoleObjectId1"); NCMBRole role2 = new NCMBRole("testRole2"); role2.setObjectId("dummyRoleObjectId2"); NCMBRole role = new NCMBRole("testRole"); role.setObjectId("dummyRoleId"); role.removeRoleInBackground(Arrays.asList(role1, role2), new DoneCallback() { @Override public void done(NCMBException e) { if (e != null) { Assert.fail(e.getMessage()); } callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); SimpleDateFormat df = NCMBDateFormat.getIso8601(); Assert.assertEquals(df.parse("2014-06-04T11:28:30.348Z"), role.getUpdateDate()); Assert.assertNull(role.getString("belongRole")); Assert.assertTrue(callbackFlag); }
public void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeRoleRelationsInBackground(getObjectId(), roles, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(e); } } }
NCMBRole extends NCMBBase { public void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeRoleRelationsInBackground(getObjectId(), roles, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(e); } } } }
NCMBRole extends NCMBBase { public void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeRoleRelationsInBackground(getObjectId(), roles, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); }
NCMBRole extends NCMBBase { public void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeRoleRelationsInBackground(getObjectId(), roles, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); static NCMBQuery<NCMBRole> getQuery(); String getRoleName(); void setRoleName(String name); void addUser(List<NCMBUser> users); void addUserInBackground(List<NCMBUser> users, final DoneCallback callback); void removeUser(List<NCMBUser> users); void removeUserInBackground(List<NCMBUser> users, final DoneCallback callback); void addRole(List<NCMBRole> roles); void addRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void removeRole(List<NCMBRole> roles); void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void createRole(); void createRoleInBackground(final DoneCallback callback); void fetchObject(); void fetchObjectInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); }
NCMBRole extends NCMBBase { public void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback) { NCMBRoleService roleService = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); try { roleService.removeRoleRelationsInBackground(getObjectId(), roles, new ExecuteServiceCallback() { @Override public void done(JSONObject json, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { mFields.put("updateDate", json.getString("updateDate")); if (callback != null) { callback.done(null); } } catch (JSONException e1) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON, e1.getMessage())); } } } } }); } catch (NCMBException e) { if (callback != null) { callback.done(e); } } } NCMBRole();  NCMBRole(String name);   NCMBRole(JSONObject params); static NCMBQuery<NCMBRole> getQuery(); String getRoleName(); void setRoleName(String name); void addUser(List<NCMBUser> users); void addUserInBackground(List<NCMBUser> users, final DoneCallback callback); void removeUser(List<NCMBUser> users); void removeUserInBackground(List<NCMBUser> users, final DoneCallback callback); void addRole(List<NCMBRole> roles); void addRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void removeRole(List<NCMBRole> roles); void removeRoleInBackground(List<NCMBRole> roles, final DoneCallback callback); void createRole(); void createRoleInBackground(final DoneCallback callback); void fetchObject(); void fetchObjectInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback);  }