brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [1/2] incubator-brooklyn git commit: BrooklynLauncherRebindCatalogTest Fix test - assume the order on catalog rebind doesn't matter
Date Wed, 12 Aug 2015 19:05:04 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master e3db4e3cc -> 6de3afc5d


BrooklynLauncherRebindCatalogTest
Fix test - assume the order on catalog rebind doesn't matter


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/8f3f0003
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/8f3f0003
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/8f3f0003

Branch: refs/heads/master
Commit: 8f3f00031c31277fa7e8bbc2bfbdd855da1779d8
Parents: 50b18e7
Author: Valentin Aitken <valentin.aitken@cloudsoftcorp.com>
Authored: Wed Aug 12 18:23:15 2015 +0300
Committer: Valentin Aitken <valentin.aitken@cloudsoftcorp.com>
Committed: Wed Aug 12 18:23:15 2015 +0300

----------------------------------------------------------------------
 .../launcher/BrooklynLauncherRebindCatalogTest.java       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8f3f0003/usage/launcher/src/test/java/org/apache/brooklyn/launcher/BrooklynLauncherRebindCatalogTest.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/java/org/apache/brooklyn/launcher/BrooklynLauncherRebindCatalogTest.java
b/usage/launcher/src/test/java/org/apache/brooklyn/launcher/BrooklynLauncherRebindCatalogTest.java
index 48fb538..bbbd442 100644
--- a/usage/launcher/src/test/java/org/apache/brooklyn/launcher/BrooklynLauncherRebindCatalogTest.java
+++ b/usage/launcher/src/test/java/org/apache/brooklyn/launcher/BrooklynLauncherRebindCatalogTest.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import javax.annotation.Nullable;
 
+import org.apache.commons.collections.IteratorUtils;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
@@ -105,7 +106,7 @@ public class BrooklynLauncherRebindCatalogTest {
                 return catalogItem.getCatalogItemId();
             }
         });
-        Assert.assertTrue(Iterables.elementsEqual(ids, idsFromItems), String.format("Expected
%s, found %s", ids, idsFromItems));
+        Assert.assertTrue(compareIterablesWithoutOrderMatters(ids, idsFromItems), String.format("Expected
%s, found %s", ids, idsFromItems));
     }
 
     protected String newTempPersistenceContainerName() {
@@ -113,4 +114,11 @@ public class BrooklynLauncherRebindCatalogTest {
         Os.deleteOnExitRecursively(persistenceDirF);
         return persistenceDirF.getAbsolutePath();
     }
+
+    private static <T> boolean compareIterablesWithoutOrderMatters(Iterable<T>
a, Iterable<T> b) {
+        List<T> aList = IteratorUtils.toList(a.iterator());
+        List<T> bList = IteratorUtils.toList(b.iterator());
+
+        return aList.containsAll(bList) && bList.containsAll(aList);
+    }
 }


Mime
View raw message