JCLOUDS-1337: B2 putBlob portable storage tiers

This commit is contained in:
Andrew Gaul 2017-10-23 20:57:07 -07:00
parent f513bf7c40
commit 3193aa68e8
2 changed files with 40 additions and 0 deletions

View File

@ -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")));

View File

@ -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);
}
}