mirror of https://github.com/apache/jclouds.git
Remove tests duplicated by testPut
This commit is contained in:
parent
91c47bfd92
commit
317089c77e
|
@ -21,7 +21,6 @@ import static org.testng.Assert.assertNotEquals;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -40,7 +39,6 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.ByteSource;
|
||||
|
||||
@Test(groups = "live")
|
||||
|
@ -164,31 +162,6 @@ public class SwiftBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
|||
}
|
||||
}
|
||||
|
||||
// InputStreamPayloads are handled differently than File; Test InputStreams too
|
||||
@Test(groups = { "integration", "live" })
|
||||
public void testMultipartChunkedInputStream() throws InterruptedException, IOException {
|
||||
String container = getContainerName();
|
||||
try {
|
||||
BlobStore blobStore = view.getBlobStore();
|
||||
|
||||
blobStore.createContainerInLocation(null, container);
|
||||
|
||||
ByteSource input = createByteSourceBiggerThan(PART_SIZE);
|
||||
|
||||
Blob write = blobStore.blobBuilder("const.txt")
|
||||
.payload(input.openStream())
|
||||
.contentLength(input.size())
|
||||
.build();
|
||||
blobStore.putBlob(container, write, PutOptions.Builder.multipart());
|
||||
|
||||
Blob read = blobStore.getBlob(container, "const.txt");
|
||||
InputStream is = read.getPayload().openStream();
|
||||
assertEquals(ByteStreams2.hashAndClose(is, Hashing.md5()), input.hash(Hashing.md5()));
|
||||
} finally {
|
||||
returnContainer(container);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIncorrectContentMD5StatusCode() {
|
||||
return 422;
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.testng.Assert.assertNotNull;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
@ -37,7 +36,6 @@ import org.jclouds.blobstore.BlobStore;
|
|||
import org.jclouds.blobstore.KeyNotFoundException;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||
import org.jclouds.blobstore.options.PutOptions;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.io.ByteStreams2;
|
||||
import org.jclouds.io.Payload;
|
||||
|
@ -57,7 +55,6 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.hash.HashCode;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code S3Client}
|
||||
|
@ -127,23 +124,6 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest {
|
|||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipartChunkedFileStream() throws IOException, InterruptedException {
|
||||
|
||||
File file = new File("target/const.txt");
|
||||
oneHundredOneConstitutions.copyTo(Files.asByteSink(file));
|
||||
String containerName = getContainerName();
|
||||
|
||||
try {
|
||||
BlobStore blobStore = view.getBlobStore();
|
||||
blobStore.createContainerInLocation(null, containerName);
|
||||
Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
|
||||
blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
|
||||
|
||||
} finally {
|
||||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testPutWithReducedRedundancyStorage() throws InterruptedException {
|
||||
String containerName = getContainerName();
|
||||
|
|
|
@ -18,33 +18,23 @@ package org.jclouds.azureblob.blobstore.integration;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.Files;
|
||||
import org.jclouds.azureblob.blobstore.strategy.MultipartUploadStrategy;
|
||||
import org.jclouds.blobstore.BlobStore;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||
import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
|
||||
import org.jclouds.blobstore.options.PutOptions;
|
||||
import org.jclouds.io.ByteStreams2;
|
||||
import org.jclouds.utils.TestUtils;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import static com.google.common.hash.Hashing.md5;
|
||||
|
||||
@Test(groups = "live")
|
||||
public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||
private ByteSource oneHundredOneConstitutions;
|
||||
private byte[] oneHundredOneConstitutionsMD5;
|
||||
|
||||
@Override
|
||||
protected long getMinimumMultipartBlobSize() {
|
||||
return MultipartUploadStrategy.MAX_BLOCK_SIZE + 1;
|
||||
|
@ -81,48 +71,6 @@ public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
|||
assert blob.getMetadata().getContentMetadata().getContentDisposition() == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Essentially copied from the AWS multipart chucked stream test
|
||||
*/
|
||||
public void testMultipartChunkedFileStream() throws IOException, InterruptedException {
|
||||
oneHundredOneConstitutions = getTestDataSupplier();
|
||||
oneHundredOneConstitutionsMD5 = oneHundredOneConstitutions.hash(md5()).asBytes();
|
||||
File file = new File("target/const.txt");
|
||||
oneHundredOneConstitutions.copyTo(Files.asByteSink(file));
|
||||
String containerName = getContainerName();
|
||||
|
||||
try {
|
||||
BlobStore blobStore = view.getBlobStore();
|
||||
blobStore.createContainerInLocation(null, containerName);
|
||||
Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
|
||||
String expected = blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
|
||||
String etag = blobStore.blobMetadata(containerName, "const.txt").getETag();
|
||||
assertEquals(etag, expected);
|
||||
} finally {
|
||||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipartUploadInputStream() throws Exception {
|
||||
long length = MultipartUploadStrategy.MAX_BLOCK_SIZE + 1;
|
||||
ByteSource byteSource = TestUtils.randomByteSource().slice(0, length);
|
||||
String containerName = getContainerName();
|
||||
try {
|
||||
BlobStore blobStore = view.getBlobStore();
|
||||
blobStore.createContainerInLocation(null, containerName);
|
||||
String blobName = "const.txt";
|
||||
Blob blob = blobStore.blobBuilder(blobName)
|
||||
.payload(byteSource.openStream())
|
||||
.contentLength(length)
|
||||
.build();
|
||||
blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
|
||||
blob = blobStore.getBlob(containerName, blobName);
|
||||
assertThat(ByteStreams2.toByteArrayAndClose(blob.getPayload().openStream())).isEqualTo(byteSource.read());
|
||||
} finally {
|
||||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipartChunkedFileStreamPowerOfTwoSize() throws IOException, InterruptedException {
|
||||
final long limit = MultipartUploadStrategy.MAX_BLOCK_SIZE;
|
||||
ByteSource input = TestUtils.randomByteSource().slice(0, limit);
|
||||
|
@ -141,27 +89,4 @@ public class AzureBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
|||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipartUserMetadata() throws Exception {
|
||||
BlobStore blobStore = view.getBlobStore();
|
||||
String containerName = getContainerName();
|
||||
String blobName = "const.txt";
|
||||
ByteSource byteSource = TestUtils.randomByteSource().slice(0, MultipartUploadStrategy.MAX_BLOCK_SIZE + 1);
|
||||
Map<String, String> userMetadata = ImmutableMap.of("foo", "bar");
|
||||
|
||||
blobStore.createContainerInLocation(null, containerName);
|
||||
try {
|
||||
Blob blob = blobStore.blobBuilder(blobName)
|
||||
.payload(byteSource)
|
||||
.contentLength(byteSource.size())
|
||||
.userMetadata(userMetadata)
|
||||
.build();
|
||||
blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
|
||||
|
||||
BlobMetadata blobMetadata = blobStore.blobMetadata(containerName, blobName);
|
||||
assertThat(blobMetadata.getUserMetadata()).isEqualTo(userMetadata);
|
||||
} finally {
|
||||
returnContainer(containerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue