@Test public void update_object_in_background_non_update_value() throws Exception { NCMBObject obj = new NCMBObject("TestClass"); obj.setObjectId("updateTestObjectId"); obj.saveInBackground(new DoneCallback() { @Override public void done(NCMBException e) { if (e != null) { Assert.fail("update object error"); } } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); SimpleDateFormat df = NCMBDateFormat.getIso8601(); Assert.assertTrue(obj.getUpdateDate().equals(df.parse("2014-06-04T11:28:30.348Z"))); }
public void saveInBackground(final DoneCallback callback) { ExecuteServiceCallback executeCallback = new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setServerDataToProperties(jsonData); mUpdateKeys.clear(); if (callback != null) { callback.done(null); } } catch (NCMBException error) { if (callback != null) { callback.done(error); } } } } }; if (getObjectId() == null) { NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.saveObjectInBackground(mClassName, mFields, executeCallback); } else { JSONObject updateJson = null; try { updateJson = createUpdateJsonData(); } catch (JSONException e) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON,e.getMessage())); } } NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.updateObjectInBackground(mClassName, getObjectId(), updateJson,executeCallback); } }
NCMBObject extends NCMBBase { public void saveInBackground(final DoneCallback callback) { ExecuteServiceCallback executeCallback = new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setServerDataToProperties(jsonData); mUpdateKeys.clear(); if (callback != null) { callback.done(null); } } catch (NCMBException error) { if (callback != null) { callback.done(error); } } } } }; if (getObjectId() == null) { NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.saveObjectInBackground(mClassName, mFields, executeCallback); } else { JSONObject updateJson = null; try { updateJson = createUpdateJsonData(); } catch (JSONException e) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON,e.getMessage())); } } NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.updateObjectInBackground(mClassName, getObjectId(), updateJson,executeCallback); } } }
NCMBObject extends NCMBBase { public void saveInBackground(final DoneCallback callback) { ExecuteServiceCallback executeCallback = new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setServerDataToProperties(jsonData); mUpdateKeys.clear(); if (callback != null) { callback.done(null); } } catch (NCMBException error) { if (callback != null) { callback.done(error); } } } } }; if (getObjectId() == null) { NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.saveObjectInBackground(mClassName, mFields, executeCallback); } else { JSONObject updateJson = null; try { updateJson = createUpdateJsonData(); } catch (JSONException e) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON,e.getMessage())); } } NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.updateObjectInBackground(mClassName, getObjectId(), updateJson,executeCallback); } } NCMBObject(String className);   NCMBObject(String className, JSONObject params); }
NCMBObject extends NCMBBase { public void saveInBackground(final DoneCallback callback) { ExecuteServiceCallback executeCallback = new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setServerDataToProperties(jsonData); mUpdateKeys.clear(); if (callback != null) { callback.done(null); } } catch (NCMBException error) { if (callback != null) { callback.done(error); } } } } }; if (getObjectId() == null) { NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.saveObjectInBackground(mClassName, mFields, executeCallback); } else { JSONObject updateJson = null; try { updateJson = createUpdateJsonData(); } catch (JSONException e) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON,e.getMessage())); } } NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.updateObjectInBackground(mClassName, getObjectId(), updateJson,executeCallback); } } NCMBObject(String className);   NCMBObject(String className, JSONObject params); void save(); void saveInBackground(final DoneCallback callback); void fetch(); void fetchInBackground(); void fetchInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); void increment(String key, int amount); void addToList(String key, List objects); void addUniqueToList(String key, List objects); void removeFromList(String key, List objects); }
NCMBObject extends NCMBBase { public void saveInBackground(final DoneCallback callback) { ExecuteServiceCallback executeCallback = new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setServerDataToProperties(jsonData); mUpdateKeys.clear(); if (callback != null) { callback.done(null); } } catch (NCMBException error) { if (callback != null) { callback.done(error); } } } } }; if (getObjectId() == null) { NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.saveObjectInBackground(mClassName, mFields, executeCallback); } else { JSONObject updateJson = null; try { updateJson = createUpdateJsonData(); } catch (JSONException e) { if (callback != null) { callback.done(new NCMBException(NCMBException.INVALID_JSON,e.getMessage())); } } NCMBObjectService objService = new NCMBObjectService(NCMB.getCurrentContext()); objService.updateObjectInBackground(mClassName, getObjectId(), updateJson,executeCallback); } } NCMBObject(String className);   NCMBObject(String className, JSONObject params); void save(); void saveInBackground(final DoneCallback callback); void fetch(); void fetchInBackground(); void fetchInBackground(final FetchCallback callback); void deleteObject(); void deleteObjectInBackground(final DoneCallback callback); void increment(String key, int amount); void addToList(String key, List objects); void addUniqueToList(String key, List objects); void removeFromList(String key, List objects);  }