public void testCreateRequestSchedule() throws Exception {
AmbariManagementController managementController = createMock(AmbariManagementController.class);
RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
Clusters clusters = createNiceMock(Clusters.class);
Cluster cluster = createNiceMock(Cluster.class);
RequestExecutionFactory executionFactory = createNiceMock
(RequestExecutionFactory.class);
RequestExecution requestExecution = createNiceMock(RequestExecution.class);
ExecutionScheduleManager executionScheduleManager = createNiceMock
(ExecutionScheduleManager.class);
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(managementController.getClusters()).andReturn(clusters);
expect(managementController.getExecutionScheduleManager()).andReturn
(executionScheduleManager).anyTimes();
expect(managementController.getRequestExecutionFactory()).andReturn
(executionFactory);
expect(managementController.getAuthName()).andReturn("admin").anyTimes();
Capture<Cluster> clusterCapture = new Capture<Cluster>();
Capture<Batch> batchCapture = new Capture<Batch>();
Capture<Schedule> scheduleCapture = new Capture<Schedule>();
expect(executionFactory.createNew(capture(clusterCapture),
capture(batchCapture), capture(scheduleCapture))).andReturn(requestExecution);
replay(managementController, clusters, cluster, executionFactory,
requestExecution, response, executionScheduleManager);