mirror of https://github.com/apache/jclouds.git
JCLOUDS-1337: Atmos putBlob portable storage tiers
This commit is contained in:
parent
e0e3519ed8
commit
f513bf7c40
|
@ -29,6 +29,7 @@ import org.jclouds.atmos.filters.ShareUrl;
|
||||||
import org.jclouds.atmos.functions.AtmosObjectName;
|
import org.jclouds.atmos.functions.AtmosObjectName;
|
||||||
import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
||||||
import org.jclouds.blobstore.domain.StorageType;
|
import org.jclouds.blobstore.domain.StorageType;
|
||||||
|
import org.jclouds.blobstore.domain.Tier;
|
||||||
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
|
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ public class ObjectToBlobMetadata implements Function<AtmosObject, MutableBlobMe
|
||||||
}
|
}
|
||||||
to.setUserMetadata(lowerKeyMetadata);
|
to.setUserMetadata(lowerKeyMetadata);
|
||||||
to.setSize(from.getContentMetadata().getContentLength());
|
to.setSize(from.getContentMetadata().getContentLength());
|
||||||
|
to.setTier(Tier.STANDARD);
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.jclouds.atmos.blobstore.integration;
|
package org.jclouds.atmos.blobstore.integration;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -24,6 +25,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||||
|
import org.jclouds.blobstore.domain.Tier;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
||||||
import org.testng.SkipException;
|
import org.testng.SkipException;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
|
@ -197,4 +199,40 @@ public class AtmosIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
public void testCopyIfNoneMatchNegative() throws Exception {
|
public void testCopyIfNoneMatchNegative() throws Exception {
|
||||||
super.testCopyIfNoneMatchNegative();
|
super.testCopyIfNoneMatchNegative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(groups = { "integration", "live" })
|
||||||
|
public void testPutBlobTierStandardMultipart() throws Exception {
|
||||||
|
try {
|
||||||
|
super.testPutBlobTierStandardMultipart();
|
||||||
|
failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
|
||||||
|
} catch (UnsupportedOperationException uoe) {
|
||||||
|
throw new SkipException("Atmos does not support multipart", uoe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = { "integration", "live" })
|
||||||
|
public void testPutBlobTierInfrequentMultipart() throws Exception {
|
||||||
|
try {
|
||||||
|
super.testPutBlobTierInfrequentMultipart();
|
||||||
|
failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
|
||||||
|
} catch (UnsupportedOperationException uoe) {
|
||||||
|
throw new SkipException("Atmos does not support multipart", uoe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(groups = { "integration", "live" })
|
||||||
|
public void testPutBlobTierArchiveMultipart() throws Exception {
|
||||||
|
try {
|
||||||
|
super.testPutBlobTierArchiveMultipart();
|
||||||
|
failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);
|
||||||
|
} catch (UnsupportedOperationException uoe) {
|
||||||
|
throw new SkipException("Atmos does not support multipart", uoe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void checkTier(BlobMetadata metadata, Tier expected) {
|
||||||
|
// Atmos maps all tiers to STANDARD
|
||||||
|
assertThat(metadata.getTier()).isEqualTo(Tier.STANDARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -787,12 +787,16 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
.tier(tier)
|
.tier(tier)
|
||||||
.build();
|
.build();
|
||||||
blobStore.putBlob(containerName, blob, options);
|
blobStore.putBlob(containerName, blob, options);
|
||||||
assertThat(blobStore.blobMetadata(containerName, blobName).getTier()).isEqualTo(tier);
|
checkTier(blobStore.blobMetadata(containerName, blobName), tier);
|
||||||
} finally {
|
} finally {
|
||||||
returnContainer(containerName);
|
returnContainer(containerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void checkTier(BlobMetadata metadata, Tier expected) {
|
||||||
|
assertThat(metadata.getTier()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
protected void checkUserMetadata(Map<String, String> userMetadata1, Map<String, String> userMetadata2) {
|
protected void checkUserMetadata(Map<String, String> userMetadata1, Map<String, String> userMetadata2) {
|
||||||
assertThat(userMetadata1).isEqualTo(userMetadata2);
|
assertThat(userMetadata1).isEqualTo(userMetadata2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue