@Test
  public void testPopulateResources() throws Exception {

    TestStreamProvider streamProvider    = new TestStreamProvider("temporal_ganglia_report_data.json");
    TestGangliaHostProvider hostProvider = new TestGangliaHostProvider();

    GangliaReportPropertyProvider propertyProvider = new GangliaReportPropertyProvider(
        PropertyHelper.getMetricPropertyIds(Resource.Type.Cluster),
        streamProvider,
        configuration,
        hostProvider,
        CLUSTER_NAME_PROPERTY_ID);

    Resource resource = new ResourceImpl(Resource.Type.Cluster);

    resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1");

    // only ask for one property
    Map<String, TemporalInfo> temporalInfoMap = new HashMap<>();
    temporalInfoMap.put(PROPERTY_ID, new TemporalInfoImpl(10L, 20L, 1L));
    Request request = PropertyHelper.getReadRequest(Collections.singleton(PROPERTY_ID), temporalInfoMap);

    Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size());

    String expected = (configuration.isHttpsEnabled() ? "https" : "http") + "://domU-12-31-39-0E-34-E1.compute-1.internal/ganglia/graph.php?g=load_report&json=1";
    Assert.assertEquals(expected, streamProvider.getLastSpec());

    Assert.assertEquals(2, PropertyHelper.getProperties(resource).size());
    Assert.assertNotNull(resource.getPropertyValue(PROPERTY_ID));
  }
Test the Ganglia report property provider.
ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProviderTest.java