axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r330032 [3/3] - in /webservices/axis2/trunk/java/modules/saaj: src/org/apache/axis2/om/impl/dom/ src/org/apache/axis2/soap/impl/dom/ test-resources/soap/ test-resources/soap/soap11/ test/org/apache/axis2/om/impl/dom/
Date Tue, 01 Nov 2005 11:48:33 GMT
Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.txt
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.txt?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.txt (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.txt Tue Nov  1 03:47:57
2005
@@ -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/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/sample1.xml Tue Nov  1 03:47:57
2005
@@ -0,0 +1,9 @@
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/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/axis2/trunk/java/modules/saaj/test-resources/soap/security2-soap.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/security2-soap.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/security2-soap.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/security2-soap.xml Tue Nov
 1 03:47:57 2005
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
+    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext"
+    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+    <S:Header>
+        <m:path xmlns:m="http://schemas.xmlsoap.org/rp">
+            <m:action>http://fabrikam123.com/getQuote</m:action>
+            <m:to>http://fabrikam123.com/stocks</m:to>
+            <m:from>mailto:johnsmith@fabrikam123.com</m:from>
+            <m:id>uuid:84b9f5d0-33fb-4a81-b02b-5b760641c1d6</m:id>
+        </m:path>
+        <wsse:Security>
+            <wsse:BinarySecurityToken
+                ValueType="wsse:X509v3"
+                EncodingType="wsse:Base64Binary"
+                Id="X509Token">
+                MIIEZzCCA9CgAwIBAgIQEmtJZc0rqrKh5i...
+            </wsse:BinarySecurityToken>
+            <ds:Signature>
+                <ds:SignedInfo>
+                    <ds:CanonicalizationMethod Algorithm=
+                                               "http://www.w3.org/2001/10/xml-exc-c14n#"/>
+                    <ds:SignatureMethod Algorithm=
+                                        "http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
+                    <ds:Reference>
+                        <ds:Transforms>
+                            <ds:Transform Algorithm=
+                                          "http://...#RoutingTransform"/>
+                            <ds:Transform Algorithm=
+                                          "http://www.w3.org/2001/10/xml-exc-c14n#"/>
+                        </ds:Transforms>
+                        <ds:DigestMethod Algorithm=
+                                         "http://www.w3.org/2000/09/xmldsig#sha1"/>
+                        <ds:DigestValue>EULddytSo1...</ds:DigestValue>
+                    </ds:Reference>
+                </ds:SignedInfo>
+                <ds:SignatureValue>
+                    BL8jdfToEb1l/vXcMZNNjPOV...
+                </ds:SignatureValue>
+                <ds:KeyInfo>
+                    <wsse:SecurityTokenReference>
+                        <wsse:Reference URI="#X509Token"/>
+                    </wsse:SecurityTokenReference>
+                </ds:KeyInfo>
+            </ds:Signature>
+        </wsse:Security>
+    </S:Header>
+    <S:Body>
+        <tru:StockSymbol xmlns:tru="http://fabrikam123.com/payloads">
+            QQQ
+        </tru:StockSymbol>
+    </S:Body>
+</S:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11fault.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11fault.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11fault.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11fault.xml Tue
Nov  1 03:47:57 2005
@@ -0,0 +1,16 @@
+ <SOAP-ENV:Envelope
+     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+     <SOAP-ENV:Header>
+         <TestHeader>Test</TestHeader>
+     </SOAP-ENV:Header>
+     <SOAP-ENV:Body>
+         <SOAP-ENV:Fault>
+             <faultcode>SOAP-ENV:MustUnderstand</faultcode>
+             <faultstring>SOAP Must Understand Error</faultstring>
+             <faultactor>Actor</faultactor>
+             <detail>Detail text
+                 <SomeElement>Some Element Text</SomeElement>
+             </detail>
+         </SOAP-ENV:Fault>
+     </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11message.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11message.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11message.xml
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap11/soap11message.xml
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,46 @@
+<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:From soapenv:mustUnderstand="0"
+            soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next">
+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">
+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous
+            </Address>
+        </wsa:From>
+        <test:MessageID xmlns:test="http://example.org/ts-tests"
+            soapenv:mustUnderstand="1"
+            soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
+            soapenv:anyAttribute="any value">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5
+        </test:MessageID>
+        <wsa:To soapenv:mustUnderstand="0"
+            soapenv:anyAttribute="any value">
+            http://localhost:8081/axis/services/BankPort
+        </wsa:To>
+    </soapenv:Header>
+    <soapenv:Body>
+        <soapenv:Fault>
+            <soapenv:faultcode>
+                env:Sender
+            </soapenv:faultcode>
+            <soapenv:faultstring>Sender Timeout</soapenv:faultstring>
+            <soapenv:faultactor>
+                http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver
+            </soapenv:faultactor>
+            <soapenv:detail xmlns:m="http://www.sample.org">
+                Details of error
+                <m:MaxTime m:detail="This is only a test">
+                    P5M
+                </m:MaxTime>
+                <m:AveTime>
+                    <m:Time>
+                        P3M
+                    </m:Time>
+                </m:AveTime>
+            </soapenv:detail>
+        </soapenv:Fault>
+    </soapenv:Body>
+</soapenv:Envelope>
+

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap12message.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap12message.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap12message.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soap12message.xml Tue Nov
 1 03:47:57 2005
@@ -0,0 +1,58 @@
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xml="http://www.w3.org/XML/1998/namespace">
+    <env:Header>
+        <test:echoOk xmlns:test="http://example.org/ts-tests"
+            env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+            env:mustUnderstand="true"
+            env:anyAttribute="any value">
+            foo
+        </test:echoOk>
+        <test1:echoOk1 xmlns:test1="http://example1.org/ts-tests"
+            env:role="http://www.w3.org/2003/05/soap-envelope/role/next"
+            env:mustUnderstand="false"
+            env:anyAttribute="any value">
+            foo
+        </test1:echoOk1>
+        <test2:echoOk2 xmlns:test2="http://example2.org/ts-tests"
+            env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+            env:mustUnderstand="1"
+            env:anyAttribute="any value">
+            foo
+        </test2:echoOk2>
+    </env:Header>
+    <env:Body>
+        <env:Fault>
+            <env:Code>
+                <env:Value>env:Sender</env:Value>
+                <env:SubCode>
+                    <env:Value>m:MessageTimeout In First SubCode</env:Value>
+                    <env:SubCode>
+                        <env:Value>m:MessageTimeout In Second SubCode</env:Value>
+                        <env:SubCode>
+                            <env:Value>m:MessageTimeout In Third SubCode</env:Value>
+                        </env:SubCode>
+                    </env:SubCode>
+                </env:SubCode>
+            </env:Code>
+            <env:Reason>
+                <env:Text xml:lang="en">Sender Timeout</env:Text>
+            </env:Reason>
+            <env:Node>
+                http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver
+            </env:Node>
+            <env:Role>
+                ultimateReceiver
+            </env:Role>
+            <env:Detail xmlns:m="http:www.sample.org">
+                Details of error
+                <m:MaxTime m:detail="This is only a test">
+                    P5M\n
+                </m:MaxTime>
+                <m:AveTime>
+                    <m:Time>
+                        P3M\n
+                    </m:Time>
+                </m:AveTime>
+            </env:Detail>
+        </env:Fault>
+    </env:Body>
+</env:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.txt
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.txt?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.txt (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.txt Tue Nov
 1 03:47:57 2005
@@ -0,0 +1,16 @@
+POST /axis/services/EchoService HTTP/1.1
+Host: 127.0.0.1
+Content-Type: application/soap+xml; charset="utf-8"
+
+<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>
+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2" ></axis2:echoVoid>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage.xml Tue Nov
 1 03:47:57 2005
@@ -0,0 +1,20 @@
+<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>
+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">
+        </axis2:echoVoid>
+    </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage1.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage1.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage1.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/soapmessage1.xml Tue Nov
 1 03:47:57 2005
@@ -0,0 +1,27 @@
+<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

Added: webservices/axis2/trunk/java/modules/saaj/test-resources/soap/whitespacedMessage.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/whitespacedMessage.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/whitespacedMessage.xml (added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/whitespacedMessage.xml Tue
Nov  1 03:47:57 2005
@@ -0,0 +1,27 @@
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">
+
+    <env:Header>
+
+
+        <wsa:MessageID env:mustUnderstand="0">
+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>
+        <wsa:To env:mustUnderstand="0">
+            http://localhost:8081/axis/services/BankPort</wsa:To>
+        <wsa:From env: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>
+
+    </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/axis2/trunk/java/modules/saaj/test-resources/soap/wrongEnvelopeNamespace.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test-resources/soap/wrongEnvelopeNamespace.xml?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test-resources/soap/wrongEnvelopeNamespace.xml
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test-resources/soap/wrongEnvelopeNamespace.xml
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<soap:Envelope
+xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
+soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
+
+  <soap:Body xmlns:m="http://www.stock.org/stock">
+    <m:GetStockPrice>
+      <m:StockName>IBM</m:StockName>
+    </m:GetStockPrice>
+  </soap:Body>
+
+</soap:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/AbstractTestCase.java?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/AbstractTestCase.java
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/AbstractTestCase.java
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 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.axis2.om.impl.dom;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * Abstract base class for test cases.
+ */
+public abstract class AbstractTestCase
+        extends TestCase {
+    protected String testDir = "test" + File.separator;
+    protected String sampleDir = "samples" + File.separator;
+    protected String outDir = "target" + File.separator + "generated" +
+            File.separator +
+            "samples" +
+            File.separator;
+    protected String tempDir = "target" + File.separator + "generated" +
+            File.separator +
+            "temp";
+    protected String testResourceDir = "test-resources";
+
+    /**
+     * Basedir for all file I/O. Important when running tests from
+     * the reactor.
+     */
+    public String basedir = System.getProperty("basedir");
+
+    /**
+     * @param testName
+     */
+    public AbstractTestCase(String testName) {
+        super(testName);
+        if (basedir == null) {
+            basedir = new File(".").getAbsolutePath();
+        }
+        testDir = new File(basedir, testDir).getAbsolutePath();
+        sampleDir = new File(basedir, sampleDir).getAbsolutePath();
+        outDir = new File(basedir, outDir).getAbsolutePath();
+        tempDir = new File(basedir, tempDir).getAbsolutePath();
+    }
+
+    public File getTestResourceFile(String relativePath) {
+        return new File(testResourceDir, relativePath);
+    }
+
+    public File getTempOutputFile(String filename) {
+        File f = new File(tempDir);
+        if(!f.exists()) {
+            f.mkdirs();
+        }
+        return new File(f, filename);
+    }
+}
+

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/MessagesTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/MessagesTest.java?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/MessagesTest.java
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/MessagesTest.java
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004,2005 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.axis2.om.impl.dom;
+
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+public class MessagesTest extends OMDOMTestCase {
+    SOAPEnvelope soapEnvelope;
+
+    public MessagesTest(String testName) {
+        super(testName);
+    }
+
+    public void testMessageWithLotOfWhiteSpaces() throws OMException,
+            Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/whitespacedMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testMinimalMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/minimalMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testReallyBigMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/reallyReallyBigMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testEmptyBodiedMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/emtyBodymessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMDOMTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMDOMTestCase.java?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMDOMTestCase.java
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMDOMTestCase.java
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004,2005 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.axis2.om.impl.dom;
+
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.dom.factory.DOMSOAPFactory;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMDOMTestCase extends AbstractTestCase{
+
+	protected static final String IN_FILE_NAME = "soap/soapmessage.xml";
+    protected StAXSOAPModelBuilder builder;
+    protected OMFactory ombuilderFactory;
+    protected SOAPFactory soapFactory;
+    
+    protected SOAPEnvelope soapEnvelope;
+	
+    public OMDOMTestCase(String testName) {
+		super(testName);
+	}
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();
+    }
+	
+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
+        if ("".equals(fileName) || fileName == null) {
+            fileName = IN_FILE_NAME;
+        }
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new FileReader(getTestResourceFile(fileName)));
+        builder = new StAXSOAPModelBuilder(parser, new DOMSOAPFactory(), null);
+        return builder;
+    }
+    
+    
+
+    protected StAXSOAPModelBuilder getOMBuilder(InputStream in) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(in);
+        builder = new StAXSOAPModelBuilder(parser, new DOMSOAPFactory(), null);
+        return builder;
+    }
+
+    protected XMLStreamWriter getStAXStreamWriter(OutputStream out) throws XMLStreamException
{
+        return XMLOutputFactory.newInstance().createXMLStreamWriter(out);
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMTestUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMTestUtils.java?rev=330032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMTestUtils.java
(added)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/OMTestUtils.java
Tue Nov  1 03:47:57 2005
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 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.axis2.om.impl.dom;
+
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.impl.dom.soap11.SOAP11Factory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+public class OMTestUtils {
+    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new FileReader(file));
+        return OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                new SOAP11Factory(), parser);
+    }
+
+    public static void walkThrough(OMElement omEle) {
+        Iterator attibIt = omEle.getAllAttributes();
+        if (attibIt != null) {
+            while (attibIt.hasNext()) {
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null",
+                        attibIt.next());
+            }
+        }
+        Iterator it = omEle.getChildren();
+        if (it != null) {
+            while (it.hasNext()) {
+                OMNode ele = (OMNode) it.next();
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null", ele);
+                if (ele instanceof OMElement) {
+                    walkThrough((OMElement) ele);
+                }
+            }
+        }
+    }
+
+    public static void compare(Element ele, OMElement omele) throws Exception {
+        if (ele == null && omele == null) {
+            return;
+        } else if (ele != null && omele != null) {
+            TestCase.assertEquals("Element name not correct",
+                    ele.getLocalName(),
+                    omele.getLocalName());
+            if (omele.getNamespace() != null) {
+                TestCase.assertEquals("Namespace URI not correct",
+                        ele.getNamespaceURI(),
+                        omele.getNamespace().getName());
+
+            }
+
+            //go through the attributes
+            NamedNodeMap map = ele.getAttributes();
+            Iterator attIterator = omele.getAllAttributes();
+            OMAttribute omattribute;
+            Attr domAttribute;
+            String DOMAttrName;
+            while (attIterator != null && attIterator.hasNext() && map ==
null) {
+                omattribute = (OMAttribute) attIterator.next();
+                Node node = map.getNamedItemNS(
+                        omattribute.getNamespace().getName(),
+                        omattribute.getLocalName());
+                if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                    Attr attr = (Attr) node;
+                    TestCase.assertEquals(attr.getValue(),
+                            omattribute.getAttributeValue());
+                } else {
+                    throw new OMException("return type is not a Attribute");
+                }
+
+            }
+            Iterator it = omele.getChildren();
+            NodeList list = ele.getChildNodes();
+            for (int i = 0; i < list.getLength(); i++) {
+                Node node = list.item(i);
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    TestCase.assertTrue(it.hasNext());
+                    OMNode tempOmNode = (OMNode) it.next();
+                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {
+                        TestCase.assertTrue(it.hasNext());
+                        tempOmNode = (OMNode) it.next();
+                    }
+                    compare((Element) node, (OMElement) tempOmNode);
+                }
+            }
+
+
+        } else {
+            throw new Exception("One is null");
+        }
+    }
+
+    public static SOAPEnvelope createOM(File file) throws Exception {
+        return (SOAPEnvelope) getOMBuilder(file).getDocumentElement();
+    }
+
+}



Mime
View raw message