Search in sources :

Example 1 with AuthToken

use of com.signalfx.metrics.auth.AuthToken in project riposte by Nike-Inc.

the class SignalFxReporterFactoryTest method getReporter_passes_properly_configured_builder_to_reporterConfigurator_and_builds_the_result_of_reporterConfigurator.

@Test
public void getReporter_passes_properly_configured_builder_to_reporterConfigurator_and_builds_the_result_of_reporterConfigurator() {
    // when
    SignalFxReporter result = factory.getReporter(metricRegistryMock);
    // then
    // Make sure the configurator function received a properly configured builder.
    ArgumentCaptor<Builder> origBuilderArgCaptor = ArgumentCaptor.forClass(Builder.class);
    verify(configuratorMock).apply(origBuilderArgCaptor.capture());
    Builder origBuilder = origBuilderArgCaptor.getValue();
    assertThat(getInternalState(origBuilder, "registry")).isSameAs(metricRegistryMock);
    assertThat(((AuthToken) getInternalState(origBuilder, "authToken")).getAuthToken()).isEqualTo(apiKey);
    // Make sure the thing returned by the configurator was used to build the final reporter.
    assertThat(((Map<String, DimensionInclusion>) getInternalState(result, "defaultDimensions")).get(customDimKey).getValue()).isEqualTo(customDimValue);
}
Also used : DimensionInclusion(com.signalfx.codahale.reporter.DimensionInclusion) SignalFxReporter(com.signalfx.codahale.reporter.SignalFxReporter) Builder(com.signalfx.codahale.reporter.SignalFxReporter.Builder) AuthToken(com.signalfx.metrics.auth.AuthToken) Test(org.junit.Test)

Aggregations

DimensionInclusion (com.signalfx.codahale.reporter.DimensionInclusion)1 SignalFxReporter (com.signalfx.codahale.reporter.SignalFxReporter)1 Builder (com.signalfx.codahale.reporter.SignalFxReporter.Builder)1 AuthToken (com.signalfx.metrics.auth.AuthToken)1 Test (org.junit.Test)1