Search in sources :

Example 1 with WsdlRequestData

use of ee.ria.xroad.proxy.common.WsdlRequestData in project X-Road by nordic-institute.

the class MetadataServiceHandlerTest method shouldThrowUnknownServiceWhenWsdlUrlNotFound.

@Test
public void shouldThrowUnknownServiceWhenWsdlUrlNotFound() throws Exception {
    final ServiceId serviceId = ServiceId.create(DEFAULT_CLIENT, GET_WSDL);
    final ServiceId requestingWsdlForService = ServiceId.create(DEFAULT_CLIENT, "someServiceWithoutWsdl");
    MetadataServiceHandlerImpl handlerToTest = new MetadataServiceHandlerImpl();
    WsdlRequestData wsdlRequestData = new WsdlRequestData();
    wsdlRequestData.setServiceCode(requestingWsdlForService.getServiceCode());
    InputStream soapContentInputStream = new TestSoapBuilder().withClient(DEFAULT_CLIENT).withService(serviceId).withModifiedBody(soapBody -> marshaller.marshal(wsdlRequestData, soapBody)).buildAsInputStream();
    when(mockProxyMessage.getSoapContent()).thenReturn(soapContentInputStream);
    handlerToTest.canHandle(serviceId, mockProxyMessage);
    thrown.expect(CodedException.class);
    thrown.expect(faultCodeEquals(X_UNKNOWN_SERVICE));
    thrown.expectMessage(containsString("Could not find wsdl URL for service"));
    // execution, should throw..
    handlerToTest.startHandling(mockRequest, mockProxyMessage, httpClientMock, mock(OpMonitoringData.class));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) XMLUnit(org.custommonkey.xmlunit.XMLUnit) Arrays(java.util.Arrays) ServiceDescriptionType(ee.ria.xroad.common.conf.serverconf.model.ServiceDescriptionType) MetaserviceTestUtil(ee.ria.xroad.proxy.util.MetaserviceTestUtil) SOAPException(javax.xml.soap.SOAPException) URISyntaxException(java.net.URISyntaxException) MethodListType(ee.ria.xroad.common.metadata.MethodListType) MimeException(org.apache.james.mime4j.MimeException) ServiceType(ee.ria.xroad.common.conf.serverconf.model.ServiceType) GET_WSDL_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.GET_WSDL_REQUEST) DescriptionType(ee.ria.xroad.common.conf.serverconf.model.DescriptionType) ServiceId(ee.ria.xroad.common.identifier.ServiceId) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) Assert.assertThat(org.junit.Assert.assertThat) ByteArrayInputStream(java.io.ByteArrayInputStream) ALLOWED_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS) AbstractContentHandler(org.apache.james.mime4j.parser.AbstractContentHandler) After(org.junit.After) LIST_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS) ClientType(ee.ria.xroad.common.conf.serverconf.model.ClientType) WireMock.aResponse(com.github.tomakehurst.wiremock.client.WireMock.aResponse) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) CodedExceptionMatcher.faultCodeEquals(ee.ria.xroad.proxy.util.MetaserviceTestUtil.CodedExceptionMatcher.faultCodeEquals) Field(org.apache.james.mime4j.stream.Field) ProxyMessage(ee.ria.xroad.proxy.protocol.ProxyMessage) JAXBException(javax.xml.bind.JAXBException) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) StandardCharsets(java.nio.charset.StandardCharsets) SystemProperties(ee.ria.xroad.common.SystemProperties) KeyConf(ee.ria.xroad.proxy.conf.KeyConf) IOUtils(org.apache.commons.io.IOUtils) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) TestSuiteGlobalConf(ee.ria.xroad.proxy.testsuite.TestSuiteGlobalConf) X_UNKNOWN_SERVICE(ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) ProvideSystemProperty(org.junit.contrib.java.lang.system.ProvideSystemProperty) ServerConfDatabaseCtx.doInTransaction(ee.ria.xroad.common.conf.serverconf.ServerConfDatabaseCtx.doInTransaction) Matchers.containsString(org.hamcrest.Matchers.containsString) TestSuiteServerConf(ee.ria.xroad.proxy.testsuite.TestSuiteServerConf) ServerConfType(ee.ria.xroad.common.conf.serverconf.model.ServerConfType) Mockito.mock(org.mockito.Mockito.mock) ALLOWED_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.ALLOWED_METHODS_REQUEST) Getter(lombok.Getter) BeforeClass(org.junit.BeforeClass) ObjectFactory(ee.ria.xroad.common.metadata.ObjectFactory) WSDLReader(javax.wsdl.xml.WSDLReader) Marshaller(javax.xml.bind.Marshaller) MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition) GlobalConf(ee.ria.xroad.common.conf.globalconf.GlobalConf) WireMock(com.github.tomakehurst.wiremock.client.WireMock) HttpServletRequest(javax.servlet.http.HttpServletRequest) WSDLFactory(javax.wsdl.factory.WSDLFactory) MessageFactory(javax.xml.soap.MessageFactory) HttpClient(org.apache.http.client.HttpClient) SoapHeader(ee.ria.xroad.common.message.SoapHeader) BodyDescriptor(org.apache.james.mime4j.stream.BodyDescriptor) ExpectedException(org.junit.rules.ExpectedException) JAXBContext(javax.xml.bind.JAXBContext) Before(org.junit.Before) WireMock.urlPathEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo) InputSource(org.xml.sax.InputSource) Unmarshaller(javax.xml.bind.Unmarshaller) X_INVALID_SERVICE_TYPE(ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE) Definition(javax.wsdl.Definition) TEXT_XML_UTF8(ee.ria.xroad.common.util.MimeTypes.TEXT_XML_UTF8) Files(java.nio.file.Files) REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.REQUEST) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType(ee.ria.xroad.proxy.util.MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType) HttpServletResponse(javax.servlet.http.HttpServletResponse) WireMockConfiguration.options(com.github.tomakehurst.wiremock.core.WireMockConfiguration.options) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) LIST_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.LIST_METHODS_REQUEST) OpMonitoringData(ee.ria.xroad.common.opmonitoring.OpMonitoringData) WSDLException(javax.wsdl.WSDLException) CodedException(ee.ria.xroad.common.CodedException) MimeTypes(ee.ria.xroad.common.util.MimeTypes) Rule(org.junit.Rule) Paths(java.nio.file.Paths) ErrorCodes(ee.ria.xroad.common.ErrorCodes) GET_WSDL(ee.ria.xroad.common.metadata.MetadataRequests.GET_WSDL) HEADER_CONTENT_TYPE(ee.ria.xroad.common.util.MimeUtils.HEADER_CONTENT_TYPE) SOAPMessage(javax.xml.soap.SOAPMessage) ServerConf(ee.ria.xroad.common.conf.serverconf.ServerConf) ClientId(ee.ria.xroad.common.identifier.ClientId) TestSuiteKeyConf(ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf) MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition) Diff(org.custommonkey.xmlunit.Diff) InputStream(java.io.InputStream) OpMonitoringData(ee.ria.xroad.common.opmonitoring.OpMonitoringData) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) ServiceId(ee.ria.xroad.common.identifier.ServiceId) Test(org.junit.Test)

