OutboundDocQueryAggregator implements NhinAggregator { protected String determineAggregateStatus(final String aggregateStatus, final String individualStatus) { if (aggregateStatus == null) { return individualStatus; } else { if (isEitherParitalSuccess(aggregateStatus, individualStatus)) { return DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS; } else { if (areTheStatusesDifferent(aggregateStatus, individualStatus)) { return DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS; } } } return aggregateStatus; }  void increaseCount(AdhocQueryResponse aggregate); void aggregate(OutboundDocQueryOrchestratable to, OutboundDocQueryOrchestratable from); @Override void aggregate(OutboundOrchestratable to, OutboundOrchestratable from);  }
@Test public void testCasesForPartialSuccess() { assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, nhinAggregator.determineAggregateStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, null)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, nhinAggregator.determineAggregateStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, nhinAggregator.determineAggregateStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, nhinAggregator.determineAggregateStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE)); }
@Test public void testCasesForSuccess() { assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS, nhinAggregator.determineAggregateStatus(null, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS, nhinAggregator.determineAggregateStatus( DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_SUCCESS)); }
@Test public void testCasesForFailure() { assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, nhinAggregator.determineAggregateStatus(null, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, nhinAggregator.determineAggregateStatus( DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE)); }