mirror of https://github.com/apache/jclouds.git
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:
parent
70eac74140
commit
c87e2052ac
|
@ -776,6 +776,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
ByteSource payload = TestUtils.randomByteSource().slice(0, 1024);
|
ByteSource payload = TestUtils.randomByteSource().slice(0, 1024);
|
||||||
PayloadBlobBuilder blobBuilder = blobStore
|
PayloadBlobBuilder blobBuilder = blobStore
|
||||||
.blobBuilder(fromName)
|
.blobBuilder(fromName)
|
||||||
|
.userMetadata(ImmutableMap.of("key1", "value1", "key2", "value2"))
|
||||||
.payload(payload)
|
.payload(payload)
|
||||||
.contentLength(payload.size());
|
.contentLength(payload.size());
|
||||||
addContentMetadata(blobBuilder);
|
addContentMetadata(blobBuilder);
|
||||||
|
@ -785,7 +786,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
String toContainer = getContainerName();
|
String toContainer = getContainerName();
|
||||||
try {
|
try {
|
||||||
blobStore.putBlob(fromContainer, blob);
|
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,
|
blobStore.copyBlob(fromContainer, fromName, toContainer, toName,
|
||||||
CopyOptions.builder().userMetadata(userMetadata).build());
|
CopyOptions.builder().userMetadata(userMetadata).build());
|
||||||
Blob toBlob = blobStore.getBlob(toContainer, toName);
|
Blob toBlob = blobStore.getBlob(toContainer, toName);
|
||||||
|
|
Loading…
Reference in New Issue