@Test
public void testGetResources() throws Exception{

  Resource.Type type = Resource.Type.RootServiceHostComponent;
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  Clusters clusters = createNiceMock(Clusters.class);
  Cluster cluster = createNiceMock(Cluster.class);
  Host host1 = createNiceMock(Host.class);
  HostHealthStatus healthStatus = createNiceMock(HostHealthStatus.class);
  HostResponse hostResponse1 = createNiceMock(HostResponse.class);
  RootServiceHostComponentResponse response = createNiceMock(RootServiceHostComponentResponse.class);
  AbstractRootServiceResponseFactory factory = createNiceMock(AbstractRootServiceResponseFactory.class);
  List<Host> hosts = new LinkedList<Host>();
  hosts.add(host1);
  Set<Cluster> clusterSet = new HashSet<Cluster>();
  clusterSet.add(cluster);
  Set<RootServiceHostComponentResponse> responseSet = new HashSet<RootServiceHostComponentResponse>();
  responseSet.add(response);
  // set expectations
  expect(managementController.getRootServiceResponseFactory()).andReturn(factory).anyTimes();
  expect(managementController.getClusters()).andReturn(clusters).anyTimes();
  expect(clusters.getHosts()).andReturn(hosts).anyTimes();
  expect(factory.getRootServiceHostComponent((RootServiceHostComponentRequest) anyObject(), EasyMock.<Set<HostResponse>>anyObject())).
      andReturn(responseSet).anyTimes();
  expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
  expect(clusters.getClustersForHost("Host100")).andReturn(clusterSet).anyTimes();
  expect(host1.getHostName()).andReturn("Host100").anyTimes();
  expect(host1.convertToResponse()).andReturn(hostResponse1).anyTimes();
  expect(hostResponse1.getClusterName()).andReturn("Cluster100").anyTimes();
  expect(hostResponse1.getHostname()).andReturn("Host100").anyTimes();
  expect(hostResponse1.getHealthStatus()).andReturn(healthStatus).anyTimes();
  expect(healthStatus.getHealthStatus()).andReturn(HostHealthStatus.HealthStatus.HEALTHY).anyTimes();
  expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
  // replay
  replay(managementController, clusters, cluster,
      host1,
      hostResponse1,
      healthStatus, factory, response);
  ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(
      type,
      PropertyHelper.getPropertyIds(type),
      PropertyHelper.getKeyPropertyIds(type),
      managementController);
  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add(RootServiceHostComponentResourceProvider.SERVICE_NAME_PROPERTY_ID);
  propertyIds.add(RootServiceHostComponentResourceProvider.HOST_NAME_PROPERTY_ID);
  propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
  propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_STATE_PROPERTY_ID);
  propertyIds.add(RootServiceHostComponentResourceProvider.PROPERTIES_PROPERTY_ID);
  propertyIds.add(RootServiceHostComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
  
  // create the request
  Request request = PropertyHelper.getReadRequest(propertyIds);
  // get all ... no predicate
  provider.getResources(request, null);
  // verify
  verify(managementController, clusters, cluster,
      host1,
      hostResponse1,
      healthStatus, factory, response);
}