ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [05/12] AMBARI-4072. Remove extraneous jmx and ganglia files (ncole)
Date Mon, 16 Dec 2013 13:28:43 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HDFS/metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HDFS/metrics.json b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HDFS/metrics.json
index 2e70925..f33a0c0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HDFS/metrics.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HDFS/metrics.json
@@ -740,7 +740,7 @@
             "temporal": false
           },
           "metrics/jvm/memMaxM":{
-            "metric" : "Hadoop:service=NameNode,name=JvmMetrics.MemMaxM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemMaxM",
             "pointInTime" : true,
             "temporal" : false
           },
@@ -820,7 +820,7 @@
             "temporal": false
           },
           "metrics/jvm/memNonHeapUsedM": {
-            "metric": "Hadoop:service=NameNode,name=jvm.memNonHeapUsedM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemNonHeapUsedM",
             "pointInTime": true,
             "temporal": false
           },
@@ -855,7 +855,7 @@
             "temporal": false
           },
           "metrics/jvm/threadsBlocked": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsBlocked",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsBlocked",
             "pointInTime": true,
             "temporal": false
           },
@@ -940,7 +940,7 @@
             "temporal": false
           },
           "metrics/jvm/memNonHeapCommittedM": {
-            "metric": "Hadoop:service=NameNode,name=jvm.memNonHeapCommittedM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemNonHeapCommittedM",
             "pointInTime": true,
             "temporal": false
           },
@@ -1050,7 +1050,7 @@
             "temporal": false
           },
           "metrics/jvm/memHeapCommittedM": {
-            "metric": "Hadoop:service=NameNode,name=jvm.memHeapCommittedM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemHeapCommittedM",
             "pointInTime": true,
             "temporal": false
           },
@@ -1060,7 +1060,7 @@
             "temporal": false
           },
           "metrics/jvm/threadsRunnable": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsRunnable",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsRunnable",
             "pointInTime": true,
             "temporal": false
           },
@@ -1085,7 +1085,7 @@
             "temporal": false
           },
           "metrics/jvm/threadsNew": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsNew",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsNew",
             "pointInTime": true,
             "temporal": false
           },
@@ -1150,7 +1150,7 @@
             "temporal": false
           },
           "metrics/jvm/logWarn": {
-            "metric": "Hadoop:service=NameNode,name=jvm.logWarn",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.LogWarn",
             "pointInTime": true,
             "temporal": false
           },
@@ -1160,12 +1160,12 @@
             "temporal": false
           },
           "metrics/jvm/threadsTimedWaiting": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsTimedWaiting",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsTimedWaiting",
             "pointInTime": true,
             "temporal": false
           },
           "metrics/jvm/gcCount": {
-            "metric": "Hadoop:service=NameNode,name=jvm.gcCount",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcCount",
             "pointInTime": true,
             "temporal": false
           },
@@ -1200,7 +1200,7 @@
             "temporal": false
           },
           "metrics/jvm/memHeapUsedM": {
-            "metric": "Hadoop:service=NameNode,name=jvm.memHeapUsedM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemHeapUsedM",
             "pointInTime": true,
             "temporal": false
           },
@@ -1210,7 +1210,7 @@
             "temporal": false
           },
           "metrics/jvm/threadsWaiting": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsWaiting",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsWaiting",
             "pointInTime": true,
             "temporal": false
           },
@@ -1220,7 +1220,7 @@
             "temporal": false
           },
           "metrics/jvm/gcTimeMillis": {
-            "metric": "Hadoop:service=NameNode,name=jvm.gcTimeMillis",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.GcTimeMillis",
             "pointInTime": true,
             "temporal": false
           },
@@ -1245,7 +1245,7 @@
             "temporal": false
           },
           "metrics/jvm/threadsTerminated": {
-            "metric": "Hadoop:service=NameNode,name=jvm.threadsTerminated",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.ThreadsTerminated",
             "pointInTime": true,
             "temporal": false
           },
@@ -1290,7 +1290,7 @@
             "temporal": false
           },
           "metrics/jvm/logInfo": {
-            "metric": "Hadoop:service=NameNode,name=jvm.logInfo",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.LogInfo",
             "pointInTime": true,
             "temporal": false
           },
@@ -1340,7 +1340,7 @@
             "temporal": false
           },
           "metrics/jvm/logError": {
-            "metric": "Hadoop:service=NameNode,name=jvm.logError",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.LogError",
             "pointInTime": true,
             "temporal": false
           },
@@ -1370,7 +1370,7 @@
             "temporal": false
           },
           "metrics/jvm/logFatal": {
-            "metric": "Hadoop:service=NameNode,name=jvm.logFatal",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.LogFatal",
             "pointInTime": true,
             "temporal": false
           },
@@ -2137,7 +2137,7 @@
             "temporal": false
           },
           "metrics/jvm/memMaxM":{
-            "metric" : "Hadoop:service=NameNode,name=JvmMetrics.MemMaxM",
+            "metric": "Hadoop:service=NameNode,name=JvmMetrics.MemMaxM",
             "pointInTime" : true,
             "temporal" : false
           },

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
index fe95d06..ec4a0e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
@@ -17,6 +17,19 @@
  */
 package org.apache.ambari.server.controller.ganglia;
 
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.ComponentSSLConfigurationTest;
 import org.apache.ambari.server.controller.internal.PropertyInfo;
@@ -27,7 +40,6 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.TemporalInfo;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.controller.utilities.PropertyHelper.MetricsVersion;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.http.NameValuePair;
@@ -36,23 +48,9 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.anyObject;
 import org.powermock.api.easymock.PowerMock;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * Test the Ganglia property provider.
  */
