@Test public void testGetSettings() throws Exception { System.setProperty(SEQWARE_SETTINGS_PROPERTY, getClass().getResource("ConfigToolsTest_settings").getPath()); Map<String, String> settings = ConfigTools.getSettings(); assertEquals(settings.get("SETTING1"), "one"); assertEquals(settings.get("SETTING2"), "TWO"); }
public static Map<String, String> getSettings() { String settings = getSettingsFilePath(); File settingsFile = new File(settings); if (!settingsFile.exists()) { throw new RuntimeException("The settings file " + settings + " does not exist, or user '" + System.getProperty("user.name") + "' does not have permissions to read it!"); } else if (!settingsFile.isFile()) { throw new RuntimeException("The settings file " + settings + " is not a file!"); } HashMap<String, String> hm = new HashMap<>(); MapTools.ini2Map(settings, hm, true); return hm; }
ConfigTools { public static Map<String, String> getSettings() { String settings = getSettingsFilePath(); File settingsFile = new File(settings); if (!settingsFile.exists()) { throw new RuntimeException("The settings file " + settings + " does not exist, or user '" + System.getProperty("user.name") + "' does not have permissions to read it!"); } else if (!settingsFile.isFile()) { throw new RuntimeException("The settings file " + settings + " is not a file!"); } HashMap<String, String> hm = new HashMap<>(); MapTools.ini2Map(settings, hm, true); return hm; } }
ConfigTools { public static Map<String, String> getSettings() { String settings = getSettingsFilePath(); File settingsFile = new File(settings); if (!settingsFile.exists()) { throw new RuntimeException("The settings file " + settings + " does not exist, or user '" + System.getProperty("user.name") + "' does not have permissions to read it!"); } else if (!settingsFile.isFile()) { throw new RuntimeException("The settings file " + settings + " is not a file!"); } HashMap<String, String> hm = new HashMap<>(); MapTools.ini2Map(settings, hm, true); return hm; }  }
ConfigTools { public static Map<String, String> getSettings() { String settings = getSettingsFilePath(); File settingsFile = new File(settings); if (!settingsFile.exists()) { throw new RuntimeException("The settings file " + settings + " does not exist, or user '" + System.getProperty("user.name") + "' does not have permissions to read it!"); } else if (!settingsFile.isFile()) { throw new RuntimeException("The settings file " + settings + " is not a file!"); } HashMap<String, String> hm = new HashMap<>(); MapTools.ini2Map(settings, hm, true); return hm; }  static Map<String, String> getSettings(); static String getSettingsValue(SqwKeys key); static String getProperty(String name); static String getSettingsFilePath(); static boolean isValidDBConnectionParam(HashMap<String, String> settings); }
ConfigTools { public static Map<String, String> getSettings() { String settings = getSettingsFilePath(); File settingsFile = new File(settings); if (!settingsFile.exists()) { throw new RuntimeException("The settings file " + settings + " does not exist, or user '" + System.getProperty("user.name") + "' does not have permissions to read it!"); } else if (!settingsFile.isFile()) { throw new RuntimeException("The settings file " + settings + " is not a file!"); } HashMap<String, String> hm = new HashMap<>(); MapTools.ini2Map(settings, hm, true); return hm; }  static Map<String, String> getSettings(); static String getSettingsValue(SqwKeys key); static String getProperty(String name); static String getSettingsFilePath(); static boolean isValidDBConnectionParam(HashMap<String, String> settings); static final String SEQWARE_SETTINGS_PROPERTY; }