@Test public void test() throws Exception { MetricsCollection collection = createTestData(); IncomingMetricMetadataAnalyzer metricMetadataAnalyzer = mock(IncomingMetricMetadataAnalyzer.class); ThreadPoolExecutor tpe = new ThreadPoolBuilder().withName("rtc test").build(); TypeAndUnitProcessor typeAndUnitProcessor = new TypeAndUnitProcessor( tpe, metricMetadataAnalyzer); typeAndUnitProcessor.apply(collection); while (tpe.getCompletedTaskCount() < 1) { Thread.sleep(1); } verify(metricMetadataAnalyzer).scanMetrics(collection.toMetrics()); }
@Override public Void apply(final MetricsCollection input) throws Exception { getThreadPool().submit(new Callable<MetricsCollection>() { public MetricsCollection call() throws Exception { Collection<IncomingMetricException> problems = metricMetadataAnalyzer.scanMetrics(input.toMetrics()); for (IncomingMetricException problem : problems) getLogger().warn(problem.getMessage()); return input; } }); return null; }
TypeAndUnitProcessor extends FunctionWithThreadPool<MetricsCollection, Void> { @Override public Void apply(final MetricsCollection input) throws Exception { getThreadPool().submit(new Callable<MetricsCollection>() { public MetricsCollection call() throws Exception { Collection<IncomingMetricException> problems = metricMetadataAnalyzer.scanMetrics(input.toMetrics()); for (IncomingMetricException problem : problems) getLogger().warn(problem.getMessage()); return input; } }); return null; } }
TypeAndUnitProcessor extends FunctionWithThreadPool<MetricsCollection, Void> { @Override public Void apply(final MetricsCollection input) throws Exception { getThreadPool().submit(new Callable<MetricsCollection>() { public MetricsCollection call() throws Exception { Collection<IncomingMetricException> problems = metricMetadataAnalyzer.scanMetrics(input.toMetrics()); for (IncomingMetricException problem : problems) getLogger().warn(problem.getMessage()); return input; } }); return null; } TypeAndUnitProcessor(ThreadPoolExecutor threadPool, IncomingMetricMetadataAnalyzer metricMetadataAnalyzer); }
TypeAndUnitProcessor extends FunctionWithThreadPool<MetricsCollection, Void> { @Override public Void apply(final MetricsCollection input) throws Exception { getThreadPool().submit(new Callable<MetricsCollection>() { public MetricsCollection call() throws Exception { Collection<IncomingMetricException> problems = metricMetadataAnalyzer.scanMetrics(input.toMetrics()); for (IncomingMetricException problem : problems) getLogger().warn(problem.getMessage()); return input; } }); return null; } TypeAndUnitProcessor(ThreadPoolExecutor threadPool, IncomingMetricMetadataAnalyzer metricMetadataAnalyzer); @Override Void apply(final MetricsCollection input); }
TypeAndUnitProcessor extends FunctionWithThreadPool<MetricsCollection, Void> { @Override public Void apply(final MetricsCollection input) throws Exception { getThreadPool().submit(new Callable<MetricsCollection>() { public MetricsCollection call() throws Exception { Collection<IncomingMetricException> problems = metricMetadataAnalyzer.scanMetrics(input.toMetrics()); for (IncomingMetricException problem : problems) getLogger().warn(problem.getMessage()); return input; } }); return null; } TypeAndUnitProcessor(ThreadPoolExecutor threadPool, IncomingMetricMetadataAnalyzer metricMetadataAnalyzer); @Override Void apply(final MetricsCollection input);  }