mirror of https://github.com/apache/jclouds.git
JCLOUDS-930: LocalBlobStore -- marker regression.
We should not append a "/" to the marker when returning list results in the case of directories (RELATIVE_PATH), as the names will already include the delimiter. Added a jclouds test to catch such regressions in the local store in the future.
This commit is contained in:
parent
8c9344b501
commit
aade18b76d
|
@ -297,9 +297,6 @@ public final class LocalBlobStore implements BlobStore {
|
|||
// Partial listing
|
||||
lastElement = contents.last();
|
||||
marker = lastElement.getName();
|
||||
if (lastElement.getType() == StorageType.RELATIVE_PATH) {
|
||||
marker += "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.google.inject.Injector;
|
|||
|
||||
import org.jclouds.ContextBuilder;
|
||||
import org.jclouds.blobstore.BlobStore;
|
||||
import org.jclouds.blobstore.domain.PageSet;
|
||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||
import org.jclouds.blobstore.domain.StorageType;
|
||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||
|
@ -125,4 +126,23 @@ public class ListContainerTest {
|
|||
assertThat(results).hasSize(1);
|
||||
assertThat(Iterables.get(results, 0).getName()).isEqualTo(directory + '/');
|
||||
}
|
||||
|
||||
public void testListMarkers() {
|
||||
String containerName = "testListMarkers";
|
||||
blobStore.createContainerInLocation(null, containerName);
|
||||
blobStore.putBlob(containerName, blobStore.blobBuilder("abc").payload("").build());
|
||||
blobStore.putBlob(containerName, blobStore.blobBuilder("foo/bar").payload("").build());
|
||||
blobStore.putBlob(containerName, blobStore.blobBuilder("foo/baz").payload("").build());
|
||||
blobStore.putBlob(containerName, blobStore.blobBuilder("qux").payload("").build());
|
||||
|
||||
PageSet<? extends StorageMetadata> results = blobStore.list(
|
||||
containerName, ListContainerOptions.Builder.maxResults(1));
|
||||
assertThat(results.getNextMarker()).isEqualTo("abc");
|
||||
results = blobStore.list(containerName,
|
||||
ListContainerOptions.Builder.maxResults(1).afterMarker(results.getNextMarker()));
|
||||
assertThat(results.getNextMarker()).isEqualTo("foo/");
|
||||
results = blobStore.list(containerName,
|
||||
ListContainerOptions.Builder.maxResults(1).afterMarker(results.getNextMarker()));
|
||||
assertThat(results.getNextMarker()).isEqualTo(null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue