Skip to content

Commit b16e8a3

Browse files
committed
---
yaml --- r: 1007 b: refs/heads/master c: f1c6b04 h: refs/heads/master i: 1005: 937e923 1003: 71bd268 999: caa054c 991: 6eff94a v: v3
1 parent dbe5fc9 commit b16e8a3

5 files changed

Lines changed: 32 additions & 40 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: 5bf23b65940772264658c065afbc565398bce47f
2+
refs/heads/master: f1c6b04fe2701dfd9f05ab24dad117db5bf046a0
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ public static List<Blob> get(final Storage storage, BlobInfo... infos) {
282282
return Collections.singletonList(
283283
new Blob(storage, storage.get(infos[0].bucket(), infos[0].name())));
284284
default:
285-
return Collections.unmodifiableList(Lists.transform(
286-
storage.get(infos[0], infos[1], Arrays.copyOfRange(infos, 2, length)),
285+
return Collections.unmodifiableList(Lists.transform(storage.get(infos),
287286
new Function<BlobInfo, Blob>() {
288287
@Override
289288
public Blob apply(BlobInfo f) {
@@ -312,8 +311,7 @@ public static List<Blob> update(final Storage storage, BlobInfo... infos) {
312311
case 1:
313312
return Collections.singletonList(new Blob(storage, storage.update(infos[0])));
314313
default:
315-
return Collections.unmodifiableList(Lists.transform(
316-
storage.update(infos[0], infos[1], Arrays.copyOfRange(infos, 2, length)),
314+
return Collections.unmodifiableList(Lists.transform(storage.update(infos),
317315
new Function<BlobInfo, Blob>() {
318316
@Override
319317
public Blob apply(BlobInfo f) {
@@ -343,8 +341,7 @@ public static List<Boolean> delete(Storage storage, BlobInfo... infos) {
343341
case 1:
344342
return Collections.singletonList(storage.delete(infos[0].bucket(), infos[0].name()));
345343
default:
346-
return Collections.unmodifiableList(
347-
storage.delete(infos[0], infos[1], Arrays.copyOfRange(infos, 2, length)));
344+
return Collections.unmodifiableList(storage.delete(infos));
348345
}
349346
}
350347
}

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,14 @@ public static Builder builder() {
563563
*/
564564
BlobInfo update(BlobInfo blobInfo, BlobTargetOption... options);
565565

566+
/**
567+
* Update blob information.
568+
*
569+
* @return the updated blob
570+
* @throws StorageException upon failure
571+
*/
572+
BlobInfo update(BlobInfo blobInfo);
573+
566574
/**
567575
* Delete the requested bucket.
568576
*
@@ -642,34 +650,28 @@ public static Builder builder() {
642650
/**
643651
* Gets the requested blobs. A batch request is used to perform this call.
644652
*
645-
* @param blobInfo1 first blob to get
646-
* @param blobInfo2 second blob to get
647-
* @param blobInfos other blobs to get
653+
* @param blobInfos blobs to get
648654
* @return an immutable list of {@code BlobInfo} objects. If a blob does not exist or access to it
649655
* has been denied the corresponding item in the list is {@code null}.
650656
*/
651-
List<BlobInfo> get(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos);
657+
List<BlobInfo> get(BlobInfo... blobInfos);
652658

653659
/**
654660
* Updates the requested blobs. A batch request is used to perform this call.
655661
*
656-
* @param blobInfo1 first blob to update
657-
* @param blobInfo2 second blob to update
658-
* @param blobInfos other blobs to update
662+
* @param blobInfos blobs to update
659663
* @return an immutable list of {@code BlobInfo} objects. If a blob does not exist or access to it
660664
* has been denied the corresponding item in the list is {@code null}.
661665
*/
662-
List<BlobInfo> update(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos);
666+
List<BlobInfo> update(BlobInfo... blobInfos);
663667

664668
/**
665669
* Deletes the requested blobs. A batch request is used to perform this call.
666670
*
667-
* @param blobInfo1 first blob to delete
668-
* @param blobInfo2 second blob to delete
669-
* @param blobInfos other blobs to delete
671+
* @param blobInfos blobs to delete
670672
* @return an immutable list of booleans. If a blob has been deleted the corresponding item in the
671673
* list is {@code true}. If deletion failed or access to the resource was denied the item is
672674
* {@code false}.
673675
*/
674-
List<Boolean> delete(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos);
676+
List<Boolean> delete(BlobInfo... blobInfos);
675677
}

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ public StorageObject call() {
349349
}
350350
}
351351

352+
@Override
353+
public BlobInfo update(BlobInfo blobInfo) {
354+
return update(blobInfo, new BlobTargetOption[0]);
355+
}
356+
352357
@Override
353358
public boolean delete(String bucket, BucketSourceOption... options) {
354359
final com.google.api.services.storage.model.Bucket bucketPb = BucketInfo.of(bucket).toPb();
@@ -579,10 +584,8 @@ public URL signUrl(BlobInfo blobInfo, long expiration, SignUrlOption... options)
579584
}
580585

581586
@Override
582-
public List<BlobInfo> get(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos) {
587+
public List<BlobInfo> get(BlobInfo... blobInfos) {
583588
BatchRequest.Builder requestBuilder = BatchRequest.builder();
584-
requestBuilder.get(blobInfo1.bucket(), blobInfo1.name());
585-
requestBuilder.get(blobInfo2.bucket(), blobInfo2.name());
586589
for (BlobInfo blobInfo : blobInfos) {
587590
requestBuilder.get(blobInfo.bucket(), blobInfo.name());
588591
}
@@ -591,10 +594,8 @@ public List<BlobInfo> get(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... bl
591594
}
592595

593596
@Override
594-
public List<BlobInfo> update(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos) {
597+
public List<BlobInfo> update(BlobInfo... blobInfos) {
595598
BatchRequest.Builder requestBuilder = BatchRequest.builder();
596-
requestBuilder.update(blobInfo1);
597-
requestBuilder.update(blobInfo2);
598599
for (BlobInfo blobInfo : blobInfos) {
599600
requestBuilder.update(blobInfo);
600601
}
@@ -603,10 +604,8 @@ public List<BlobInfo> update(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo...
603604
}
604605

605606
@Override
606-
public List<Boolean> delete(BlobInfo blobInfo1, BlobInfo blobInfo2, BlobInfo... blobInfos) {
607+
public List<Boolean> delete(BlobInfo... blobInfos) {
607608
BatchRequest.Builder requestBuilder = BatchRequest.builder();
608-
requestBuilder.delete(blobInfo1.bucket(), blobInfo1.name());
609-
requestBuilder.delete(blobInfo2.bucket(), blobInfo2.name());
610609
for (BlobInfo blobInfo : blobInfos) {
611610
requestBuilder.delete(blobInfo.bucket(), blobInfo.name());
612611
}

trunk/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void testReload() throws Exception {
100100
@Test
101101
public void testUpdate() throws Exception {
102102
BlobInfo updatedInfo = BLOB_INFO.toBuilder().cacheControl("c").build();
103-
expect(storage.update(updatedInfo)).andReturn(updatedInfo);
103+
expect(storage.update(updatedInfo, new Storage.BlobTargetOption[0])).andReturn(updatedInfo);
104104
replay(storage);
105105
Blob updatedBlob = blob.update(updatedInfo);
106106
assertSame(storage, blob.storage());
@@ -184,8 +184,7 @@ public void testGetOne() throws Exception {
184184
@Test
185185
public void testGetSome() throws Exception {
186186
List<BlobInfo> blobInfoList = Arrays.asList(BLOB_INFO_ARRAY);
187-
expect(storage.get(BLOB_INFO_ARRAY[0], BLOB_INFO_ARRAY[1],
188-
Arrays.copyOfRange(BLOB_INFO_ARRAY, 2, BLOB_INFO_ARRAY.length))).andReturn(blobInfoList);
187+
expect(storage.get(BLOB_INFO_ARRAY)).andReturn(blobInfoList);
189188
replay(storage);
190189
List<Blob> result = Blob.get(storage, BLOB_INFO_ARRAY);
191190
assertEquals(blobInfoList.size(), result.size());
@@ -197,8 +196,7 @@ public void testGetSome() throws Exception {
197196
@Test
198197
public void testGetSomeNull() throws Exception {
199198
List<BlobInfo> blobInfoList = Arrays.asList(BLOB_INFO_ARRAY[0], null, BLOB_INFO_ARRAY[2]);
200-
expect(storage.get(BLOB_INFO_ARRAY[0], BLOB_INFO_ARRAY[1],
201-
Arrays.copyOfRange(BLOB_INFO_ARRAY, 2, BLOB_INFO_ARRAY.length))).andReturn(blobInfoList);
199+
expect(storage.get(BLOB_INFO_ARRAY)).andReturn(blobInfoList);
202200
replay(storage);
203201
List<Blob> result = Blob.get(storage, BLOB_INFO_ARRAY);
204202
assertEquals(blobInfoList.size(), result.size());
@@ -233,8 +231,7 @@ public void testUpdateSome() throws Exception {
233231
for (BlobInfo info : BLOB_INFO_ARRAY) {
234232
blobInfoList.add(info.toBuilder().contentType("content").build());
235233
}
236-
expect(storage.update(BLOB_INFO_ARRAY[0], BLOB_INFO_ARRAY[1],
237-
Arrays.copyOfRange(BLOB_INFO_ARRAY, 2, BLOB_INFO_ARRAY.length))).andReturn(blobInfoList);
234+
expect(storage.update(BLOB_INFO_ARRAY)).andReturn(blobInfoList);
238235
replay(storage);
239236
List<Blob> result = Blob.update(storage, BLOB_INFO_ARRAY);
240237
assertEquals(blobInfoList.size(), result.size());
@@ -248,8 +245,7 @@ public void testUpdateSomeNull() throws Exception {
248245
List<BlobInfo> blobInfoList = Arrays.asList(
249246
BLOB_INFO_ARRAY[0].toBuilder().contentType("content").build(), null,
250247
BLOB_INFO_ARRAY[2].toBuilder().contentType("content").build());
251-
expect(storage.update(BLOB_INFO_ARRAY[0], BLOB_INFO_ARRAY[1],
252-
Arrays.copyOfRange(BLOB_INFO_ARRAY, 2, BLOB_INFO_ARRAY.length))).andReturn(blobInfoList);
248+
expect(storage.update(BLOB_INFO_ARRAY)).andReturn(blobInfoList);
253249
replay(storage);
254250
List<Blob> result = Blob.update(storage, BLOB_INFO_ARRAY);
255251
assertEquals(blobInfoList.size(), result.size());
@@ -280,9 +276,7 @@ public void testDeleteOne() throws Exception {
280276
@Test
281277
public void testDeleteSome() throws Exception {
282278
List<Boolean> deleleResultList = Arrays.asList(true, true, true);
283-
expect(storage.delete(BLOB_INFO_ARRAY[0], BLOB_INFO_ARRAY[1],
284-
Arrays.copyOfRange(BLOB_INFO_ARRAY, 2, BLOB_INFO_ARRAY.length)))
285-
.andReturn(deleleResultList);
279+
expect(storage.delete(BLOB_INFO_ARRAY)).andReturn(deleleResultList);
286280
replay(storage);
287281
List<Boolean> result = Blob.delete(storage, BLOB_INFO_ARRAY);
288282
assertEquals(deleleResultList.size(), result.size());

0 commit comments

Comments
 (0)