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

View File

@ -193,4 +193,9 @@ public class FilesystemContainerIntegrationTest extends BaseContainerIntegration
public void testSetContainerAccess() throws Exception { public void testSetContainerAccess() throws Exception {
throw new SkipException("filesystem does not support anonymous access"); 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");
}
} }