You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2014/07/01 01:51:20 UTC

git commit: AMBARI-6325. HA Wizard: can't initialize JournalNodes. (swagle)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 4e7ad853b -> 8f21a9aa2


AMBARI-6325. HA Wizard: can't initialize JournalNodes. (swagle)


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

Branch: refs/heads/branch-1.6.1
Commit: 8f21a9aa2867e877572320346b28d9991de2a31b
Parents: 4e7ad85
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Mon Jun 30 16:21:19 2014 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Mon Jun 30 16:21:19 2014 -0700

----------------------------------------------------------------------
 .../internal/AbstractPropertyProvider.java      |  7 ++++++-
 .../internal/AbstractPropertyProviderTest.java  | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f21a9aa/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
index db914ec..542567f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
@@ -316,8 +316,13 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P
    * Verify if the property category is supported
    */
   protected boolean checkPropertyCategory(String propertyId) {
-    String category = PropertyHelper.getPropertyCategory(propertyId);
     Set<String> categoryIds = getCategoryIds();
+    // Support query by category
+    if (categoryIds.contains(propertyId)) {
+      return true;
+    }
+
+    String category = PropertyHelper.getPropertyCategory(propertyId);
     while (category != null) {
       if(categoryIds.contains(category)) {
         return true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f21a9aa/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
index c5fd49d..8656e80 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
@@ -60,6 +60,26 @@ public class AbstractPropertyProviderTest {
   }
 
   @Test
+  public void testGetJMXPropertyInfoMap() {
+    AbstractPropertyProvider provider = new TestPropertyProvider(
+      PropertyHelper.getJMXPropertyIds(Resource.Type.HostComponent));
+
+    // top level category
+    Map<String, PropertyInfo> propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics");
+    Assert.assertEquals(86, propertyInfoMap.size());
+
+    // specific property
+    propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics/rpc/RpcQueueTime_avg_time");
+    Assert.assertEquals(1, propertyInfoMap.size());
+    Assert.assertTrue(propertyInfoMap.containsKey("metrics/rpc/RpcQueueTime_avg_time"));
+
+    // category
+    propertyInfoMap = provider.getPropertyInfoMap("DATANODE", "metrics/rpc/");
+    Assert.assertEquals(12, propertyInfoMap.size());
+    Assert.assertTrue(propertyInfoMap.containsKey("metrics/rpc/RpcQueueTime_avg_time"));
+  }
+
+  @Test
   public void testSubstituteArguments() throws Exception
   {
     //simple substitute