NhinDocRetrieveProxyWebServiceSecuredImpl implements NhinDocRetrieveProxy { @NwhinInvocationEvent(beforeBuilder = RetrieveDocumentSetRequestTypeDescriptionBuilder.class, afterReturningBuilder = RetrieveDocumentSetResponseTypeDescriptionBuilder.class, serviceType = "Retrieve Document", version = "") @Override public RetrieveDocumentSetResponseType respondingGatewayCrossGatewayRetrieve( final RetrieveDocumentSetRequestType request, final AssertionType assertion, final NhinTargetSystemType targetSystem, final GATEWAY_API_LEVEL level) { String url; RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); final String sServiceName = NhincConstants.DOC_RETRIEVE_SERVICE_NAME; try { if (request != null) { LOG.debug("Before target system URL look up."); url = getUrl(targetSystem, sServiceName, level); LOG.debug("After target system URL look up. URL for service: " + sServiceName + " is: " + url); if (NullChecker.isNotNullish(url)) { final ServicePortDescriptor<RespondingGatewayRetrievePortType> portDescriptor = getServicePortDescriptor( NhincConstants.GATEWAY_API_LEVEL.LEVEL_g0); final CONNECTClient<RespondingGatewayRetrievePortType> client = getCONNECTClientSecured( portDescriptor, assertion, url, targetSystem); client.enableMtom(); response = (RetrieveDocumentSetResponseType) client.invokePort( RespondingGatewayRetrievePortType.class, "respondingGatewayCrossGatewayRetrieve", request); } else { throw new WebServiceException("Could not determine URL for Nhin Doc Retrieve endpoint"); } } else { throw new IllegalArgumentException("Request Message must be provided"); } } catch (final ExchangeManagerException e) { final XDCommonResponseHelper helper = new XDCommonResponseHelper(); final RegistryResponseType error = helper.createError(e.getLocalizedMessage(), ErrorCodes.XDSRepositoryError, NhincConstants.INIT_MULTISPEC_LOC_ENTITY_DR); response = new RetrieveDocumentSetResponseType(); response.setRegistryResponse(error); throw new ErrorEventException(e, response, "Unable to call Nhin Doc Retrieve"); } catch (final Exception e) { response = MessageGenerator.getInstance() .createRegistryResponseError("Nhin Document Retrieve Processing"); throw new ErrorEventException(e, response, "Unable to call Nhin Doc Retrieve"); } return response; }  @NwhinInvocationEvent(beforeBuilder = RetrieveDocumentSetRequestTypeDescriptionBuilder.class, afterReturningBuilder = RetrieveDocumentSetResponseTypeDescriptionBuilder.class, serviceType = "Retrieve Document", version = "") @Override RetrieveDocumentSetResponseType respondingGatewayCrossGatewayRetrieve(
        final RetrieveDocumentSetRequestType request, final AssertionType assertion,
        final NhinTargetSystemType targetSystem, final GATEWAY_API_LEVEL level); ServicePortDescriptor<RespondingGatewayRetrievePortType> getServicePortDescriptor(
        final NhincConstants.GATEWAY_API_LEVEL apiLevel);  }
@Test public void testMtomg0() throws Exception { NhinDocRetrieveProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1", "2.0"); when(cache.getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString())) .thenReturn("endpoint"); impl.respondingGatewayCrossGatewayRetrieve(request, assertion, target, GATEWAY_API_LEVEL.LEVEL_g0); verify(client).enableMtom(); }
@Test public void testMtomg1() throws Exception { NhinDocRetrieveProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1", "2.0"); when(cache.getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString())) .thenReturn("endpoint"); impl.respondingGatewayCrossGatewayRetrieve(request, assertion, target, GATEWAY_API_LEVEL.LEVEL_g1); verify(client).enableMtom(); }
@Test public void testGuidanceg0() throws Exception { NhinDocRetrieveProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1", "3.0"); when(cache.getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString())) .thenReturn("endpoint"); impl.respondingGatewayCrossGatewayRetrieve(request, assertion, target, GATEWAY_API_LEVEL.LEVEL_g0); verify(cache).getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString()); }
@Test public void testGuidanceg1() throws Exception { NhinDocRetrieveProxyWebServiceSecuredImpl impl = getImpl(); NhinTargetSystemType target = getTarget("1.1", "3.0"); when(cache.getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString())) .thenReturn("endpoint"); impl.respondingGatewayCrossGatewayRetrieve(request, assertion, target, GATEWAY_API_LEVEL.LEVEL_g1); verify(cache).getEndpointURL(anyString(), anyString(), any(UDDI_SPEC_VERSION.class), anyString()); }