Example 2 with WsdlRequestData

use of ee.ria.xroad.proxy.common.WsdlRequestData in project X-Road by nordic-institute.

the class MetadataServiceHandlerImpl method handleGetWsdl.

private void handleGetWsdl(SoapMessageImpl request) throws Exception {
    log.trace("handleGetWsdl()");
    Unmarshaller um = JaxbUtils.createUnmarshaller(WsdlRequestData.class);
    WsdlRequestData requestData = um.unmarshal(SoapUtils.getFirstChild(request.getSoap().getSOAPBody()), WsdlRequestData.class).getValue();
    if (StringUtils.isBlank(requestData.getServiceCode())) {
        throw new CodedException(X_INVALID_REQUEST, "Missing serviceCode in message body");
    }
    ServiceId serviceId = requestData.toServiceId(request.getService().getClientId());
    String url = getWsdlUrl(serviceId);
    if (url == null) {
        throw new CodedException(X_UNKNOWN_SERVICE, "Could not find wsdl URL for service %s", requestData.toServiceId(request.getService().getClientId()));
    }
    log.info("Downloading WSDL from URL: {}", url);
    try (InputStream in = modifyWsdl(getWsdl(url, serviceId))) {
        Map<String, String> additionalHeaders = new HashMap<>();
        additionalHeaders.put("Content-Transfer-Encoding", "binary");
        additionalHeaders.put("Content-ID", "<wsdl=" + UUID.randomUUID().toString() + "@x-road.eu>");
        responseEncoder.soap(SoapUtils.toResponse(request), new HashMap<>());
        responseEncoder.attachment(MimeTypes.TEXT_XML, in, additionalHeaders);
    }
}
Also used : CodedException(ee.ria.xroad.common.CodedException) HashMap(java.util.HashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) Unmarshaller(javax.xml.bind.Unmarshaller) ServiceId(ee.ria.xroad.common.identifier.ServiceId)

