Repository: ambari Updated Branches: refs/heads/branch-1.6.1 b5f6cbbe3 -> 0de1199fb
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/0de1199f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0de1199f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0de1199f Branch: refs/heads/branch-1.6.1 Commit: 0de1199fb26e888dd69859be90dcdc07da635220 Parents: b5f6cbb Author: Dmytro Sen <[email protected]> Authored: Wed Jun 25 17:51:53 2014 +0300 Committer: Dmytro Sen <[email protected]> Committed: Wed Jun 25 17:51:53 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/0de1199f/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 63426cb..8017844 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 @@ -821,13 +821,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/0de1199f/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
