JCLOUDS-930: Plumb prefix support down to S3.

Plumbs the ListContainerOptions.prefix setting down to the S3 API.
This commit is contained in:
Timur Alperovich 2015-06-25 14:08:02 -07:00
parent 497a013c8a
commit c409c19ff3
2 changed files with 7 additions and 6 deletions

View File

@ -30,6 +30,10 @@ public class ContainerToBucketListOptions implements
Function<ListContainerOptions, ListBucketOptions> {
public ListBucketOptions apply(ListContainerOptions from) {
checkNotNull(from, "set options to instance NONE instead of passing null");
if (from.getPrefix() != null && from.getDir() != null) {
throw new IllegalArgumentException("Cannot set both directory and prefix options");
}
ListBucketOptions httpOptions = new ListBucketOptions();
if (!from.isRecursive()) {
httpOptions.delimiter("/");
@ -40,6 +44,9 @@ public class ContainerToBucketListOptions implements
path = path + "/";
httpOptions.withPrefix(path);
}
if (from.getPrefix() != null) {
httpOptions.withPrefix(from.getPrefix());
}
if (from.getMarker() != null) {
httpOptions.afterMarker(from.getMarker());
}

View File

@ -18,7 +18,6 @@ package org.jclouds.s3.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest;
import org.testng.SkipException;
import org.testng.annotations.Test;
@Test(groups = "live", testName = "S3ContainerLiveTest")
@ -28,9 +27,4 @@ public class S3ContainerLiveTest extends BaseContainerLiveTest {
provider = "s3";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
@Override
public void testContainerListWithPrefix() {
throw new SkipException("Prefix option has not been plumbed down to S3");
}
}