@Test
  public void testGetCompletedRequests() throws AmbariException {
    List<Long> requestIds = new ArrayList<>();
    requestIds.add(requestId);
    requestIds.add(requestId + 1);

    // populate with a completed request
    populateActionDBWithCompletedRequest(db, hostName, requestId, stageId);

    // only 1 should come back
    List<Long> requestIdsResult = db.getRequestsByStatus(RequestStatus.COMPLETED,
        BaseRequest.DEFAULT_PAGE_SIZE, false);

    assertEquals(1, requestIdsResult.size());
    assertTrue(requestIdsResult.contains(requestId));

    // populate with a partially completed request
    populateActionDBWithPartiallyCompletedRequest(db, hostName, requestId + 1, stageId);

    // the new request should not come back
    requestIdsResult = db.getRequestsByStatus(RequestStatus.COMPLETED,
        BaseRequest.DEFAULT_PAGE_SIZE, false);

    assertEquals(1, requestIdsResult.size());
    assertTrue(requestIdsResult.contains(requestId));
  }
Tests getting requests which are fully COMPLETED out the database. This
will test for partial completions as well.

@throws AmbariException
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java