Fix static access of MultipartUpload members.

This commit is contained in:
Diwaker Gupta 2013-02-20 11:23:53 -08:00
parent e16c7ba40c
commit c37d3103e7
2 changed files with 19 additions and 18 deletions

View File

@ -18,7 +18,7 @@
*/
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.
@ -55,8 +55,8 @@ public class MpuGraphData {
MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm();
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);
}

View File

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