@Test
public void testGetResourcesInProgress() throws Exception {
Resource.Type type = Resource.Type.Request;
AmbariManagementController managementController = createMock(AmbariManagementController.class);
ActionManager actionManager = createNiceMock(ActionManager.class);
HostRoleCommand hostRoleCommand0 = createNiceMock(HostRoleCommand.class);
HostRoleCommand hostRoleCommand1 = createNiceMock(HostRoleCommand.class);
HostRoleCommand hostRoleCommand2 = createNiceMock(HostRoleCommand.class);
HostRoleCommand hostRoleCommand3 = createNiceMock(HostRoleCommand.class);
List<HostRoleCommand> hostRoleCommands0 = new LinkedList<HostRoleCommand>();
hostRoleCommands0.add(hostRoleCommand0);
hostRoleCommands0.add(hostRoleCommand1);
List<HostRoleCommand> hostRoleCommands1 = new LinkedList<HostRoleCommand>();
hostRoleCommands1.add(hostRoleCommand2);
hostRoleCommands1.add(hostRoleCommand3);
org.apache.ambari.server.actionmanager.Request requestMock0 =
createNiceMock(org.apache.ambari.server.actionmanager.Request.class);
expect(requestMock0.getCommands()).andReturn(hostRoleCommands0).anyTimes();
expect(requestMock0.getRequestContext()).andReturn("this is a context").anyTimes();
expect(requestMock0.getRequestId()).andReturn(100L).anyTimes();
org.apache.ambari.server.actionmanager.Request requestMock1 =
createNiceMock(org.apache.ambari.server.actionmanager.Request.class);
expect(requestMock1.getCommands()).andReturn(hostRoleCommands1).anyTimes();
expect(requestMock1.getRequestContext()).andReturn("this is a context").anyTimes();
expect(requestMock1.getRequestId()).andReturn(101L).anyTimes();
Capture<Collection<Long>> requestIdsCapture = new Capture<Collection<Long>>();
// set expectations
expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
expect(actionManager.getRequests(capture(requestIdsCapture))).andReturn(Arrays.asList(requestMock0));
expect(actionManager.getRequests(capture(requestIdsCapture))).andReturn(Arrays.asList(requestMock1));
expect(hostRoleCommand0.getRequestId()).andReturn(100L).anyTimes();
expect(hostRoleCommand1.getRequestId()).andReturn(100L).anyTimes();
expect(hostRoleCommand2.getRequestId()).andReturn(101L).anyTimes();