ContentMetadataBuilder.create(); ImmutableMap.Builder<String, String> userMetadata = ImmutableMap.builder();
ContentMetadataBuilder.create(); ImmutableMap.Builder<String, String> userMetadata = ImmutableMap.builder();
ContentMetadataBuilder.create(); ImmutableMap.Builder<String, String> userMetadata = ImmutableMap.builder();
ContentMetadata metadata = ContentMetadataBuilder.create() .contentLength(entry.size()) .build();
ContentMetadata metadata = ContentMetadataBuilder.create() .contentLength(entry.size()) .build();
ContentMetadata metadata = ContentMetadataBuilder.create() .contentLength(entry.contentLength()) .build();
ContentMetadata metadata = ContentMetadataBuilder.create() .contentLength(entry.size()) .build();
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateContainer" }) public void testSetBlobProperties() throws Exception { String blobName = "blob-name"; ByteSource byteSource = TestUtils.randomByteSource().slice(0, 1024); String contentDisposition = "attachment; filename=photo.jpg"; String contentEncoding = "compress"; String contentLanguage = "en"; String contentType = "audio/ogg"; // create blob AzureBlob object = getApi().newBlob(); object.getProperties().setName(blobName); object.setPayload(byteSource.read()); getApi().putBlob(privateContainer, object); // set properties getApi().setBlobProperties(privateContainer, blobName, ContentMetadataBuilder.create() .contentDisposition(contentDisposition) .contentEncoding(contentEncoding) .contentLanguage(contentLanguage) .contentType(contentType) .build()); // get properties BlobProperties properties = getApi().getBlobProperties(privateContainer, blobName); ContentMetadata contentMetadata = properties.getContentMetadata(); assertThat(contentMetadata.getContentDisposition()).isEqualTo(contentDisposition); assertThat(contentMetadata.getContentEncoding()).isEqualTo(contentEncoding); assertThat(contentMetadata.getContentLanguage()).isEqualTo(contentLanguage); assertThat(contentMetadata.getContentType()).isEqualTo(contentType); }
public void testSetBlobProperties() throws Exception { String cacheControl = "max-age=3600"; ContentMetadata metadata = ContentMetadataBuilder.create() .cacheControl(cacheControl) .build(); Invokable<?, ?> method = method(AzureBlobClient.class, "setBlobProperties", String.class, String.class, ContentMetadata.class); GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("container", "blob", metadata)); assertRequestLineEquals(request, "PUT https://identity.blob.core.windows.net/container/blob?comp=properties HTTP/1.1"); assertNonPayloadHeadersEqual(request, "x-ms-blob-cache-control: " + cacheControl + "\n" + "x-ms-blob-content-type: application/unknown\n" + "x-ms-version: 2017-04-17\n"); assertPayloadEquals(request, null, null, false); assertResponseParserClassEquals(method, request, ParseETagHeader.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, null); }
Map<String, String> userMetadata = ImmutableMap.of("key3", "value3", "key4", "value4"); blobStore.copyBlob(fromContainer, fromName, toContainer, toName, CopyOptions.builder() .contentMetadata(ContentMetadataBuilder.create() .cacheControl("max-age=3600") .contentType("text/csv")
ContentMetadataBuilder builder = ContentMetadataBuilder.create();
ContentMetadataBuilder builder = ContentMetadataBuilder.create();