use of com.newrelic.agent.introspec.InstrumentationTestConfig in project newrelic-java-agent by newrelic.
the class IntrospectorConfig method readConfig.
public static Map<String, Object> readConfig(Class<?> classUnderTest) throws Exception {
Map<String, Object> config = new HashMap<>();
for (Annotation annotation : classUnderTest.getAnnotations()) {
if (annotation instanceof InstrumentationTestConfig) {
String configPath = ((InstrumentationTestConfig) annotation).configName();
if (!configPath.isEmpty()) {
URL resource = IntrospectorConfig.class.getClassLoader().getResource(configPath);
if (resource == null) {
throw new InitializationError("Unable to find config file " + configPath);
}
File configFile = new File(resource.toURI());
return AgentConfigHelper.getConfigurationFileSettings(configFile);
}
}
}
return config;
}
Aggregations