You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2004/12/02 14:59:50 UTC

svn commit: r109503 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/impl/llom java/org/apache/axis/impl/llom/builder test-resources/soap test/org/apache/axis/om

Author: hemapani
Date: Thu Dec  2 05:59:49 2004
New Revision: 109503

URL: http://svn.apache.org/viewcvs?view=rev&rev=109503
Log:
refactoring some test classes and test XML's : checkin in on behalf of Ajith
Removed:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/tester-out.xml
Modified:
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml
   webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java?view=diff&rev=109503&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java&r1=109502&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java&r2=109503
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMAttributeImpl.java	Thu Dec  2 05:59:49 2004
@@ -74,5 +74,9 @@
             nextSibling.setPreviousSibling(previousSibling);
     }
 
+    //overidden to force even null namepaces
+    public OMNamespace getNamespace() throws OMException {
+        return ns;
+    }
 
 }

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java?view=diff&rev=109503&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java&r1=109502&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java&r2=109503
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNamedNodeImpl.java	Thu Dec  2 05:59:49 2004
@@ -29,8 +29,8 @@
  */
 public class OMNamedNodeImpl extends OMNodeImpl implements OMNamedNode {
 
-    private OMNamespace ns;
-    String localName;
+    protected OMNamespace ns;
+    protected String localName;
 
 
     public OMNamedNodeImpl(String localName, OMNamespace ns, OMElement parent) {
@@ -52,6 +52,8 @@
     }
 
     public OMNamespace getNamespace() throws OMException {
+        if (ns==null)
+            throw new OMException("all elements in a soap message must be namespace qualified");
         return ns;
     }
 

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java?view=diff&rev=109503&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r1=109502&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java&r2=109503
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/builder/ObjectToOMBuilder.java	Thu Dec  2 05:59:49 2004
@@ -116,23 +116,14 @@
 
 
     public void endDocument() throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.endDocument");
         lastNode.setComplete(true);
-//        ((Printable)startElement).print(System.out);
-
     }
 
     public void startDocument() throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.startDocument");
         lastNode = this.startElement;
     }
 
     public void characters(char ch[], int start, int length) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.characters");
-
         OMText text = omFactory.createText(null, (new StringBuffer().append(ch, start, length).toString()));
         addNewNode(text, lastNode);
         text.setComplete(true);
@@ -140,49 +131,29 @@
     }
 
     public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.ignorableWhitespace");
-//        buffer.append(ch, start, length);
     }
 
     public void endPrefixMapping(String prefix) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.endPrefixMapping");
-//        System.out.println("prefix = " + prefix);
     }
 
     public void skippedEntity(String name) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.skippedEntity");
     }
 
     public void setDocumentLocator(Locator locator) {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.setDocumentLocator");
     }
 
     public void processingInstruction(String target, String data) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.processingInstruction");
     }
 
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.startPrefixMapping");
-//        System.out.println("prefix = " + prefix + " uri = " + uri);
         nameSpaces.add(omFactory.createOMNamespace(uri, prefix));
     }
 
     public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
-        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.endElement");
-//        System.out.println("namespaceURI = " + namespaceURI);
-        System.out.println("localName = " + localName);
-//        System.out.println("qName = " + qName);
+
 
         if (lastNode.isComplete()) {
             OMElement parent = lastNode.getParent();
-            System.out.println("parent.getLocalName() = " + parent.getLocalName());
             parent.setComplete(true);
             lastNode = parent;
         } else {
@@ -194,14 +165,7 @@
     }
 
     public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
-//        System.out.println("==================================");
-//        System.out.println("ContentHandlerImpl.startElement");
-//        System.out.println("namespaceURI = " + namespaceURI);
-//        System.out.println("localName = " + localName);
-//        System.out.println("qName = " + qName);
 
-
-        // ===================================================================
         if (localName.length() == 0)
             localName = qName;
 
@@ -241,10 +205,6 @@
 
         element.setComplete(false);
         lastNode = element;
-        // ===================================================================
-
-//        buffer = new StringBuffer();
-//        textBufferStack.push(buffer);
 
     }
 

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml?view=diff&rev=109503&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml&r1=109502&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml&r2=109503
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/soapmessage1.xml	Thu Dec  2 05:59:49 2004
@@ -1 +1 @@
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"><soapenv:Header><wsa:MessageID soapenv:mustUnderstand="0">uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID><wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To><wsa:From soapenv:mustUnderstand="0"><Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</Address></wsa:From></soapenv:Header><soapenv:Body><ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost:8081/axis/services/BankPort"><accountNo href="#id0"/></ns1:getBalance><multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1001</multiRef></soapenv:Body></soapenv:Envelope>
\ No newline at end of file
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"><soapenv:Header><wsa:MessageID soapenv:mustUnderstand="0">uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID><wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To><wsa:From soapenv:mustUnderstand="0"><Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</Address></wsa:From></soapenv:Header><soapenv:Body><ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost:8081/axis/services/BankPort"><ns1:accountNo href="#id0"/></ns1:getBalance><multiRef xmlns="tempUri" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1001</multiRef></soapenv:Body></soapenv:Envelope>
\ No newline at end of file

Deleted: /webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/tester-out.xml
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test-resources/soap/tester-out.xml?view=auto&rev=109502
==============================================================================

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java?view=diff&rev=109503&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r1=109502&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java&r2=109503
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java	(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/OMTestUtils.java	Thu Dec  2 05:59:49 2004
@@ -23,23 +23,28 @@
 import junit.framework.TestCase;
 
 import org.apache.axis.impl.llom.wrapper.OMXPPWrapper;
+import org.apache.axis.impl.llom.builder.OMStAXBuilder;
+import org.apache.axis.impl.llom.factory.OMLinkedListImplFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserFactory;
 
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+
 /**
  * @author Srinath Perera(hemapani@opensource.lk)
  */
 public class OMTestUtils {
 
-    public static OMXPPWrapper getOMBuilder(File file) throws Exception {
-        XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
-        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-        parser.setInput(new FileReader(file));
-        OMXPPWrapper omXmlPullParserWrapper = new OMXPPWrapper(parser);
-        return omXmlPullParserWrapper;
+    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
+
+        XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(file));
+        OMStAXBuilder builder =   new OMStAXBuilder(new OMLinkedListImplFactory(),parser);
+
+        return builder;
     }
     
     public static void walkThrough(OMElement omEle){