WsdlDocumentFilterTestpublic class WsdlDocumentFilterTest extends AbstractFilteringTest
Fields Summary |
---|
private static final String[] | testPolicyResources | private static final String[] | testWsdlResources | private static final com.sun.xml.ws.api.server.SDDocumentFilter | filter |
Constructors Summary |
---|
public WsdlDocumentFilterTest(String testName)
super(testName);
|
Methods Summary |
---|
private void | readAndWriteWsdl(java.lang.String wsdlName, java.io.StringWriter buffer, boolean filter)
XMLStreamReader reader = null;
XMLStreamWriter writer = null;
try {
reader = XMLInputFactory.newInstance().createXMLStreamReader(PolicyResourceLoader.getResourceStream("wsdl_filter/" + wsdlName + ".wsdl"));
writer = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer /*, "UTF-8"*/);
//generate the WSDL with utf-8 encoding and XML version 1.0
writer.writeStartDocument("UTF-8", "1.0");
if (filter) {
writer = new WsdlDocumentFilter().filter(null, writer);
}
new XMLStreamReaderToXMLStreamWriter().bridge(reader, writer);
writer.writeEndDocument();
} finally {
if (writer != null) try {writer.close();} finally {
if (reader != null) reader.close();
}
}
| public void | testCreateProxy()Test of createProxy method, of class com.sun.xml.ws.policy.jaxws.documentfilter.FilteringXmlStreamWriterProxy.
XMLStreamWriter result = openFilteredWriter(new StringWriter(), filter);
assertNotNull(result);
| public void | testFilterPolicyExpression()
performResourceBasedTest(testPolicyResources, "wsdl_filter/", ".xml", filter);
| public void | testFilterWSDL()
for (String wsdlResource : testWsdlResources) {
StringWriter filteredBuffer = new StringWriter();
StringWriter unfilteredBuffer = new StringWriter();
readAndWriteWsdl(wsdlResource, filteredBuffer, true);
readAndWriteWsdl(wsdlResource + "_expected", unfilteredBuffer, false);
System.out.println(filteredBuffer.toString());
assertEquals(unfilteredBuffer.toString(), filteredBuffer.toString());
}
|
|