@Test public void testCreateReporterUsesCorrectSender() throws Exception { testedService = new TestableGraphiteMetricReporterService(); runner.addControllerService(SERVICE_IDENTIFIER, testedService); setServiceProperties(TEST_HOST, TEST_PORT, TEST_CHARSET, METRIC_NAMES_PREFIX); when(graphiteSenderMock.isConnected()).thenReturn(false); runner.enableControllerService(testedService); ScheduledReporter createdReporter = testedService.createReporter(metricRegistryStub); createdReporter.report(); String expectedMetricName = MetricRegistry.name(METRIC_NAMES_PREFIX, TEST_METRIC_NAME); verify(graphiteSenderMock).send(eq(expectedMetricName), eq(String.valueOf(TEST_METRIC_VALUE)), anyLong()); }
@Override public ScheduledReporter createReporter(MetricRegistry metricRegistry) { return GraphiteReporter.forRegistry(metricRegistry).prefixedWith(metricNamePrefix).build(graphiteSender); }
GraphiteMetricReporterService extends AbstractControllerService implements MetricReporterService { @Override public ScheduledReporter createReporter(MetricRegistry metricRegistry) { return GraphiteReporter.forRegistry(metricRegistry).prefixedWith(metricNamePrefix).build(graphiteSender); } }
GraphiteMetricReporterService extends AbstractControllerService implements MetricReporterService { @Override public ScheduledReporter createReporter(MetricRegistry metricRegistry) { return GraphiteReporter.forRegistry(metricRegistry).prefixedWith(metricNamePrefix).build(graphiteSender); }  }
GraphiteMetricReporterService extends AbstractControllerService implements MetricReporterService { @Override public ScheduledReporter createReporter(MetricRegistry metricRegistry) { return GraphiteReporter.forRegistry(metricRegistry).prefixedWith(metricNamePrefix).build(graphiteSender); }  @OnEnabled void onEnabled(final ConfigurationContext context); @OnDisabled void shutdown(); @Override ScheduledReporter createReporter(MetricRegistry metricRegistry); }
GraphiteMetricReporterService extends AbstractControllerService implements MetricReporterService { @Override public ScheduledReporter createReporter(MetricRegistry metricRegistry) { return GraphiteReporter.forRegistry(metricRegistry).prefixedWith(metricNamePrefix).build(graphiteSender); }  @OnEnabled void onEnabled(final ConfigurationContext context); @OnDisabled void shutdown(); @Override ScheduledReporter createReporter(MetricRegistry metricRegistry); static final PropertyDescriptor HOST; static final PropertyDescriptor PORT; static final PropertyDescriptor CHARSET; }