Skip to content

Commit dceed7d

Browse files
committed
---
yaml --- r: 6363 b: refs/heads/tswast-patch-1 c: 04cf0a7 h: refs/heads/master i: 6361: 703c476 6359: a976de0
1 parent 2649fff commit dceed7d

2 files changed

Lines changed: 17 additions & 32 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 99178a3d0758a2ad7e1577c7e3adc99b8ef542bb
60+
refs/heads/tswast-patch-1: 04cf0a7c708cbf8c0e53fb971490b0e2cc6c5ab5
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-storage/src/test/java/com/google/gcloud/storage/ITStorageTest.java

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public void testCreateBlob() {
9696
BlobInfo blob = BlobInfo.builder(bucket, blobName).build();
9797
BlobInfo remoteBlob = storage.create(blob, BLOB_BYTE_CONTENT);
9898
assertNotNull(remoteBlob);
99-
assertEquals(blob.bucket(), remoteBlob.bucket());
100-
assertEquals(blob.name(), remoteBlob.name());
99+
assertEquals(blob.blobId(), remoteBlob.blobId());
101100
byte[] readBytes = storage.readAllBytes(bucket, blobName);
102101
assertArrayEquals(BLOB_BYTE_CONTENT, readBytes);
103102
assertTrue(storage.delete(bucket, blobName));
@@ -109,8 +108,7 @@ public void testCreateEmptyBlob() {
109108
BlobInfo blob = BlobInfo.builder(bucket, blobName).build();
110109
BlobInfo remoteBlob = storage.create(blob);
111110
assertNotNull(remoteBlob);
112-
assertEquals(blob.bucket(), remoteBlob.bucket());
113-
assertEquals(blob.name(), remoteBlob.name());
111+
assertEquals(blob.blobId(), remoteBlob.blobId());
114112
byte[] readBytes = storage.readAllBytes(bucket, blobName);
115113
assertArrayEquals(new byte[0], readBytes);
116114
assertTrue(storage.delete(bucket, blobName));
@@ -123,8 +121,7 @@ public void testCreateBlobStream() throws UnsupportedEncodingException {
123121
ByteArrayInputStream stream = new ByteArrayInputStream(BLOB_STRING_CONTENT.getBytes(UTF_8));
124122
BlobInfo remoteBlob = storage.create(blob, stream);
125123
assertNotNull(remoteBlob);
126-
assertEquals(blob.bucket(), remoteBlob.bucket());
127-
assertEquals(blob.name(), remoteBlob.name());
124+
assertEquals(blob.blobId(), remoteBlob.blobId());
128125
assertEquals(blob.contentType(), remoteBlob.contentType());
129126
byte[] readBytes = storage.readAllBytes(bucket, blobName);
130127
assertEquals(BLOB_STRING_CONTENT, new String(readBytes, UTF_8));
@@ -169,8 +166,7 @@ public void testUpdateBlob() {
169166
assertNotNull(storage.create(blob));
170167
BlobInfo updatedBlob = storage.update(blob.toBuilder().contentType(CONTENT_TYPE).build());
171168
assertNotNull(updatedBlob);
172-
assertEquals(blob.bucket(), updatedBlob.bucket());
173-
assertEquals(blob.name(), updatedBlob.name());
169+
assertEquals(blob.blobId(), updatedBlob.blobId());
174170
assertEquals(CONTENT_TYPE, updatedBlob.contentType());
175171
assertTrue(storage.delete(bucket, blobName));
176172
}
@@ -241,8 +237,7 @@ public void testComposeBlob() {
241237
Storage.ComposeRequest.of(ImmutableList.of(sourceBlobName1, sourceBlobName2), targetBlob);
242238
BlobInfo remoteBlob = storage.compose(req);
243239
assertNotNull(remoteBlob);
244-
assertEquals(bucket, remoteBlob.bucket());
245-
assertEquals(targetBlobName, remoteBlob.name());
240+
assertEquals(targetBlob.blobId(), remoteBlob.blobId());
246241
byte[] readBytes = storage.readAllBytes(bucket, targetBlobName);
247242
byte[] composedBytes = Arrays.copyOf(BLOB_BYTE_CONTENT, BLOB_BYTE_CONTENT.length * 2);
248243
System.arraycopy(BLOB_BYTE_CONTENT, 0, composedBytes, BLOB_BYTE_CONTENT.length,
@@ -306,8 +301,7 @@ public void testCopyBlobUpdateMetadata() {
306301
Storage.CopyRequest req = Storage.CopyRequest.of(bucket, sourceBlobName, targetBlob);
307302
BlobInfo remoteBlob = storage.copy(req);
308303
assertNotNull(remoteBlob);
309-
assertEquals(bucket, remoteBlob.bucket());
310-
assertEquals(targetBlobName, remoteBlob.name());
304+
assertEquals(targetBlob.blobId(), remoteBlob.blobId());
311305
assertEquals(CONTENT_TYPE, remoteBlob.contentType());
312306
assertTrue(storage.delete(bucket, sourceBlobName));
313307
assertTrue(storage.delete(bucket, targetBlobName));
@@ -355,10 +349,8 @@ public void testBatchRequest() {
355349
assertEquals(0, updateResponse.gets().size());
356350
BlobInfo remoteUpdatedBlob1 = updateResponse.updates().get(0).get();
357351
BlobInfo remoteUpdatedBlob2 = updateResponse.updates().get(1).get();
358-
assertEquals(bucket, remoteUpdatedBlob1.bucket());
359-
assertEquals(bucket, remoteUpdatedBlob2.bucket());
360-
assertEquals(updatedBlob1.name(), remoteUpdatedBlob1.name());
361-
assertEquals(updatedBlob2.name(), remoteUpdatedBlob2.name());
352+
assertEquals(sourceBlob1.blobId(), remoteUpdatedBlob1.blobId());
353+
assertEquals(sourceBlob2.blobId(), remoteUpdatedBlob2.blobId());
362354
assertEquals(updatedBlob1.contentType(), remoteUpdatedBlob1.contentType());
363355
assertEquals(updatedBlob2.contentType(), remoteUpdatedBlob2.contentType());
364356

@@ -533,8 +525,7 @@ public void testPostSignedUrl() throws IOException {
533525
connection.connect();
534526
BlobInfo remoteBlob = storage.get(bucket, blobName);
535527
assertNotNull(remoteBlob);
536-
assertEquals(bucket, remoteBlob.bucket());
537-
assertEquals(blob.name(), remoteBlob.name());
528+
assertEquals(blob.blobId(), remoteBlob.blobId());
538529
assertTrue(storage.delete(bucket, blobName));
539530
}
540531

@@ -546,11 +537,9 @@ public void testGetBlobs() {
546537
BlobInfo sourceBlob2 = BlobInfo.builder(bucket, sourceBlobName2).build();
547538
assertNotNull(storage.create(sourceBlob1));
548539
assertNotNull(storage.create(sourceBlob2));
549-
List<BlobInfo> remoteInfos = storage.get(sourceBlob1.blobId(), sourceBlob2.blobId());
550-
assertEquals(sourceBlob1.bucket(), remoteInfos.get(0).bucket());
551-
assertEquals(sourceBlob1.name(), remoteInfos.get(0).name());
552-
assertEquals(sourceBlob2.bucket(), remoteInfos.get(1).bucket());
553-
assertEquals(sourceBlob2.name(), remoteInfos.get(1).name());
540+
List<BlobInfo> remoteBlobs = storage.get(sourceBlob1.blobId(), sourceBlob2.blobId());
541+
assertEquals(sourceBlob1.blobId(), remoteBlobs.get(0).blobId());
542+
assertEquals(sourceBlob2.blobId(), remoteBlobs.get(1).blobId());
554543
assertTrue(storage.delete(bucket, sourceBlobName1));
555544
assertTrue(storage.delete(bucket, sourceBlobName2));
556545
}
@@ -563,8 +552,7 @@ public void testGetBlobsFail() {
563552
BlobInfo sourceBlob2 = BlobInfo.builder(bucket, sourceBlobName2).build();
564553
assertNotNull(storage.create(sourceBlob1));
565554
List<BlobInfo> remoteBlobs = storage.get(sourceBlob1.blobId(), sourceBlob2.blobId());
566-
assertEquals(sourceBlob1.bucket(), remoteBlobs.get(0).bucket());
567-
assertEquals(sourceBlob1.name(), remoteBlobs.get(0).name());
555+
assertEquals(sourceBlob1.blobId(), remoteBlobs.get(0).blobId());
568556
assertNull(remoteBlobs.get(1));
569557
assertTrue(storage.delete(bucket, sourceBlobName1));
570558
}
@@ -607,11 +595,9 @@ public void testUpdateBlobs() {
607595
List<BlobInfo> updatedBlobs = storage.update(
608596
remoteBlob1.toBuilder().contentType(CONTENT_TYPE).build(),
609597
remoteBlob2.toBuilder().contentType(CONTENT_TYPE).build());
610-
assertEquals(sourceBlob1.bucket(), updatedBlobs.get(0).bucket());
611-
assertEquals(sourceBlob1.name(), updatedBlobs.get(0).name());
598+
assertEquals(sourceBlob1.blobId(), updatedBlobs.get(0).blobId());
612599
assertEquals(CONTENT_TYPE, updatedBlobs.get(0).contentType());
613-
assertEquals(sourceBlob2.bucket(), updatedBlobs.get(1).bucket());
614-
assertEquals(sourceBlob2.name(), updatedBlobs.get(1).name());
600+
assertEquals(sourceBlob2.blobId(), updatedBlobs.get(1).blobId());
615601
assertEquals(CONTENT_TYPE, updatedBlobs.get(1).contentType());
616602
assertTrue(storage.delete(bucket, sourceBlobName1));
617603
assertTrue(storage.delete(bucket, sourceBlobName2));
@@ -628,8 +614,7 @@ public void testUpdateBlobsFail() {
628614
List<BlobInfo> updatedBlobs = storage.update(
629615
remoteBlob1.toBuilder().contentType(CONTENT_TYPE).build(),
630616
sourceBlob2.toBuilder().contentType(CONTENT_TYPE).build());
631-
assertEquals(sourceBlob1.bucket(), updatedBlobs.get(0).bucket());
632-
assertEquals(sourceBlob1.name(), updatedBlobs.get(0).name());
617+
assertEquals(sourceBlob1.blobId(), updatedBlobs.get(0).blobId());
633618
assertEquals(CONTENT_TYPE, updatedBlobs.get(0).contentType());
634619
assertNull(updatedBlobs.get(1));
635620
assertTrue(storage.delete(bucket, sourceBlobName1));

0 commit comments

Comments
 (0)