@@ -96,8 +96,7 @@ public void testCreateBlob() { |
96 | 96 | BlobInfo blob = BlobInfo.builder(bucket, blobName).build(); |
97 | 97 | BlobInfo remoteBlob = storage.create(blob, BLOB_BYTE_CONTENT); |
98 | 98 | assertNotNull(remoteBlob); |
99 | | - assertEquals(blob.bucket(), remoteBlob.bucket()); |
100 | | - assertEquals(blob.name(), remoteBlob.name()); |
| 99 | + assertEquals(blob.blobId(), remoteBlob.blobId()); |
101 | 100 | byte[] readBytes = storage.readAllBytes(bucket, blobName); |
102 | 101 | assertArrayEquals(BLOB_BYTE_CONTENT, readBytes); |
103 | 102 | assertTrue(storage.delete(bucket, blobName)); |
@@ -109,8 +108,7 @@ public void testCreateEmptyBlob() { |
109 | 108 | BlobInfo blob = BlobInfo.builder(bucket, blobName).build(); |
110 | 109 | BlobInfo remoteBlob = storage.create(blob); |
111 | 110 | assertNotNull(remoteBlob); |
112 | | - assertEquals(blob.bucket(), remoteBlob.bucket()); |
113 | | - assertEquals(blob.name(), remoteBlob.name()); |
| 111 | + assertEquals(blob.blobId(), remoteBlob.blobId()); |
114 | 112 | byte[] readBytes = storage.readAllBytes(bucket, blobName); |
115 | 113 | assertArrayEquals(new byte[0], readBytes); |
116 | 114 | assertTrue(storage.delete(bucket, blobName)); |
@@ -123,8 +121,7 @@ public void testCreateBlobStream() throws UnsupportedEncodingException { |
123 | 121 | ByteArrayInputStream stream = new ByteArrayInputStream(BLOB_STRING_CONTENT.getBytes(UTF_8)); |
124 | 122 | BlobInfo remoteBlob = storage.create(blob, stream); |
125 | 123 | assertNotNull(remoteBlob); |
126 | | - assertEquals(blob.bucket(), remoteBlob.bucket()); |
127 | | - assertEquals(blob.name(), remoteBlob.name()); |
| 124 | + assertEquals(blob.blobId(), remoteBlob.blobId()); |
128 | 125 | assertEquals(blob.contentType(), remoteBlob.contentType()); |
129 | 126 | byte[] readBytes = storage.readAllBytes(bucket, blobName); |
130 | 127 | assertEquals(BLOB_STRING_CONTENT, new String(readBytes, UTF_8)); |
@@ -169,8 +166,7 @@ public void testUpdateBlob() { |
169 | 166 | assertNotNull(storage.create(blob)); |
170 | 167 | BlobInfo updatedBlob = storage.update(blob.toBuilder().contentType(CONTENT_TYPE).build()); |
171 | 168 | assertNotNull(updatedBlob); |
172 | | - assertEquals(blob.bucket(), updatedBlob.bucket()); |
173 | | - assertEquals(blob.name(), updatedBlob.name()); |
| 169 | + assertEquals(blob.blobId(), updatedBlob.blobId()); |
174 | 170 | assertEquals(CONTENT_TYPE, updatedBlob.contentType()); |
175 | 171 | assertTrue(storage.delete(bucket, blobName)); |
176 | 172 | } |
@@ -241,8 +237,7 @@ public void testComposeBlob() { |
241 | 237 | Storage.ComposeRequest.of(ImmutableList.of(sourceBlobName1, sourceBlobName2), targetBlob); |
242 | 238 | BlobInfo remoteBlob = storage.compose(req); |
243 | 239 | assertNotNull(remoteBlob); |
244 | | - assertEquals(bucket, remoteBlob.bucket()); |
245 | | - assertEquals(targetBlobName, remoteBlob.name()); |
| 240 | + assertEquals(targetBlob.blobId(), remoteBlob.blobId()); |
246 | 241 | byte[] readBytes = storage.readAllBytes(bucket, targetBlobName); |
247 | 242 | byte[] composedBytes = Arrays.copyOf(BLOB_BYTE_CONTENT, BLOB_BYTE_CONTENT.length * 2); |
248 | 243 | System.arraycopy(BLOB_BYTE_CONTENT, 0, composedBytes, BLOB_BYTE_CONTENT.length, |
@@ -306,8 +301,7 @@ public void testCopyBlobUpdateMetadata() { |
306 | 301 | Storage.CopyRequest req = Storage.CopyRequest.of(bucket, sourceBlobName, targetBlob); |
307 | 302 | BlobInfo remoteBlob = storage.copy(req); |
308 | 303 | assertNotNull(remoteBlob); |
309 | | - assertEquals(bucket, remoteBlob.bucket()); |
310 | | - assertEquals(targetBlobName, remoteBlob.name()); |
| 304 | + assertEquals(targetBlob.blobId(), remoteBlob.blobId()); |
311 | 305 | assertEquals(CONTENT_TYPE, remoteBlob.contentType()); |
312 | 306 | assertTrue(storage.delete(bucket, sourceBlobName)); |
313 | 307 | assertTrue(storage.delete(bucket, targetBlobName)); |
@@ -355,10 +349,8 @@ public void testBatchRequest() { |
355 | 349 | assertEquals(0, updateResponse.gets().size()); |
356 | 350 | BlobInfo remoteUpdatedBlob1 = updateResponse.updates().get(0).get(); |
357 | 351 | 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()); |
362 | 354 | assertEquals(updatedBlob1.contentType(), remoteUpdatedBlob1.contentType()); |
363 | 355 | assertEquals(updatedBlob2.contentType(), remoteUpdatedBlob2.contentType()); |
364 | 356 |
|
@@ -533,8 +525,7 @@ public void testPostSignedUrl() throws IOException { |
533 | 525 | connection.connect(); |
534 | 526 | BlobInfo remoteBlob = storage.get(bucket, blobName); |
535 | 527 | assertNotNull(remoteBlob); |
536 | | - assertEquals(bucket, remoteBlob.bucket()); |
537 | | - assertEquals(blob.name(), remoteBlob.name()); |
| 528 | + assertEquals(blob.blobId(), remoteBlob.blobId()); |
538 | 529 | assertTrue(storage.delete(bucket, blobName)); |
539 | 530 | } |
540 | 531 |
|
@@ -546,11 +537,9 @@ public void testGetBlobs() { |
546 | 537 | BlobInfo sourceBlob2 = BlobInfo.builder(bucket, sourceBlobName2).build(); |
547 | 538 | assertNotNull(storage.create(sourceBlob1)); |
548 | 539 | 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()); |
554 | 543 | assertTrue(storage.delete(bucket, sourceBlobName1)); |
555 | 544 | assertTrue(storage.delete(bucket, sourceBlobName2)); |
556 | 545 | } |
@@ -563,8 +552,7 @@ public void testGetBlobsFail() { |
563 | 552 | BlobInfo sourceBlob2 = BlobInfo.builder(bucket, sourceBlobName2).build(); |
564 | 553 | assertNotNull(storage.create(sourceBlob1)); |
565 | 554 | 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()); |
568 | 556 | assertNull(remoteBlobs.get(1)); |
569 | 557 | assertTrue(storage.delete(bucket, sourceBlobName1)); |
570 | 558 | } |
@@ -607,11 +595,9 @@ public void testUpdateBlobs() { |
607 | 595 | List<BlobInfo> updatedBlobs = storage.update( |
608 | 596 | remoteBlob1.toBuilder().contentType(CONTENT_TYPE).build(), |
609 | 597 | 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()); |
612 | 599 | 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()); |
615 | 601 | assertEquals(CONTENT_TYPE, updatedBlobs.get(1).contentType()); |
616 | 602 | assertTrue(storage.delete(bucket, sourceBlobName1)); |
617 | 603 | assertTrue(storage.delete(bucket, sourceBlobName2)); |
@@ -628,8 +614,7 @@ public void testUpdateBlobsFail() { |
628 | 614 | List<BlobInfo> updatedBlobs = storage.update( |
629 | 615 | remoteBlob1.toBuilder().contentType(CONTENT_TYPE).build(), |
630 | 616 | 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()); |
633 | 618 | assertEquals(CONTENT_TYPE, updatedBlobs.get(0).contentType()); |
634 | 619 | assertNull(updatedBlobs.get(1)); |
635 | 620 | assertTrue(storage.delete(bucket, sourceBlobName1)); |
|