private static void completeProperties(Settings settings, Properties properties, String prefix) { List<String> jdbcKeys = settings.getKeysStartingWith(prefix); for (String jdbcKey : jdbcKeys) { String value = settings.getString(jdbcKey); properties.setProperty(jdbcKey, value); } }
@Test public void getKeysStartingWith() { Settings settings = new MapSettings(); settings.setProperty("sonar.jdbc.url", "foo"); settings.setProperty("sonar.jdbc.username", "bar"); settings.setProperty("sonar.security", "admin"); assertThat(settings.getKeysStartingWith("sonar")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username", "sonar.security"); assertThat(settings.getKeysStartingWith("sonar.jdbc")).containsOnly("sonar.jdbc.url", "sonar.jdbc.username"); assertThat(settings.getKeysStartingWith("other")).hasSize(0); }
for (String key : settings.getKeysStartingWith("sonar.jdbc")) { LOG.info(key + ": " + settings.getString(key));
private static void completeProperties(Settings settings, Properties properties, String prefix) { List<String> jdbcKeys = settings.getKeysStartingWith(prefix); for (String jdbcKey : jdbcKeys) { String value = settings.getString(jdbcKey); properties.setProperty(jdbcKey, value); } }
private static void completeProperties(Settings settings, Properties properties, String prefix) { List<String> jdbcKeys = settings.getKeysStartingWith(prefix); for (String jdbcKey : jdbcKeys) { String value = settings.getString(jdbcKey); properties.setProperty(jdbcKey, value); } }
private void loadCustomRules() { if (this.settings == null) return; if (settings.getBoolean(TypeScriptPlugin.SETTING_TS_LINT_DISALLOW_CUSTOM_RULES)) { LOG.info("Usage of custom rules is inhibited"); return; } List<String> configKeys = settings.getKeysStartingWith(TypeScriptPlugin.SETTING_TS_RULE_CONFIGS); for (String cfgKey : configKeys) { if (!cfgKey.endsWith("config")) { continue; } String rulesConfig = settings.getString(cfgKey); if (rulesConfig != null) { InputStream rulesConfigStream = new ByteArrayInputStream(rulesConfig.getBytes(Charset.defaultCharset())); loadRules(rulesConfigStream, tslintRules); } } }