private String addObjectAndValidateContent(String sourcecontainer, String sourceKey) throws InterruptedException { String eTag = addBlobToContainer(sourcecontainer, sourceKey); validateContent(sourcecontainer, sourceKey); return eTag; }
private String addObjectAndValidateContent(String sourcecontainer, String sourceKey) throws InterruptedException { String eTag = addBlobToContainer(sourcecontainer, sourceKey); validateContent(sourcecontainer, sourceKey); awaitConsistency(); return eTag; }
@Test(groups = { "integration", "live" }, dataProvider = "delete") public void deleteMultipleObjects(String name) throws InterruptedException { String name2 = name + "2"; String container = getContainerName(); try { addBlobToContainer(container, name, name, MediaType.TEXT_PLAIN); addBlobToContainer(container, name2, name2, MediaType.TEXT_PLAIN); awaitConsistency(); view.getBlobStore().removeBlobs(container, ImmutableSet.of(name, name2)); awaitConsistency(); assertContainerEmptyDeleting(container, name); } finally { returnContainer(container); } }
@Test(groups = { "integration", "live" }, dataProvider = "delete") public void deleteObject(String name) throws InterruptedException { String container = getContainerName(); try { addBlobToContainer(container, name, name, MediaType.TEXT_PLAIN); view.getBlobStore().removeBlob(container, name); assertContainerEmptyDeleting(container, name); } finally { returnContainer(container); } }
@Test(groups = { "integration", "live" }) public void testSetBlobAccess() throws Exception { BlobStore blobStore = view.getBlobStore(); String containerName = getContainerName(); String blobName = "set-access-blob-name"; try { addBlobToContainer(containerName, blobName, blobName, MediaType.TEXT_PLAIN); assertThat(blobStore.getBlobAccess(containerName, blobName)).isEqualTo(BlobAccess.PRIVATE); blobStore.setBlobAccess(containerName, blobName, BlobAccess.PUBLIC_READ); assertThat(blobStore.getBlobAccess(containerName, blobName)).isEqualTo(BlobAccess.PUBLIC_READ); // test that blob is anonymously readable HttpRequest request = view.getSigner().signGetBlob(containerName, blobName).toBuilder() .replaceQueryParams(ImmutableMap.<String, String>of()).build(); HttpResponse response = view.utils().http().invoke(request); assertThat(response.getStatusCode()).isEqualTo(200); blobStore.setBlobAccess(containerName, blobName, BlobAccess.PRIVATE); assertThat(blobStore.getBlobAccess(containerName, blobName)).isEqualTo(BlobAccess.PRIVATE); } finally { returnContainer(containerName); } }
@Test(groups = { "integration", "live" }, dataProvider = "delete") public void deleteObject(String name) throws InterruptedException { String container = getContainerName(); try { addBlobToContainer(container, name, name, MediaType.TEXT_PLAIN); awaitConsistency(); view.getBlobStore().removeBlob(container, name); awaitConsistency(); assertContainerEmptyDeleting(container, name); } finally { returnContainer(container); } }
assertNull(view.getBlobStore().blobMetadata(container, "powderpuff")); addBlobToContainer(container, blob); Blob newObject = validateContent(container, name); addBlobToContainer(container, blob); awaitConsistency(); validateMetadata(view.getBlobStore().blobMetadata(container, name));
@Test(groups = { "integration", "live" }) public void testMetadata() throws InterruptedException, IOException { String name = "hello"; // NOTE all metadata in jclouds comes out as lowercase, in an effort to // normalize the // providers. Blob blob = view.getBlobStore().blobBuilder(name).userMetadata(ImmutableMap.of("Adrian", "powderpuff")) .payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).calculateMD5().build(); String container = getContainerName(); try { assertNull(view.getBlobStore().blobMetadata(container, "powderpuff")); addBlobToContainer(container, blob); Blob newObject = validateContent(container, name); BlobMetadata metadata = newObject.getMetadata(); validateMetadata(metadata); validateMetadata(metadata, container, name); validateMetadata(view.getBlobStore().blobMetadata(container, name)); // write 2 items with the same name to ensure that provider doesn't // accept dupes blob.getMetadata().getUserMetadata().put("Adrian", "wonderpuff"); blob.getMetadata().getUserMetadata().put("Adrian", "powderpuff"); addBlobToContainer(container, blob); validateMetadata(view.getBlobStore().blobMetadata(container, name)); } finally { returnContainer(container); } }