ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: Revert "AMBARI-6262 Return field host_components fully when hosts filtered (Hosts table's filtering by Host Components won't work without this) (dsen)"
Date Thu, 26 Jun 2014 19:34:19 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 7f78cdf74 -> 736e78c88


Revert "AMBARI-6262 Return field host_components fully when hosts filtered (Hosts table's
filtering by Host Components won't work without this) (dsen)"

This reverts commit 0de1199fb26e888dd69859be90dcdc07da635220.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/736e78c8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/736e78c8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/736e78c8

Branch: refs/heads/branch-1.6.1
Commit: 736e78c883af676369d29e85466284c0551b8713
Parents: 7f78cdf
Author: Dmytro Sen <dsen@hortonworks.com>
Authored: Thu Jun 26 22:33:53 2014 +0300
Committer: Dmytro Sen <dsen@hortonworks.com>
Committed: Thu Jun 26 22:33:53 2014 +0300

----------------------------------------------------------------------
 .../apache/ambari/server/api/query/QueryImpl.java   |  7 +++++++
 .../ambari/server/api/query/QueryImplTest.java      | 16 ++--------------
 2 files changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/736e78c8/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 8017844..63426cb 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,6 +821,13 @@ 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/736e78c8/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 7b35356..ad453d9 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,7 +201,6 @@ 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();
@@ -226,25 +225,14 @@ public class QueryImplTest {
 
     Assert.assertEquals(1, versionNode.getChildren().size());
     TreeNode<Resource> opSystemsNode = versionNode.getChild("operatingSystems");
-    Assert.assertEquals(3, opSystemsNode.getChildren().size());
+    Assert.assertEquals(1, 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"));
+    Assert.assertEquals("centos5", osResource.getPropertyValue("OperatingSystems/os_type"));
   }
 
   @Test


Mime
View raw message