service0, serviceFactory, ambariMetaInfo, requestStatusResponse);
}
@Test
public void testReconfigureClientsFlag() throws Exception {
AmbariManagementController managementController1 = createMock(AmbariManagementController.class);
AmbariManagementController managementController2 = createMock
(AmbariManagementController.class);
Clusters clusters = createNiceMock(Clusters.class);
Cluster cluster = createNiceMock(Cluster.class);
Service service0 = createNiceMock(Service.class);
ServiceResponse serviceResponse0 = createNiceMock(ServiceResponse.class);
AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
RequestStatusResponse response1 = createNiceMock(RequestStatusResponse.class);
RequestStatusResponse response2 = createNiceMock(RequestStatusResponse
.class);
Map<String, String> mapRequestProps = new HashMap<String, String>();
mapRequestProps.put("context", "Called from a test");
// set expectations
expect(managementController1.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).
andReturn(Collections.<ServiceComponentHostResponse>emptySet()).anyTimes();
expect(managementController2.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).
andReturn(Collections.<ServiceComponentHostResponse>emptySet()).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(managementController1.getClusters()).andReturn(clusters).anyTimes();
expect(managementController1.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
expect(managementController2.getClusters()).andReturn(clusters).anyTimes();
expect(managementController2.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
expect(cluster.getService("Service102")).andReturn(service0).anyTimes();
expect(service0.convertToResponse()).andReturn(serviceResponse0).anyTimes();
expect(service0.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
expect(service0.getServiceComponents()).andReturn(Collections.<String, ServiceComponent>emptyMap()).anyTimes();
expect(serviceResponse0.getClusterName()).andReturn("Cluster100").anyTimes();
expect(serviceResponse0.getServiceName()).andReturn("Service102").anyTimes();
Capture<Map<String, String>> requestPropertiesCapture = new Capture<Map<String, String>>();
Capture<Map<State, List<Service>>> changedServicesCapture = new Capture<Map<State, List<Service>>>();
Capture<Map<State, List<ServiceComponent>>> changedCompsCapture = new Capture<Map<State, List<ServiceComponent>>>();
Capture<Map<String, Map<State, List<ServiceComponentHost>>>> changedScHostsCapture = new Capture<Map<String, Map<State, List<ServiceComponentHost>>>>();
Capture<Map<String, String>> requestParametersCapture = new Capture<Map<String, String>>();
Capture<Collection<ServiceComponentHost>> ignoredScHostsCapture = new Capture<Collection<ServiceComponentHost>>();
Capture<Cluster> clusterCapture = new Capture<Cluster>();
expect(managementController1.createStages(capture(clusterCapture), capture(requestPropertiesCapture), capture(requestParametersCapture), capture(changedServicesCapture), capture(changedCompsCapture), capture(changedScHostsCapture), capture(ignoredScHostsCapture), anyBoolean(), anyBoolean()
)).andReturn(response1);
expect(managementController2.createStages(capture(clusterCapture), capture(requestPropertiesCapture), capture(requestParametersCapture), capture(changedServicesCapture), capture(changedCompsCapture), capture(changedScHostsCapture), capture(ignoredScHostsCapture), anyBoolean(), anyBoolean()
)).andReturn(response2);
// replay
replay(managementController1, response1, managementController2, response2,
clusters, cluster, service0, serviceResponse0, ambariMetaInfo);