Tabnine Logo
IterableWithMarker
Code IndexAdd Tabnine to your IDE (free)

How to use
IterableWithMarker
in
org.jclouds.collect

Best Java code snippets using org.jclouds.collect.IterableWithMarker (Showing top 20 results out of 315)

origin: jclouds/legacy-jclouds

@Override
protected IterableWithMarker<T> computeNext() {
  if (unread)
   try {
     return current;
   } finally {
     unread = false;
   }
  else if (current.nextMarker().isPresent())
   return current = markerToNext.apply(current.nextMarker().get());
  else
   return endOfData();
}
origin: com.amysta.jclouds/jclouds-core

  @Override
  public Iterator<E> next() {
   return iterator.next().iterator();
  }
};
origin: jclouds/legacy-jclouds

  @Test
  public void testMarkerEqual() {

   IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar"), "MARKER");
   Assert.assertEquals(initial.toSet(), ImmutableSet.of("foo", "bar"));
   Assert.assertEquals(initial.nextMarker(), Optional.of("MARKER"));
  }
}
origin: jclouds/legacy-jclouds

/**
* Tests parsing all possible XML elements that could be encountered by {@link ListAlarmHistoryResponseHandler}.
*
* @throws Exception if something goes wrong
*/
public void testParseFullResponse() throws Exception {
 IterableWithMarker<AlarmHistoryItem> alarmHistoryItems =
    factory.create(injector.getInstance(ListAlarmHistoryResponseHandler.class))
        .parse(getClass().getResourceAsStream("/DescribeAlarmHistoryResponse.xml"));
 assertEquals(alarmHistoryItems.toString(), expected().toString());
 assertFalse(alarmHistoryItems.nextMarker().isPresent());
}
origin: jclouds/legacy-jclouds

  Metric metric = response.iterator().next();
response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));
origin: jclouds/legacy-jclouds

public void test() {
 InputStream is = getClass().getResourceAsStream("/hosted_zones.xml");
 IterableWithMarker<HostedZone> expected = expected();
 ListHostedZonesResponseHandler handler = injector.getInstance(ListHostedZonesResponseHandler.class);
 IterableWithMarker<HostedZone> result = factory.create(handler).parse(is);
 assertEquals(result.toString(), expected.toString());
}
origin: jclouds/legacy-jclouds

@Test(expectedExceptions = ResourceNotFoundException.class)
public void testListWhenResponseIs404() {
 Route53Api fail = requestSendsResponse(list, notFound);
 assertEquals(fail.getResourceRecordSetApiForHostedZone("Z1PA6795UKMFR9").list().get(0).toSet(), ImmutableSet.of());
}
origin: apache/jclouds

public void testListRegionsOnePage() {
 final AtomicInteger found = new AtomicInteger(0);
 assertTrue(api().list(page(1)).allMatch(new Predicate<Region>() {
   @Override
   public boolean apply(Region input) {
    found.incrementAndGet();
    return !Strings.isNullOrEmpty(input.slug());
   }
 }), "All regions must have the 'slug' field populated");
 assertTrue(found.get() > 0, "Expected some regions to be returned");
}
origin: jclouds/legacy-jclouds

private PagedIterable<HostedZone> zones() {
 PagedIterable<HostedZone> zones = api.getHostedZoneApi().list();
 if (zones.get(0).isEmpty())
   throw new SkipException("no zones in context: " + identity);
 return zones;
}
origin: jclouds/legacy-jclouds

/**
* Tests {@link S3#listBucket(S3Client, String, ListBucketOptions)} where a
* single response returns all results.
*
* @throws Exception
*            if anything goes wrong
*/
@Test
public void testSinglePageResult() throws Exception {
 S3Client api = createMock(S3Client.class);
 ListBucketOptions options = new ListBucketOptions();
 ListBucketResponse response = new ListBucketHandlerTest().expected();
 expect(api.listBucket("bucket", options)).andReturn(response).once();
 EasyMock.replay(api);
 PagedIterable<ObjectMetadata> result = S3.listBucket(api, "bucket", options);
 // number of pages
 assertEquals(result.size(), 1);
 // number of objects
 assertEquals(result.get(0).size(), 10);
}
origin: jclouds/legacy-jclouds

