You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by za...@apache.org on 2014/02/07 18:38:33 UTC

git commit: Adds a top-level zone filter. New live tests iterate over all available zones to ensure jclouds is fully compatible. Sometimes we want to filter to specific zones on demand.

Updated Branches:
  refs/heads/master 4330eaec5 -> 30a29cc73


Adds a top-level zone filter. New live tests iterate over all available zones to ensure jclouds is fully compatible. Sometimes we want to filter to specific zones on demand.


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

Branch: refs/heads/master
Commit: 30a29cc73e54f4be0bc92bc13f98739d11d3b0c3
Parents: 4330eae
Author: Zack Shoylev <za...@rackspace.com>
Authored: Wed Feb 5 12:19:18 2014 -0600
Committer: Zack Shoylev <za...@rackspace.com>
Committed: Fri Feb 7 10:37:49 2014 -0600

----------------------------------------------------------------------
 .../java/org/jclouds/apis/BaseApiLiveTest.java     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/30a29cc7/core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java b/core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java
index 194c3ff..e3e4e07 100644
--- a/core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java
+++ b/core/src/test/java/org/jclouds/apis/BaseApiLiveTest.java
@@ -24,6 +24,7 @@ import static org.jclouds.util.Closeables2.closeQuietly;
 import java.io.Closeable;
 import java.util.NoSuchElementException;
 import java.util.Properties;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import org.jclouds.ContextBuilder;
@@ -34,7 +35,9 @@ import org.jclouds.providers.Providers;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 
+import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 import com.google.common.reflect.TypeToken;
 import com.google.inject.Module;
 
@@ -74,6 +77,20 @@ public abstract class BaseApiLiveTest<A extends Closeable> {
       return null;
    }
 
+   /**
+    * This helps live testing against specific zones only.
+    * @param zones A list of zones, usually from getConfiguredZones()
+    * @return a set of zones in the given set that are also contained in the set specified by the test.live.zones system property
+    */
+   protected Set<String> filterZones(Set<String> zones) {
+      String zonesToList = System.getProperty("test.live.zones");
+      if(zonesToList == null) {
+         return zones; // no filter applied
+      }
+      Set<String> zoneFilter = Sets.newHashSet(Splitter.on(',').split(zonesToList));
+      return Sets.intersection(zones, zoneFilter);
+   }
+
    @BeforeClass(groups = { "integration", "live" })
    public void setup() {
       initialize();