use of software.amazon.awssdk.metrics.MetricPublisher in project aws-sdk-java-v2 by aws.
the class SyncClientMetricPublisherResolutionTest method testApiCall_publishersSetOnClient_clientPublishersInvoked.
@Test
public void testApiCall_publishersSetOnClient_clientPublishersInvoked() throws IOException {
MetricPublisher publisher1 = mock(MetricPublisher.class);
MetricPublisher publisher2 = mock(MetricPublisher.class);
client = clientWithPublishers(publisher1, publisher2);
try {
client.allTypes();
} catch (Throwable t) {
// ignored, call fails because our mock HTTP client isn't set up
} finally {
verify(publisher1).publish(any(MetricCollection.class));
verify(publisher2).publish(any(MetricCollection.class));
}
}
use of software.amazon.awssdk.metrics.MetricPublisher in project aws-sdk-java-v2 by aws.
the class SyncClientMetricPublisherResolutionTest method testApiCall_publishersSetOnClientAndRequest_requestPublishersInvoked.
@Test
public void testApiCall_publishersSetOnClientAndRequest_requestPublishersInvoked() throws IOException {
MetricPublisher clientPublisher1 = mock(MetricPublisher.class);
MetricPublisher clientPublisher2 = mock(MetricPublisher.class);
MetricPublisher requestPublisher1 = mock(MetricPublisher.class);
MetricPublisher requestPublisher2 = mock(MetricPublisher.class);
client = clientWithPublishers(clientPublisher1, clientPublisher2);
try {
client.allTypes(r -> r.overrideConfiguration(o -> o.addMetricPublisher(requestPublisher1).addMetricPublisher(requestPublisher2)));
} catch (Throwable t) {
// ignored, call fails because our mock HTTP client isn't set up
} finally {
verify(requestPublisher1).publish(any(MetricCollection.class));
verify(requestPublisher2).publish(any(MetricCollection.class));
verifyNoMoreInteractions(clientPublisher1);
verifyNoMoreInteractions(clientPublisher2);
}
}
use of software.amazon.awssdk.metrics.MetricPublisher in project aws-sdk-java-v2 by aws.
the class SyncClientMetricPublisherResolutionTest method testApiCall_publishersSetOnRequest_requestPublishersInvoked.
@Test
public void testApiCall_publishersSetOnRequest_requestPublishersInvoked() throws IOException {
MetricPublisher publisher1 = mock(MetricPublisher.class);
MetricPublisher publisher2 = mock(MetricPublisher.class);
client = clientWithPublishers();
try {
client.allTypes(r -> r.overrideConfiguration(o -> o.addMetricPublisher(publisher1).addMetricPublisher(publisher2)));
} catch (Throwable t) {
// ignored, call fails because our mock HTTP client isn't set up
} finally {
verify(publisher1).publish(any(MetricCollection.class));
verify(publisher2).publish(any(MetricCollection.class));
}
}
use of software.amazon.awssdk.metrics.MetricPublisher in project aws-sdk-java-v2 by aws.
the class AsyncCoreMetricsTest method apiCall_publisherOverriddenOnRequest_requestPublisherTakesPrecedence.
@Test
public void apiCall_publisherOverriddenOnRequest_requestPublisherTakesPrecedence() {
stubSuccessfulResponse();
MetricPublisher requestMetricPublisher = mock(MetricPublisher.class);
client.allTypes(r -> r.overrideConfiguration(o -> o.addMetricPublisher(requestMetricPublisher))).join();
verify(requestMetricPublisher).publish(any(MetricCollection.class));
verifyNoMoreInteractions(mockPublisher);
}
use of software.amazon.awssdk.metrics.MetricPublisher in project aws-sdk-java-v2 by aws.
the class AsyncClientMetricPublisherResolutionTest method testApiCall_publishersSetOnClient_clientPublishersInvoked.
@Test
public void testApiCall_publishersSetOnClient_clientPublishersInvoked() throws IOException {
MetricPublisher publisher1 = mock(MetricPublisher.class);
MetricPublisher publisher2 = mock(MetricPublisher.class);
client = clientWithPublishers(publisher1, publisher2);
try {
client.allTypes().join();
} catch (Throwable t) {
// ignored, call fails because our mock HTTP client isn't set up
} finally {
verify(publisher1).publish(any(MetricCollection.class));
verify(publisher2).publish(any(MetricCollection.class));
}
}
Aggregations