public void testUpdateRequestSchedule() throws Exception {
AmbariManagementController managementController = createMock(AmbariManagementController.class);
RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
Clusters clusters = createNiceMock(Clusters.class);
Cluster cluster = createNiceMock(Cluster.class);
final RequestExecution requestExecution = createNiceMock(RequestExecution.class);
RequestScheduleResponse requestScheduleResponse = createNiceMock
(RequestScheduleResponse.class);
ExecutionScheduleManager executionScheduleManager = createNiceMock
(ExecutionScheduleManager.class);
expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(managementController.getAuthName()).andReturn("admin").anyTimes();
expect(managementController.getExecutionScheduleManager()).andReturn
(executionScheduleManager).anyTimes();
expect(requestExecution.getId()).andReturn(25L).anyTimes();
expect(requestExecution.convertToResponse()).andReturn
(requestScheduleResponse).anyTimes();
expect(requestExecution.convertToResponseWithBody()).andReturn
(requestScheduleResponse).anyTimes();
expect(requestScheduleResponse.getId()).andReturn(25L).anyTimes();
expect(requestScheduleResponse.getClusterName()).andReturn("Cluster100")
.anyTimes();
expect(cluster.getAllRequestExecutions()).andStubAnswer(new IAnswer<Map<Long, RequestExecution>>() {
@Override
public Map<Long, RequestExecution> answer() throws Throwable {
Map<Long, RequestExecution> requestExecutionMap = new HashMap<Long,
RequestExecution>();
requestExecutionMap.put(requestExecution.getId(), requestExecution);
return requestExecutionMap;
}
});
replay(managementController, clusters, cluster, requestExecution,