mirror of https://github.com/apache/jclouds.git
JCLOUDS-1337: B2 putBlob portable storage tiers
This commit is contained in:
parent
f513bf7c40
commit
3193aa68e8
|
@ -55,6 +55,7 @@ import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
|||
import org.jclouds.blobstore.domain.PageSet;
|
||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||
import org.jclouds.blobstore.domain.StorageType;
|
||||
import org.jclouds.blobstore.domain.Tier;
|
||||
import org.jclouds.blobstore.domain.internal.BlobImpl;
|
||||
import org.jclouds.blobstore.domain.internal.BlobMetadataImpl;
|
||||
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
|
||||
|
@ -454,6 +455,7 @@ public final class B2BlobStore extends BaseBlobStore {
|
|||
contentMetadata.setContentType(b2Object.contentType());
|
||||
metadata.setContentMetadata(contentMetadata);
|
||||
metadata.setUserMetadata(b2Object.fileInfo());
|
||||
metadata.setTier(Tier.STANDARD);
|
||||
try {
|
||||
metadata.setPublicUri(URI.create(auth.get().downloadUrl() + "/file/" + container + "/" +
|
||||
URLEncoder.encode(b2Object.fileName(), "UTF-8")));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.jclouds.b2.blobstore.integration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -24,6 +25,7 @@ import java.util.concurrent.ExecutionException;
|
|||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||
import org.jclouds.blobstore.domain.BlobBuilder.PayloadBlobBuilder;
|
||||
import org.jclouds.blobstore.domain.Tier;
|
||||
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -241,4 +243,40 @@ public final class B2BlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
|||
throw new SkipException("B2 requires at least two parts", iae);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { "integration", "live" })
|
||||
public void testPutBlobTierStandardMultipart() throws Exception {
|
||||
try {
|
||||
super.testPutBlobTierStandardMultipart();
|
||||
failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new SkipException("B2 requires at least two parts", iae);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { "integration", "live" })
|
||||
public void testPutBlobTierInfrequentMultipart() throws Exception {
|
||||
try {
|
||||
super.testPutBlobTierInfrequentMultipart();
|
||||
failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new SkipException("B2 requires at least two parts", iae);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = { "integration", "live" })
|
||||
public void testPutBlobTierArchiveMultipart() throws Exception {
|
||||
try {
|
||||
super.testPutBlobTierArchiveMultipart();
|
||||
failBecauseExceptionWasNotThrown(IllegalArgumentException.class);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new SkipException("B2 requires at least two parts", iae);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkTier(BlobMetadata metadata, Tier expected) {
|
||||
// B2 maps all tiers to STANDARD
|
||||
assertThat(metadata.getTier()).isEqualTo(Tier.STANDARD);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue