1 16 package org.apache.axis2.om; 17 18 import org.apache.axis2.soap.SOAPEnvelope; 19 import org.w3c.dom.Document ; 20 21 import javax.xml.parsers.DocumentBuilder ; 22 import javax.xml.parsers.DocumentBuilderFactory ; 23 import java.io.File ; 24 25 28 public class CompareOMWithDOMTest extends AbstractTestCase { 29 32 public CompareOMWithDOMTest(String testName) { 33 super(testName); 34 } 35 36 public void testAllMessagesInSOAP() throws OMException, Exception { 37 File dir = new File (testResourceDir, "soap"); 38 File [] files = dir.listFiles(); 39 if (files != null) { 40 for (int i = 0; i < files.length; i++) { 41 if (files[i].isFile() && files[i].getName().endsWith(".xml")) { 42 System.out.println("files = " + files[i].getAbsolutePath()); 43 SOAPEnvelope soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(files[i]).getDocumentElement(); 44 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 45 dbf.setNamespaceAware(true); 46 DocumentBuilder builder = dbf.newDocumentBuilder(); 47 Document doc = builder.parse(files[i].getAbsolutePath()); 48 49 OMTestUtils.compare(doc.getDocumentElement(), soapEnvelope); 53 } 54 } 55 56 } 57 } 58 } 59 | Popular Tags |