1 package org.apache.axis2.handlers.util; 2 3 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder; 4 5 import javax.xml.stream.XMLInputFactory; 6 import javax.xml.stream.XMLStreamReader; 7 import java.io.File ; 8 import java.io.FileReader ; 9 10 26 public class TestUtil{ 27 28 31 32 protected static final String IN_FILE_NAME = "soapmessage.xml"; 33 protected StAXSOAPModelBuilder builder; 34 protected String testResourceDir = "test-resources"; 35 36 37 public StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception { 38 if (fileName == "" || fileName == null) { 39 fileName = IN_FILE_NAME; 40 } 41 XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader (getTestResourceFile(fileName))); 42 builder = new StAXSOAPModelBuilder(parser); 43 return builder; 44 } 45 46 protected File getTestResourceFile(String relativePath) { 47 return new File (testResourceDir, relativePath); 48 } 49 } 50 | Popular Tags |