@Test public void should_detect_codekvast_system_properties() { System.setProperty(CODEKVAST_APP_VERSION, "sysprop-appVersion"); Properties props = new Properties(); props.setProperty("appVersion", "some-app-version"); assertThat( expandVariables(props, "appVersion", "default-app-version"), is(Optional.of("sysprop-appVersion"))); }
Optional<String> expandVariables(Properties props, String key, String defaultValue) { String value = System.getProperty(getSystemPropertyName(key)); if (value == null) { value = System.getenv(getEnvVarName(key)); } if (value == null) { value = props.getProperty(key, defaultValue); } return value == null || value.trim().isEmpty() ? Optional.empty() : Optional.of(expandVariables(props, value)); }
ConfigUtils { Optional<String> expandVariables(Properties props, String key, String defaultValue) { String value = System.getProperty(getSystemPropertyName(key)); if (value == null) { value = System.getenv(getEnvVarName(key)); } if (value == null) { value = props.getProperty(key, defaultValue); } return value == null || value.trim().isEmpty() ? Optional.empty() : Optional.of(expandVariables(props, value)); } }
ConfigUtils { Optional<String> expandVariables(Properties props, String key, String defaultValue) { String value = System.getProperty(getSystemPropertyName(key)); if (value == null) { value = System.getenv(getEnvVarName(key)); } if (value == null) { value = props.getProperty(key, defaultValue); } return value == null || value.trim().isEmpty() ? Optional.empty() : Optional.of(expandVariables(props, value)); }  }
ConfigUtils { Optional<String> expandVariables(Properties props, String key, String defaultValue) { String value = System.getProperty(getSystemPropertyName(key)); if (value == null) { value = System.getenv(getEnvVarName(key)); } if (value == null) { value = props.getProperty(key, defaultValue); } return value == null || value.trim().isEmpty() ? Optional.empty() : Optional.of(expandVariables(props, value)); }  List<String> getNormalizedPackages(String packages); String getStringValue(Properties props, String propertyName, String defaultValue); String getStringValue2(
      Properties props, String propertyName1, String propertyName2, String defaultValue); Optional<String> getStringValue(Properties props, String propertyName); boolean getBooleanValue(Properties props, String key, boolean defaultValue); int getIntValue(Properties props, String key, int defaultValue); String getEnvVarName(String propertyName); String getSystemPropertyName(String key); List<File> getCommaSeparatedFileValues(String uriValues); }
ConfigUtils { Optional<String> expandVariables(Properties props, String key, String defaultValue) { String value = System.getProperty(getSystemPropertyName(key)); if (value == null) { value = System.getenv(getEnvVarName(key)); } if (value == null) { value = props.getProperty(key, defaultValue); } return value == null || value.trim().isEmpty() ? Optional.empty() : Optional.of(expandVariables(props, value)); }  List<String> getNormalizedPackages(String packages); String getStringValue(Properties props, String propertyName, String defaultValue); String getStringValue2(
      Properties props, String propertyName1, String propertyName2, String defaultValue); Optional<String> getStringValue(Properties props, String propertyName); boolean getBooleanValue(Properties props, String key, boolean defaultValue); int getIntValue(Properties props, String key, int defaultValue); String getEnvVarName(String propertyName); String getSystemPropertyName(String key); List<File> getCommaSeparatedFileValues(String uriValues);  }