@Test
public void testReadResourceManager() throws Exception {

  TestStreamProvider streamProvider = new TestStreamProvider(false);
  Clusters clusters = createNiceMock(Clusters.class);
  Cluster cluster = createNiceMock(Cluster.class);
  Config config1 = createNiceMock(Config.class);
  Config config2 = createNiceMock(Config.class);
  Map<String, String> map = new HashMap<>();
  map.put("yarn.http.policy", "HTTPS_ONLY");
  map.put("yarn.resourcemanager.webapp.https.address", "ec2-54-234-33-50.compute-1.amazonaws.com:8999");
  map.put("yarn.resourcemanager.webapp.address", "ec2-54-234-33-50.compute-1.amazonaws.com:8088");
  expect(clusters.getCluster("testCluster")).andReturn(cluster);
  expect(cluster.getDesiredConfigByType("yarn-site")).andReturn(config1).anyTimes();
  expect(cluster.getDesiredConfigByType("core-site")).andReturn(config2).anyTimes();
  expect(config1.getProperties()).andReturn(map).anyTimes();
  expect(config2.getProperties()).andReturn(new HashMap<String, String>()).anyTimes();
  replay(clusters, cluster, config1, config2);
  HttpPropertyProvider propProvider = new HttpPropertyProvider(
          streamProvider, clusters,
          PROPERTY_ID_CLUSTER_NAME,
          PROPERTY_ID_HOST_NAME,
          PROPERTY_ID_COMPONENT_NAME,
          HTTP_PROPERTY_REQUESTS);
  Resource resource = new ResourceImpl(Resource.Type.HostComponent);
  resource.setProperty(PROPERTY_ID_HOST_NAME, "ec2-54-234-33-50.compute-1.amazonaws.com");
  resource.setProperty(PROPERTY_ID_CLUSTER_NAME, "testCluster");
  resource.setProperty(PROPERTY_ID_COMPONENT_NAME, "RESOURCEMANAGER");
  Request request = PropertyHelper.getReadRequest(Collections.<String>emptySet());
  propProvider.populateResources(Collections.singleton(resource), request, null);
  Assert.assertTrue(resource.getPropertiesMap().get("HostRoles").get("ha_state").equals("ACTIVE"));
  Assert.assertTrue(streamProvider.getLastSpec().equals("https://ec2-54-234-33-50.compute-1.amazonaws.com:8999" +
          "/ws/v1/cluster/info"));
}