@Test public void script_execute_POST() throws Exception { NCMBScript script = new NCMBScript("testScript_POST.js", NCMBScript.MethodType.POST, mScriptUrl); JSONObject body = new JSONObject(); body.put("message", "hello,tarou"); script.executeInBackground(null, body, null, new ExecuteScriptCallback() { @Override public void done(byte[] result, NCMBException e) { if (e != null) { Assert.fail(e.getMessage()); } else { try { Assert.assertEquals("hello,tarou", new String(result, "UTF-8")); } catch (UnsupportedEncodingException error) { Assert.fail(error.getMessage()); } } mCallbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(mCallbackFlag); }
public void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback) { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground(mScriptName, mMethod, header, body, query, mBaseUrl, new ExecuteScriptCallback() { @Override public void done(byte[] data, NCMBException e) { if (callback != null) { callback.done(data, e); } } }); }
NCMBScript { public void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback) { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground(mScriptName, mMethod, header, body, query, mBaseUrl, new ExecuteScriptCallback() { @Override public void done(byte[] data, NCMBException e) { if (callback != null) { callback.done(data, e); } } }); } }
NCMBScript { public void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback) { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground(mScriptName, mMethod, header, body, query, mBaseUrl, new ExecuteScriptCallback() { @Override public void done(byte[] data, NCMBException e) { if (callback != null) { callback.done(data, e); } } }); } NCMBScript(String scriptName, MethodType method);  NCMBScript(String scriptName, MethodType method, String baseUrl); }
NCMBScript { public void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback) { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground(mScriptName, mMethod, header, body, query, mBaseUrl, new ExecuteScriptCallback() { @Override public void done(byte[] data, NCMBException e) { if (callback != null) { callback.done(data, e); } } }); } NCMBScript(String scriptName, MethodType method);  NCMBScript(String scriptName, MethodType method, String baseUrl); void setScriptName(String scriptName); String getScriptName(); void setMethod(MethodType method); MethodType getMethod(); void setBaseUrl(String baseUrl); String getBaseUrl(); byte[] execute(Map<String, String> header, JSONObject body, JSONObject query); void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback); }
NCMBScript { public void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback) { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground(mScriptName, mMethod, header, body, query, mBaseUrl, new ExecuteScriptCallback() { @Override public void done(byte[] data, NCMBException e) { if (callback != null) { callback.done(data, e); } } }); } NCMBScript(String scriptName, MethodType method);  NCMBScript(String scriptName, MethodType method, String baseUrl); void setScriptName(String scriptName); String getScriptName(); void setMethod(MethodType method); MethodType getMethod(); void setBaseUrl(String baseUrl); String getBaseUrl(); byte[] execute(Map<String, String> header, JSONObject body, JSONObject query); void executeInBackground(Map<String, String> header, JSONObject body, JSONObject query, final ExecuteScriptCallback callback);  }