@Test public void testGetActions() throws Exception { int requestId = 500; ActionQueue queue = createNiceMock(ActionQueue.class); ActionDBAccessor db = createStrictMock(ActionDBAccessor.class); Clusters clusters = createNiceMock(Clusters.class); Stage stage1 = createNiceMock(Stage.class); Stage stage2 = createNiceMock(Stage.class); List<Stage> listStages = new ArrayList<Stage>(); listStages.add(stage1); listStages.add(stage2); expect(db.getLastPersistedRequestIdWhenInitialized()).andReturn(Long.valueOf(1000)); expect(db.getAllStages(requestId)).andReturn(listStages); replay(queue, db, clusters); ActionScheduler actionScheduler = new ActionScheduler(0, 0, db, createNiceMock(JPAEventPublisher.class)); ActionManager manager = new ActionManager(db, injector.getInstance(RequestFactory.class), actionScheduler); assertSame(listStages, manager.getActions(requestId)); verify(queue, db, clusters); }
public List<Stage> getActions(long requestId) { return db.getAllStages(requestId); }
ActionManager { public List<Stage> getActions(long requestId) { return db.getAllStages(requestId); } }
ActionManager { public List<Stage> getActions(long requestId) { return db.getAllStages(requestId); } @Inject  ActionManager(ActionDBAccessor db, RequestFactory requestFactory,
      ActionScheduler scheduler); }
ActionManager { public List<Stage> getActions(long requestId) { return db.getAllStages(requestId); } @Inject  ActionManager(ActionDBAccessor db, RequestFactory requestFactory,
      ActionScheduler scheduler); void start(); void shutdown(); void sendActions(List<Stage> stages, ExecuteActionRequest actionRequest); void sendActions(Request request, ExecuteActionRequest executeActionRequest); List<Request> getRequests(Collection<Long> requestIds); List<Stage> getRequestStatus(long requestId); Stage getAction(long requestId, long stageId); List<Stage> getActions(long requestId); HostRoleCommand getTaskById(long taskId); void processTaskResponse(String hostname, List<CommandReport> reports,
                                  Map<Long, HostRoleCommand> commands); boolean isInProgressCommand(CommandReport report); void handleLostHost(String host); long getNextRequestId(); List<HostRoleCommand> getRequestTasks(long requestId); List<HostRoleCommand> getAllTasksByRequestIds(Collection<Long> requestIds); Collection<HostRoleCommand> getTasks(Collection<Long> taskIds); Map<Long, HostRoleCommand> getTasksMap(Collection<Long> taskIds); List<Long> getRequestsByStatus(RequestStatus status, int maxResults, boolean ascOrder); Map<Long, String> getRequestContext(List<Long> requestIds); String getRequestContext(long requestId); void cancelRequest(long requestId, String reason); static void setTopologyManager(TopologyManager topologyManager); void resubmitTasks(List<Long> taskIds); }
ActionManager { public List<Stage> getActions(long requestId) { return db.getAllStages(requestId); } @Inject  ActionManager(ActionDBAccessor db, RequestFactory requestFactory,
      ActionScheduler scheduler); void start(); void shutdown(); void sendActions(List<Stage> stages, ExecuteActionRequest actionRequest); void sendActions(Request request, ExecuteActionRequest executeActionRequest); List<Request> getRequests(Collection<Long> requestIds); List<Stage> getRequestStatus(long requestId); Stage getAction(long requestId, long stageId); List<Stage> getActions(long requestId); HostRoleCommand getTaskById(long taskId); void processTaskResponse(String hostname, List<CommandReport> reports,
                                  Map<Long, HostRoleCommand> commands); boolean isInProgressCommand(CommandReport report); void handleLostHost(String host); long getNextRequestId(); List<HostRoleCommand> getRequestTasks(long requestId); List<HostRoleCommand> getAllTasksByRequestIds(Collection<Long> requestIds); Collection<HostRoleCommand> getTasks(Collection<Long> taskIds); Map<Long, HostRoleCommand> getTasksMap(Collection<Long> taskIds); List<Long> getRequestsByStatus(RequestStatus status, int maxResults, boolean ascOrder); Map<Long, String> getRequestContext(List<Long> requestIds); String getRequestContext(long requestId); void cancelRequest(long requestId, String reason); static void setTopologyManager(TopologyManager topologyManager); void resubmitTasks(List<Long> taskIds);  }