JCLOUDS-651: Ensure copy replaces user metadata

Some object stores have additive semantics for metadata.  As currently
implemented Azure, S3, and Swift consistently replace user metadata
but have different behavior for system metadata, e.g., Content-Type.
This commit is contained in:
Andrew Gaul 2015-04-03 17:50:33 -07:00
parent 70eac74140
commit c87e2052ac
1 changed files with 2 additions and 1 deletions

View File

@ -776,6 +776,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
ByteSource payload = TestUtils.randomByteSource().slice(0, 1024);
PayloadBlobBuilder blobBuilder = blobStore
.blobBuilder(fromName)
.userMetadata(ImmutableMap.of("key1", "value1", "key2", "value2"))
.payload(payload)
.contentLength(payload.size());
addContentMetadata(blobBuilder);
@ -785,7 +786,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
String toContainer = getContainerName();
try {
blobStore.putBlob(fromContainer, blob);
Map<String, String> userMetadata = ImmutableMap.of("key1", "value1", "key2", "value2");
Map<String, String> userMetadata = ImmutableMap.of("key3", "value3", "key4", "value4");
blobStore.copyBlob(fromContainer, fromName, toContainer, toName,
CopyOptions.builder().userMetadata(userMetadata).build());
Blob toBlob = blobStore.getBlob(toContainer, toName);