diff --git a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/functions/ToListContainerOptions.java b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/functions/ToListContainerOptions.java index 2650f5b389..fbfb0c9bf3 100644 --- a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/functions/ToListContainerOptions.java +++ b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/functions/ToListContainerOptions.java @@ -28,12 +28,12 @@ public class ToListContainerOptions implements @Override public org.jclouds.openstack.swift.v1.options.ListContainerOptions apply(ListContainerOptions from) { checkNotNull(from, "set options to instance NONE instead of passing null"); - org.jclouds.openstack.swift.v1.options.ListContainerOptions options = new org.jclouds.openstack.swift.v1.options.ListContainerOptions(); - if ((from.getDir() == null) && (from.isRecursive())) { - options.prefix(""); + if (from.getDir() != null && from.getPrefix() != null) { + throw new IllegalArgumentException("Cannot set both directory and prefix"); } - if ((from.getDir() == null) && (!from.isRecursive())) { - options.path(""); + org.jclouds.openstack.swift.v1.options.ListContainerOptions options = new org.jclouds.openstack.swift.v1.options.ListContainerOptions(); + if (from.getDir() == null && !from.isRecursive()) { + options.delimiter('/'); } if ((from.getDir() != null) && (from.isRecursive())) { options.prefix(from.getDir().endsWith("/") ? from.getDir() : from.getDir() + "/"); @@ -41,6 +41,9 @@ public class ToListContainerOptions implements if ((from.getDir() != null) && (!from.isRecursive())) { options.path(from.getDir()); } + if (from.getPrefix() != null) { + options.prefix(from.getPrefix()); + } if (from.getMarker() != null) { options.marker(from.getMarker()); } diff --git a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/integration/SwiftContainerLiveTest.java b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/integration/SwiftContainerLiveTest.java index c2fd8003d1..9bd85d6f5f 100644 --- a/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/integration/SwiftContainerLiveTest.java +++ b/apis/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/blobstore/integration/SwiftContainerLiveTest.java @@ -21,7 +21,6 @@ import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CRED import java.util.Properties; import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest; -import org.testng.SkipException; import org.testng.annotations.Test; @Test(groups = "live", testName = "SwiftContainerLiveTest") @@ -37,9 +36,4 @@ public class SwiftContainerLiveTest extends BaseContainerLiveTest { setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE); return props; } - - @Override - public void testContainerListWithPrefix() { - throw new SkipException("Prefix option has not been plumbed down to Swift"); - } }