JCLOUDS-930: Plumb prefix support down to Azure.

Plumbs support for the prefix query option in the Azure provider. This
option is not compatible with the "directory" list option and an
exception is thrown if both are set.
This commit is contained in:
Timur Alperovich 2015-06-25 13:38:39 -07:00
parent 8677ffcb21
commit 497a013c8a
2 changed files with 6 additions and 6 deletions

View File

@ -30,6 +30,9 @@ public class ListOptionsToListBlobsOptions implements
Function<ListContainerOptions, ListBlobsOptions> {
public ListBlobsOptions apply(ListContainerOptions from) {
checkNotNull(from, "set options to instance NONE instead of passing null");
if (from.getDir() != null && from.getPrefix() != null) {
throw new IllegalArgumentException("Cannot set both directory and prefix");
}
ListBlobsOptions httpOptions = new ListBlobsOptions();
if (!from.isRecursive()) {
httpOptions.delimiter("/");
@ -37,6 +40,9 @@ public class ListOptionsToListBlobsOptions implements
if (from.getDir() != null) {
httpOptions.prefix(from.getDir().endsWith("/") ? from.getDir() : from.getDir() + "/");
}
if (from.getPrefix() != null) {
httpOptions.prefix(from.getPrefix());
}
if (from.getMarker() != null) {
httpOptions.marker(from.getMarker());
}

View File

@ -17,7 +17,6 @@
package org.jclouds.azureblob.blobstore.integration;
import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest;
import org.testng.SkipException;
import org.testng.annotations.Test;
@Test(groups = { "live" })
@ -25,9 +24,4 @@ public class AzureBlobContainerLiveTest extends BaseContainerLiveTest {
public AzureBlobContainerLiveTest() {
provider = "azureblob";
}
@Override
public void testContainerListWithPrefix() {
throw new SkipException("Prefix option has not been plumbed down to Azure");
}
}