@Test
public void testGetClientHostForRunningAction_clientComponent() throws Exception {

  Injector injector = createNiceMock(Injector.class);
  Cluster cluster = createNiceMock(Cluster.class);
  Service service = createNiceMock(Service.class);
  StackId stackId = createNiceMock(StackId.class);
  ServiceComponent component = createNiceMock(ServiceComponent.class);
  expect(service.getName()).andReturn("service");
  expect(service.getServiceComponent("component")).andReturn(component);
  expect(service.getDesiredStackVersion()).andReturn(stackId);
  expect(stackId.getStackName()).andReturn("stack");
  expect(stackId.getStackVersion()).andReturn("1.0");
  ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
  ComponentInfo compInfo = createNiceMock(ComponentInfo.class);
  expect(serviceInfo.getClientComponent()).andReturn(compInfo);
  expect(compInfo.getName()).andReturn("component");
  expect(component.getServiceComponentHosts()).andReturn(Collections.<String, ServiceComponentHost>singletonMap("host", null));
  expect(ambariMetaInfo.getService("stack", "1.0", "service")).andReturn(serviceInfo);
  replay(injector, cluster, service, component, serviceInfo, compInfo, ambariMetaInfo, stackId);
  AmbariManagementControllerImpl controller = new AmbariManagementControllerImpl(null, clusters, injector);
  setAmbariMetaInfo(ambariMetaInfo, controller);
  ServiceComponent resultComponent = controller.getClientComponentForRunningAction(cluster, service);
  assertNotNull(resultComponent);
  assertEquals(component, resultComponent);
  verify(injector, cluster, service, component, serviceInfo, compInfo, ambariMetaInfo, stackId);
}