axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: rev 76112 - in webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src: java/org/apache/axis/om/impl samples samples/soap test/org/apache/axis/om
Date Wed, 17 Nov 2004 11:24:41 GMT
Author: hemapani
Date: Wed Nov 17 03:24:38 2004
New Revision: 76112

Added:
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.txt
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.xml
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTest.java
Modified:
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/java/org/apache/axis/om/impl/SOAPMessageImpl.java
   webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTestCase.java
Log:
add a test case to show expectations of engine from OM

Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/java/org/apache/axis/om/impl/SOAPMessageImpl.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/java/org/apache/axis/om/impl/SOAPMessageImpl.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/java/org/apache/axis/om/impl/SOAPMessageImpl.java
Wed Nov 17 03:24:38 2004
@@ -33,7 +33,12 @@
         this.parserWrapper = parserWrapper;
     }
 
-   public void setEnvelope(SOAPEnvelopeImpl root) {
+    public SOAPMessageImpl(Object[] obj) {
+        //TODO create the OM from Obj
+    }
+
+    
+    public void setEnvelope(SOAPEnvelopeImpl root) {
         this.envelope = root;
     }
 

Added: webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.txt
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.txt	Wed
Nov 17 03:24:38 2004
@@ -0,0 +1,12 @@
+POST /axis/services/EchoService HTTP/1.1
+Host: 127.0.0.1
+Content-Type: application/soap+xml; charset="utf-8"
+
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+ <env:Header>
+ </env:Header>
+ <env:Body>
+	<axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2" ></axis2:echoVoid>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Added: webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.xml
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/samples/soap/sample1.xml	Wed
Nov 17 03:24:38 2004
@@ -0,0 +1,8 @@
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+ <env:Header>
+ </env:Header>
+ <env:Body>
+	<axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2" ></axis2:echoVoid>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Added: webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTest.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTest.java
Wed Nov 17 03:24:38 2004
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.om;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+
+import org.apache.axis.om.impl.OMXMLPullParserWrapper;
+import org.apache.axis.om.impl.SOAPMessageImpl;
+import org.apache.axis.om.soap.SOAPMessage;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * This test case tests the basic expectations of the engine from the OM.
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class OMTest extends TestCase{
+    SOAPMessage omdoc;
+    protected void setUp() throws Exception {
+        File file = new File("src/samples/soap/sample1.xml");
+        FileInputStream in = new FileInputStream(file);
+        
+        XmlPullParserFactory pf = XmlPullParserFactory.newInstance();
+        pf.setNamespaceAware(true);
+        XmlPullParser  parser = pf.newPullParser();
+        parser.setInput(new InputStreamReader(in));
+        
+        OMXMLParserWrapper parserWrapper = new OMXMLPullParserWrapper(parser); 
+        omdoc = new SOAPMessageImpl(parserWrapper);
+    }
+
+    
+    /**
+     * Sometime the hasNext() in the childeren iterator is true yet the next() is null
+     */
+
+    public void testNullInChilderen(){
+        isNullChildrenAreThere(omdoc.getEnvelope());
+    }
+    
+    /**
+     * the document is completly namesapce qulified so all the OMElements got to have namespace
values not null
+     *
+     */
+    public void test4MissingNamespaces(){
+        isNameSpacesMissing(omdoc.getEnvelope());
+    }
+    
+    public void isNullChildrenAreThere(OMElement omeleent){
+        Iterator it = omeleent.getChildren();
+        while(it.hasNext()){
+            OMNode node = (OMNode)it.next();
+            assertNotNull(node);
+            if(node.getType() == OMNode.ELEMENT_NODE){
+                isNullChildrenAreThere((OMElement)node);
+            }
+        }
+    }
+
+    public void isNameSpacesMissing(OMElement omeleent){
+        OMNamespace omns = omeleent.getNamespace();
+        assertNotNull(omns);
+        assertNotNull(omns.getValue());
+        Iterator it = omeleent.getChildren();
+        while(it.hasNext()){
+            OMNode node = (OMNode)it.next();
+            
+            if(node != null && node.getType() == OMNode.ELEMENT_NODE){
+                isNameSpacesMissing((OMElement)node);
+            }
+        }
+    }
+}

Modified: webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTestCase.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTestCase.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/chinthaka/OM/src/test/org/apache/axis/om/OMTestCase.java
Wed Nov 17 03:24:38 2004
@@ -36,8 +36,6 @@
     protected SOAPMessage soapMessage;
     protected SOAPEnvelope soapEnvelope;
 
-    public static void main(String[] args) {
-    }
 
     protected void setUp() throws Exception {
         super.setUp();

Mime
View raw message