AdapterDocQueryOrchImpl { public AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion) { LOG.debug("Enter AdapterDocQueryOrchImpl.respondingGatewayCrossGatewayQuery()"); AdhocQueryResponse response = null; try { if (request != null) { AdapterComponentDocRegistryProxyObjectFactory objFactory = new AdapterComponentDocRegistryProxyObjectFactory(); AdapterComponentDocRegistryProxy registryProxy = objFactory.getAdapterComponentDocRegistryProxy(); AdhocQueryRequest adhocQueryRequest = new AdhocQueryRequest(); adhocQueryRequest.setAdhocQuery(request.getAdhocQuery()); adhocQueryRequest.setResponseOption(request.getResponseOption()); adhocQueryRequest.setComment(request.getComment()); adhocQueryRequest.setFederated(request.isFederated()); adhocQueryRequest.setFederation(request.getFederation()); adhocQueryRequest.setId(request.getId()); adhocQueryRequest.setMaxResults(request.getMaxResults()); adhocQueryRequest.setRequestSlotList(request.getRequestSlotList()); adhocQueryRequest.setStartIndex(request.getStartIndex()); response = registryProxy.registryStoredQuery(request, assertion); } else { throw new IllegalArgumentException("Request must be provided."); } } catch (Exception e) { RegistryErrorList errorList = new RegistryErrorList(); response = new AdhocQueryResponse(); response.setRegistryObjectList(new RegistryObjectListType()); response.setStatus(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE); RegistryError err = new RegistryError(); errorList.getRegistryError().add(err); response.setRegistryErrorList(errorList); err.setValue(ERROR_VALUE); err.setSeverity(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR); err.setCodeContext(ERROR_CODE_CONTEXT); err.setErrorCode(DocumentConstants.XDS_ERRORCODE_REPOSITORY_ERROR); throw new ErrorEventException(e, response, "Unable to query document registry."); } LOG.debug("End AdapterDocQueryOrchImpl.respondingGatewayCrossGatewayQuery()"); return response; }  AdhocQueryResponse respondingGatewayCrossGatewayQuery(AdhocQueryRequest request, AssertionType assertion);  }
@Test public void errorResponseHasRegistryObjectList() { AdapterDocQueryOrchImpl impl = new AdapterDocQueryOrchImpl(); try { impl.respondingGatewayCrossGatewayQuery(null, null); Assert.fail(); } catch (ErrorEventException e) { AdhocQueryResponse response = (AdhocQueryResponse) e.getReturnOverride(); assertNotNull(response.getRegistryObjectList()); assertEquals(0, response.getRegistryObjectList().getIdentifiable().size()); } }
@Test public void errorResponseHasRegistryObjectList() throws Exception { AdapterDocQueryOrchImpl impl = new AdapterDocQueryOrchImpl(); try { impl.respondingGatewayCrossGatewayQuery(null, null); Assert.fail(); } catch (ErrorEventException e) { AdhocQueryResponse response = (AdhocQueryResponse) e.getReturnOverride(); assertNotNull(response.getRegistryObjectList()); assertEquals(0, response.getRegistryObjectList().getIdentifiable().size()); AdhocQueryResponseAsserter.assertSchemaCompliant(response); } }