private TestClassLoader getTestClassLoader() { PLoggerFactory.initialize(new Slf4jLoggerBinder()); ProfilerConfig profilerConfig = new ProfilerConfig(); profilerConfig.setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName()); DefaultAgent agent = MockAgent.of(profilerConfig); return new TestClassLoader(agent); }
public static MockAgent of(String configPath) { ProfilerConfig profilerConfig = null; try { URL resource = MockAgent.class.getClassLoader().getResource(configPath); if (resource == null) { throw new FileNotFoundException("pinpoint.config not found. configPath:" + configPath); } profilerConfig = ProfilerConfig.load(resource.getPath()); profilerConfig.setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName()); } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } return of(profilerConfig); }