You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2016/01/29 07:43:27 UTC

jclouds git commit: Enable filesystem service tests

Repository: jclouds
Updated Branches:
  refs/heads/master 773aa30c6 -> a8f5401f6


Enable filesystem service tests


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/a8f5401f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/a8f5401f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/a8f5401f

Branch: refs/heads/master
Commit: a8f5401f6c0103f044441f8423a705f0e8d47c5a
Parents: 773aa30
Author: Andrew Gaul <ga...@apache.org>
Authored: Fri Apr 17 17:18:28 2015 -0700
Committer: Andrew Gaul <ga...@apache.org>
Committed: Thu Jan 28 22:42:05 2016 -0800

----------------------------------------------------------------------
 .../internal/FilesystemStorageStrategyImpl.java |  8 +++-
 .../FilesystemServiceIntegrationTest.java       | 40 ++++++++++++++++++++
 ...ilesystemServiceIntegrationTestDisabled.java | 40 --------------------
 .../FilesystemStorageStrategyImplTest.java      | 14 +++++--
 4 files changed, 57 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/a8f5401f/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
index 91750d5..5cab591 100644
--- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
+++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java
@@ -73,6 +73,7 @@ import org.jclouds.logging.Logger;
 import org.jclouds.rest.annotations.ParamValidators;
 
 import com.google.common.base.Function;
+import com.google.common.base.Supplier;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -116,19 +117,22 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
    protected final boolean autoDetectContentType;
    protected final FilesystemContainerNameValidator filesystemContainerNameValidator;
    protected final FilesystemBlobKeyValidator filesystemBlobKeyValidator;
+   private final Supplier<Location> defaultLocation;
 
    @Inject
    protected FilesystemStorageStrategyImpl(Provider<BlobBuilder> blobBuilders,
          @Named(FilesystemConstants.PROPERTY_BASEDIR) String baseDir,
          @Named(FilesystemConstants.PROPERTY_AUTO_DETECT_CONTENT_TYPE) boolean autoDetectContentType,
          FilesystemContainerNameValidator filesystemContainerNameValidator,
-         FilesystemBlobKeyValidator filesystemBlobKeyValidator) {
+         FilesystemBlobKeyValidator filesystemBlobKeyValidator,
+         Supplier<Location> defaultLocation) {
       this.blobBuilders = checkNotNull(blobBuilders, "filesystem storage strategy blobBuilders");
       this.baseDirectory = checkNotNull(baseDir, "filesystem storage strategy base directory");
       this.autoDetectContentType = autoDetectContentType;
       this.filesystemContainerNameValidator = checkNotNull(filesystemContainerNameValidator,
             "filesystem container name validator");
       this.filesystemBlobKeyValidator = checkNotNull(filesystemBlobKeyValidator, "filesystem blob key validator");
+      this.defaultLocation = defaultLocation;
    }
 
    @Override
@@ -597,7 +601,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
 
    @Override
    public Location getLocation(final String containerName) {
-      return null;
+      return defaultLocation.get();
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a8f5401f/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTest.java
new file mode 100644
index 0000000..1913248
--- /dev/null
+++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.filesystem.integration;
+
+import java.util.Properties;
+
+import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
+import org.jclouds.blobstore.integration.internal.BaseServiceIntegrationTest;
+import org.jclouds.filesystem.reference.FilesystemConstants;
+import org.jclouds.filesystem.utils.TestUtils;
+import org.testng.annotations.Test;
+
+@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemServiceIntegrationTest")
+public class FilesystemServiceIntegrationTest extends BaseServiceIntegrationTest {
+   public FilesystemServiceIntegrationTest() {
+      provider = "filesystem";
+      BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
+   }
+
+   @Override
+   protected Properties setupProperties() {
+      Properties props = super.setupProperties();
+      props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
+      return props;
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a8f5401f/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTestDisabled.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTestDisabled.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTestDisabled.java
deleted file mode 100644
index 73c8469..0000000
--- a/apis/filesystem/src/test/java/org/jclouds/filesystem/integration/FilesystemServiceIntegrationTestDisabled.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.filesystem.integration;
-
-import java.util.Properties;
-
-import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
-import org.jclouds.blobstore.integration.internal.BaseServiceIntegrationTest;
-import org.jclouds.filesystem.reference.FilesystemConstants;
-import org.jclouds.filesystem.utils.TestUtils;
-import org.testng.annotations.Test;
-
-@Test(groups = { "integration", "live" }, testName = "blobstore.FilesystemServiceIntegrationTest")
-public class FilesystemServiceIntegrationTestDisabled extends BaseServiceIntegrationTest {
-   public FilesystemServiceIntegrationTestDisabled() {
-      provider = "filesystem";
-      BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
-   }
-
-   @Override
-   protected Properties setupProperties() {
-      Properties props = super.setupProperties();
-      props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
-      return props;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/a8f5401f/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java
index 61f08fc..2540e42 100644
--- a/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java
+++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImplTest.java
@@ -40,6 +40,7 @@ import org.jclouds.blobstore.domain.BlobBuilder;
 import org.jclouds.blobstore.domain.ContainerAccess;
 import org.jclouds.blobstore.domain.internal.BlobBuilderImpl;
 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.FilesystemContainerNameValidatorImpl;
 import org.jclouds.filesystem.utils.TestUtils;
@@ -51,6 +52,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
 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 FS = File.separator;
+   private static final Supplier<Location> defaultLocation = new Supplier<Location>() {
+      @Override
+      public Location get() {
+         return null;
+      }
+   };
 
    static {
       System.setProperty(LOGGING_CONFIG_KEY, LOGGING_CONFIG_VALUE);
@@ -87,7 +95,7 @@ public class FilesystemStorageStrategyImplTest {
             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.createResources();
    }
@@ -386,7 +394,7 @@ public class FilesystemStorageStrategyImplTest {
              public BlobBuilder get() {
                 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");
       TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);
@@ -521,7 +529,7 @@ public class FilesystemStorageStrategyImplTest {
                   public BlobBuilder get() {
                      return new BlobBuilderImpl();
                   }
-               }, absoluteBasePath, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl());
+               }, absoluteBasePath, false, new FilesystemContainerNameValidatorImpl(), new FilesystemBlobKeyValidatorImpl(), defaultLocation);
       TestUtils.cleanDirectoryContent(absoluteContainerPath);
 
       String blobKey;