use of com.amazonaws.services.route53.model.ListHostedZonesRequest in project iep by Netflix.
the class PaginationTest method route53HostedZones.
@Test
public void route53HostedZones() throws Exception {
SortedSet<String> pages = newPageSet(5);
final Iterator<String> reqIt = pages.iterator();
final Iterator<String> resIt = pages.iterator();
Function<ListHostedZonesRequest, ListHostedZonesResult> f = r -> {
if (r.getMarker() != null) {
Assert.assertEquals(reqIt.next(), r.getMarker());
}
return new ListHostedZonesResult().withNextMarker(resIt.hasNext() ? resIt.next() : null);
};
Publisher<ListHostedZonesResult> publisher = Pagination.createPublisher(new ListHostedZonesRequest(), f);
Iterable<String> iter = Flowable.fromPublisher(publisher).filter(r -> r.getNextMarker() != null).map(ListHostedZonesResult::getNextMarker).blockingIterable();
SortedSet<String> results = new TreeSet<>();
for (String s : iter) {
results.add(s);
}
Assert.assertEquals(pages, results);
Assert.assertFalse(reqIt.hasNext());
}
Aggregations