Do not allow options in filesystem clearContainer

This requires some additional logic to clean up empty directories.
Test regression from 22ce5484a4.
This commit is contained in:
Andrew Gaul 2018-11-14 14:42:30 -08:00
parent 9ede9d3ddc
commit e59ccbff81
2 changed files with 8 additions and 3 deletions

View File

@ -16,6 +16,7 @@
*/
package org.jclouds.filesystem.strategy.internal;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.io.BaseEncoding.base16;
@ -248,9 +249,8 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
@Override
public void clearContainer(String container, ListContainerOptions options) {
filesystemContainerNameValidator.validate(container);
if (options.getDir() != null) {
container += denormalize("/" + options.getDir());
}
// TODO: these require calling removeDirectoriesTreeOfBlobKey
checkArgument(options.getDir() == null || options.getPrefix() == null, "cannot specify directory or prefix");
try {
File containerFile = openFolder(container);
File[] children = containerFile.listFiles();

View File

@ -193,4 +193,9 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration
public void testSetContainerAccess() throws Exception {
throw new SkipException("filesystem does not support anonymous access");
}
@Override
public void testClearWithOptions() throws InterruptedException {
throw new SkipException("filesystem does not support clear with options");
}
}