Example 3 with WsdlRequestData

use of ee.ria.xroad.proxy.common.WsdlRequestData in project X-Road by nordic-institute.

the class MetadataServiceHandlerTest method shouldThrowRuntimeExWhenWsdlUrlNotOk200.

@Test
public void shouldThrowRuntimeExWhenWsdlUrlNotOk200() throws Exception {
    final ServiceId serviceId = ServiceId.create(DEFAULT_CLIENT, GET_WSDL);
    final ServiceId requestingWsdlForService = ServiceId.create(DEFAULT_CLIENT, "someServiceWithWsdl122");
    MetadataServiceHandlerImpl handlerToTest = new MetadataServiceHandlerImpl();
    WsdlRequestData wsdlRequestData = new WsdlRequestData();
    wsdlRequestData.setServiceCode(requestingWsdlForService.getServiceCode());
    InputStream soapContentInputStream = new TestSoapBuilder().withClient(DEFAULT_CLIENT).withService(serviceId).withModifiedBody(soapBody -> marshaller.marshal(wsdlRequestData, soapBody)).buildAsInputStream();
    when(mockProxyMessage.getSoapContent()).thenReturn(soapContentInputStream);
    setUpDatabase(requestingWsdlForService);
    mockServer.stubFor(WireMock.any(urlPathEqualTo(EXPECTED_WSDL_QUERY_PATH)).willReturn(aResponse().withStatus(HttpServletResponse.SC_FORBIDDEN)));
    mockServer.start();
    handlerToTest.canHandle(serviceId, mockProxyMessage);
    thrown.expect(RuntimeException.class);
    thrown.expectMessage(containsString("Received HTTP error: 403 - Forbidden"));
    // execution, should throw..
    handlerToTest.startHandling(mockRequest, mockProxyMessage, httpClientMock, mock(OpMonitoringData.class));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) XMLUnit(org.custommonkey.xmlunit.XMLUnit) Arrays(java.util.Arrays) ServiceDescriptionType(ee.ria.xroad.common.conf.serverconf.model.ServiceDescriptionType) MetaserviceTestUtil(ee.ria.xroad.proxy.util.MetaserviceTestUtil) SOAPException(javax.xml.soap.SOAPException) URISyntaxException(java.net.URISyntaxException) MethodListType(ee.ria.xroad.common.metadata.MethodListType) MimeException(org.apache.james.mime4j.MimeException) ServiceType(ee.ria.xroad.common.conf.serverconf.model.ServiceType) GET_WSDL_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.GET_WSDL_REQUEST) DescriptionType(ee.ria.xroad.common.conf.serverconf.model.DescriptionType) ServiceId(ee.ria.xroad.common.identifier.ServiceId) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) Assert.assertThat(org.junit.Assert.assertThat) ByteArrayInputStream(java.io.ByteArrayInputStream) ALLOWED_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS) AbstractContentHandler(org.apache.james.mime4j.parser.AbstractContentHandler) After(org.junit.After) LIST_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS) ClientType(ee.ria.xroad.common.conf.serverconf.model.ClientType) WireMock.aResponse(com.github.tomakehurst.wiremock.client.WireMock.aResponse) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) CodedExceptionMatcher.faultCodeEquals(ee.ria.xroad.proxy.util.MetaserviceTestUtil.CodedExceptionMatcher.faultCodeEquals) Field(org.apache.james.mime4j.stream.Field) ProxyMessage(ee.ria.xroad.proxy.protocol.ProxyMessage) JAXBException(javax.xml.bind.JAXBException) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) StandardCharsets(java.nio.charset.StandardCharsets) SystemProperties(ee.ria.xroad.common.SystemProperties) KeyConf(ee.ria.xroad.proxy.conf.KeyConf) IOUtils(org.apache.commons.io.IOUtils) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) TestSuiteGlobalConf(ee.ria.xroad.proxy.testsuite.TestSuiteGlobalConf) X_UNKNOWN_SERVICE(ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) ProvideSystemProperty(org.junit.contrib.java.lang.system.ProvideSystemProperty) ServerConfDatabaseCtx.doInTransaction(ee.ria.xroad.common.conf.serverconf.ServerConfDatabaseCtx.doInTransaction) Matchers.containsString(org.hamcrest.Matchers.containsString) TestSuiteServerConf(ee.ria.xroad.proxy.testsuite.TestSuiteServerConf) ServerConfType(ee.ria.xroad.common.conf.serverconf.model.ServerConfType) Mockito.mock(org.mockito.Mockito.mock) ALLOWED_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.ALLOWED_METHODS_REQUEST) Getter(lombok.Getter) BeforeClass(org.junit.BeforeClass) ObjectFactory(ee.ria.xroad.common.metadata.ObjectFactory) WSDLReader(javax.wsdl.xml.WSDLReader) Marshaller(javax.xml.bind.Marshaller) MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition) GlobalConf(ee.ria.xroad.common.conf.globalconf.GlobalConf) WireMock(com.github.tomakehurst.wiremock.client.WireMock) HttpServletRequest(javax.servlet.http.HttpServletRequest) WSDLFactory(javax.wsdl.factory.WSDLFactory) MessageFactory(javax.xml.soap.MessageFactory) HttpClient(org.apache.http.client.HttpClient) SoapHeader(ee.ria.xroad.common.message.SoapHeader) BodyDescriptor(org.apache.james.mime4j.stream.BodyDescriptor) ExpectedException(org.junit.rules.ExpectedException) JAXBContext(javax.xml.bind.JAXBContext) Before(org.junit.Before) WireMock.urlPathEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo) InputSource(org.xml.sax.InputSource) Unmarshaller(javax.xml.bind.Unmarshaller) X_INVALID_SERVICE_TYPE(ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE) Definition(javax.wsdl.Definition) TEXT_XML_UTF8(ee.ria.xroad.common.util.MimeTypes.TEXT_XML_UTF8) Files(java.nio.file.Files) REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.REQUEST) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType(ee.ria.xroad.proxy.util.MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType) HttpServletResponse(javax.servlet.http.HttpServletResponse) WireMockConfiguration.options(com.github.tomakehurst.wiremock.core.WireMockConfiguration.options) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) LIST_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.LIST_METHODS_REQUEST) OpMonitoringData(ee.ria.xroad.common.opmonitoring.OpMonitoringData) WSDLException(javax.wsdl.WSDLException) CodedException(ee.ria.xroad.common.CodedException) MimeTypes(ee.ria.xroad.common.util.MimeTypes) Rule(org.junit.Rule) Paths(java.nio.file.Paths) ErrorCodes(ee.ria.xroad.common.ErrorCodes) GET_WSDL(ee.ria.xroad.common.metadata.MetadataRequests.GET_WSDL) HEADER_CONTENT_TYPE(ee.ria.xroad.common.util.MimeUtils.HEADER_CONTENT_TYPE) SOAPMessage(javax.xml.soap.SOAPMessage) ServerConf(ee.ria.xroad.common.conf.serverconf.ServerConf) ClientId(ee.ria.xroad.common.identifier.ClientId) TestSuiteKeyConf(ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf) MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition) Diff(org.custommonkey.xmlunit.Diff) InputStream(java.io.InputStream) OpMonitoringData(ee.ria.xroad.common.opmonitoring.OpMonitoringData) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) ServiceId(ee.ria.xroad.common.identifier.ServiceId) Test(org.junit.Test)