@@ -71,8 +69,7 @@ public class GangliaPropertyProviderTest {
   private static final String HOST_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "host_name");
   private static final String COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("HostRoles", "component_name");
   
-  private static final String RM_CATEGORY_1 = "metrics/yarn/Queue/root/default";
-  private static final String RM_AVAILABLE_MEMORY_PROPERTY = PropertyHelper.getPropertyId(RM_CATEGORY_1, "AvailableMB");
+
   
   private ComponentSSLConfiguration configuration;
 
@@ -103,7 +100,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("temporal_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -209,7 +206,7 @@ public class GangliaPropertyProviderTest {
         "isGangliaCollectorHostLive", "isGangliaCollectorComponentLive");
 
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1),
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent),
         streamProvider,
         configuration,
         hostProvider,
@@ -250,7 +247,7 @@ public class GangliaPropertyProviderTest {
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
     GangliaPropertyProvider propertyProvider = new GangliaHostPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.Host, PropertyHelper.MetricsVersion.HDP1),
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.Host),
         streamProvider,
         configuration,
         hostProvider,
@@ -309,7 +306,7 @@ public class GangliaPropertyProviderTest {
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
     GangliaPropertyProvider propertyProvider = new GangliaHostPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.Host, PropertyHelper.MetricsVersion.HDP1),
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.Host),
         streamProvider,
         configuration,
         hostProvider,
@@ -362,59 +359,12 @@ public class GangliaPropertyProviderTest {
     Assert.assertTrue(isUrlParamsEquals(actualUri, expectedUri));
   }
   
-  class PopulateResourceManagerResourcesTest{
-    public void testProperty(String property, String jmxMetricName) throws SystemException{
-      TestStreamProvider streamProvider  = new TestStreamProvider("yarn_ganglia_data.txt");
-      TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
-
-      GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
-          PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP2),
-          streamProvider,
-          configuration,
-          hostProvider,
-          CLUSTER_NAME_PROPERTY_ID,
-          HOST_NAME_PROPERTY_ID,
-          COMPONENT_NAME_PROPERTY_ID);
-
-      // flume
-      Resource resource = new ResourceImpl(Resource.Type.HostComponent);
-
-      resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-      resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
-
-      // only ask for one property
-      Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-      temporalInfoMap.put(property, new TemporalInfoImpl(10L, 20L, 1L));
-      Request  request = PropertyHelper.getReadRequest(Collections.singleton(property), temporalInfoMap);
-
-      Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
-
-      String expected = (configuration.isGangliaSSL() ? "https" : "http") +
-          String.format("://domU-12-31-39-0E-34-E1.compute-1.internal/cgi-bin/rrd.py?c=HDPResourceManager&h=ip-10-39-113-33.ec2.internal&m=%s&s=10&e=20&r=1",jmxMetricName);
-      Assert.assertEquals(expected, streamProvider.getLastSpec());
-
-      Assert.assertEquals(3, PropertyHelper.getProperties(resource).size());
-      Assert.assertNotNull(resource.getPropertyValue(property));
-    }
-  }
-  
-  @Test
-  public void testPopulateResources_resourcemanager_clustermetrics() throws Exception {
-	  PopulateResourceManagerResourcesTest tester = new PopulateResourceManagerResourcesTest();
-	  tester.testProperty("metrics/yarn/ClusterMetrics/NumActiveNMs","yarn.ClusterMetrics.NumActiveNMs");
-	  tester.testProperty("metrics/yarn/ClusterMetrics/NumDecommissionedNMs","yarn.ClusterMetrics.NumDecommissionedNMs");
-	  tester.testProperty("metrics/yarn/ClusterMetrics/NumLostNMs", "yarn.ClusterMetrics.NumLostNMs");
-	  tester.testProperty("metrics/yarn/ClusterMetrics/NumUnhealthyNMs", "yarn.ClusterMetrics.NumUnhealthyNMs");
-	  tester.testProperty("metrics/yarn/ClusterMetrics/NumRebootedNMs", "yarn.ClusterMetrics.NumRebootedNMs");
-  }
-
-
   @Test
   public void testPopulateResources_params() throws Exception {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -472,7 +422,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -536,7 +486,7 @@ public class GangliaPropertyProviderTest {
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1),
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent),
         streamProvider,
         configuration,
         hostProvider,
