1 16 package org.apache.axis2.om.impl.streamwrapper; 17 18 import org.apache.axis2.om.AbstractTestCase; 19 import org.apache.axis2.om.OMAbstractFactory; 20 import org.apache.axis2.om.OMXMLParserWrapper; 21 import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory; 22 import org.apache.axis2.soap.SOAPEnvelope; 23 24 import javax.xml.stream.XMLInputFactory; 25 import javax.xml.stream.XMLStreamReader; 26 import java.io.File ; 27 import java.io.FileReader ; 28 29 public class OMStaxStreamingWrapperTest extends AbstractTestCase { 30 private SOAPEnvelope envelope = null; 31 private File tempFile; 32 private XMLStreamReader parser; 33 34 public OMStaxStreamingWrapperTest(String testName) { 35 super(testName); 36 } 37 38 protected void setUp() throws Exception { 39 XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance(). 40 createXMLStreamReader(new FileReader (getTestResourceFile("soap/soapmessage1.xml"))); 41 OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), xmlStreamReader); 42 envelope = (SOAPEnvelope) builder.getDocumentElement(); 43 tempFile = File.createTempFile("temp", "xml"); 44 45 } 46 47 48 61 public void testWrapperHalfOM() throws Exception { 62 assertNotNull(envelope); 63 parser = envelope.getXMLStreamReaderWithoutCaching(); 64 while (parser.hasNext()) { 65 int event = parser.next(); 66 assertTrue(event > 0); 67 } 68 } 69 70 221 222 protected void tearDown() throws Exception { 223 tempFile.delete(); 224 } 225 } 226 | Popular Tags |