@Test public void testPersist_noStages() throws AmbariException { ActionManager actionManager = createStrictMock(ActionManager.class); RequestFactory requestFactory = createStrictMock(RequestFactory.class); replay(actionManager, requestFactory); RequestStageContainer requestStages = new RequestStageContainer(1L, null, requestFactory, actionManager); requestStages.persist(); verify(actionManager, requestFactory); }
public void persist() throws AmbariException { if (!stages.isEmpty()) { Request request = (null == actionRequest) ? requestFactory.createNewFromStages(stages) : requestFactory.createNewFromStages(stages, actionRequest); if (null != requestContext) { request.setRequestContext(requestContext); } if (request != null && request.getStages()!= null && !request.getStages().isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Triggering Action Manager, request=%s", request)); } actionManager.sendActions(request, actionRequest); } } }
RequestStageContainer { public void persist() throws AmbariException { if (!stages.isEmpty()) { Request request = (null == actionRequest) ? requestFactory.createNewFromStages(stages) : requestFactory.createNewFromStages(stages, actionRequest); if (null != requestContext) { request.setRequestContext(requestContext); } if (request != null && request.getStages()!= null && !request.getStages().isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Triggering Action Manager, request=%s", request)); } actionManager.sendActions(request, actionRequest); } } } }
RequestStageContainer { public void persist() throws AmbariException { if (!stages.isEmpty()) { Request request = (null == actionRequest) ? requestFactory.createNewFromStages(stages) : requestFactory.createNewFromStages(stages, actionRequest); if (null != requestContext) { request.setRequestContext(requestContext); } if (request != null && request.getStages()!= null && !request.getStages().isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Triggering Action Manager, request=%s", request)); } actionManager.sendActions(request, actionRequest); } } } RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager);  RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager,
                               ExecuteActionRequest actionRequest); }
RequestStageContainer { public void persist() throws AmbariException { if (!stages.isEmpty()) { Request request = (null == actionRequest) ? requestFactory.createNewFromStages(stages) : requestFactory.createNewFromStages(stages, actionRequest); if (null != requestContext) { request.setRequestContext(requestContext); } if (request != null && request.getStages()!= null && !request.getStages().isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Triggering Action Manager, request=%s", request)); } actionManager.sendActions(request, actionRequest); } } } RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager);  RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager,
                               ExecuteActionRequest actionRequest); Long getId(); void addStages(List<Stage> stages); List<Stage> getStages(); long getLastStageId(); void setRequestContext(String context); State getProjectedState(String host, String component); void persist(); RequestStatusResponse getRequestStatusResponse(); }
RequestStageContainer { public void persist() throws AmbariException { if (!stages.isEmpty()) { Request request = (null == actionRequest) ? requestFactory.createNewFromStages(stages) : requestFactory.createNewFromStages(stages, actionRequest); if (null != requestContext) { request.setRequestContext(requestContext); } if (request != null && request.getStages()!= null && !request.getStages().isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Triggering Action Manager, request=%s", request)); } actionManager.sendActions(request, actionRequest); } } } RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager);  RequestStageContainer(Long id, List<Stage> stages, RequestFactory factory, ActionManager manager,
                               ExecuteActionRequest actionRequest); Long getId(); void addStages(List<Stage> stages); List<Stage> getStages(); long getLastStageId(); void setRequestContext(String context); State getProjectedState(String host, String component); void persist(); RequestStatusResponse getRequestStatusResponse();  }