use of com.microsoft.applicationinsights.agent.internal.telemetry.TelemetryClient in project ApplicationInsights-Java by microsoft.
the class QuickPulseDataFetcherTests method endpointIsFormattedCorrectlyWhenUsingConfig.
@Test
void endpointIsFormattedCorrectlyWhenUsingConfig() throws URISyntaxException {
TelemetryClient telemetryClient = TelemetryClient.createForTest();
telemetryClient.setConnectionString("InstrumentationKey=testing-123");
QuickPulseDataFetcher quickPulseDataFetcher = new QuickPulseDataFetcher(null, telemetryClient, null, null, null);
String quickPulseEndpoint = quickPulseDataFetcher.getQuickPulseEndpoint();
String endpointUrl = quickPulseDataFetcher.getEndpointUrl(quickPulseEndpoint);
URI uri = new URI(endpointUrl);
assertThat(uri).isNotNull();
assertThat(endpointUrl).isEqualTo("https://rt.services.visualstudio.com/QuickPulseService.svc/post?ikey=testing-123");
}
use of com.microsoft.applicationinsights.agent.internal.telemetry.TelemetryClient in project ApplicationInsights-Java by microsoft.
the class LazyConfigurationAccessorTest method disableLazySetWithLazySetOptInOnConnectionStringNullAndInstrumentationKeyNull.
@Test
// TRUE"
void disableLazySetWithLazySetOptInOnConnectionStringNullAndInstrumentationKeyNull() {
assertThat(LazyConfigurationAccessor.shouldSetConnectionString(true, "true")).isTrue();
// given
TelemetryClient telemetryClient = mock(TelemetryClient.class);
AppIdSupplier appIdSupplier = mock(AppIdSupplier.class);
LazyConfigurationAccessor lazyConfigurationAccessor = new LazyConfigurationAccessor(telemetryClient, appIdSupplier);
// when
lazyConfigurationAccessor.setConnectionString(null, null);
// then
verify(telemetryClient, never()).setConnectionString(anyString());
}
use of com.microsoft.applicationinsights.agent.internal.telemetry.TelemetryClient in project ApplicationInsights-Java by microsoft.
the class LazyConfigurationAccessorTest method enableLazySetWithLazySetOptInOffConnectionStringNullInstrumentationKeyNotNull.
@Test
// is TRUE")
void enableLazySetWithLazySetOptInOffConnectionStringNullInstrumentationKeyNotNull() {
assertThat(LazyConfigurationAccessor.shouldSetConnectionString(false, "true")).isTrue();
// given
TelemetryClient telemetryClient = mock(TelemetryClient.class);
AppIdSupplier appIdSupplier = mock(AppIdSupplier.class);
LazyConfigurationAccessor lazyConfigurationAccessor = new LazyConfigurationAccessor(telemetryClient, appIdSupplier);
// when
lazyConfigurationAccessor.setConnectionString(null, INSTRUMENTATION_KEY);
// then
verify(telemetryClient).setConnectionString("InstrumentationKey=" + INSTRUMENTATION_KEY);
}
Aggregations