ConfigurationLoader { public static CollectorConfiguration getConfiguration(String type) { return loadConfig(PropertyUtil.getProperty(HAWKULAR_APM_CONFIG, DEFAULT_URI), type); }  static CollectorConfiguration getConfiguration(String type); static final String HAWKULAR_APM_CONFIG; }
@Test public void testLoadConfigFromClasspath() { System.setProperty("HAWKULAR_APM_CONFIG", "cpconfig"); CollectorConfiguration cc = ConfigurationLoader.getConfiguration(null); assertNotNull(cc); assertNotNull(cc.getTransactions()); assertNotNull(cc.getTransactions().get("cptest")); assertEquals("Classpath test", cc.getTransactions().get("cptest").getDescription()); }
@Test public void testLoadConfigFromRelativePath() { System.setProperty("HAWKULAR_APM_CONFIG", "src/relconfig"); CollectorConfiguration cc = ConfigurationLoader.getConfiguration(null); assertNotNull(cc); assertNotNull(cc); assertNotNull(cc.getTransactions()); assertNotNull(cc.getTransactions().get("reltest")); assertEquals("Relative path test", cc.getTransactions().get("reltest").getDescription()); }
@Test public void testLoadConfigFromAbsolutePath() { String path=Paths.get("").toFile().getAbsolutePath()+ java.io.File.separator+"src"+java.io.File.separator+"absconfig"; System.setProperty("HAWKULAR_APM_CONFIG", path); CollectorConfiguration cc = ConfigurationLoader.getConfiguration(null); assertNotNull(cc); assertNotNull(cc); assertNotNull(cc.getTransactions()); assertNotNull(cc.getTransactions().get("abstest")); assertEquals("Absolute path test", cc.getTransactions().get("abstest").getDescription()); }