Search in sources :

Example 6 with GetMetricStatisticsRequest

use of com.amazonaws.services.cloudwatch.model.GetMetricStatisticsRequest in project beam by apache.

the class SimplifiedKinesisClientTest method shouldCountBytesWhenSingleDataPointReturned.

@Test
public void shouldCountBytesWhenSingleDataPointReturned() throws Exception {
    Instant countSince = new Instant("2017-04-06T10:00:00.000Z");
    Instant countTo = new Instant("2017-04-06T11:00:00.000Z");
    Minutes periodTime = Minutes.minutesBetween(countSince, countTo);
    GetMetricStatisticsRequest metricStatisticsRequest = underTest.createMetricStatisticsRequest(STREAM, countSince, countTo, periodTime);
    GetMetricStatisticsResult result = new GetMetricStatisticsResult().withDatapoints(new Datapoint().withSum(1.0));
    when(cloudWatch.getMetricStatistics(metricStatisticsRequest)).thenReturn(result);
    long backlogBytes = underTest.getBacklogBytes(STREAM, countSince, countTo);
    assertThat(backlogBytes).isEqualTo(1L);
}
Also used : Datapoint(com.amazonaws.services.cloudwatch.model.Datapoint) GetMetricStatisticsRequest(com.amazonaws.services.cloudwatch.model.GetMetricStatisticsRequest) Instant(org.joda.time.Instant) GetMetricStatisticsResult(com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult) Minutes(org.joda.time.Minutes) Test(org.junit.Test)

Aggregations

GetMetricStatisticsRequest (com.amazonaws.services.cloudwatch.model.GetMetricStatisticsRequest)6 GetMetricStatisticsResult (com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult)5 Minutes (org.joda.time.Minutes)4 Datapoint (com.amazonaws.services.cloudwatch.model.Datapoint)3 Instant (org.joda.time.Instant)3 Dimension (com.amazonaws.services.cloudwatch.model.Dimension)2 Test (org.junit.Test)2 AmazonServiceException (com.amazonaws.AmazonServiceException)1 ExpiredIteratorException (com.amazonaws.services.kinesis.model.ExpiredIteratorException)1 LimitExceededException (com.amazonaws.services.kinesis.model.LimitExceededException)1 ProvisionedThroughputExceededException (com.amazonaws.services.kinesis.model.ProvisionedThroughputExceededException)1 ArrayList (java.util.ArrayList)1