@Test public void executeScriptInBackground() throws Exception { NCMBScriptService scriptService = (NCMBScriptService) NCMB.factory(NCMB.ServiceType.SCRIPT); scriptService.executeScriptInBackground( "testScript.js", NCMBScript.MethodType.GET, null, null, null, mScriptUrl, new ExecuteScriptCallback() { @Override public void done(byte[] result, NCMBException e) { if (e != null) { Assert.fail(e.getMessage()); } else { try { Assert.assertEquals("hello", new String(result, "UTF-8")); } catch (UnsupportedEncodingException error) { Assert.fail(error.getMessage()); } } mCallbackFlag = true; } }); Robolectric.flushBackgroundThreadScheduler(); ShadowLooper.runUiThreadTasks(); Assert.assertTrue(mCallbackFlag); }
public void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback) { new StaticAsyncTask(this, callback).execute(scriptName, method, header, body, query, baseUrl); }
NCMBScriptService extends NCMBService { public void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback) { new StaticAsyncTask(this, callback).execute(scriptName, method, header, body, query, baseUrl); } }
NCMBScriptService extends NCMBService { public void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback) { new StaticAsyncTask(this, callback).execute(scriptName, method, header, body, query, baseUrl); } NCMBScriptService(NCMBContext context); }
NCMBScriptService extends NCMBService { public void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback) { new StaticAsyncTask(this, callback).execute(scriptName, method, header, body, query, baseUrl); } NCMBScriptService(NCMBContext context); byte[] executeScript(String scriptName, MethodType method, Map<String, String> header, JSONObject body, JSONObject query, String baseUrl); void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback); }
NCMBScriptService extends NCMBService { public void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback) { new StaticAsyncTask(this, callback).execute(scriptName, method, header, body, query, baseUrl); } NCMBScriptService(NCMBContext context); byte[] executeScript(String scriptName, MethodType method, Map<String, String> header, JSONObject body, JSONObject query, String baseUrl); void executeScriptInBackground(final String scriptName, final MethodType method, final Map<String, String> header, final JSONObject body, final JSONObject query, final String baseUrl, final ExecuteScriptCallback callback); static final String SERVICE_PATH; static final String DEFAULT_SCRIPT_DOMAIN_URL; static final String DEFAULT_SCRIPT_API_VERSION; }