diff --git a/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java b/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java index 677f9c8633..0aabe99aec 100644 --- a/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java +++ b/providers/b2/src/main/java/org/jclouds/b2/blobstore/B2BlobStore.java @@ -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"))); diff --git a/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java b/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java index fa0f6aea49..85d37faf95 100644 --- a/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java +++ b/providers/b2/src/test/java/org/jclouds/b2/blobstore/integration/B2BlobIntegrationLiveTest.java @@ -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); + } }