JvmSystemPropertiesInfoMetricImporter implements MetricsImporter { @Override public void register(Registry registry) { Id id = registry.createId(LookoutIdNameConstants.JVM_SYSTEM_PROP_NAME); registry.info(id, new AutoPollFriendlyInfo<Properties>() { @Override public AutoPollSuggestion autoPollSuggest() { return AutoPollSuggestion.POLL_WHEN_UPDATED; } @Override public long lastModifiedTime() { return -1; } @Override public Properties value() { return System.getProperties(); } }); Id envId = registry.createId(LookoutIdNameConstants.JVM_SYSTEM_ENV_NAME); registry.info(envId, new AutoPollFriendlyInfo<Map<String, String>>() { @Override public AutoPollSuggestion autoPollSuggest() { return AutoPollSuggestion.POLL_WHEN_UPDATED; } @Override public long lastModifiedTime() { return -1; } @Override public Map<String, String> value() { return System.getenv(); } }); }  @Override void register(Registry registry);  }
@Test public void testRegister() throws Exception { Registry registry = new DefaultRegistry(); JvmSystemPropertiesInfoMetricImporter jvmSystemPropertiesInfoMetricImporter = new JvmSystemPropertiesInfoMetricImporter(); jvmSystemPropertiesInfoMetricImporter.register(registry); Id idSys = registry.createId(LookoutIdNameConstants.JVM_SYSTEM_PROP_NAME); InfoWrapper infoWrapper = registry.get(idSys); assertEquals(System.getProperties(), infoWrapper.value()); Id envId = registry.createId(LookoutIdNameConstants.JVM_SYSTEM_ENV_NAME); InfoWrapper envWrapper = registry.get(envId); assertEquals(System.getenv(), envWrapper.value()); }