@Override public String getSerializationBodyFormat() { final HttpAdapter routerAdapter = (HttpAdapter) RemoteRailsConfig.getRouterAdapterByClass(this.getClass()); if (routerAdapter == null || routerAdapter.getConfigurationsAsConfiguration("GET") == null) { return RemoteRailsConfig.getInstance().getDefaultRouterAdapter().getSuffix(); } return routerAdapter.getConfigurationsAsConfiguration("POST").getBodyFormat(); }
@Test public void shouldBeAbleDeleteFromCache() throws com.anypresence.sdk.acl.UnauthorizedException, RemoteRequestException, InterruptedException, ClassNotFoundException { APSetup.setBaseUrl("http://localhost"); APSetup.setup(); Config.getInstance().setStrictQueryFieldCheck(false); APSDKSetup.setDBStoreType(DBStoreType.IN_MEMORY); Config.DEBUG_MODE = true; RemoteRailsConfig.getInstance().setInlineMode(true); lock = new CountDownLatch(1); IRestClient client = getTestRestClient(); RestClientFactory.registerJSONRestClientImplementation(client); com.anypresence.sdk.citi_mobile_challenge.models.RetailBankingLogin.queryInBackground( "all", null, new APFutureCallback< List<com.anypresence.sdk.citi_mobile_challenge.models.RetailBankingLogin>>() { @Override public void finished( List<com.anypresence.sdk.citi_mobile_challenge.models.RetailBankingLogin> arg0, Throwable ex) { objects = arg0; lock.countDown(); } }); lock.await(); Assert.assertTrue(objects.size() == 2); // Delete one object in cache objects.get(0).deleteInCache(); Assert.assertTrue( com.anypresence.sdk.citi_mobile_challenge.models.RetailBankingLogin.loadAllInCache().size() == 1); // Delete all objects in the cache com.anypresence.sdk.APObject.deleteAllInCache(); Assert.assertTrue( com.anypresence.sdk.citi_mobile_challenge.models.RetailBankingLogin.loadAllInCache().size() == 0); }