@Test public void getDefaultConfigurationTest() { assertEquals(20, defaultConfiguration.size()); assertEquals("", defaultConfiguration.get("log")); assertEquals("", defaultConfiguration.get("logSSL")); assertEquals("", defaultConfiguration.get("site")); assertEquals("never", defaultConfiguration.get("storage")); assertEquals("", defaultConfiguration.get("plugins")); assertEquals("xiti.com", defaultConfiguration.get("domain")); assertEquals("androidId", defaultConfiguration.get("identifier")); assertEquals(false, defaultConfiguration.get("hashUserId")); assertEquals("/hit.xiti", defaultConfiguration.get("pixelPath")); assertEquals(true, defaultConfiguration.get("persistIdentifiedVisitor")); assertEquals(true, defaultConfiguration.get("enableCrashDetection")); assertEquals(false, defaultConfiguration.get("campaignLastPersistence")); assertEquals(30, defaultConfiguration.get("campaignLifetime")); assertEquals(60, defaultConfiguration.get("sessionBackgroundDuration")); assertEquals(false, defaultConfiguration.get("autoSalesTracker")); assertEquals(false, defaultConfiguration.get("ignoreLimitedAdTracking")); assertEquals(true, defaultConfiguration.get("sendHitWhenOptOut")); assertEquals(8_000, defaultConfiguration.get("maxHitSize")); assertEquals(397, defaultConfiguration.get("UUIDDuration")); assertEquals("fixed", defaultConfiguration.get("UUIDExpirationMode")); }
private JSONObject getDefaultConfiguration(boolean isTablet) { JSONObject result = new JSONObject(); String stringResult; try { InputStream inputStream = getClass().getResourceAsStream("/" + JSON_FILE); int size = inputStream.available(); byte[] buffer = new byte[size]; if (inputStream.read(buffer) != -1) { stringResult = new String(buffer, ENCODING); JSONObject json = new JSONObject(stringResult); if (isTablet) { result = json.getJSONObject(TABLET_CONFIGURATION); } else { result = json.getJSONObject(PHONE_CONFIGURATION); } } inputStream.close(); } catch (Exception e) { try { result.put(TrackerConfigurationKeys.LOG, "") .put(TrackerConfigurationKeys.LOG_SSL, "") .put(TrackerConfigurationKeys.DOMAIN, "xiti.com") .put(TrackerConfigurationKeys.PIXEL_PATH, "/hit.xiti") .put(TrackerConfigurationKeys.SITE, "") .put(TrackerConfigurationKeys.IDENTIFIER, "androidId") .put(TrackerConfigurationKeys.ENABLE_CRASH_DETECTION, true) .put(TrackerConfigurationKeys.PLUGINS, "") .put(TrackerConfigurationKeys.STORAGE, "never") .put(TrackerConfigurationKeys.HASH_USER_ID, false) .put(TrackerConfigurationKeys.PERSIST_IDENTIFIED_VISITOR, true) .put(TrackerConfigurationKeys.CAMPAIGN_LAST_PERSISTENCE, false) .put(TrackerConfigurationKeys.CAMPAIGN_LIFETIME, 30) .put(TrackerConfigurationKeys.SESSION_BACKGROUND_DURATION, 60) .put(TrackerConfigurationKeys.AUTO_SALES_TRACKER, false) .put(TrackerConfigurationKeys.IGNORE_LIMITED_AD_TRACKING, false) .put(TrackerConfigurationKeys.SEND_HIT_WHEN_OPT_OUT, true) .put(TrackerConfigurationKeys.MAX_HIT_SIZE, 8_000) .put(TrackerConfigurationKeys.UUID_DURATION, 397) .put(TrackerConfigurationKeys.UUID_EXPIRATION_MODE, "fixed"); } catch (JSONException e1) { Log.e(ATInternet.TAG, e1.toString()); } } return result; }
Configuration extends LinkedHashMap<String, Object> { private JSONObject getDefaultConfiguration(boolean isTablet) { JSONObject result = new JSONObject(); String stringResult; try { InputStream inputStream = getClass().getResourceAsStream("/" + JSON_FILE); int size = inputStream.available(); byte[] buffer = new byte[size]; if (inputStream.read(buffer) != -1) { stringResult = new String(buffer, ENCODING); JSONObject json = new JSONObject(stringResult); if (isTablet) { result = json.getJSONObject(TABLET_CONFIGURATION); } else { result = json.getJSONObject(PHONE_CONFIGURATION); } } inputStream.close(); } catch (Exception e) { try { result.put(TrackerConfigurationKeys.LOG, "") .put(TrackerConfigurationKeys.LOG_SSL, "") .put(TrackerConfigurationKeys.DOMAIN, "xiti.com") .put(TrackerConfigurationKeys.PIXEL_PATH, "/hit.xiti") .put(TrackerConfigurationKeys.SITE, "") .put(TrackerConfigurationKeys.IDENTIFIER, "androidId") .put(TrackerConfigurationKeys.ENABLE_CRASH_DETECTION, true) .put(TrackerConfigurationKeys.PLUGINS, "") .put(TrackerConfigurationKeys.STORAGE, "never") .put(TrackerConfigurationKeys.HASH_USER_ID, false) .put(TrackerConfigurationKeys.PERSIST_IDENTIFIED_VISITOR, true) .put(TrackerConfigurationKeys.CAMPAIGN_LAST_PERSISTENCE, false) .put(TrackerConfigurationKeys.CAMPAIGN_LIFETIME, 30) .put(TrackerConfigurationKeys.SESSION_BACKGROUND_DURATION, 60) .put(TrackerConfigurationKeys.AUTO_SALES_TRACKER, false) .put(TrackerConfigurationKeys.IGNORE_LIMITED_AD_TRACKING, false) .put(TrackerConfigurationKeys.SEND_HIT_WHEN_OPT_OUT, true) .put(TrackerConfigurationKeys.MAX_HIT_SIZE, 8_000) .put(TrackerConfigurationKeys.UUID_DURATION, 397) .put(TrackerConfigurationKeys.UUID_EXPIRATION_MODE, "fixed"); } catch (JSONException e1) { Log.e(ATInternet.TAG, e1.toString()); } } return result; } }
Configuration extends LinkedHashMap<String, Object> { private JSONObject getDefaultConfiguration(boolean isTablet) { JSONObject result = new JSONObject(); String stringResult; try { InputStream inputStream = getClass().getResourceAsStream("/" + JSON_FILE); int size = inputStream.available(); byte[] buffer = new byte[size]; if (inputStream.read(buffer) != -1) { stringResult = new String(buffer, ENCODING); JSONObject json = new JSONObject(stringResult); if (isTablet) { result = json.getJSONObject(TABLET_CONFIGURATION); } else { result = json.getJSONObject(PHONE_CONFIGURATION); } } inputStream.close(); } catch (Exception e) { try { result.put(TrackerConfigurationKeys.LOG, "") .put(TrackerConfigurationKeys.LOG_SSL, "") .put(TrackerConfigurationKeys.DOMAIN, "xiti.com") .put(TrackerConfigurationKeys.PIXEL_PATH, "/hit.xiti") .put(TrackerConfigurationKeys.SITE, "") .put(TrackerConfigurationKeys.IDENTIFIER, "androidId") .put(TrackerConfigurationKeys.ENABLE_CRASH_DETECTION, true) .put(TrackerConfigurationKeys.PLUGINS, "") .put(TrackerConfigurationKeys.STORAGE, "never") .put(TrackerConfigurationKeys.HASH_USER_ID, false) .put(TrackerConfigurationKeys.PERSIST_IDENTIFIED_VISITOR, true) .put(TrackerConfigurationKeys.CAMPAIGN_LAST_PERSISTENCE, false) .put(TrackerConfigurationKeys.CAMPAIGN_LIFETIME, 30) .put(TrackerConfigurationKeys.SESSION_BACKGROUND_DURATION, 60) .put(TrackerConfigurationKeys.AUTO_SALES_TRACKER, false) .put(TrackerConfigurationKeys.IGNORE_LIMITED_AD_TRACKING, false) .put(TrackerConfigurationKeys.SEND_HIT_WHEN_OPT_OUT, true) .put(TrackerConfigurationKeys.MAX_HIT_SIZE, 8_000) .put(TrackerConfigurationKeys.UUID_DURATION, 397) .put(TrackerConfigurationKeys.UUID_EXPIRATION_MODE, "fixed"); } catch (JSONException e1) { Log.e(ATInternet.TAG, e1.toString()); } } return result; } Configuration(Context context);   Configuration(HashMap<String, Object> configuration); }
Configuration extends LinkedHashMap<String, Object> { private JSONObject getDefaultConfiguration(boolean isTablet) { JSONObject result = new JSONObject(); String stringResult; try { InputStream inputStream = getClass().getResourceAsStream("/" + JSON_FILE); int size = inputStream.available(); byte[] buffer = new byte[size]; if (inputStream.read(buffer) != -1) { stringResult = new String(buffer, ENCODING); JSONObject json = new JSONObject(stringResult); if (isTablet) { result = json.getJSONObject(TABLET_CONFIGURATION); } else { result = json.getJSONObject(PHONE_CONFIGURATION); } } inputStream.close(); } catch (Exception e) { try { result.put(TrackerConfigurationKeys.LOG, "") .put(TrackerConfigurationKeys.LOG_SSL, "") .put(TrackerConfigurationKeys.DOMAIN, "xiti.com") .put(TrackerConfigurationKeys.PIXEL_PATH, "/hit.xiti") .put(TrackerConfigurationKeys.SITE, "") .put(TrackerConfigurationKeys.IDENTIFIER, "androidId") .put(TrackerConfigurationKeys.ENABLE_CRASH_DETECTION, true) .put(TrackerConfigurationKeys.PLUGINS, "") .put(TrackerConfigurationKeys.STORAGE, "never") .put(TrackerConfigurationKeys.HASH_USER_ID, false) .put(TrackerConfigurationKeys.PERSIST_IDENTIFIED_VISITOR, true) .put(TrackerConfigurationKeys.CAMPAIGN_LAST_PERSISTENCE, false) .put(TrackerConfigurationKeys.CAMPAIGN_LIFETIME, 30) .put(TrackerConfigurationKeys.SESSION_BACKGROUND_DURATION, 60) .put(TrackerConfigurationKeys.AUTO_SALES_TRACKER, false) .put(TrackerConfigurationKeys.IGNORE_LIMITED_AD_TRACKING, false) .put(TrackerConfigurationKeys.SEND_HIT_WHEN_OPT_OUT, true) .put(TrackerConfigurationKeys.MAX_HIT_SIZE, 8_000) .put(TrackerConfigurationKeys.UUID_DURATION, 397) .put(TrackerConfigurationKeys.UUID_EXPIRATION_MODE, "fixed"); } catch (JSONException e1) { Log.e(ATInternet.TAG, e1.toString()); } } return result; } Configuration(Context context);   Configuration(HashMap<String, Object> configuration); @Override String toString(); }
Configuration extends LinkedHashMap<String, Object> { private JSONObject getDefaultConfiguration(boolean isTablet) { JSONObject result = new JSONObject(); String stringResult; try { InputStream inputStream = getClass().getResourceAsStream("/" + JSON_FILE); int size = inputStream.available(); byte[] buffer = new byte[size]; if (inputStream.read(buffer) != -1) { stringResult = new String(buffer, ENCODING); JSONObject json = new JSONObject(stringResult); if (isTablet) { result = json.getJSONObject(TABLET_CONFIGURATION); } else { result = json.getJSONObject(PHONE_CONFIGURATION); } } inputStream.close(); } catch (Exception e) { try { result.put(TrackerConfigurationKeys.LOG, "") .put(TrackerConfigurationKeys.LOG_SSL, "") .put(TrackerConfigurationKeys.DOMAIN, "xiti.com") .put(TrackerConfigurationKeys.PIXEL_PATH, "/hit.xiti") .put(TrackerConfigurationKeys.SITE, "") .put(TrackerConfigurationKeys.IDENTIFIER, "androidId") .put(TrackerConfigurationKeys.ENABLE_CRASH_DETECTION, true) .put(TrackerConfigurationKeys.PLUGINS, "") .put(TrackerConfigurationKeys.STORAGE, "never") .put(TrackerConfigurationKeys.HASH_USER_ID, false) .put(TrackerConfigurationKeys.PERSIST_IDENTIFIED_VISITOR, true) .put(TrackerConfigurationKeys.CAMPAIGN_LAST_PERSISTENCE, false) .put(TrackerConfigurationKeys.CAMPAIGN_LIFETIME, 30) .put(TrackerConfigurationKeys.SESSION_BACKGROUND_DURATION, 60) .put(TrackerConfigurationKeys.AUTO_SALES_TRACKER, false) .put(TrackerConfigurationKeys.IGNORE_LIMITED_AD_TRACKING, false) .put(TrackerConfigurationKeys.SEND_HIT_WHEN_OPT_OUT, true) .put(TrackerConfigurationKeys.MAX_HIT_SIZE, 8_000) .put(TrackerConfigurationKeys.UUID_DURATION, 397) .put(TrackerConfigurationKeys.UUID_EXPIRATION_MODE, "fixed"); } catch (JSONException e1) { Log.e(ATInternet.TAG, e1.toString()); } } return result; } Configuration(Context context);   Configuration(HashMap<String, Object> configuration); @Override String toString();  }