Search in sources :

Example 1 with PutMetricDataResponse

use of software.amazon.awssdk.services.cloudwatch.model.PutMetricDataResponse in project iep by Netflix.

the class PaginationTest method cloudwatchPut.

@Test
public void cloudwatchPut() throws Exception {
    final AtomicInteger n = new AtomicInteger();
    Function<PutMetricDataRequest, PutMetricDataResponse> f = r -> {
        if (n.getAndIncrement() > 0) {
            Assert.fail("non-paginated API called more than once");
        }
        return PutMetricDataResponse.builder().build();
    };
    Publisher<PutMetricDataResponse> publisher = Pagination.createPublisher(PutMetricDataRequest.builder().build(), f);
    Iterable<PutMetricDataResponse> iter = Flowable.fromPublisher(publisher).blockingIterable();
    int count = 0;
    for (PutMetricDataResponse r : iter) {
        ++count;
    }
    Assert.assertEquals(1, count);
}
Also used : SortedSet(java.util.SortedSet) ListResourceRecordSetsResponse(software.amazon.awssdk.services.route53.model.ListResourceRecordSetsResponse) DescribeTargetGroupsRequest(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeTargetGroupsRequest) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) Function(java.util.function.Function) TreeSet(java.util.TreeSet) ListMetricsRequest(software.amazon.awssdk.services.cloudwatch.model.ListMetricsRequest) ListHostedZonesResponse(software.amazon.awssdk.services.route53.model.ListHostedZonesResponse) DescribeAutoScalingGroupsResponse(software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsResponse) ListClustersRequest(software.amazon.awssdk.services.emr.model.ListClustersRequest) Flowable(io.reactivex.Flowable) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) DescribeInstancesResponse(software.amazon.awssdk.services.ec2.model.DescribeInstancesResponse) Map(java.util.Map) DescribeInstancesRequest(software.amazon.awssdk.services.ec2.model.DescribeInstancesRequest) PutMetricDataRequest(software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest) Iterator(java.util.Iterator) ScanResponse(software.amazon.awssdk.services.dynamodb.model.ScanResponse) Publisher(org.reactivestreams.Publisher) ListClustersResponse(software.amazon.awssdk.services.emr.model.ListClustersResponse) Test(org.junit.Test) JUnit4(org.junit.runners.JUnit4) DescribeTargetGroupsResponse(software.amazon.awssdk.services.elasticloadbalancingv2.model.DescribeTargetGroupsResponse) PutMetricDataResponse(software.amazon.awssdk.services.cloudwatch.model.PutMetricDataResponse) ListHostedZonesRequest(software.amazon.awssdk.services.route53.model.ListHostedZonesRequest) DescribeAutoScalingGroupsRequest(software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsRequest) ListResourceRecordSetsRequest(software.amazon.awssdk.services.route53.model.ListResourceRecordSetsRequest) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) DescribeLoadBalancersRequest(software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersRequest) Assert(org.junit.Assert) DescribeLoadBalancersResponse(software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersResponse) ListMetricsResponse(software.amazon.awssdk.services.cloudwatch.model.ListMetricsResponse) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PutMetricDataRequest(software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest) PutMetricDataResponse(software.amazon.awssdk.services.cloudwatch.model.PutMetricDataResponse) Test(org.junit.Test)

Aggregations

Flowable (io.reactivex.Flowable)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Function (java.util.function.Function)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 JUnit4 (org.junit.runners.JUnit4)1 Publisher (org.reactivestreams.Publisher)1 DescribeAutoScalingGroupsRequest (software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsRequest)1 DescribeAutoScalingGroupsResponse (software.amazon.awssdk.services.autoscaling.model.DescribeAutoScalingGroupsResponse)1 DescribeLoadBalancersRequest (software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersRequest)1 DescribeLoadBalancersResponse (software.amazon.awssdk.services.autoscaling.model.DescribeLoadBalancersResponse)1 ListMetricsRequest (software.amazon.awssdk.services.cloudwatch.model.ListMetricsRequest)1 ListMetricsResponse (software.amazon.awssdk.services.cloudwatch.model.ListMetricsResponse)1 PutMetricDataRequest (software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest)1