Search in sources :

Example 1 with PropertiesExpandingStreamReader

use of org.apache.cxf.staxutils.PropertiesExpandingStreamReader in project cxf by apache.

the class WSDLManagerImplTest method testXMLStreamReaderWrapper.

@Test
public void testXMLStreamReaderWrapper() throws Exception {
    final Map<String, String> map = new HashMap<>();
    map.put("org.apache.cxf.test.wsdl11.port", "99999");
    String wsdlUrl = getClass().getResource("hello_world_wrap.wsdl").toString();
    WSDLManagerImpl builder = new WSDLManagerImpl();
    builder.setXMLStreamReaderWrapper(new XMLStreamReaderWrapper() {

        @Override
        public XMLStreamReader wrap(XMLStreamReader reader) {
            return new PropertiesExpandingStreamReader(reader, map);
        }
    });
    Definition def = builder.getDefinition(wsdlUrl);
    java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
    builder.getWSDLFactory().newWSDLWriter().writeWSDL(def, bos);
    assertTrue(bos.toString().contains("http://localhost:99999/SoapContext/SoapPort"));
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) PropertiesExpandingStreamReader(org.apache.cxf.staxutils.PropertiesExpandingStreamReader) HashMap(java.util.HashMap) XMLStreamReaderWrapper(org.apache.cxf.staxutils.XMLStreamReaderWrapper) Definition(javax.wsdl.Definition) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Definition (javax.wsdl.Definition)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 PropertiesExpandingStreamReader (org.apache.cxf.staxutils.PropertiesExpandingStreamReader)1 XMLStreamReaderWrapper (org.apache.cxf.staxutils.XMLStreamReaderWrapper)1 Test (org.junit.Test)1