FileDocCategorySizeDatePackage
AbstractFilteringTest.javaAPI DocExample6262Tue May 29 16:57:38 BST 2007com.sun.xml.ws.policy.jaxws.xmlstreamwriter.documentfilter

AbstractFilteringTest

public class AbstractFilteringTest extends TestCase
Abstract base class for filtering tests
author
Marek Potociar (marek.potociar at sun.com)

Fields Summary
private static final com.sun.xml.ws.policy.sourcemodel.PolicyModelMarshaller
marshaller
Constructors Summary
public AbstractFilteringTest(String testName)
Creates a new instance of AbstractFilteringTest

    
    
           
       super(testName);
Methods Summary
protected final com.sun.xml.ws.policy.sourcemodel.PolicyModelMarshallergetPolicyModelMarshaller()

        return marshaller;
    
protected final javax.xml.stream.XMLStreamWriteropenFilteredWriter(java.io.Writer outputStream, com.sun.xml.ws.policy.jaxws.xmlstreamwriter.InvocationProcessorFactory factory)

        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream);
        return EnhancedXmlStreamWriterProxy.createProxy(writer, factory);
    
protected final javax.xml.stream.XMLStreamWriteropenFilteredWriter(java.io.Writer outputStream, com.sun.xml.ws.api.server.SDDocumentFilter filter)

        return filter.filter(null, XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream));
    
protected final voidperformResourceBasedTest(java.lang.String[] resourceNames, java.lang.String resourcePrefix, java.lang.String resourceSuffix, com.sun.xml.ws.policy.jaxws.xmlstreamwriter.InvocationProcessorFactory factory)

        for (String testResourceName : resourceNames) {
            PolicySourceModel model = PolicyResourceLoader.unmarshallModel(resourcePrefix + testResourceName + resourceSuffix);
            PolicySourceModel expected = PolicyResourceLoader.unmarshallModel(resourcePrefix + testResourceName + "_expected" + resourceSuffix);
            
            StringWriter buffer = new StringWriter();
            XMLStreamWriter writer = openFilteredWriter(buffer, factory);
            marshaller.marshal(model, writer);
            writer.close();
            
            String marshalledData = buffer.toString();
            
            PolicySourceModel result = PolicyResourceLoader.unmarshallModel(new StringReader(marshalledData));
            assertEquals("Result is not as expected for '" + testResourceName + "' test resource.", expected, result);
        }        
    
protected final voidperformResourceBasedTest(java.lang.String[] resourceNames, java.lang.String resourcePrefix, java.lang.String resourceSuffix, com.sun.xml.ws.api.server.SDDocumentFilter filter)

        for (String testResourceName : resourceNames) {
            PolicySourceModel model = PolicyResourceLoader.unmarshallModel(resourcePrefix + testResourceName + resourceSuffix);
            PolicySourceModel expected = PolicyResourceLoader.unmarshallModel(resourcePrefix + testResourceName + "_expected" + resourceSuffix);
            
            StringWriter buffer = new StringWriter();
            XMLStreamWriter writer = openFilteredWriter(buffer, filter);
            marshaller.marshal(model, writer);
            writer.close();
            
            String marshalledData = buffer.toString();
            
            PolicySourceModel result = PolicyResourceLoader.unmarshallModel(new StringReader(marshalledData));
            assertEquals("Result is not as expected for '" + testResourceName + "' test resource.", expected, result);
        }        
    
public voidtestDummy()

        // dummy test method to avoid JUnit warnings