@Test public void updateInBackground() throws Exception { NCMBFile file = new NCMBFile("Sample.txt", new NCMBAcl()); file.updateInBackground(new DoneCallback() { @Override public void done(NCMBException e) { callbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(callbackFlag); }
public void updateInBackground(final DoneCallback callback) { JSONObject aclJson = new JSONObject(); try { aclJson = createAclJSON(); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } NCMBFileService fileService = (NCMBFileService) NCMB.factory(NCMB.ServiceType.FILE); fileService.updateFileInBackground(getFileName(), aclJson, new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setLocalData(jsonData); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } if (callback != null) { callback.done(null); } } } }); }
NCMBFile extends NCMBBase { public void updateInBackground(final DoneCallback callback) { JSONObject aclJson = new JSONObject(); try { aclJson = createAclJSON(); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } NCMBFileService fileService = (NCMBFileService) NCMB.factory(NCMB.ServiceType.FILE); fileService.updateFileInBackground(getFileName(), aclJson, new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setLocalData(jsonData); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } if (callback != null) { callback.done(null); } } } }); } }
NCMBFile extends NCMBBase { public void updateInBackground(final DoneCallback callback) { JSONObject aclJson = new JSONObject(); try { aclJson = createAclJSON(); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } NCMBFileService fileService = (NCMBFileService) NCMB.factory(NCMB.ServiceType.FILE); fileService.updateFileInBackground(getFileName(), aclJson, new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setLocalData(jsonData); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } if (callback != null) { callback.done(null); } } } }); } NCMBFile();  NCMBFile(String fileName);  NCMBFile(String fileName, NCMBAcl acl);  NCMBFile(String fileName, byte[] fileData, NCMBAcl acl); }
NCMBFile extends NCMBBase { public void updateInBackground(final DoneCallback callback) { JSONObject aclJson = new JSONObject(); try { aclJson = createAclJSON(); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } NCMBFileService fileService = (NCMBFileService) NCMB.factory(NCMB.ServiceType.FILE); fileService.updateFileInBackground(getFileName(), aclJson, new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setLocalData(jsonData); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } if (callback != null) { callback.done(null); } } } }); } NCMBFile();  NCMBFile(String fileName);  NCMBFile(String fileName, NCMBAcl acl);  NCMBFile(String fileName, byte[] fileData, NCMBAcl acl); void setFileName(String fileName); String getFileName(); void setFileData(byte[] data); byte[] getFileData(); static NCMBQuery<NCMBFile> getQuery(); void save(); void saveInBackground(final DoneCallback callback); void update(); void updateInBackground(final DoneCallback callback); void delete(); void deleteInBackground(final DoneCallback callback); byte[] fetch(); void fetchInBackground(final FetchFileCallback callback); }
NCMBFile extends NCMBBase { public void updateInBackground(final DoneCallback callback) { JSONObject aclJson = new JSONObject(); try { aclJson = createAclJSON(); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } NCMBFileService fileService = (NCMBFileService) NCMB.factory(NCMB.ServiceType.FILE); fileService.updateFileInBackground(getFileName(), aclJson, new ExecuteServiceCallback() { @Override public void done(JSONObject jsonData, NCMBException e) { if (e != null) { if (callback != null) { callback.done(e); } } else { try { setLocalData(jsonData); } catch (NCMBException error) { if (callback != null) { callback.done(error); } } if (callback != null) { callback.done(null); } } } }); } NCMBFile();  NCMBFile(String fileName);  NCMBFile(String fileName, NCMBAcl acl);  NCMBFile(String fileName, byte[] fileData, NCMBAcl acl); void setFileName(String fileName); String getFileName(); void setFileData(byte[] data); byte[] getFileData(); static NCMBQuery<NCMBFile> getQuery(); void save(); void saveInBackground(final DoneCallback callback); void update(); void updateInBackground(final DoneCallback callback); void delete(); void deleteInBackground(final DoneCallback callback); byte[] fetch(); void fetchInBackground(final FetchFileCallback callback);  }