Wms130SoapExtendedCapabilitesWriter { public void writeSoapWmsExtendedCapabilites( XMLStreamWriter writer, String postUrl, SupportedEncodings supportedEncodings ) throws XMLStreamException { if ( soapEncodingIsSupportedForAtLeastOneRequestType( supportedEncodings ) ) { writer.setPrefix( SOAPWMS_PREFIX, SOAPWMS_NS ); writer.writeStartElement( SOAPWMS_NS, "ExtendedCapabilities" ); writer.writeNamespace( SOAPWMS_PREFIX, SOAPWMS_NS ); writer.writeNamespace( WMS_PREFIX, WMSNS ); writer.writeNamespace( XSI_PREFIX, XSINS ); writer.writeNamespace( XLINK_PREFIX, XLNNS ); writer.writeAttribute( XSINS, "schemaLocation", SOAPWMS_NS + " " + SOAPWMS_XSD_LOCATION ); writer.writeStartElement( SOAPWMS_NS, "SOAP" ); writeOnlineResource( writer, postUrl ); writeSoapVersionConstraint( writer ); writeSupportedOperations( writer, supportedEncodings ); writer.writeEndElement(); writer.writeEndElement(); } }  void writeSoapWmsExtendedCapabilites( XMLStreamWriter writer, String postUrl,
                                                 SupportedEncodings supportedEncodings ); static final String SOAPWMS_NS; static final String SOAPWMS_PREFIX; }
@Test public void testWriteSoapWmsExtendedCapabilites_ContainsPostUrl() throws Exception { Wms130SoapExtendedCapabilitesWriter writer = new Wms130SoapExtendedCapabilitesWriter(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( stream ); String postUrl = "http: SupportedEncodings supportedEncodings = mockSupportedEncodings(); writer.writeSoapWmsExtendedCapabilites( streamWriter, postUrl, supportedEncodings ); streamWriter.close(); assertThat( xml( stream.toString() ), hasXPath( " nsBindings(), equalTo( postUrl ) ) ); }
@Test public void testWriteSoapWmsExtendedCapabilites_NotContainsGetMap() throws Exception { Wms130SoapExtendedCapabilitesWriter writer = new Wms130SoapExtendedCapabilitesWriter(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( stream ); String postUrl = "http: SupportedEncodings supportedEncodings = mockSupportedEncodingsNoGetMap(); writer.writeSoapWmsExtendedCapabilites( streamWriter, postUrl, supportedEncodings ); streamWriter.close(); assertThat( xml( stream.toString() ), hasXPath( " nsBindings() ) ); assertThat( xml( stream.toString() ), hasXPath( " nsBindings() ) ); assertThat( xml( stream.toString() ), not( hasXPath( " nsBindings() ) ) ); }
@Ignore("Requires access to referenced schema") @Test public void testWriteSoapWmsExtendedCapabilites_SchemaValid() throws Exception { Wms130SoapExtendedCapabilitesWriter writer = new Wms130SoapExtendedCapabilitesWriter(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( stream ); SupportedEncodings supportedEncodings = mockSupportedEncodings(); writer.writeSoapWmsExtendedCapabilites( streamWriter, "http: streamWriter.close(); assertThat( xml( stream.toString() ), XmlMatchers.conformsTo( schema() ) ); }