/**
* Tests parsing all possible XML elements that could be encountered by {@link ListAlarmsResponseHandler}.
*
* @throws Exception if something goes wrong
*/
public void testParseFullResponse() throws Exception {
 IterableWithMarker<Alarm> metricAlarms =
    factory.create(injector.getInstance(ListAlarmsResponseHandler.class))
        .parse(getClass().getResourceAsStream("/DescribeAlarmsResponse.xml"));
 assertEquals(metricAlarms.toString(), expected().toString());
 assertFalse(metricAlarms.nextMarker().isPresent());
}
origin: apache/jclouds

  Metric metric = response.iterator().next();
response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));
origin: apache/jclouds

public void test() {
 InputStream is = getClass().getResourceAsStream("/hosted_zones.xml");
 IterableWithMarker<HostedZone> expected = expected();
 ListHostedZonesResponseHandler handler = injector.getInstance(ListHostedZonesResponseHandler.class);
 IterableWithMarker<HostedZone> result = factory.create(handler).parse(is);
 assertEquals(result.toString(), expected.toString());
}
origin: jclouds/legacy-jclouds

@Test(expectedExceptions = ResourceNotFoundException.class)
public void testListWhenResponseIs404() {
 Route53Api fail = requestSendsResponse(list, notFound);
 assertEquals(fail.getHostedZoneApi().list().get(0).toSet(), ImmutableSet.of());
}
origin: apache/jclouds

public void testListSizesOnePage() {
 final AtomicInteger found = new AtomicInteger(0);
 assertTrue(api().list(page(1)).allMatch(new Predicate<Size>() {
   @Override
   public boolean apply(Size input) {
    found.incrementAndGet();
    return !Strings.isNullOrEmpty(input.slug());
   }
 }), "All sizes must have the 'slug' field populated");
 assertTrue(found.get() > 0, "Expected some sizes to be returned");
}
origin: apache/jclouds

private PagedIterable<HostedZone> zones() {
 PagedIterable<HostedZone> zones = api.getHostedZoneApi().list();
 if (zones.get(0).isEmpty())
   throw new SkipException("no zones in context: " + identity);
 return zones;
}
origin: apache/jclouds

/**
* Tests {@link S3#listBucket(S3Client, String, ListBucketOptions)} where a
* single response returns all results.
*
* @throws Exception
*            if anything goes wrong
*/
@Test
public void testSinglePageResult() throws Exception {
 S3Client api = createMock(S3Client.class);
 ListBucketOptions options = new ListBucketOptions();
 ListBucketResponse response = new ListBucketHandlerTest().expected();
 expect(api.listBucket("bucket", options)).andReturn(response).once();
 EasyMock.replay(api);
 PagedIterable<ObjectMetadata> result = S3.listBucket(api, "bucket", options);
 // number of pages
 assertEquals(result.size(), 1);
 // number of objects
 assertEquals(result.get(0).size(), 10);
}
origin: org.jclouds/jclouds-core

@Override
protected IterableWithMarker<T> computeNext() {
  if (unread)
   try {
     return current;
   } finally {
     unread = false;
   }
  else if (current.nextMarker().isPresent())
   return current = markerToNext.apply(current.nextMarker().get());
  else
   return endOfData();
}
origin: jclouds/legacy-jclouds

@Test
public void testElementsEqual() {
 IterableWithMarker<String> initial = IterableWithMarkers.from(ImmutableSet.of("foo", "bar"));
 Assert.assertEquals(initial.toSet(), ImmutableSet.of("foo", "bar"));
 Assert.assertEquals(initial.nextMarker(), Optional.absent());
}
origin: jclouds/legacy-jclouds

  @Override
  public Iterator<E> next() {
   return iterator.next().iterator();
  }
};
org.jclouds.collectIterableWithMarker

Javadoc

An Iterable that can be continued

Most used methods

  • nextMarker
    If there is a next marker, then the set is incomplete and you should issue another command to retrie
  • iterator
  • toSet
  • toString
  • allMatch
  • isEmpty
  • size
  • first

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Path (java.nio.file)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now