@@ -568,7 +518,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -626,7 +576,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -684,7 +634,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -743,7 +693,7 @@ public class GangliaPropertyProviderTest {
     TestStreamProvider streamProvider  = new TestStreamProvider("flume_ganglia_data.txt");
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
         gangliaPropertyIds,
         streamProvider,
@@ -797,171 +747,9 @@ public class GangliaPropertyProviderTest {
     Assert.assertNotNull(resource.getPropertyValue(FLUME_CHANNEL_CAPACITY_PROPERTY));
   }
   
-  @Test
-  public void testPopulateResources_params_category5() throws Exception {
-    TestStreamProvider streamProvider  = new TestStreamProvider("temporal_ganglia_data_yarn_queues.txt");
-    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
-    Map<String, Map<String, PropertyInfo>> gangliaPropertyIds = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP2);
-    GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
-        gangliaPropertyIds,
-        streamProvider,
-        configuration,
-        hostProvider,
-        CLUSTER_NAME_PROPERTY_ID,
-        HOST_NAME_PROPERTY_ID,
-        COMPONENT_NAME_PROPERTY_ID);
-    
-    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
-    resource.setProperty(HOST_NAME_PROPERTY_ID, "dev01.ambari.apache.org");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
-
-    // only ask for one property
-    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-    temporalInfoMap.put(RM_CATEGORY_1, new TemporalInfoImpl(10L, 20L, 1L));
-    
-    Request  request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap);
-
-    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
-    
-    List<String> metricsRegexes = new ArrayList<String>();
-    
-    metricsRegexes.add("metrics/yarn/Queue/$1.replaceAll(\"([.])\",\"/\")/");
 
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "RESOURCEMANAGER");
-    
-    URIBuilder expectedUri = new URIBuilder();
-
-    expectedUri.setScheme((configuration.isGangliaSSL() ? "https" : "http"));
-    expectedUri.setHost("domU-12-31-39-0E-34-E1.compute-1.internal");
-    expectedUri.setPath("/cgi-bin/rrd.py");
-    expectedUri.setParameter("c", "HDPResourceManager");
-    expectedUri.setParameter("h", "dev01.ambari.apache.org");
-    expectedUri.setParameter("m", metricsList);
-    expectedUri.setParameter("s", "10");
-    expectedUri.setParameter("e", "20");
-    expectedUri.setParameter("r", "1");
-    
-    URIBuilder actualUri = new URIBuilder(streamProvider.getLastSpec());
-
-    Assert.assertEquals(expectedUri.getScheme(), actualUri.getScheme());
-    Assert.assertEquals(expectedUri.getHost(), actualUri.getHost());
-    Assert.assertEquals(expectedUri.getPath(), actualUri.getPath());
-    
-    Assert.assertTrue(isUrlParamsEquals(actualUri, expectedUri));    
-    
-    
-    Assert.assertTrue(PropertyHelper.getProperties(resource).size() > 2);
-    Assert.assertNotNull(resource.getPropertyValue(RM_AVAILABLE_MEMORY_PROPERTY));
-  }
-
-  @Test
-  public void testPopulateResources_journalNode() throws Exception {
-    TestStreamProvider streamProvider = new TestStreamProvider("journalnode_ganglia_data.txt");
-    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
-
-    GangliaPropertyProvider propertyProvider = new GangliaHostComponentPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, MetricsVersion.HDP2),
-        streamProvider,
-        configuration,
-        hostProvider,
-        CLUSTER_NAME_PROPERTY_ID,
-        HOST_NAME_PROPERTY_ID,
-        COMPONENT_NAME_PROPERTY_ID);
-
-    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
-
-    resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "JOURNALNODE");
-
-
-    Object[][] testData = {
-      {"metrics", "boottime", 1378290058.0},
-      {"metrics/cpu", "cpu_aidle", 0.0},
-      {"metrics/cpu", "cpu_idle", 88.2},
-      {"metrics/cpu", "cpu_nice", 0.0},
-      {"metrics/cpu", "cpu_num", 2.0},
-      {"metrics/cpu", "cpu_speed", 3583.0},
-      {"metrics/cpu", "cpu_system", 8.4},
-      {"metrics/cpu", "cpu_user", 3.3},
-      {"metrics/cpu", "cpu_wio", 0.1},
-      {"metrics/disk", "disk_free", 92.428},
-      {"metrics/disk", "disk_total", 101.515},
-      {"metrics/disk", "part_max_used", 12.8},
-      {"metrics/load", "load_fifteen", 0.026},
-      {"metrics/load", "load_five", 0.114},
-      {"metrics/load", "load_one", 0.226},
-      {"metrics/memory", "mem_buffers", 129384.0},
-      {"metrics/memory", "mem_cached", 589576.0},
-      {"metrics/memory", "mem_free", 1365496.0},
-      {"metrics/memory", "mem_shared", 0.0},
-      {"metrics/memory", "mem_total", 4055144.0},
-      {"metrics/memory", "swap_free", 4128760.0},
-      {"metrics/memory", "swap_total", 4128760.0},
-      {"metrics/network", "bytes_in", 22547.48},
-      {"metrics/network", "bytes_out", 5772.33},
-      {"metrics/network", "pkts_in", 24.0},
-      {"metrics/network", "pkts_out", 35.4},
-      {"metrics/process", "proc_run", 4.0},
-      {"metrics/process", "proc_total", 657.0},
-      {"metrics/dfs/journalNode", "batchesWritten", 0.0},
-      {"metrics/dfs/journalNode", "batchesWrittenWhileLagging", 0.0},
-      {"metrics/dfs/journalNode", "bytesWritten", 0.0},
-      {"metrics/dfs/journalNode", "currentLagTxns", 0.0},
-      {"metrics/dfs/journalNode", "lastPromisedEpoch", 5.0},
-      {"metrics/dfs/journalNode", "lastWriterEpoch", 5.0},
-      {"metrics/dfs/journalNode", "lastWrittenTxId", 613.0},
-      {"metrics/dfs/journalNode", "syncs60s50thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs60s75thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs60s90thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs60s95thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs60s99thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs60s_num_ops", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s50thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s75thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s90thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s95thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s99thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs300s_num_ops", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s50thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s75thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s90thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s95thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s99thPercentileLatencyMicros", 0.0},
-      {"metrics/dfs/journalNode", "syncs3600s_num_ops", 0.0},
-      {"metrics/dfs/journalNode", "txnsWritten", 0.0}
-    };
-
-    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
-    Set<String> properties = new LinkedHashSet<String>();
-
-    for (Object[] row : testData) {
-      properties.add(PropertyHelper.getPropertyId(row[0].toString(), row[1].toString()));
-    }
-
-    Request request = PropertyHelper.getReadRequest(properties, temporalInfoMap);
-
-    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
-
-    Map<String, Object> p = PropertyHelper.getProperties(resource);
-
-    for (String key : p.keySet()) {
-      if (!properties.contains(key)) {
-        System.out.printf(key);
-      }
-    }
-
-
-
-
-    Assert.assertEquals(properties.size() + 2, PropertyHelper.getProperties(resource).size());
-
-    int i = 0;
-    for (String property : properties) {
-      Assert.assertEquals(testData[i++][2], resource.getPropertyValue(property));
-    }
-  }
   
   private boolean isUrlParamsEquals(URIBuilder actualUri, URIBuilder expectedUri) {
     for (final NameValuePair expectedParam : expectedUri.getQueryParams()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaReportPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaReportPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaReportPropertyProviderTest.java
index 5b13e31..1ae17b3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaReportPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaReportPropertyProviderTest.java
@@ -77,7 +77,7 @@ public class GangliaReportPropertyProviderTest {
     TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
 
     GangliaReportPropertyProvider propertyProvider = new GangliaReportPropertyProvider(
-        PropertyHelper.getGangliaPropertyIds(Resource.Type.Cluster, PropertyHelper.MetricsVersion.HDP1),
+        PropertyHelper.getGangliaPropertyIds(Resource.Type.Cluster),
         streamProvider,
         configuration,
         hostProvider,

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/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 02ce79e..ff2d0d2 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
@@ -37,14 +37,14 @@ public class AbstractPropertyProviderTest {
 
   @Test
   public void testGetComponentMetrics() {
-    Map<String, Map<String, PropertyInfo>> componentMetrics = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1);
+    Map<String, Map<String, PropertyInfo>> componentMetrics = PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
     AbstractPropertyProvider provider = new TestPropertyProvider(componentMetrics);
     Assert.assertEquals(componentMetrics, provider.getComponentMetrics());
   }
 
   @Test
   public void testGetPropertyInfoMap() {
-    AbstractPropertyProvider provider = new TestPropertyProvider(PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1));
+    AbstractPropertyProvider provider = new TestPropertyProvider(PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent));
 
     // specific property
     Map<String, PropertyInfo> propertyInfoMap = provider.getPropertyInfoMap("NAMENODE", "metrics/cpu/cpu_aidle");
@@ -92,8 +92,7 @@ public class AbstractPropertyProviderTest {
   @Test
   public void testUpdateComponentMetricMapHDP1() {
     Map<String, Map<String, PropertyInfo>> componentMetrics =
-      PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent,
-      PropertyHelper.MetricsVersion.HDP1);
+      PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent);
 
     AbstractPropertyProvider provider = new TestPropertyProvider(componentMetrics);
 
@@ -116,36 +115,8 @@ public class AbstractPropertyProviderTest {
       flumeMetrics.get(specificMetric).getPropertyId());
   }
 
-  @Test
-  public void testUpdateComponentMetricMapHDP2() {
-    Map<String, Map<String, PropertyInfo>> componentMetrics =
-      PropertyHelper.getGangliaPropertyIds(Resource.Type.HostComponent,
-      PropertyHelper.MetricsVersion.HDP2);
-
-    AbstractPropertyProvider provider = new TestPropertyProvider(componentMetrics);
-
-    Map<String, PropertyInfo> resourceManagerMetrics = provider.getComponentMetrics().get(
-      "RESOURCEMANAGER");
-
-    int metricsBefore = resourceManagerMetrics.size();
-    String specificMetric =
-      "metrics/yarn/Queue/specificQueue1/specificQueue2/AvailableMB";
-    String specificPropertyInfoId =
-      "yarn.QueueMetrics.Queue=specificQueue1.specificQueue2.AvailableMB";
-    Map<String, PropertyInfo> componentMetricMap =
-      provider.getComponentMetrics().get("RESOURCEMANAGER");
-
-    Assert.assertNull(resourceManagerMetrics.get(specificMetric));
-
-    provider.updateComponentMetricMap(componentMetricMap, specificMetric);
-
-    Assert.assertEquals(metricsBefore + 1, resourceManagerMetrics.size());
-    Assert.assertNotNull(resourceManagerMetrics.get(specificMetric));
-    Assert.assertEquals(specificPropertyInfoId,
-      resourceManagerMetrics.get(specificMetric).getPropertyId());
-  }
 
-  static class TestPropertyProvider extends AbstractPropertyProvider {
+  private static class TestPropertyProvider extends AbstractPropertyProvider {
 
     public TestPropertyProvider(Map<String, Map<String, PropertyInfo>> componentMetrics) {
       super(componentMetrics);

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractProviderModuleTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractProviderModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractProviderModuleTest.java
deleted file mode 100644
index 36410c9..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractProviderModuleTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.apache.ambari.server.controller.internal;
-
-import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
-import org.apache.ambari.server.controller.spi.NoSuchResourceException;
-import org.apache.ambari.server.controller.spi.Predicate;
-import org.apache.ambari.server.controller.spi.Request;
-import org.apache.ambari.server.controller.spi.RequestStatus;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
-import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * AbstractProviderModule tests.
- */
-public class AbstractProviderModuleTest {
-  @Test
-  public void testGetMetricsVersion() throws Exception {
-
-    TestAbstractProviderModule module = new TestAbstractProviderModule("HDP-1.0");
-    PropertyHelper.MetricsVersion version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP1, version);
-    version = module.getMetricsVersion("c2");
-    Assert.assertNull(version);
-
-    module = new TestAbstractProviderModule("HDPLocal-1.3.2");
-    version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP1, version);
-
-    module = new TestAbstractProviderModule("HDP-2.0.1");
-    version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP2, version);
-
-    module = new TestAbstractProviderModule("HDP-2.0.1.x");
-    version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP2, version);
-
-    module = new TestAbstractProviderModule("HDP-9.9.9");
-    version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP2, version);
-
-    module = new TestAbstractProviderModule("HDPLocal-2.0.0");
-    version = module.getMetricsVersion("c1");
-    Assert.assertEquals(PropertyHelper.MetricsVersion.HDP2, version);
-  }
-
-  private static class TestAbstractProviderModule extends AbstractProviderModule {
-    private final String clusterVersion;
-
-    private TestAbstractProviderModule(String clusterVersion) {
-      this.clusterVersion = clusterVersion;
-    }
-
-    @Override
-    protected ResourceProvider createResourceProvider(Resource.Type type) {
-      return new TestResourceProvider(type, clusterVersion);
-    }
-  }
-
-  private static class TestResourceProvider implements ResourceProvider {
-    private final Resource.Type type;
-    private final String clusterVersion;
-
-    private TestResourceProvider(Resource.Type type, String clusterVersion) {
-      this.type = type;
-      this.clusterVersion = clusterVersion;
-    }
-
-    @Override
-    public RequestStatus createResources(Request request)
-        throws SystemException, UnsupportedPropertyException,
-        ResourceAlreadyExistsException, NoSuchParentResourceException {
-      return null;
-    }
-
-    @Override
-    public Set<Resource> getResources(Request request, Predicate predicate)
-        throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
-      if (type == Resource.Type.Cluster) {
-        Resource cluster = new ResourceImpl(Resource.Type.Cluster);
-        cluster.setProperty(ClusterResourceProvider.CLUSTER_ID_PROPERTY_ID, 1);
-        cluster.setProperty(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "c1");
-        cluster.setProperty(ClusterResourceProvider.CLUSTER_VERSION_PROPERTY_ID, clusterVersion);
-
-        return Collections.singleton(cluster);
-      }
-      return Collections.emptySet();
-    }
-
-    @Override
-    public RequestStatus updateResources(Request request, Predicate predicate)
-        throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-      return null;
-    }
-
-    @Override
-    public RequestStatus deleteResources(Predicate predicate)
-        throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-      return null;
-    }
-
-    @Override
-    public Map<Resource.Type, String> getKeyPropertyIds() {
-      return null;
-    }
-
-    @Override
-    public Set<String> checkPropertyIds(Set<String> propertyIds) {
-      return null;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/eb80c2b7/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
index 451e34f..607fc6f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java
@@ -19,12 +19,19 @@ package org.apache.ambari.server.controller.internal;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.ambari.server.controller.ganglia.GangliaHostComponentPropertyProvider;
+import org.apache.ambari.server.controller.ganglia.GangliaPropertyProvider;
 import org.apache.ambari.server.controller.ganglia.GangliaPropertyProviderTest.TestGangliaHostProvider;
+import org.apache.ambari.server.controller.jmx.JMXPropertyProvider;
+import org.apache.ambari.server.controller.jmx.TestStreamProvider;
 import org.apache.ambari.server.controller.jmx.JMXPropertyProviderTest.TestJMXHostProvider;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.PropertyProvider;
@@ -41,6 +48,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.Metric;
+import org.apache.http.client.utils.URIBuilder;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -54,6 +62,12 @@ import com.google.inject.persist.PersistService;
  * Tests the stack defined property provider.
  */
 public class StackDefinedPropertyProviderTest {
+  private static final String HOST_COMPONENT_HOST_NAME_PROPERTY_ID = "HostRoles/host_name";
+  private static final String HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID = "HostRoles/component_name";
+  private static final String HOST_COMPONENT_STATE_PROPERTY_ID = "HostRoles/state";    
+
+  
+  private Clusters clusters = null;
   private Injector injector = null;
 
   @Before
@@ -64,7 +78,7 @@ public class StackDefinedPropertyProviderTest {
     injector.getInstance(GuiceJpaInitializer.class);
     StackDefinedPropertyProvider.init(injector);
     
-    Clusters clusters = injector.getInstance(Clusters.class);
+    clusters = injector.getInstance(Clusters.class);
     clusters.addCluster("c1");
     
     Cluster cluster = clusters.getCluster("c1");
@@ -114,6 +128,7 @@ public class StackDefinedPropertyProviderTest {
     Assert.assertTrue("Expected Ganglia metric 'metrics/rpcdetailed'", values.containsKey("metrics/rpcdetailed"));
   }
   
+  
   @Test
   public void testCustomProviders() throws Exception {
     
@@ -193,7 +208,7 @@ public class StackDefinedPropertyProviderTest {
   }
   
   /**
-   * Test for empty constructor.
+   * Test for empty constructor.  Public since instantiated via reflection.
    */
   public static class CustomMetricProvider1 implements PropertyProvider {
     @Override
@@ -214,7 +229,7 @@ public class StackDefinedPropertyProviderTest {
   }
 
   /**
-   * Test map constructors.
+   * Test map constructors.  Public since instantiated via reflection.
    */
   public static class CustomMetricProvider2 implements PropertyProvider {
     private Map<String, String> providerProperties = null;
@@ -239,7 +254,7 @@ public class StackDefinedPropertyProviderTest {
   }
 
   /**
-   * Test singleton accessor.
+   * Test singleton accessor.  Public since instantiated via reflection.
    */
   public static class CustomMetricProvider3 implements PropertyProvider {
     private static CustomMetricProvider3 instance = null;
@@ -268,5 +283,662 @@ public class StackDefinedPropertyProviderTest {
     }
   }
   
+  @Test
+  public void testPopulateResources_HDP2() throws Exception {
+    
+    StreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(true);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    // resourcemanager
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "domu-12-31-39-0e-34-e1.compute-1.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // request with an empty set should get all supported properties
+    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/resourcemanager_jmx.json for values
+    Assert.assertEquals(6,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(8192,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertEquals(1,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+    
+    Assert.assertEquals(1,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumActiveNMs")));
+    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumDecommissionedNMs")));
+    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumLostNMs")));
+    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumUnhealthyNMs")));
+    Assert.assertEquals(0,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/ClusterMetrics", "NumRebootedNMs")));
+
+    Assert.assertEquals(932118528,  resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "HeapMemoryMax")));
+
+    //namenode
+    resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "domu-12-31-39-0e-34-e1.compute-1.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "NAMENODE");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // request with an empty set should get all supported properties
+    request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+  }  
+  
+  @Test
+  public void testPopulateResources_HDP2_params() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "h1");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // request with an empty set should get all supported properties
+    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/resourcemanager_jmx.json for values
+    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+    
+    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(47,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
+    
+    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
+    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
+    Assert.assertEquals(6048, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
+  }  
+
+
+  @Test
+  public void testPopulateResources_HDP2_params_singleProperty() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "h1");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/AvailableMB"), temporalInfoMap);
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/resourcemanager_jmx.json for values
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+  }
+  
+  @Test
+  public void testPopulateResources_HDP2_params_category() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "h1");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue"), temporalInfoMap);
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/resourcemanager_jmx.json for values
+    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertEquals(6,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+
+    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(47,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
+
+    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
+    Assert.assertEquals(4,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
+    Assert.assertEquals(6048, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
+  }
+
+  @Test
+  public void testPopulateResources_HDP2_params_category2() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "h1");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    Request  request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/default"), temporalInfoMap);
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/resourcemanager_jmx.json for values
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersAllocated")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AggregateContainersReleased")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableMB")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AvailableVCores")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root", "AppsSubmitted")));
+
+    Assert.assertEquals(15,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersAllocated")));
+    Assert.assertEquals(12,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AggregateContainersReleased")));
+    Assert.assertEquals(8192, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableMB")));
+    Assert.assertEquals(1,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AvailableVCores")));
+    Assert.assertEquals(47,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default", "AppsSubmitted")));
+
+    Assert.assertEquals(99,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersAllocated")));
+    Assert.assertEquals(98,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AggregateContainersReleased")));
+    Assert.assertEquals(9898, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AvailableMB")));
+    Assert.assertEquals(2,    resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AvailableVCores")));
+    Assert.assertEquals(97,   resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/default/sub_queue", "AppsSubmitted")));
+
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersAllocated")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AggregateContainersReleased")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableMB")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AvailableVCores")));
+    Assert.assertNull(resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/yarn/Queue/root/second_queue", "AppsSubmitted")));
+  }  
+
+  @Test
+  public void testPopulateResources_jmx_JournalNode() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "domu-12-31-39-0e-34-e1.compute-1.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "JOURNALNODE");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    // request with an empty set should get all supported properties
+    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    // see test/resources/hdfs_journalnode_jmx.json for values
+    Assert.assertEquals(1377795104272L, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "startTime")));
+    Assert.assertEquals(954466304, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "HeapMemoryMax")));
+    Assert.assertEquals(14569736, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "HeapMemoryUsed")));
+    Assert.assertEquals(136314880, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "NonHeapMemoryMax")));
+    Assert.assertEquals(24993392, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "NonHeapMemoryUsed")));
+    Assert.assertEquals(9100, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "gcCount")));
+    Assert.assertEquals(31641, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "gcTimeMillis")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "logError")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "logFatal")));
+    Assert.assertEquals(4163, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "logInfo")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "logWarn")));
+    Assert.assertEquals(29.8125, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "memHeapCommittedM")));
+    Assert.assertEquals(13.894783, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "memHeapUsedM")));
+    Assert.assertEquals(24.9375, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "memNonHeapCommittedM")));
+    Assert.assertEquals(23.835556, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "memNonHeapUsedM")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsBlocked")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsNew")));
+    Assert.assertEquals(6, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsRunnable")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsTerminated")));
+    Assert.assertEquals(3, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsTimedWaiting")));
+    Assert.assertEquals(8, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/jvm", "threadsWaiting")));
+
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "NumOpenConnections")));
+    Assert.assertEquals(4928861, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "ReceivedBytes")));
+    Assert.assertEquals(13.211112159230245, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "RpcProcessingTime_avg_time")));
+    Assert.assertEquals(25067, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "RpcProcessingTime_num_ops")));
+    Assert.assertEquals(0.19686821997924706, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "RpcQueueTime_avg_time")));
+    Assert.assertEquals(25067, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "RpcQueueTime_num_ops")));
+    Assert.assertEquals(6578899, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "SentBytes")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "callQueueLen")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "rpcAuthenticationFailures")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "rpcAuthenticationSuccesses")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "rpcAuthorizationFailures")));
+    Assert.assertEquals(12459, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpc", "rpcAuthorizationSuccesses")));
+
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "getJournalState_num_ops")));
+    Assert.assertEquals(0.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "getJournalState_avg_time")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "newEpoch_num_ops")));
+    Assert.assertEquals(60.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "newEpoch_avg_time")));
+    Assert.assertEquals(4129, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "startLogSegment_num_ops")));
+    Assert.assertEquals(38.25951359084413, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "startLogSegment_avg_time")));
+    Assert.assertEquals(8265, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "journal_num_ops")));
+    Assert.assertEquals(2.1832618025751187, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "journal_avg_time")));
+    Assert.assertEquals(4129, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "finalizeLogSegment_num_ops")));
+    Assert.assertEquals(11.575679542203101, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "finalizeLogSegment_avg_time")));
+    Assert.assertEquals(8536, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "getEditLogManifest_num_ops")));
+    Assert.assertEquals(12.55427859318747, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "getEditLogManifest_avg_time")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "prepareRecovery_num_ops")));
+    Assert.assertEquals(10.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "prepareRecovery_avg_time")));
+    Assert.assertEquals(1, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "acceptRecovery_num_ops")));
+    Assert.assertEquals(30.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/rpcdetailed", "acceptRecovery_avg_time")));
+
+    Assert.assertEquals(0.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/ugi", "loginFailure_avg_time")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/ugi", "loginFailure_num_ops")));
+    Assert.assertEquals(0.0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/ugi", "loginSuccess_avg_time")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/ugi", "loginSuccess_num_ops")));
+
+    Assert.assertEquals("{\"mycluster\":{\"Formatted\":\"true\"}}", resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode", "journalsStatus")));
+
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s_num_ops")));
+    Assert.assertEquals(988, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s50thPercentileLatencyMicros")));
+    Assert.assertEquals(988, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s75thPercentileLatencyMicros")));
+    Assert.assertEquals(988, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s90thPercentileLatencyMicros")));
+    Assert.assertEquals(988, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s95thPercentileLatencyMicros")));
+    Assert.assertEquals(988, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs60s99thPercentileLatencyMicros")));
+    Assert.assertEquals(4, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s_num_ops")));
+    Assert.assertEquals(1027, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s50thPercentileLatencyMicros")));
+    Assert.assertEquals(1037, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s75thPercentileLatencyMicros")));
+    Assert.assertEquals(1037, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s90thPercentileLatencyMicros")));
+    Assert.assertEquals(1037, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s95thPercentileLatencyMicros")));
+    Assert.assertEquals(1037, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs300s99thPercentileLatencyMicros")));
+    Assert.assertEquals(60, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s_num_ops")));
+    Assert.assertEquals(1122, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s50thPercentileLatencyMicros")));
+    Assert.assertEquals(1344, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s75thPercentileLatencyMicros")));
+    Assert.assertEquals(1554, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s90thPercentileLatencyMicros")));
+    Assert.assertEquals(1980, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s95thPercentileLatencyMicros")));
+    Assert.assertEquals(8442, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "syncs3600s99thPercentileLatencyMicros")));
+    Assert.assertEquals(8265, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "batchesWritten")));
+    Assert.assertEquals(8265, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "txnsWritten")));
+    Assert.assertEquals(107837, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "bytesWritten")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "batchesWrittenWhileLagging")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "lastPromisedEpoch")));
+    Assert.assertEquals(2, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "lastWriterEpoch")));
+    Assert.assertEquals(0, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "currentLagTxns")));
+    Assert.assertEquals(8444, resource.getPropertyValue(PropertyHelper.getPropertyId("metrics/dfs/journalnode/cluster/mycluster", "lastWrittenTxId")));
+  }  
+
+  @Test
+  public void testPopulateResources_NoRegionServer() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        null,
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "domu-12-31-39-0e-34-e1.compute-1.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "HBASE_REGIONSERVER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    int preSize = resource.getPropertiesMap().size();
+    
+    // request with an empty set should get all supported properties
+    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    Assert.assertEquals(preSize, resource.getPropertiesMap().size());
+  }
+
+  @Test
+  public void testPopulateResources_HBaseMaster2() throws Exception {
+    TestStreamProvider  streamProvider = new TestStreamProvider();
+    TestJMXHostProvider hostProvider = new TestJMXHostProvider(false);
+    TestGangliaHostProvider gangliaHostProvider = new TestGangliaHostProvider();
+
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        hostProvider,
+        gangliaHostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+    
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "domu-12-31-39-0e-34-e1.compute-1.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "HBASE_MASTER");
+    resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED");
+
+    
+    // request with an empty set should get all supported properties
+    Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
+
+    Set<Resource> res = propertyProvider.populateResources(Collections.singleton(resource), request, null);
+    Assert.assertEquals(1, res.size());
+    
+    Map<String, Map<String, Object>> map = res.iterator().next().getPropertiesMap();
+
+    Assert.assertTrue(map.containsKey("metrics/hbase/master"));
+    // uses 'tag.isActiveMaster' (name with a dot)
+    Assert.assertTrue(map.get("metrics/hbase/master").containsKey("IsActiveMaster"));
+  }    
+
+  
+  @Test
+  public void testPopulateResources_params_category5() throws Exception {
+    org.apache.ambari.server.controller.ganglia.TestStreamProvider streamProvider =
+        new org.apache.ambari.server.controller.ganglia.TestStreamProvider("temporal_ganglia_data_yarn_queues.txt");
+
+    TestJMXHostProvider jmxHostProvider = new TestJMXHostProvider(true);
+    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
+    
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        jmxHostProvider,
+        hostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+    
+    
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "dev01.ambari.apache.org");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+
+    String RM_CATEGORY_1 = "metrics/yarn/Queue/root/default";
+    String RM_AVAILABLE_MEMORY_PROPERTY = PropertyHelper.getPropertyId(RM_CATEGORY_1, "AvailableMB");
+    
+    // only ask for one property
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    temporalInfoMap.put(RM_CATEGORY_1, new TemporalInfoImpl(10L, 20L, 1L));
+    
+    Request  request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap);
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+    
+    List<String> metricsRegexes = new ArrayList<String>();
+    
+    metricsRegexes.add("metrics/yarn/Queue/$1.replaceAll(\"([.])\",\"/\")/");
+
+    Assert.assertTrue(PropertyHelper.getProperties(resource).size() > 2);
+    Assert.assertNotNull(resource.getPropertyValue(RM_AVAILABLE_MEMORY_PROPERTY));
+  }  
+
+  @Test
+  public void testPopulateResources_ganglia_JournalNode() throws Exception {
+    org.apache.ambari.server.controller.ganglia.TestStreamProvider streamProvider =
+        new org.apache.ambari.server.controller.ganglia.TestStreamProvider("journalnode_ganglia_data.txt");
+
+    TestJMXHostProvider jmxHostProvider = new TestJMXHostProvider(true);
+    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
+    
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        jmxHostProvider,
+        hostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+    resource.setProperty("HostRoles/cluster_name", "c1");
+    resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
+    resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "JOURNALNODE");
+
+
+    Object[][] testData = {
+      {"metrics", "boottime", 1378290058.0},
+      {"metrics/cpu", "cpu_aidle", 0.0},
+      {"metrics/cpu", "cpu_idle", 88.2},
+      {"metrics/cpu", "cpu_nice", 0.0},
+      {"metrics/cpu", "cpu_num", 2.0},
+      {"metrics/cpu", "cpu_speed", 3583.0},
+      {"metrics/cpu", "cpu_system", 8.4},
+      {"metrics/cpu", "cpu_user", 3.3},
+      {"metrics/cpu", "cpu_wio", 0.1},
+      {"metrics/disk", "disk_free", 92.428},
+      {"metrics/disk", "disk_total", 101.515},
+      {"metrics/disk", "part_max_used", 12.8},
+      {"metrics/load", "load_fifteen", 0.026},
+      {"metrics/load", "load_five", 0.114},
+      {"metrics/load", "load_one", 0.226},
+      {"metrics/memory", "mem_buffers", 129384.0},
+      {"metrics/memory", "mem_cached", 589576.0},
+      {"metrics/memory", "mem_free", 1365496.0},
+      {"metrics/memory", "mem_shared", 0.0},
+      {"metrics/memory", "mem_total", 4055144.0},
+      {"metrics/memory", "swap_free", 4128760.0},
+      {"metrics/memory", "swap_total", 4128760.0},
+      {"metrics/network", "bytes_in", 22547.48},
+      {"metrics/network", "bytes_out", 5772.33},
+      {"metrics/network", "pkts_in", 24.0},
+      {"metrics/network", "pkts_out", 35.4},
+      {"metrics/process", "proc_run", 4.0},
+      {"metrics/process", "proc_total", 657.0},
+      {"metrics/dfs/journalNode", "batchesWritten", 0.0},
+      {"metrics/dfs/journalNode", "batchesWrittenWhileLagging", 0.0},
+      {"metrics/dfs/journalNode", "bytesWritten", 0.0},
+      {"metrics/dfs/journalNode", "currentLagTxns", 0.0},
+      {"metrics/dfs/journalNode", "lastPromisedEpoch", 5.0},
+      {"metrics/dfs/journalNode", "lastWriterEpoch", 5.0},
+      {"metrics/dfs/journalNode", "lastWrittenTxId", 613.0},
+      {"metrics/dfs/journalNode", "syncs60s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs60s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs300s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s50thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s75thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s90thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s95thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s99thPercentileLatencyMicros", 0.0},
+      {"metrics/dfs/journalNode", "syncs3600s_num_ops", 0.0},
+      {"metrics/dfs/journalNode", "txnsWritten", 0.0}
+    };
+
+    Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+    Set<String> properties = new LinkedHashSet<String>();
+
+    for (Object[] row : testData) {
+      properties.add(PropertyHelper.getPropertyId(row[0].toString(), row[1].toString()));
+    }
+
+    Request request = PropertyHelper.getReadRequest(properties, temporalInfoMap);
+
+    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+
+    Map<String, Object> p = PropertyHelper.getProperties(resource);
+
+    for (String key : p.keySet()) {
+      if (!properties.contains(key)) {
+        System.out.printf(key);
+      }
+    }
+
+    // size + properties defined before "Object[][] testData ... " above 
+    Assert.assertEquals(properties.size() + 3, PropertyHelper.getProperties(resource).size());
+
+    int i = 0;
+    for (String property : properties) {
+      Assert.assertEquals(testData[i++][2], resource.getPropertyValue(property));
+    }
+  }  
+
+  @Test
+  public void testPopulateResources_resourcemanager_clustermetrics() throws Exception {
+    
+    String[] metrics = new String[] {
+      "metrics/yarn/ClusterMetrics/NumActiveNMs",
+      "metrics/yarn/ClusterMetrics/NumDecommissionedNMs",
+      "metrics/yarn/ClusterMetrics/NumLostNMs",
+      "metrics/yarn/ClusterMetrics/NumUnhealthyNMs",
+      "metrics/yarn/ClusterMetrics/NumRebootedNMs"
+    };
+    
+    org.apache.ambari.server.controller.ganglia.TestStreamProvider streamProvider =
+        new org.apache.ambari.server.controller.ganglia.TestStreamProvider("yarn_ganglia_data.txt");
+
+    TestJMXHostProvider jmxHostProvider = new TestJMXHostProvider(true);
+    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();
+    
+    StackDefinedPropertyProvider propertyProvider = new StackDefinedPropertyProvider(
+        Resource.Type.HostComponent,
+        jmxHostProvider,
+        hostProvider,
+        streamProvider,
+        PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+        PropertyHelper.getPropertyId("HostRoles", "host_name"),
+        PropertyHelper.getPropertyId("HostRoles", "component_name"),
+        PropertyHelper.getPropertyId("HostRoles", "state"),
+        new EmptyPropertyProvider(),
+        new EmptyPropertyProvider());
+
+    for (String metric : metrics) {
+      Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+
+      resource.setProperty("HostRoles/cluster_name", "c1");
+      resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
+      resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER");
+      
+      // only ask for one property
+      Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
+      temporalInfoMap.put(metric, new TemporalInfoImpl(10L, 20L, 1L));
+      Request  request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap);
+
+      Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());
+      
+      Assert.assertEquals(4, PropertyHelper.getProperties(resource).size());
+      Assert.assertNotNull(resource.getPropertyValue(metric));
+      
+    }
+    
+  }  
   
 }


Mime
View raw message