@@ -101,13 +101,12 @@ public static void afterClass() throws ExecutionException, InterruptedException
101101
102102 @ Test (timeout = 5000 )
103103 public void testListBuckets () throws InterruptedException {
104- Iterator <Bucket > bucketIterator =
105- storage .list (Storage .BucketListOption .prefix (BUCKET ),
106- Storage .BucketListOption .fields ()).values ().iterator ();
104+ Iterator <Bucket > bucketIterator = storage .list (Storage .BucketListOption .prefix (BUCKET ),
105+ Storage .BucketListOption .fields ()).iterateAll ();
107106 while (!bucketIterator .hasNext ()) {
108107 Thread .sleep (500 );
109108 bucketIterator = storage .list (Storage .BucketListOption .prefix (BUCKET ),
110- Storage .BucketListOption .fields ()).values (). iterator ();
109+ Storage .BucketListOption .fields ()).iterateAll ();
111110 }
112111 while (bucketIterator .hasNext ()) {
113112 Bucket remoteBucket = bucketIterator .next ();
@@ -310,14 +309,16 @@ public void testListBlobsSelectedFields() throws InterruptedException {
310309 Storage .BlobListOption .fields (BlobField .METADATA ));
311310 // Listing blobs is eventually consistent, we loop until the list is of the expected size. The
312311 // test fails if timeout is reached.
313- while (Iterators .size (page .values (). iterator ()) != 2 ) {
312+ while (Iterators .size (page .iterateAll ()) != 2 ) {
314313 Thread .sleep (500 );
315314 page = storage .list (BUCKET ,
316315 Storage .BlobListOption .prefix ("test-list-blobs-selected-fields-blob" ),
317316 Storage .BlobListOption .fields (BlobField .METADATA ));
318317 }
319318 Set <String > blobSet = ImmutableSet .of (blobNames [0 ], blobNames [1 ]);
320- for (Blob remoteBlob : page .values ()) {
319+ Iterator <Blob > iterator = page .iterateAll ();
320+ while (iterator .hasNext ()) {
321+ Blob remoteBlob = iterator .next ();
321322 assertEquals (BUCKET , remoteBlob .bucket ());
322323 assertTrue (blobSet .contains (remoteBlob .name ()));
323324 assertEquals (metadata , remoteBlob .metadata ());
@@ -346,14 +347,16 @@ public void testListBlobsEmptySelectedFields() throws InterruptedException {
346347 Storage .BlobListOption .fields ());
347348 // Listing blobs is eventually consistent, we loop until the list is of the expected size. The
348349 // test fails if timeout is reached.
349- while (Iterators .size (page .values (). iterator ()) != 2 ) {
350+ while (Iterators .size (page .iterateAll ()) != 2 ) {
350351 Thread .sleep (500 );
351352 page = storage .list (BUCKET ,
352353 Storage .BlobListOption .prefix ("test-list-blobs-empty-selected-fields-blob" ),
353354 Storage .BlobListOption .fields ());
354355 }
355356 Set <String > blobSet = ImmutableSet .of (blobNames [0 ], blobNames [1 ]);
356- for (Blob remoteBlob : page .values ()) {
357+ Iterator <Blob > iterator = page .iterateAll ();
358+ while (iterator .hasNext ()) {
359+ Blob remoteBlob = iterator .next ();
357360 assertEquals (BUCKET , remoteBlob .bucket ());
358361 assertTrue (blobSet .contains (remoteBlob .name ()));
359362 assertNull (remoteBlob .contentType ());
@@ -362,7 +365,7 @@ public void testListBlobsEmptySelectedFields() throws InterruptedException {
362365 assertTrue (remoteBlob2 .delete ());
363366 }
364367
365- @ Test (timeout = 10000 )
368+ @ Test (timeout = 15000 )
366369 public void testListBlobsVersioned () throws ExecutionException , InterruptedException {
367370 String bucketName = RemoteGcsHelper .generateBucketName ();
368371 Bucket bucket = storage .create (BucketInfo .builder (bucketName ).versioningEnabled (true ).build ());
@@ -385,14 +388,16 @@ public void testListBlobsVersioned() throws ExecutionException, InterruptedExcep
385388 Storage .BlobListOption .versions (true ));
386389 // Listing blobs is eventually consistent, we loop until the list is of the expected size. The
387390 // test fails if timeout is reached.
388- while (Iterators .size (page .values (). iterator ()) != 3 ) {
391+ while (Iterators .size (page .iterateAll ()) != 3 ) {
389392 Thread .sleep (500 );
390393 page = storage .list (bucketName ,
391394 Storage .BlobListOption .prefix ("test-list-blobs-versioned-blob" ),
392395 Storage .BlobListOption .versions (true ));
393396 }
394397 Set <String > blobSet = ImmutableSet .of (blobNames [0 ], blobNames [1 ]);
395- for (Blob remoteBlob : page .values ()) {
398+ Iterator <Blob > iterator = page .iterateAll ();
399+ while (iterator .hasNext ()) {
400+ Blob remoteBlob = iterator .next ();
396401 assertEquals (bucketName , remoteBlob .bucket ());
397402 assertTrue (blobSet .contains (remoteBlob .name ()));
398403 assertNotNull (remoteBlob .generation ());
0 commit comments