Map<String, Map<String, PropertyInfo>> metrics = PropertyHelper.getJMXPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP1);
Map<String, PropertyInfo> componentMetrics = metrics.get("HISTORYSERVER");
Assert.assertNull(componentMetrics);
componentMetrics = metrics.get("NAMENODE");
Assert.assertNotNull(componentMetrics);
PropertyInfo info = componentMetrics.get("metrics/jvm/memHeapUsedM");
Assert.assertNotNull(info);
Assert.assertEquals("Hadoop:service=NameNode,name=jvm.memHeapUsedM", info.getPropertyId());
//version 2
metrics = PropertyHelper.getJMXPropertyIds(Resource.Type.HostComponent, PropertyHelper.MetricsVersion.HDP2);
componentMetrics = metrics.get("HISTORYSERVER");
Assert.assertNotNull(componentMetrics);
componentMetrics = metrics.get("NAMENODE");
Assert.assertNotNull(componentMetrics);
info = componentMetrics.get("metrics/jvm/memHeapUsedM");
Assert.assertNotNull(info);
Assert.assertEquals("Hadoop:service=NameNode,name=JvmMetrics.MemHeapUsedM", info.getPropertyId());
}