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.OMOutput; 21 import org.apache.axis2.om.OMXMLParserWrapper; 22 import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory; 23 import org.apache.axis2.soap.SOAPEnvelope; 24 import org.apache.axis2.soap.SOAPFactory; 25 26 import javax.xml.stream.XMLInputFactory; 27 import javax.xml.stream.XMLStreamReader; 28 import java.io.File ; 29 import java.io.FileOutputStream ; 30 import java.io.FileReader ; 31 32 public class OmStAXBuilderTest extends AbstractTestCase { 33 private SOAPFactory factory = null; 34 private OMXMLParserWrapper builder; 35 private File tempFile; 36 37 public OmStAXBuilderTest(String testName) { 38 super(testName); 39 } 40 41 protected void setUp() throws Exception { 42 factory = OMAbstractFactory.getSOAP11Factory(); 43 XMLStreamReader reader = XMLInputFactory.newInstance(). 44 createXMLStreamReader(new FileReader (getTestResourceFile("soap/soapmessage.xml"))); 45 builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(factory, reader); 46 tempFile = File.createTempFile("temp", "xml"); 47 } 48 49 public void testStaxBuilder() throws Exception { 50 SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement(); 51 assertNotNull(envelope); 52 OMOutput omOutput = new OMOutput(new FileOutputStream (tempFile),false); 53 envelope.serializeWithCache(omOutput); 55 56 57 } 58 59 protected void tearDown() throws Exception { 60 tempFile.delete(); 61 } 62 63 64 } 65 | Popular Tags |