mirror of https://github.com/apache/jclouds.git
Add a live test for swift multipart upload.
This commit is contained in:
parent
2fa96a9cb3
commit
1b5462346b
|
@ -18,11 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.openstack.swift.blobstore.integration;
|
package org.jclouds.openstack.swift.blobstore.integration;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import com.google.common.io.InputSupplier;
|
||||||
|
import org.jclouds.blobstore.BlobStore;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
||||||
|
import org.jclouds.blobstore.options.PutOptions;
|
||||||
|
import org.jclouds.crypto.CryptoStreams;
|
||||||
|
import org.testng.ITestContext;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author James Murty
|
* @author James Murty
|
||||||
|
@ -30,6 +39,9 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
|
private InputSupplier<InputStream> oneHundredOneConstitutions;
|
||||||
|
private byte[] oneHundredOneConstitutionsMD5;
|
||||||
|
|
||||||
public SwiftBlobIntegrationLiveTest() {
|
public SwiftBlobIntegrationLiveTest() {
|
||||||
provider = "swift";
|
provider = "swift";
|
||||||
}
|
}
|
||||||
|
@ -39,6 +51,13 @@ public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
// not supported in swift
|
// not supported in swift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeClass(groups = { "integration", "live" }, dependsOnMethods = "setupContext")
|
||||||
|
@Override
|
||||||
|
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
|
||||||
|
super.setUpResourcesOnThisThread(testContext);
|
||||||
|
oneHundredOneConstitutions = getTestDataSupplier();
|
||||||
|
oneHundredOneConstitutionsMD5 = CryptoStreams.md5(oneHundredOneConstitutions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void checkContentDisposition(Blob blob, String contentDisposition) {
|
protected void checkContentDisposition(Blob blob, String contentDisposition) {
|
||||||
|
@ -61,4 +80,22 @@ public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "unic₪de" }, { "path/foo" }, { "colon:" },
|
return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "unic₪de" }, { "path/foo" }, { "colon:" },
|
||||||
{ "asteri*k" }, { "{great<r}" }, { "lesst>en" }, { "p|pe" } };
|
{ "asteri*k" }, { "{great<r}" }, { "lesst>en" }, { "p|pe" } };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMultipartChunkedFileStream() throws IOException, InterruptedException {
|
||||||
|
FileOutputStream fous = new FileOutputStream(new File("target/const.txt"));
|
||||||
|
ByteStreams.copy(oneHundredOneConstitutions.getInput(), fous);
|
||||||
|
fous.flush();
|
||||||
|
fous.close();
|
||||||
|
String containerName = getContainerName();
|
||||||
|
|
||||||
|
try {
|
||||||
|
BlobStore blobStore = context.getBlobStore();
|
||||||
|
blobStore.createContainerInLocation(null, containerName);
|
||||||
|
Blob blob = blobStore.blobBuilder("const.txt")
|
||||||
|
.payload(new File("target/const.txt")).build();
|
||||||
|
blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
|
||||||
|
} finally {
|
||||||
|
returnContainer(containerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue