@Test public void testLoadSystemSettings() { final String SETTINGS = "settings"; final String USERENV = "odps.idata.userenv"; Task task = new SQLTask(); task.loadSystemSettings(); String settingsStr = task.getProperties().get(SETTINGS); assertNotNull(settingsStr); JsonParser parser = new JsonParser(); JsonObject jsonObject = parser.parse(settingsStr).getAsJsonObject(); assertTrue(jsonObject.has(USERENV)); }
void loadSystemSettings() { JsonObject settings; if (properties.containsKey("settings")) { JsonParser parser = new JsonParser(); settings = parser.parse(properties.get("settings")).getAsJsonObject(); } else { settings = new JsonObject(); } for (Entry<String, String> setting : SYSTEM_SETTINGS.entrySet()) { settings.addProperty(setting.getKey(), setting.getValue()); } properties.put("settings", settings.toString()); }
Task { void loadSystemSettings() { JsonObject settings; if (properties.containsKey("settings")) { JsonParser parser = new JsonParser(); settings = parser.parse(properties.get("settings")).getAsJsonObject(); } else { settings = new JsonObject(); } for (Entry<String, String> setting : SYSTEM_SETTINGS.entrySet()) { settings.addProperty(setting.getKey(), setting.getValue()); } properties.put("settings", settings.toString()); } }
Task { void loadSystemSettings() { JsonObject settings; if (properties.containsKey("settings")) { JsonParser parser = new JsonParser(); settings = parser.parse(properties.get("settings")).getAsJsonObject(); } else { settings = new JsonObject(); } for (Entry<String, String> setting : SYSTEM_SETTINGS.entrySet()) { settings.addProperty(setting.getKey(), setting.getValue()); } properties.put("settings", settings.toString()); }  }
Task { void loadSystemSettings() { JsonObject settings; if (properties.containsKey("settings")) { JsonParser parser = new JsonParser(); settings = parser.parse(properties.get("settings")).getAsJsonObject(); } else { settings = new JsonObject(); } for (Entry<String, String> setting : SYSTEM_SETTINGS.entrySet()) { settings.addProperty(setting.getKey(), setting.getValue()); } properties.put("settings", settings.toString()); }  String getName(); void setName(String name); String getComment(); void setComment(String comment); final Map<String, String> getProperties(); final void setProperties(Map<String, String> properties); void setProperty(String name, String value); String getCommandText(); }
Task { void loadSystemSettings() { JsonObject settings; if (properties.containsKey("settings")) { JsonParser parser = new JsonParser(); settings = parser.parse(properties.get("settings")).getAsJsonObject(); } else { settings = new JsonObject(); } for (Entry<String, String> setting : SYSTEM_SETTINGS.entrySet()) { settings.addProperty(setting.getKey(), setting.getValue()); } properties.put("settings", settings.toString()); }  String getName(); void setName(String name); String getComment(); void setComment(String comment); final Map<String, String> getProperties(); final void setProperties(Map<String, String> properties); void setProperty(String name, String value); String getCommandText();  }