StackId stackId = createNiceMock(StackId.class);
ComponentInfo componentInfo = createNiceMock(ComponentInfo.class);
HostResponse hostResponse1 = createNiceMock(HostResponse.class);
ResourceProviderFactory resourceProviderFactory = createNiceMock(ResourceProviderFactory.class);
ResourceProvider hostResourceProvider = createNiceMock(HostResourceProvider.class);
AbstractControllerResourceProvider.init(resourceProviderFactory);
Set<Cluster> clusterSet = new HashSet<Cluster>();
clusterSet.add(cluster);
ServiceComponentHostResponse shr1 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component100", "Host100", "STARTED", "", null, null);
ServiceComponentHostResponse shr2 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component102", "Host100", "STARTED", "", null, null);
ServiceComponentHostResponse shr3 = new ServiceComponentHostResponse("Cluster100", "Service100", "Component103", "Host100", "STARTED", "", null, null);
Set<ServiceComponentHostResponse> responses = new HashSet<ServiceComponentHostResponse>();
responses.add(shr1);
responses.add(shr2);
responses.add(shr3);
// set expectations
expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).andReturn(responses).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(clusters.getClustersForHost("Host100")).andReturn(clusterSet).anyTimes();
expect(hostResponse1.getClusterName()).andReturn("Cluster100").anyTimes();
expect(hostResponse1.getHostname()).andReturn("Host100").anyTimes();
expect(hostResponse1.getHealthStatus()).andReturn(healthStatus).anyTimes();
expect(hostResponse1.getStatus()).andReturn(HealthStatus.HEALTHY.name()).anyTimes();
expect(healthStatus.getHealthStatus()).andReturn(HostHealthStatus.HealthStatus.HEALTHY).anyTimes();
expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
expect(ambariMetaInfo.getComponentCategory((String) anyObject(), (String) anyObject(),
(String) anyObject(), (String) anyObject())).andReturn(componentInfo).anyTimes();
expect(componentInfo.getCategory()).andReturn("MASTER").anyTimes();
//expect(managementController.getResourceProviderFactory()).andReturn(resourceProviderFactory).anyTimes();
expect(resourceProviderFactory.getHostResourceProvider(anyObject(Set.class), anyObject(Map.class),
eq(managementController))).andReturn(hostResourceProvider).anyTimes();
Set<String> propertyIds = new HashSet<String>();
propertyIds.add(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID);