mirror of https://github.com/apache/jclouds.git
Enable filesystem service tests
This commit is contained in:
parent
773aa30c64
commit
a8f5401f6c
|
@ -73,6 +73,7 @@ import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.rest.annotations.ParamValidators;
|
import org.jclouds.rest.annotations.ParamValidators;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -116,19 +117,22 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
protected final boolean autoDetectContentType;
|
protected final boolean autoDetectContentType;
|
||||||
protected final FilesystemContainerNameValidator filesystemContainerNameValidator;
|
protected final FilesystemContainerNameValidator filesystemContainerNameValidator;
|
||||||
protected final FilesystemBlobKeyValidator filesystemBlobKeyValidator;
|
protected final FilesystemBlobKeyValidator filesystemBlobKeyValidator;
|
||||||
|
private final Supplier<Location> defaultLocation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected FilesystemStorageStrategyImpl(Provider<BlobBuilder> blobBuilders,
|
protected FilesystemStorageStrategyImpl(Provider<BlobBuilder> blobBuilders,
|
||||||
@Named(FilesystemConstants.PROPERTY_BASEDIR) String baseDir,
|
@Named(FilesystemConstants.PROPERTY_BASEDIR) String baseDir,
|
||||||
@Named(FilesystemConstants.PROPERTY_AUTO_DETECT_CONTENT_TYPE) boolean autoDetectContentType,
|
@Named(FilesystemConstants.PROPERTY_AUTO_DETECT_CONTENT_TYPE) boolean autoDetectContentType,
|
||||||
FilesystemContainerNameValidator filesystemContainerNameValidator,
|
FilesystemContainerNameValidator filesystemContainerNameValidator,
|
||||||
FilesystemBlobKeyValidator filesystemBlobKeyValidator) {
|
FilesystemBlobKeyValidator filesystemBlobKeyValidator,
|
||||||
|
Supplier<Location> defaultLocation) {
|
||||||
this.blobBuilders = checkNotNull(blobBuilders, "filesystem storage strategy blobBuilders");
|
this.blobBuilders = checkNotNull(blobBuilders, "filesystem storage strategy blobBuilders");
|
||||||
this.baseDirectory = checkNotNull(baseDir, "filesystem storage strategy base directory");
|
this.baseDirectory = checkNotNull(baseDir, "filesystem storage strategy base directory");
|
||||||
this.autoDetectContentType = autoDetectContentType;
|
this.autoDetectContentType = autoDetectContentType;
|
||||||
this.filesystemContainerNameValidator = checkNotNull(filesystemContainerNameValidator,
|
this.filesystemContainerNameValidator = checkNotNull(filesystemContainerNameValidator,
|
||||||
"filesystem container name validator");
|
"filesystem container name validator");
|
||||||
this.filesystemBlobKeyValidator = checkNotNull(filesystemBlobKeyValidator, "filesystem blob key validator");
|
this.filesystemBlobKeyValidator = checkNotNull(filesystemBlobKeyValidator, "filesystem blob key validator");
|
||||||
|
this.defaultLocation = defaultLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -597,7 +601,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getLocation(final String containerName) {
|
public Location getLocation(final String containerName) {
|
||||||
return null;
|
return defaultLocation.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,8 +25,8 @@ import org.jclouds.filesystem.utils.TestUtils;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemServiceIntegrationTest")
|
@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemServiceIntegrationTest")
|
||||||
public class FilesystemServiceIntegrationTestDisabled extends BaseServiceIntegrationTest {
|
public class FilesystemServiceIntegrationTest extends BaseServiceIntegrationTest {
|
||||||
public FilesystemServiceIntegrationTestDisabled() {
|
public FilesystemServiceIntegrationTest() {
|
||||||
provider = "filesystem";
|
provider = "filesystem";
|
||||||
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
|
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
|
||||||
}
|
}
|
|
@ -40,6 +40,7 @@ import org.jclouds.blobstore.domain.BlobBuilder;
|
||||||
import org.jclouds.blobstore.domain.ContainerAccess;
|
import org.jclouds.blobstore.domain.ContainerAccess;
|
||||||
import org.jclouds.blobstore.domain.internal.BlobBuilderImpl;
|
import org.jclouds.blobstore.domain.internal.BlobBuilderImpl;
|
||||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.filesystem.predicates.validators.internal.FilesystemBlobKeyValidatorImpl;
|
import org.jclouds.filesystem.predicates.validators.internal.FilesystemBlobKeyValidatorImpl;
|
||||||
import org.jclouds.filesystem.predicates.validators.internal.FilesystemContainerNameValidatorImpl;
|
import org.jclouds.filesystem.predicates.validators.internal.FilesystemContainerNameValidatorImpl;
|
||||||
import org.jclouds.filesystem.utils.TestUtils;
|
import org.jclouds.filesystem.utils.TestUtils;
|
||||||
|
@ -51,6 +52,7 @@ import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
@ -72,6 +74,12 @@ public class FilesystemStorageStrategyImplTest {
|
||||||
private static final String LOGGING_CONFIG_VALUE = "src/main/resources/logging.properties";
|
private static final String LOGGING_CONFIG_VALUE = "src/main/resources/logging.properties";
|
||||||
|
|
||||||
private static final String FS = File.separator;
|
private static final String FS = File.separator;
|
||||||
|
private static final Supplier<Location> defaultLocation = new Supplier<Location>() {
|
||||||
|
@Override
|
||||||
|
public Location get() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.setProperty(LOGGING_CONFIG_KEY, LOGGING_CONFIG_VALUE);
|
System.setProperty(LOGGING_CONFIG_KEY, LOGGING_CONFIG_VALUE);
|
||||||
|
@ -87,7 +95,7 @@ public class FilesystemStorageStrategyImplTest {
|
||||||
return new BlobBuilderImpl();
|
return new BlobBuilderImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, TestUtils.TARGET_BASE_DIR, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl());
|
}, TestUtils.TARGET_BASE_DIR, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl(), defaultLocation);
|
||||||
TestUtils.cleanDirectoryContent(TestUtils.TARGET_BASE_DIR);
|
TestUtils.cleanDirectoryContent(TestUtils.TARGET_BASE_DIR);
|
||||||
TestUtils.createResources();
|
TestUtils.createResources();
|
||||||
}
|
}
|
||||||
|
@ -386,7 +394,7 @@ public class FilesystemStorageStrategyImplTest {
|
||||||
public BlobBuilder get() {
|
public BlobBuilder get() {
|
||||||
return new BlobBuilderImpl();
|
return new BlobBuilderImpl();
|
||||||
}
|
}
|
||||||
}, TestUtils.TARGET_BASE_DIR, true, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl());
|
}, TestUtils.TARGET_BASE_DIR, true, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl(), defaultLocation);
|
||||||
|
|
||||||
String blobKey = TestUtils.createRandomBlobKey("file-", ".jpg");
|
String blobKey = TestUtils.createRandomBlobKey("file-", ".jpg");
|
||||||
TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);
|
TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);
|
||||||
|
@ -521,7 +529,7 @@ public class FilesystemStorageStrategyImplTest {
|
||||||
public BlobBuilder get() {
|
public BlobBuilder get() {
|
||||||
return new BlobBuilderImpl();
|
return new BlobBuilderImpl();
|
||||||
}
|
}
|
||||||
}, absoluteBasePath, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl());
|
}, absoluteBasePath, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl(), defaultLocation);
|
||||||
TestUtils.cleanDirectoryContent(absoluteContainerPath);
|
TestUtils.cleanDirectoryContent(absoluteContainerPath);
|
||||||
|
|
||||||
String blobKey;
|
String blobKey;
|
||||||
|
|
Loading…
Reference in New Issue