Example 4 with WsdlRequestData

use of ee.ria.xroad.proxy.common.WsdlRequestData in project X-Road by nordic-institute.

the class MetadataServiceHandlerTest method prepareTestConstructsForWsdl.

/**
 * Prepare TestMetadataServiceHandlerImpl, wiremock, et al for get WSDL tests
 */
private TestMetadataServiceHandlerImpl prepareTestConstructsForWsdl(ServiceId serviceId, boolean isRest) throws Exception {
    final ServiceId requestingWsdlForService = ServiceId.create(DEFAULT_CLIENT, "someServiceWithWsdl122");
    TestMetadataServiceHandlerImpl handlerToTest = new TestMetadataServiceHandlerImpl();
    WsdlRequestData wsdlRequestData = new WsdlRequestData();
    wsdlRequestData.setServiceCode(requestingWsdlForService.getServiceCode());
    InputStream soapContentInputStream = new TestSoapBuilder().withClient(DEFAULT_CLIENT).withService(serviceId).withModifiedBody(soapBody -> marshaller.marshal(wsdlRequestData, soapBody)).buildAsInputStream();
    when(mockProxyMessage.getSoapContent()).thenReturn(soapContentInputStream);
    setUpDatabase(requestingWsdlForService, isRest);
    mockServer.stubFor(WireMock.any(urlPathEqualTo(EXPECTED_WSDL_QUERY_PATH)).willReturn(aResponse().withBodyFile("wsdl.wsdl")));
    mockServer.start();
    when(mockResponse.getOutputStream()).thenReturn(mockServletOutputStream);
    handlerToTest.canHandle(serviceId, mockProxyMessage);
    return handlerToTest;
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) XMLUnit(org.custommonkey.xmlunit.XMLUnit) Arrays(java.util.Arrays) ServiceDescriptionType(ee.ria.xroad.common.conf.serverconf.model.ServiceDescriptionType) MetaserviceTestUtil(ee.ria.xroad.proxy.util.MetaserviceTestUtil) SOAPException(javax.xml.soap.SOAPException) URISyntaxException(java.net.URISyntaxException) MethodListType(ee.ria.xroad.common.metadata.MethodListType) MimeException(org.apache.james.mime4j.MimeException) ServiceType(ee.ria.xroad.common.conf.serverconf.model.ServiceType) GET_WSDL_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.GET_WSDL_REQUEST) DescriptionType(ee.ria.xroad.common.conf.serverconf.model.DescriptionType) ServiceId(ee.ria.xroad.common.identifier.ServiceId) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) Assert.assertThat(org.junit.Assert.assertThat) ByteArrayInputStream(java.io.ByteArrayInputStream) ALLOWED_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.ALLOWED_METHODS) AbstractContentHandler(org.apache.james.mime4j.parser.AbstractContentHandler) After(org.junit.After) LIST_METHODS(ee.ria.xroad.common.metadata.MetadataRequests.LIST_METHODS) ClientType(ee.ria.xroad.common.conf.serverconf.model.ClientType) WireMock.aResponse(com.github.tomakehurst.wiremock.client.WireMock.aResponse) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) CodedExceptionMatcher.faultCodeEquals(ee.ria.xroad.proxy.util.MetaserviceTestUtil.CodedExceptionMatcher.faultCodeEquals) Field(org.apache.james.mime4j.stream.Field) ProxyMessage(ee.ria.xroad.proxy.protocol.ProxyMessage) JAXBException(javax.xml.bind.JAXBException) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) StandardCharsets(java.nio.charset.StandardCharsets) SystemProperties(ee.ria.xroad.common.SystemProperties) KeyConf(ee.ria.xroad.proxy.conf.KeyConf) IOUtils(org.apache.commons.io.IOUtils) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) TestSuiteGlobalConf(ee.ria.xroad.proxy.testsuite.TestSuiteGlobalConf) X_UNKNOWN_SERVICE(ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) ProvideSystemProperty(org.junit.contrib.java.lang.system.ProvideSystemProperty) ServerConfDatabaseCtx.doInTransaction(ee.ria.xroad.common.conf.serverconf.ServerConfDatabaseCtx.doInTransaction) Matchers.containsString(org.hamcrest.Matchers.containsString) TestSuiteServerConf(ee.ria.xroad.proxy.testsuite.TestSuiteServerConf) ServerConfType(ee.ria.xroad.common.conf.serverconf.model.ServerConfType) Mockito.mock(org.mockito.Mockito.mock) ALLOWED_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.ALLOWED_METHODS_REQUEST) Getter(lombok.Getter) BeforeClass(org.junit.BeforeClass) ObjectFactory(ee.ria.xroad.common.metadata.ObjectFactory) WSDLReader(javax.wsdl.xml.WSDLReader) Marshaller(javax.xml.bind.Marshaller) MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseOperationNamesFromWSDLDefinition) GlobalConf(ee.ria.xroad.common.conf.globalconf.GlobalConf) WireMock(com.github.tomakehurst.wiremock.client.WireMock) HttpServletRequest(javax.servlet.http.HttpServletRequest) WSDLFactory(javax.wsdl.factory.WSDLFactory) MessageFactory(javax.xml.soap.MessageFactory) HttpClient(org.apache.http.client.HttpClient) SoapHeader(ee.ria.xroad.common.message.SoapHeader) BodyDescriptor(org.apache.james.mime4j.stream.BodyDescriptor) ExpectedException(org.junit.rules.ExpectedException) JAXBContext(javax.xml.bind.JAXBContext) Before(org.junit.Before) WireMock.urlPathEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo) InputSource(org.xml.sax.InputSource) Unmarshaller(javax.xml.bind.Unmarshaller) X_INVALID_SERVICE_TYPE(ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE) Definition(javax.wsdl.Definition) TEXT_XML_UTF8(ee.ria.xroad.common.util.MimeTypes.TEXT_XML_UTF8) Files(java.nio.file.Files) REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.REQUEST) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType(ee.ria.xroad.proxy.util.MetaserviceTestUtil.verifyAndGetSingleBodyElementOfType) HttpServletResponse(javax.servlet.http.HttpServletResponse) WireMockConfiguration.options(com.github.tomakehurst.wiremock.core.WireMockConfiguration.options) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) LIST_METHODS_REQUEST(ee.ria.xroad.proxy.util.MetaserviceTestUtil.LIST_METHODS_REQUEST) OpMonitoringData(ee.ria.xroad.common.opmonitoring.OpMonitoringData) WSDLException(javax.wsdl.WSDLException) CodedException(ee.ria.xroad.common.CodedException) MimeTypes(ee.ria.xroad.common.util.MimeTypes) Rule(org.junit.Rule) Paths(java.nio.file.Paths) ErrorCodes(ee.ria.xroad.common.ErrorCodes) GET_WSDL(ee.ria.xroad.common.metadata.MetadataRequests.GET_WSDL) HEADER_CONTENT_TYPE(ee.ria.xroad.common.util.MimeUtils.HEADER_CONTENT_TYPE) SOAPMessage(javax.xml.soap.SOAPMessage) ServerConf(ee.ria.xroad.common.conf.serverconf.ServerConf) ClientId(ee.ria.xroad.common.identifier.ClientId) TestSuiteKeyConf(ee.ria.xroad.proxy.testsuite.TestSuiteKeyConf) MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition(ee.ria.xroad.proxy.util.MetaserviceTestUtil.parseEndpointUrlsFromWSDLDefinition) Diff(org.custommonkey.xmlunit.Diff) InputStream(java.io.InputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) WsdlRequestData(ee.ria.xroad.proxy.common.WsdlRequestData) TestSoapBuilder(ee.ria.xroad.proxy.util.MetaserviceTestUtil.TestSoapBuilder) ServiceId(ee.ria.xroad.common.identifier.ServiceId)

