mirror of https://github.com/apache/jclouds.git
Fix static access of MultipartUpload members.
This commit is contained in:
parent
e16c7ba40c
commit
c37d3103e7
|
@ -18,20 +18,20 @@
|
|||
*/
|
||||
package org.jclouds.aws.s3.blobstore.strategy.internal;
|
||||
|
||||
import org.jclouds.aws.s3.blobstore.strategy.MultipartUploadStrategy;
|
||||
import org.jclouds.aws.s3.blobstore.strategy.MultipartUpload;
|
||||
|
||||
/**
|
||||
* Print out on the console some graph data regarding the partitioning algorithm.
|
||||
*
|
||||
*
|
||||
* @author Tibor Kiss
|
||||
*/
|
||||
public class MpuGraphData {
|
||||
|
||||
private static void calculate(long length, MultipartUploadSlicingAlgorithm algorithm) {
|
||||
System.out.println("" + length + " " + algorithm.getParts() + " "
|
||||
System.out.println("" + length + " " + algorithm.getParts() + " "
|
||||
+ algorithm.calculateChunkSize(length) + " " + + algorithm.getRemaining());
|
||||
}
|
||||
|
||||
|
||||
private static void foreach(long from, long to1, long to2, long to3, MultipartUploadSlicingAlgorithm algorithm) {
|
||||
long i = 0L, step = 1L;
|
||||
System.out.println("=== {" + from + "," + to1 + "} ===");
|
||||
|
@ -53,10 +53,10 @@ public class MpuGraphData {
|
|||
|
||||
public static void main(String[] args) {
|
||||
MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm();
|
||||
foreach(1L,
|
||||
foreach(1L,
|
||||
algorithm.defaultPartSize * algorithm.magnitudeBase,
|
||||
MultipartUploadStrategy.MAX_PART_SIZE * algorithm.magnitudeBase,
|
||||
MultipartUploadStrategy.MAX_PART_SIZE * MultipartUploadStrategy.MAX_NUMBER_OF_PARTS,
|
||||
MultipartUpload.MAX_PART_SIZE * algorithm.magnitudeBase,
|
||||
MultipartUpload.MAX_PART_SIZE * MultipartUpload.MAX_NUMBER_OF_PARTS,
|
||||
algorithm);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.aws.s3.blobstore.strategy.internal;
|
|||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.aws.s3.blobstore.strategy.MultipartUpload;
|
||||
import org.jclouds.aws.s3.blobstore.strategy.MultipartUploadStrategy;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class MpuPartitioningAlgorithmTest {
|
|||
MultipartUploadSlicingAlgorithm strategy = new MultipartUploadSlicingAlgorithm();
|
||||
|
||||
// exactly the MIN_PART_SIZE
|
||||
long length = MultipartUploadStrategy.MIN_PART_SIZE;
|
||||
long length = MultipartUpload.MIN_PART_SIZE;
|
||||
long chunkSize = strategy.calculateChunkSize(length);
|
||||
assertEquals(chunkSize, MultipartUploadSlicingAlgorithm.DEFAULT_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), 0);
|
||||
|
@ -100,17 +101,17 @@ public class MpuPartitioningAlgorithmTest {
|
|||
public void testWhenPartsHasToStartGrowingFromMagnitudeBase() {
|
||||
MultipartUploadSlicingAlgorithm strategy = new MultipartUploadSlicingAlgorithm();
|
||||
// upper limit while we still have exactly MAGNITUDE_BASE parts (together with the remaining)
|
||||
long length = MultipartUploadStrategy.MAX_PART_SIZE * MultipartUploadSlicingAlgorithm.DEFAULT_MAGNITUDE_BASE;
|
||||
long length = MultipartUpload.MAX_PART_SIZE * MultipartUploadSlicingAlgorithm.DEFAULT_MAGNITUDE_BASE;
|
||||
long chunkSize = strategy.calculateChunkSize(length);
|
||||
assertEquals(chunkSize, MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(chunkSize, MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUploadSlicingAlgorithm.DEFAULT_MAGNITUDE_BASE - 1);
|
||||
assertEquals(strategy.getRemaining(), MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getRemaining(), MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(chunkSize * strategy.getParts() + strategy.getRemaining(), length);
|
||||
|
||||
// then the number of parts is increasing
|
||||
length += 1;
|
||||
chunkSize = strategy.calculateChunkSize(length);
|
||||
assertEquals(chunkSize, MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(chunkSize, MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUploadSlicingAlgorithm.DEFAULT_MAGNITUDE_BASE);
|
||||
assertEquals(strategy.getRemaining(), 1);
|
||||
assertEquals(chunkSize * strategy.getParts() + strategy.getRemaining(), length);
|
||||
|
@ -125,18 +126,18 @@ public class MpuPartitioningAlgorithmTest {
|
|||
public void testWhenPartsExceedsMaxNumberOfParts() {
|
||||
MultipartUploadSlicingAlgorithm strategy = new MultipartUploadSlicingAlgorithm();
|
||||
// upper limit while we still have exactly MAX_NUMBER_OF_PARTS parts (together with the remaining)
|
||||
long length = MultipartUploadStrategy.MAX_PART_SIZE * MultipartUploadStrategy.MAX_NUMBER_OF_PARTS;
|
||||
long length = MultipartUpload.MAX_PART_SIZE * MultipartUpload.MAX_NUMBER_OF_PARTS;
|
||||
long chunkSize = strategy.calculateChunkSize(length);
|
||||
assertEquals(chunkSize, MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUploadStrategy.MAX_NUMBER_OF_PARTS - 1);
|
||||
assertEquals(strategy.getRemaining(), MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(chunkSize, MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUpload.MAX_NUMBER_OF_PARTS - 1);
|
||||
assertEquals(strategy.getRemaining(), MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(chunkSize * strategy.getParts() + strategy.getRemaining(), length);
|
||||
|
||||
// then the number of parts is increasing
|
||||
length += 1;
|
||||
chunkSize = strategy.calculateChunkSize(length);
|
||||
assertEquals(chunkSize, MultipartUploadStrategy.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUploadStrategy.MAX_NUMBER_OF_PARTS);
|
||||
assertEquals(chunkSize, MultipartUpload.MAX_PART_SIZE);
|
||||
assertEquals(strategy.getParts(), MultipartUpload.MAX_NUMBER_OF_PARTS);
|
||||
assertEquals(strategy.getRemaining(), 1);
|
||||
assertEquals(chunkSize * strategy.getParts() + strategy.getRemaining(), length);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue