brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [6/9] brooklyn-server git commit: fix discrepancy message
Date Fri, 27 Oct 2017 11:26:11 GMT
fix discrepancy message

just compare names. the "kind" can switch from "unresolved" but the result won't be updated.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/856c1c96
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/856c1c96
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/856c1c96

Branch: refs/heads/master
Commit: 856c1c96663f32e6b799f6b187ed3cfda511c10c
Parents: d179585
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Oct 25 17:29:07 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Oct 25 17:29:07 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/core/catalog/internal/CatalogBundleLoader.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/856c1c96/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
index be9abba..c57808c 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
@@ -25,6 +25,7 @@ import java.net.URL;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.mgmt.ManagementContext;
@@ -103,11 +104,13 @@ public class CatalogBundleLoader {
                 this.managementContext.getCatalog().addTypesFromBundleBom(bomText, mb, force,
result.mapOfNewToReplaced);
                 if (validate) {
                     Set<RegisteredType> matches = MutableSet.copyOf(this.managementContext.getTypeRegistry().getMatching(RegisteredTypePredicates.containingBundle(mb.getVersionedName())));
-                    if (!(matches.containsAll(result.mapOfNewToReplaced.keySet()) &&
result.mapOfNewToReplaced.keySet().containsAll(matches))) {
+                    Set<String> resultNames = result.mapOfNewToReplaced.keySet().stream().map((type)
-> type.getId()).collect(Collectors.toSet());
+                    Set<String> matchesNames = matches.stream().map((type) -> type.getId()).collect(Collectors.toSet());
+                    if (!(matchesNames.containsAll(resultNames) && resultNames.containsAll(matchesNames)))
{
                         // sanity check
                         LOG.warn("Discrepancy in list of Brooklyn items found for "+mb.getVersionedName()+":
"+
-                            "installer said "+result.mapOfNewToReplaced.keySet()+" ("+result.mapOfNewToReplaced.keySet().size()+")
"+
-                            "but registry search found "+matches+" ("+matches.size()+")");
+                            "installer gave "+result+" (of "+result.mapOfNewToReplaced.keySet().size()+"
total installed), "+
+                            "but registry search gave "+matches+" (from "+matches.size()+"
total found for this bundle)");
                     }
                     Map<RegisteredType, Collection<Throwable>> validationErrors
= this.managementContext.getCatalog().validateTypes( matches );
                     if (!validationErrors.isEmpty()) {


Mime
View raw message