Aggregations

CodedException (ee.ria.xroad.common.CodedException)4 ServiceId (ee.ria.xroad.common.identifier.ServiceId)4 WsdlRequestData (ee.ria.xroad.proxy.common.WsdlRequestData)4 WireMockServer (com.github.tomakehurst.wiremock.WireMockServer)3 WireMock (com.github.tomakehurst.wiremock.client.WireMock)3 WireMock.aResponse (com.github.tomakehurst.wiremock.client.WireMock.aResponse)3 WireMock.urlPathEqualTo (com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo)3 WireMockConfiguration.options (com.github.tomakehurst.wiremock.core.WireMockConfiguration.options)3 ErrorCodes (ee.ria.xroad.common.ErrorCodes)3 X_INVALID_SERVICE_TYPE (ee.ria.xroad.common.ErrorCodes.X_INVALID_SERVICE_TYPE)3 X_UNKNOWN_SERVICE (ee.ria.xroad.common.ErrorCodes.X_UNKNOWN_SERVICE)3 SystemProperties (ee.ria.xroad.common.SystemProperties)3 GlobalConf (ee.ria.xroad.common.conf.globalconf.GlobalConf)3 ServerConf (ee.ria.xroad.common.conf.serverconf.ServerConf)3 ServerConfDatabaseCtx.doInTransaction (ee.ria.xroad.common.conf.serverconf.ServerConfDatabaseCtx.doInTransaction)3 ClientType (ee.ria.xroad.common.conf.serverconf.model.ClientType)3 DescriptionType (ee.ria.xroad.common.conf.serverconf.model.DescriptionType)3 ServerConfType (ee.ria.xroad.common.conf.serverconf.model.ServerConfType)3 ServiceDescriptionType (ee.ria.xroad.common.conf.serverconf.model.ServiceDescriptionType)3 ServiceType (ee.ria.xroad.common.conf.serverconf.model.ServiceType)3