From 3026e77428e35d47f2e68541849082710394a8c8 Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 21 Jan 2016 09:32:43 +0100 Subject: [PATCH] Rename Storage.apply to Storage.submit --- .../main/java/com/google/gcloud/storage/Bucket.java | 2 +- .../main/java/com/google/gcloud/storage/Storage.java | 2 +- .../java/com/google/gcloud/storage/StorageImpl.java | 8 ++++---- .../java/com/google/gcloud/storage/BucketTest.java | 2 +- .../java/com/google/gcloud/storage/ITStorageTest.java | 10 +++++----- .../com/google/gcloud/storage/StorageImplTest.java | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java index d0e823492ee3..3acd3f5d79b9 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java @@ -319,7 +319,7 @@ public List get(String blobName1, String blobName2, String... blobNames) { batch.get(info.name(), name); } List blobs = new ArrayList<>(blobNames.length); - BatchResponse response = storage.apply(batch.build()); + BatchResponse response = storage.submit(batch.build()); for (BatchResponse.Result result : response.gets()) { BlobInfo blobInfo = result.get(); blobs.add(blobInfo != null ? new Blob(storage, blobInfo) : null); diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java index f8c90ff42930..272c5fdef223 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Storage.java @@ -1412,7 +1412,7 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx * @return the batch response * @throws StorageException upon failure */ - BatchResponse apply(BatchRequest batchRequest); + BatchResponse submit(BatchRequest batchRequest); /** * Return a channel for reading the blob's content. The blob's latest generation is read. If the diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java index a4b6c56e5ede..b6a833f26ab4 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java @@ -441,7 +441,7 @@ public byte[] call() { } @Override - public BatchResponse apply(BatchRequest batchRequest) { + public BatchResponse submit(BatchRequest batchRequest) { List>> toDelete = Lists.newArrayListWithCapacity(batchRequest.toDelete().size()); for (Map.Entry> entry : batchRequest.toDelete().entrySet()) { @@ -592,7 +592,7 @@ public List get(BlobId... blobIds) { for (BlobId blob : blobIds) { requestBuilder.get(blob); } - BatchResponse response = apply(requestBuilder.build()); + BatchResponse response = submit(requestBuilder.build()); return Collections.unmodifiableList(transformResultList(response.gets(), null)); } @@ -602,7 +602,7 @@ public List update(BlobInfo... blobInfos) { for (BlobInfo blobInfo : blobInfos) { requestBuilder.update(blobInfo); } - BatchResponse response = apply(requestBuilder.build()); + BatchResponse response = submit(requestBuilder.build()); return Collections.unmodifiableList(transformResultList(response.updates(), null)); } @@ -612,7 +612,7 @@ public List delete(BlobId... blobIds) { for (BlobId blob : blobIds) { requestBuilder.delete(blob); } - BatchResponse response = apply(requestBuilder.build()); + BatchResponse response = submit(requestBuilder.build()); return Collections.unmodifiableList(transformResultList(response.deletes(), Boolean.FALSE)); } diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java index e67e7aff17dc..4e253033c6f2 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java @@ -175,7 +175,7 @@ public void testGetAll() throws Exception { } BatchResponse response = new BatchResponse(Collections.>emptyList(), Collections.>emptyList(), batchResultList); - expect(storage.apply(capture(capturedBatchRequest))).andReturn(response); + expect(storage.submit(capture(capturedBatchRequest))).andReturn(response); replay(storage); List blobs = bucket.get("n1", "n2", "n3"); Set blobInfoSet = capturedBatchRequest.getValue().toGet().keySet(); diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java index 614ceee7b61e..63b9d739b686 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java @@ -584,7 +584,7 @@ public void testBatchRequest() { .update(updatedBlob1) .update(updatedBlob2) .build(); - BatchResponse updateResponse = storage.apply(updateRequest); + BatchResponse updateResponse = storage.submit(updateRequest); assertEquals(2, updateResponse.updates().size()); assertEquals(0, updateResponse.deletes().size()); assertEquals(0, updateResponse.gets().size()); @@ -602,7 +602,7 @@ public void testBatchRequest() { .get(BUCKET, sourceBlobName1) .get(BUCKET, sourceBlobName2) .build(); - BatchResponse getResponse = storage.apply(getRequest); + BatchResponse getResponse = storage.submit(getRequest); assertEquals(2, getResponse.gets().size()); assertEquals(0, getResponse.deletes().size()); assertEquals(0, getResponse.updates().size()); @@ -616,7 +616,7 @@ public void testBatchRequest() { .delete(BUCKET, sourceBlobName1) .delete(BUCKET, sourceBlobName2) .build(); - BatchResponse deleteResponse = storage.apply(deleteRequest); + BatchResponse deleteResponse = storage.submit(deleteRequest); assertEquals(2, deleteResponse.deletes().size()); assertEquals(0, deleteResponse.gets().size()); assertEquals(0, deleteResponse.updates().size()); @@ -646,7 +646,7 @@ public void testBatchRequestManyDeletes() { .get(BUCKET, sourceBlobName1) .update(updatedBlob2) .build(); - BatchResponse response = storage.apply(updateRequest); + BatchResponse response = storage.submit(updateRequest); assertEquals(2 * MAX_BATCH_DELETES, response.deletes().size()); assertEquals(1, response.updates().size()); assertEquals(1, response.gets().size()); @@ -685,7 +685,7 @@ public void testBatchRequestFail() { .get(BUCKET, blobName, Storage.BlobGetOption.generationMatch(-1L)) .get(BlobId.of(BUCKET, blobName, -1L)) .build(); - BatchResponse batchResponse = storage.apply(batchRequest); + BatchResponse batchResponse = storage.submit(batchRequest); assertEquals(1, batchResponse.updates().size()); assertEquals(2, batchResponse.deletes().size()); assertEquals(2, batchResponse.gets().size()); diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java index b8da0580cd4a..f32a51507857 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/StorageImplTest.java @@ -975,7 +975,7 @@ public Tuple apply(StorageObject f) { EasyMock.expect(storageRpcMock.batch(EasyMock.capture(capturedBatchRequest))).andReturn(res); EasyMock.replay(storageRpcMock); storage = options.service(); - BatchResponse batchResponse = storage.apply(req); + BatchResponse batchResponse = storage.submit(req); // Verify captured StorageRpc.BatchRequest List>> capturedToDelete =