Repository: ambari Updated Branches: refs/heads/trunk b41ba67e6 -> 1785225b0
AMBARI-6262 Return field host_components fully when hosts filtered (Hosts table's filtering by Host Components won't work without this) (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1785225b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1785225b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1785225b Branch: refs/heads/trunk Commit: 1785225b04e7610235ded00ed180220d98a84f65 Parents: b41ba67 Author: Dmytro Sen <[email protected]> Authored: Wed Jun 25 17:13:22 2014 +0300 Committer: Dmytro Sen <[email protected]> Committed: Wed Jun 25 17:13:22 2014 +0300 ---------------------------------------------------------------------- .../apache/ambari/server/api/query/QueryImpl.java | 7 ------- .../ambari/server/api/query/QueryImplTest.java | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1785225b/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java index 104f994..98d1db7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java @@ -826,13 +826,6 @@ public class QueryImpl implements Query, ResourceInstance { // record the sub-resource properties on this query subResourcePredicateProperties.addAll(visitor.getSubResourceProperties()); - if (hasSubResourcePredicate()) { - for (Map.Entry<String, QueryImpl> entry : requestedSubResources.entrySet()) { - subResourcePredicate = getSubResourcePredicate(predicate, entry.getKey()); - entry.getValue().processUserPredicate(subResourcePredicate); - } - } - processedPredicate = visitor.getProcessedPredicate(); return processedPredicate; } http://git-wip-us.apache.org/repos/asf/ambari/blob/1785225b/ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java index ad453d9..7b35356 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/query/QueryImplTest.java @@ -201,6 +201,7 @@ public class QueryImplTest { //test QueryImpl instance = new TestQuery(mapIds, resourceDefinition); + instance.addProperty("versions/operatingSystems/OperatingSystems/os_type/*", null); PredicateBuilder pb = new PredicateBuilder(); Predicate predicate = pb.property("versions/operatingSystems/OperatingSystems/os_type").equals("centos5").toPredicate(); @@ -225,14 +226,25 @@ public class QueryImplTest { Assert.assertEquals(1, versionNode.getChildren().size()); TreeNode<Resource> opSystemsNode = versionNode.getChild("operatingSystems"); - Assert.assertEquals(1, opSystemsNode.getChildren().size()); + Assert.assertEquals(3, opSystemsNode.getChildren().size()); TreeNode<Resource> opSystemNode = opSystemsNode.getChild("OperatingSystem:1"); Assert.assertEquals("OperatingSystem:1", opSystemNode.getName()); Resource osResource = opSystemNode.getObject(); Assert.assertEquals(Resource.Type.OperatingSystem, opSystemNode.getObject().getType()); - Assert.assertEquals("centos5", osResource.getPropertyValue("OperatingSystems/os_type")); + + opSystemNode = opSystemsNode.getChild("OperatingSystem:2"); + Assert.assertEquals("OperatingSystem:2", opSystemNode.getName()); + osResource = opSystemNode.getObject(); + Assert.assertEquals(Resource.Type.OperatingSystem, opSystemNode.getObject().getType()); + Assert.assertEquals("centos6", osResource.getPropertyValue("OperatingSystems/os_type")); + + opSystemNode = opSystemsNode.getChild("OperatingSystem:3"); + Assert.assertEquals("OperatingSystem:3", opSystemNode.getName()); + osResource = opSystemNode.getObject(); + Assert.assertEquals(Resource.Type.OperatingSystem, opSystemNode.getObject().getType()); + Assert.assertEquals("oraclelinux5", osResource.getPropertyValue("OperatingSystems/os_type")); } @Test
