TracerParameters { @SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, String> getParameters() { Properties props = Configuration.loadConfigurationFile(); loadSystemProperties(props); for (String propName : props.stringPropertyNames()) { String value = props.getProperty(propName); if (ACCESS_TOKEN.equals(propName)) { value = hideString(value); } logger.log(Level.INFO, "Retrieved Tracer parameter " + propName + "=" + value); } return (Map)props; } private  TracerParameters(); static Options.OptionsBuilder getOptionsFromParameters(Options.OptionsBuilder optionsBuilder); @SuppressWarnings({"unchecked", "rawtypes"}) static Map<String, String> getParameters(); final static String ACCESS_TOKEN; final static String CLOCK_SKEW_CORRECTION; final static String COMPONENT_NAME; final static String COLLECTOR_CLIENT; final static String COLLECTOR_HOST; final static String COLLECTOR_PORT; final static String COLLECTOR_PROTOCOL; final static String DEADLINE_MILLIS; final static String DISABLE_REPORTING_LOOP; final static String MAX_BUFFERED_SPANS; final static String MAX_REPORTING_INTERVAL_MILLIS; final static String RESET_CLIENT; final static String VERBOSITY; final static String TAGS; final static String PROPAGATOR; final static String SERVICE_VERSION; final static String DISABLE_METRICS_REPORTING; final static String METRICS_URL; final static String HOSTNAME; final static String [] ALL; }
@Test public void getParameters_fromSystemProperties() { System.setProperty(TracerParameters.ACCESS_TOKEN, ACCESS_TOKEN); System.setProperty(TracerParameters.COMPONENT_NAME, COMPONENT_NAME); System.setProperty(TracerParameters.COLLECTOR_CLIENT, COLLECTOR_CLIENT); System.setProperty(TracerParameters.COLLECTOR_HOST, COLLECTOR_HOST); System.setProperty(TracerParameters.COLLECTOR_PROTOCOL, COLLECTOR_PROTOCOL); System.setProperty(TracerParameters.COLLECTOR_PORT, COLLECTOR_PORT); System.setProperty(TracerParameters.METRICS_URL, METRICS_URL); System.setProperty(TracerParameters.DISABLE_METRICS_REPORTING, DISABLE_METRICS); System.setProperty(TracerParameters.HOSTNAME, HOSTNAME); assertValidParameters(TracerParameters.getParameters()); }
@Test public void getParameters_fromConfigurationFile() throws Exception { Properties props = new Properties(); props.setProperty(TracerParameters.ACCESS_TOKEN, ACCESS_TOKEN); props.setProperty(TracerParameters.COMPONENT_NAME, COMPONENT_NAME); props.setProperty(TracerParameters.COLLECTOR_CLIENT, COLLECTOR_CLIENT); props.setProperty(TracerParameters.COLLECTOR_HOST, COLLECTOR_HOST); props.setProperty(TracerParameters.COLLECTOR_PROTOCOL, COLLECTOR_PROTOCOL); props.setProperty(TracerParameters.COLLECTOR_PORT, COLLECTOR_PORT); System.setProperty(TracerParameters.METRICS_URL, METRICS_URL); System.setProperty(TracerParameters.DISABLE_METRICS_REPORTING, DISABLE_METRICS); System.setProperty(TracerParameters.HOSTNAME, HOSTNAME); File file = null; try { file = Utils.savePropertiesToTempFile(props); System.setProperty(Configuration.CONFIGURATION_FILE_KEY, file.getAbsolutePath()); assertValidParameters(TracerParameters.getParameters()); } finally { if (file != null) file.delete(); } }