@Test public void testPropsOverride() throws Exception { Properties startProps = new Properties(); startProps.setProperty(PROP_KEY, "true"); System.setProperty(PROP_KEY, "false"); Properties props = WinkSystemProperties.loadSystemProperties(startProps); assertTrue("expected empty properties bag", props.isEmpty()); }
public static Properties loadSystemProperties(Properties properties) { String key = null; String value = null; Properties systemProperties = new Properties(); if (properties != null) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { key = (String)keyEnum.nextElement(); value = (String)properties.get(key); if (value == null || value.length() == 0) { value = getSystemProperty(key); if(value != null) { systemProperties.setProperty(key, value); } } else { logger.trace("Property {} is already defined with value {}", key, value); } } } else { logger.trace("Properties are null"); } return systemProperties; }
WinkSystemProperties { public static Properties loadSystemProperties(Properties properties) { String key = null; String value = null; Properties systemProperties = new Properties(); if (properties != null) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { key = (String)keyEnum.nextElement(); value = (String)properties.get(key); if (value == null || value.length() == 0) { value = getSystemProperty(key); if(value != null) { systemProperties.setProperty(key, value); } } else { logger.trace("Property {} is already defined with value {}", key, value); } } } else { logger.trace("Properties are null"); } return systemProperties; } }
WinkSystemProperties { public static Properties loadSystemProperties(Properties properties) { String key = null; String value = null; Properties systemProperties = new Properties(); if (properties != null) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { key = (String)keyEnum.nextElement(); value = (String)properties.get(key); if (value == null || value.length() == 0) { value = getSystemProperty(key); if(value != null) { systemProperties.setProperty(key, value); } } else { logger.trace("Property {} is already defined with value {}", key, value); } } } else { logger.trace("Properties are null"); } return systemProperties; }  }
WinkSystemProperties { public static Properties loadSystemProperties(Properties properties) { String key = null; String value = null; Properties systemProperties = new Properties(); if (properties != null) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { key = (String)keyEnum.nextElement(); value = (String)properties.get(key); if (value == null || value.length() == 0) { value = getSystemProperty(key); if(value != null) { systemProperties.setProperty(key, value); } } else { logger.trace("Property {} is already defined with value {}", key, value); } } } else { logger.trace("Properties are null"); } return systemProperties; }  static Properties loadSystemProperties(Properties properties); }
WinkSystemProperties { public static Properties loadSystemProperties(Properties properties) { String key = null; String value = null; Properties systemProperties = new Properties(); if (properties != null) { Enumeration<?> keyEnum = properties.propertyNames(); while (keyEnum.hasMoreElements()) { key = (String)keyEnum.nextElement(); value = (String)properties.get(key); if (value == null || value.length() == 0) { value = getSystemProperty(key); if(value != null) { systemProperties.setProperty(key, value); } } else { logger.trace("Property {} is already defined with value {}", key, value); } } } else { logger.trace("Properties are null"); } return systemProperties; }  static Properties loadSystemProperties(Properties properties);  }