ws-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r391260 [6/7] - in /webservices/commons/trunk/modules/axiom: src/org/apache/axiom/om/ src/org/apache/axiom/om/impl/ src/org/apache/axiom/om/impl/dom/ src/org/apache/axiom/om/impl/llom/ src/org/apache/axiom/om/impl/serialize/ src/org/apache/...
Date Tue, 04 Apr 2006 09:33:39 GMT
Modified: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBlankElementTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBlankElementTest.java?rev=391260&r1=391259&r2=391260&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBlankElementTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBlankElementTest.java
Tue Apr  4 02:33:33 2006
@@ -1,56 +1,56 @@
-/*
- * 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.axiom.om;
-
-import junit.framework.TestCase;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.StringWriter;
-
-
-public class OMBlankElementTest extends TestCase {
-
-
-	public OMBlankElementTest(String name) {
-		super(name);
-	}
-
-	public void testBlankOMElem() {
-		try {
-			//We should not get anything as the return value here: the output of the serialization
-			String value = buildBlankOMElem();
-			assertNull("There's a serialized output for a blank XML element that cannot exist", value);
-		} catch (Exception e) {
-			//An exception is thrown trying to serializeAndConsume a blank element
-			assertTrue(true);
-		}
-	}
-
-
-
-	String buildBlankOMElem() throws XMLStreamException {
-		OMFactory factory = OMAbstractFactory.getOMFactory();
-		OMNamespace namespace1 = factory.createOMNamespace("","");
-		OMElement elem1 = factory.createOMElement("",namespace1);
-
-		StringWriter writer = new StringWriter();
-		elem1.build();
-		elem1.serialize(writer);
-		writer.flush();
-		return writer.toString();
-	}
-}
+/*
+ * 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.axiom.om;
+
+import junit.framework.TestCase;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+
+public class OMBlankElementTest extends TestCase {
+
+
+	public OMBlankElementTest(String name) {
+		super(name);
+	}
+
+	public void testBlankOMElem() {
+		try {
+			//We should not get anything as the return value here: the output of the serialization
+			String value = buildBlankOMElem();
+			assertNull("There's a serialized output for a blank XML element that cannot exist", value);
+		} catch (Exception e) {
+			//An exception is thrown trying to serializeAndConsume a blank element
+			assertTrue(true);
+		}
+	}
+
+
+
+	String buildBlankOMElem() throws XMLStreamException {
+		OMFactory factory = OMAbstractFactory.getOMFactory();
+		OMNamespace namespace1 = factory.createOMNamespace("","");
+		OMElement elem1 = factory.createOMElement("",namespace1);
+
+		StringWriter writer = new StringWriter();
+		elem1.build();
+		elem1.serialize(writer);
+		writer.flush();
+		return writer.toString();
+	}
+}

Modified: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBodyTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBodyTest.java?rev=391260&r1=391259&r2=391260&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBodyTest.java (original)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMBodyTest.java Tue Apr
 4 02:33:33 2006
@@ -1,62 +1,59 @@
-/*
- * 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.axiom.om;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPProcessingException;
-
-public class OMBodyTest extends OMTestCase implements OMConstants {
-    SOAPBody soapBody;
-    private Log log = LogFactory.getLog(getClass());
-
-    public OMBodyTest(String testName) {
-        super(testName);
-    }
-
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        soapBody = soapEnvelope.getBody();
-    }
-
-    /*
-     * Class under test for SOAPFault addFault()
-     */
-    public void testAddFault() {
-        log.info("Adding SOAP fault to body ....");
-        try {
-            soapBody.addChild(
-                    soapFactory.createSOAPFault(soapBody,
-                            new Exception("Testing soap fault")));
-        } catch (SOAPProcessingException e) {
-            log.info(e.getMessage());
-            fail(e.getMessage());
-        }
-        log.info("\t checking for SOAP Fault ...");
-        assertTrue("SOAP body has no SOAP fault", soapBody.hasFault());
-        log.info("\t checking for not-nullity ...");
-        assertTrue("SOAP body has no SOAP fault", soapBody.getFault() != null);
-
-        //SimpleOMSerializer simpleOMSerializer = new SimpleOMSerializer();
-        //simpleOMSerializer.serializeAndConsume(soapBody, System.out);
-    }
-
-}
+/*
+ * 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.axiom.om;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public class OMBodyTest extends OMTestCase implements OMConstants {
+    SOAPBody soapBody;
+    private Log log = LogFactory.getLog(getClass());
+
+    public OMBodyTest(String testName) {
+        super(testName);
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapBody = soapEnvelope.getBody();
+    }
+
+    /*
+     * Class under test for SOAPFault addFault()
+     */
+    public void testAddFault() {
+        log.info("Adding SOAP fault to body ....");
+        try {
+            soapBody.addChild(
+                    soapFactory.createSOAPFault(soapBody,
+                            new Exception("Testing soap fault")));
+        } catch (SOAPProcessingException e) {
+            log.info(e.getMessage());
+            fail(e.getMessage());
+        }
+        log.info("\t checking for SOAP Fault ...");
+        assertTrue("SOAP body has no SOAP fault", soapBody.hasFault());
+        log.info("\t checking for not-nullity ...");
+        assertTrue("SOAP body has no SOAP fault", soapBody.getFault() != null);
+    }
+
+}

Modified: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java?rev=391260&r1=391259&r2=391260&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java
Tue Apr  4 02:33:33 2006
@@ -1,131 +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.axiom.om.impl.llom;
-
-import junit.framework.TestCase;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMOutputFormat;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * This tests the serializeAndConsume method
- */
-public class OMDocumentSerilizationTest extends TestCase {
-
-    private OMDocument document;
-    private String xmlDeclStart = "<?xml";
-    private String encoding = "encoding='UTF-8'";
-    private String encoding_UTF16 = "encoding='UTF-16'";
-    private String encoding2 = "encoding=\"UTF-8\"";
-    private String encoding2_UTF16 = "encoding=\"UTF-16\"";
-    private String version = "version='1.0'";
-    private String version_11 = "version='1.1'";
-    private String version2 = "version=\"1.0\"";
-    private String version2_11 = "version=\"1.1\"";
-
-    public void setUp() {
-        OMFactory factory = OMAbstractFactory.getOMFactory();
-
-        OMNamespace namespace = factory.createOMNamespace("http://testuri.org","test");
-        OMElement documentElement = factory.createOMElement("DocumentElement",namespace);
-
-        OMElement child1 = factory.createOMElement("Child1",namespace);
-        child1.setText("TestText");
-        documentElement.addChild(child1);
-
-        document = factory.createOMDocument();
-        document.setOMDocumentElement(documentElement);
-
-    }
-
-    public OMDocumentSerilizationTest(String name) {
-        super(name);
-    }
-
-
-    public void testXMLDecleration() throws XMLStreamException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        document.serializeAndConsume(baos);
-
-        String xmlDocument = new String(baos.toByteArray());
-
-        assertTrue("XML Declaration missing",-1<xmlDocument.indexOf(xmlDeclStart));
-    }
-
-    public void testExcludeXMLDeclaration() throws XMLStreamException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        OMOutputFormat format = new OMOutputFormat();
-        format.setIgnoreXMLDeclaration(true);
-        document.serializeAndConsume(baos, format);
-
-        String xmlDocument = new String(baos.toByteArray());
-
-        assertTrue(
-                "XML Declaration is included when serilizing without the declaration",
-                -1 == xmlDocument.indexOf(xmlDeclStart));
-    }
-
-    public void testCharsetEncoding() throws XMLStreamException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        document.serializeAndConsume(baos);
-
-        String xmlDocument = new String(baos.toByteArray());
-
-        assertTrue("Charset declaration missing",-1 < xmlDocument.indexOf(encoding) ||
-                                                 -1 < xmlDocument.indexOf(encoding.toLowerCase())
||
-                                                 -1 < xmlDocument.indexOf(encoding2.toLowerCase())
||
-                                                 -1 < xmlDocument.indexOf(encoding2));
-    }
-
-    public void testCharsetEncodingUTF_16() throws XMLStreamException, UnsupportedEncodingException
{
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        OMOutputFormat format = new OMOutputFormat();
-        format.setCharSetEncoding("UTF-16");
-        document.serializeAndConsume(baos, format);
-
-        String xmlDocument = new String(baos.toByteArray(),"UTF-16");
-        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(encoding_UTF16)
||
-                                                 -1<xmlDocument.indexOf(encoding2_UTF16));
-    }
-
-
-    public void testXMLVersion() throws XMLStreamException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        document.serializeAndConsume(baos);
-
-        String xmlDocument = new String(baos.toByteArray());
-        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version) ||
-                                                 -1<xmlDocument.indexOf(version2));
-    }
-
-    public void testXMLVersion_11() throws XMLStreamException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        document.setXMLVersion("1.1");
-        document.serializeAndConsume(baos);
-
-        String xmlDocument = new String(baos.toByteArray());
-        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version_11) ||
-                                                 -1<xmlDocument.indexOf(version2_11));
-    }
-}
+/*
+ * 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.axiom.om.impl.llom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMOutputFormat;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * This tests the serializeAndConsume method
+ */
+public class OMDocumentSerilizationTest extends TestCase {
+
+    private OMDocument document;
+    private String xmlDeclStart = "<?xml";
+    private String encoding = "encoding='UTF-8'";
+    private String encoding_UTF16 = "encoding='UTF-16'";
+    private String encoding2 = "encoding=\"UTF-8\"";
+    private String encoding2_UTF16 = "encoding=\"UTF-16\"";
+    private String version = "version='1.0'";
+    private String version_11 = "version='1.1'";
+    private String version2 = "version=\"1.0\"";
+    private String version2_11 = "version=\"1.1\"";
+
+    public void setUp() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+
+        OMNamespace namespace = factory.createOMNamespace("http://testuri.org","test");
+        OMElement documentElement = factory.createOMElement("DocumentElement",namespace);
+
+        OMElement child1 = factory.createOMElement("Child1",namespace);
+        child1.setText("TestText");
+        documentElement.addChild(child1);
+
+        document = factory.createOMDocument();
+        document.setOMDocumentElement(documentElement);
+
+    }
+
+    public OMDocumentSerilizationTest(String name) {
+        super(name);
+    }
+
+
+    public void testXMLDecleration() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue("XML Declaration missing",-1<xmlDocument.indexOf(xmlDeclStart));
+    }
+
+    public void testExcludeXMLDeclaration() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setIgnoreXMLDeclaration(true);
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue(
+                "XML Declaration is included when serilizing without the declaration",
+                -1 == xmlDocument.indexOf(xmlDeclStart));
+    }
+
+    public void testCharsetEncoding() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue("Charset declaration missing",-1 < xmlDocument.indexOf(encoding) ||
+                                                 -1 < xmlDocument.indexOf(encoding.toLowerCase())
||
+                                                 -1 < xmlDocument.indexOf(encoding2.toLowerCase())
||
+                                                 -1 < xmlDocument.indexOf(encoding2));
+    }
+
+    public void testCharsetEncodingUTF_16() throws XMLStreamException, UnsupportedEncodingException
{
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding("UTF-16");
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray(),"UTF-16");
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(encoding_UTF16)
||
+                                                 -1<xmlDocument.indexOf(encoding2_UTF16));
+    }
+
+
+    public void testXMLVersion() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version) ||
+                                                 -1<xmlDocument.indexOf(version2));
+    }
+
+    public void testXMLVersion_11() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.setXMLVersion("1.1");
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version_11) ||
+                                                 -1<xmlDocument.indexOf(version2_11));
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java?rev=391260&r1=391259&r2=391260&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
Tue Apr  4 02:33:33 2006
@@ -1,150 +1,134 @@
-/*
- * 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.axiom.om.impl.serializer;
-
-import junit.framework.TestCase;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-
-public class NoNamespaceSerializerTest extends TestCase {
-
-    private String xmlTextOne = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+
-            "<soapenv:Body>\n" +
-            "   <ns1:getBalance xmlns:ns1=\"http://localhost:8081/axis/services/BankPort/\">\n"
+
-            "      <accountNo href=\"#id0\"/>\n" +
-            "   </ns1:getBalance>\n" +
-            " </soapenv:Body></soapenv:Envelope>";
-
-    private String xmlText2 = "<purchase-order xmlns=\"http://openuri.org/easypo\">\n"
+
-            "  <customer>\n" +
-            "    <name>Gladys Kravitz</name>\n" +
-            "    <address>Anytown, PA</address>\n" +
-            "  </customer>\n" +
-            "  <date>2005-03-06T14:06:12.697+06:00</date>\n" +
-            "</purchase-order>";
-
-    private String xmlTextTwo = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+
-            "<soapenv:Body>\n" +
-            "   <getBalance xmlns=\"http://localhost:8081/axis/services/BankPort/\">\n"
+
-            "      <accountNo href=\"#id0\"/>\n" +
-            "   </getBalance>\n" +
-            " </soapenv:Body></soapenv:Envelope>";
-
-    private XMLStreamReader readerOne;
-    private XMLStreamReader readerTwo;
-    private XMLStreamWriter writer;
-
-    // private OMXMLParserWrapper builder;
-    // private File tempFile;
-
-    private OMXMLParserWrapper builderOne;
-    private OMXMLParserWrapper builderTwo;
-    // private File tempFile;
-
-
-
-    protected void setUp() throws Exception {
-        readerOne =
-                XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new InputStreamReader(
-                                new ByteArrayInputStream(xmlTextOne.getBytes())));
-        readerTwo =
-                XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new InputStreamReader(
-                                new ByteArrayInputStream(xmlTextTwo.getBytes())));
-        writer = XMLOutputFactory.newInstance().
-                createXMLStreamWriter(System.out);
-        builderOne =
-                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                        OMAbstractFactory.getSOAP11Factory(), readerOne);
-        builderTwo =
-                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                        OMAbstractFactory.getSOAP11Factory(), readerTwo);
-    }
-
-
-//    public void testSerilizationWithCacheOff() throws Exception {
-//        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-//        env.serializeAndConsume(writer, false);
-//        writer.flush();
-//
-//
-//    }
-//
-//    public void testSerilizationWithCacheOn() throws Exception {
-//        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-//        env.serializeAndConsume(writer, true);
-//        writer.flush();
-//    }
-
-
-    public void testSerilizationWithDefaultNamespaces() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
-        env.serialize(writer);
-        OMElement balanceElement = env.getBody().getFirstElement();
-        assertEquals("Deafualt namespace has not been set properly",
-                balanceElement.getNamespace().getName(),
-                "http://localhost:8081/axis/services/BankPort/");
-
-        OMElement accountNo = balanceElement.getFirstElement();
-        assertEquals(
-                "Deafualt namespace of children has not been set properly",
-                accountNo.getNamespace().getName(),
-                "http://localhost:8081/axis/services/BankPort/");
-
-    }
-
-    public void submitPurchaseOrderTest()
-            throws Exception {
-        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
-        SOAPEnvelope env = omFactory.getDefaultEnvelope();
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
-                omFactory,
-                XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new InputStreamReader(
-                                new ByteArrayInputStream(xmlText2.getBytes()))));
-        env.getBody().addChild(builder.getDocumentElement());
-
-        env.serialize(System.out);
-    }
-
-    public void testSerilizationWithCacheOn() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-        env.serialize(writer);
-        writer.flush();
-    }
-
-    public void testSerilizationWithCacheOff() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-        env.serialize(writer);
-        writer.flush();
-    }
-}
+/*
+ * 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.axiom.om.impl.serializer;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+
+public class NoNamespaceSerializerTest extends TestCase {
+
+    private String xmlTextOne = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+
+            "<soapenv:Body>\n" +
+            "   <ns1:getBalance xmlns:ns1=\"http://localhost:8081/axis/services/BankPort/\">\n"
+
+            "      <accountNo href=\"#id0\"/>\n" +
+            "   </ns1:getBalance>\n" +
+            " </soapenv:Body></soapenv:Envelope>";
+
+    private String xmlText2 = "<purchase-order xmlns=\"http://openuri.org/easypo\">\n"
+
+            "  <customer>\n" +
+            "    <name>Gladys Kravitz</name>\n" +
+            "    <address>Anytown, PA</address>\n" +
+            "  </customer>\n" +
+            "  <date>2005-03-06T14:06:12.697+06:00</date>\n" +
+            "</purchase-order>";
+
+    private String xmlTextTwo = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+
+            "<soapenv:Body>\n" +
+            "   <getBalance xmlns=\"http://localhost:8081/axis/services/BankPort/\">\n"
+
+            "      <accountNo href=\"#id0\"/>\n" +
+            "   </getBalance>\n" +
+            " </soapenv:Body></soapenv:Envelope>";
+
+    private XMLStreamReader readerOne;
+    private XMLStreamReader readerTwo;
+    private XMLStreamWriter writer;
+
+    // private OMXMLParserWrapper builder;
+    // private File tempFile;
+
+    private OMXMLParserWrapper builderOne;
+    private OMXMLParserWrapper builderTwo;
+    // private File tempFile;
+
+
+
+    protected void setUp() throws Exception {
+        readerOne =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlTextOne.getBytes())));
+        readerTwo =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlTextTwo.getBytes())));
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(System.out);
+        builderOne =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                        OMAbstractFactory.getSOAP11Factory(), readerOne);
+        builderTwo =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                        OMAbstractFactory.getSOAP11Factory(), readerTwo);
+    }
+
+    public void testSerilizationWithDefaultNamespaces() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
+        env.serialize(writer);
+        OMElement balanceElement = env.getBody().getFirstElement();
+        assertEquals("Deafualt namespace has not been set properly",
+                balanceElement.getNamespace().getName(),
+                "http://localhost:8081/axis/services/BankPort/");
+
+        OMElement accountNo = balanceElement.getFirstElement();
+        assertEquals(
+                "Deafualt namespace of children has not been set properly",
+                accountNo.getNamespace().getName(),
+                "http://localhost:8081/axis/services/BankPort/");
+
+    }
+
+    public void submitPurchaseOrderTest()
+            throws Exception {
+        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = omFactory.getDefaultEnvelope();
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
+                omFactory,
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlText2.getBytes()))));
+        env.getBody().addChild(builder.getDocumentElement());
+
+        env.serialize(System.out);
+    }
+
+    public void testSerilizationWithCacheOn() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serialize(writer);
+        writer.flush();
+    }
+
+    public void testSerilizationWithCacheOff() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serialize(writer);
+        writer.flush();
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?rev=391260&r1=391259&r2=391260&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
Tue Apr  4 02:33:33 2006
@@ -1,229 +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.axiom.om.impl.streamwrapper;
-
-import org.apache.axiom.om.AbstractTestCase;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileReader;
-
-public class OMStaxStreamingWrapperTest extends AbstractTestCase {
-    private SOAPEnvelope envelope = null;
-    private File tempFile;
-    private XMLStreamReader parser;
-
-    public OMStaxStreamingWrapperTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new FileReader(
-                                getTestResourceFile("soap/soapmessage1.xml")));
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                OMAbstractFactory.getSOAP11Factory(), xmlStreamReader);
-        envelope = (SOAPEnvelope) builder.getDocumentElement();
-        tempFile = File.createTempFile("temp", "xml");
-
-    }
-
-
-    //    public void testWrapperFullOM() throws Exception {
-    //        assertNotNull(envelope);
-    //        //this serializing will cause the OM to fully build!
-    //        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(tempFile));
-    //        envelope.serializeAndConsume(writer,true);
-    //        parser = envelope.getXMLStreamReader(false);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //        }
-    //
-    //    }
-
-    public void testWrapperHalfOM() throws Exception {
-        assertNotNull(envelope);
-        parser = envelope.getXMLStreamReaderWithoutCaching();
-        while (parser.hasNext()) {
-            int event = parser.next();
-            assertTrue(event > 0);
-        }
-    }
-
-    //    public void testWrapperHalfOMWithCacheOff() throws Exception {
-    //        assertNotNull(envelope);
-    //        parser = envelope.getXMLStreamReader(true);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //        }
-    //    }
-    //
-    //    public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException
{
-    //        assertNotNull(envelope);
-    //        parser = envelope.getXMLStreamReader(true);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //            if (event == XMLStreamConstants.START_ELEMENT) {
-    //                checkStartElement(parser);
-    //            } else if (event == XMLStreamConstants.CHARACTERS) {
-    //                checkCharacters(parser);
-    //            }
-    //        }
-    //
-    //
-    //    }
-    //
-    //    public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
-    //        assertNotNull(envelope);
-    //        parser = envelope.getXMLStreamReader(false);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //            if (event == XMLStreamConstants.START_ELEMENT) {
-    //                checkStartElement(parser);
-    //            } else if (event == XMLStreamConstants.CHARACTERS) {
-    //                checkCharacters(parser);
-    //            }
-    //        }
-    //
-    //
-    //    }
-    //
-    //    private void checkCharacters(XMLStreamReader wrapper) {
-    //        assertFalse(wrapper.isStartElement());
-    //        assertFalse(wrapper.isEndElement());
-    //        assertFalse(wrapper.isWhiteSpace());
-    //        assertFalse(wrapper.hasName());
-    //        assertTrue(wrapper.isCharacters());
-    //
-    //        assertNotNull(wrapper.getText());
-    //        assertTrue(wrapper.getTextLength() > 0);
-    //    }
-    //
-    //    private void checkStartElement(XMLStreamReader wrapper) {
-    //        assertTrue(wrapper.isStartElement());
-    //        assertTrue(wrapper.hasName());
-    //        assertFalse(wrapper.isEndElement());
-    //        assertFalse(wrapper.isCharacters());
-    //        assertFalse(wrapper.isWhiteSpace());
-    //
-    //        //at the start element event these need to be supplied
-    //        assertNotNull(wrapper.getLocalName());
-    //        assertNotNull(wrapper.getName());
-    //        assertNotNull(wrapper.getNamespaceURI());
-    //        //prefix may be null
-    //        wrapper.getPrefix();
-    //
-    //        //todo add the other checks here
-    //        int attribCount = wrapper.getAttributeCount();
-    //        for (int i = 0; i < attribCount; i++) {
-    //            assertNotNull(wrapper.getAttributeLocalName(i));
-    //            assertNotNull(wrapper.getAttributeValue(i));
-    //            assertNotNull(wrapper.getAttributeName(i));
-    //            wrapper.getAttributePrefix(i);
-    //            wrapper.getAttributeNamespace(i);
-    //            //todo add the other checks here
-    //        }
-    //
-    //
-    //    }
-    //
-    //    public void testWrapperElementEventGenerationWithHalfOMWithCacheOff() throws XMLStreamException
{
-    //        assertNotNull(envelope);
-    //        parser = envelope.getXMLStreamReader(true);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //            if (event == XMLStreamConstants.START_ELEMENT) {
-    //                checkStartElement(parser);
-    //            } else if (event == XMLStreamConstants.CHARACTERS) {
-    //                checkCharacters(parser);
-    //            }
-    //        }
-    //
-    //
-    //    }
-    //
-    //    public void testWrapperElementEventGenerationWithHalfOM() throws Exception {
-    //        assertNotNull(envelope);
-    //        parser = envelope.getXMLStreamReader(false);
-    //        while (parser.hasNext()) {
-    //            int event = parser.next();
-    //            assertTrue(event > 0);
-    //            if (event == XMLStreamConstants.START_ELEMENT) {
-    //                checkStartElement(parser);
-    //            } else if (event == XMLStreamConstants.CHARACTERS) {
-    //                checkCharacters(parser);
-    //            }
-    //        }
-    //
-    //
-    //    }
-    //
-    //    private void checkCharacters(XMLStreamReader wrapper) {
-    //        assertFalse(wrapper.isStartElement());
-    //        assertFalse(wrapper.isEndElement());
-    //        assertFalse(wrapper.isWhiteSpace());
-    //        assertFalse(wrapper.hasName());
-    //        assertTrue(wrapper.isCharacters());
-    //
-    //        assertNotNull(wrapper.getText());
-    //        assertTrue(wrapper.getTextLength() > 0);
-    //    }
-    //
-    //    private void checkStartElement(XMLStreamReader wrapper) {
-    //        assertTrue(wrapper.isStartElement());
-    //        assertTrue(wrapper.hasName());
-    //        assertFalse(wrapper.isEndElement());
-    //        assertFalse(wrapper.isCharacters());
-    //        assertFalse(wrapper.isWhiteSpace());
-    //
-    //        //at the start element event these need to be supplied
-    //        assertNotNull(wrapper.getLocalName());
-    //        assertNotNull(wrapper.getName());
-    //        assertNotNull(wrapper.getNamespaceURI());
-    //        //prefix may be null
-    //        wrapper.getPrefix();
-    //
-    //        //todo add the other checks here
-    //        int attribCount = wrapper.getAttributeCount();
-    //        for (int i = 0; i < attribCount; i++) {
-    //            assertNotNull(wrapper.getAttributeLocalName(i));
-    //            assertNotNull(wrapper.getAttributeValue(i));
-    //            assertNotNull(wrapper.getAttributeName(i));
-    //            wrapper.getAttributePrefix(i);
-    //            wrapper.getAttributeNamespace(i);
-    //            //todo add the other checks here
-    //        }
-    //
-    //
-    //    }
-
-
-    protected void tearDown() throws Exception {
-        tempFile.delete();
-    }
-}
+/*
+ * 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.axiom.om.impl.streamwrapper;
+
+import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+
+public class OMStaxStreamingWrapperTest extends AbstractTestCase {
+    private SOAPEnvelope envelope = null;
+    private File tempFile;
+    private XMLStreamReader parser;
+
+    public OMStaxStreamingWrapperTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage1.xml")));
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(), xmlStreamReader);
+        envelope = (SOAPEnvelope) builder.getDocumentElement();
+        tempFile = File.createTempFile("temp", "xml");
+
+    }
+
+    public void testWrapperHalfOM() throws Exception {
+        assertNotNull(envelope);
+        parser = envelope.getXMLStreamReaderWithoutCaching();
+        while (parser.hasNext()) {
+            int event = parser.next();
+            assertTrue(event > 0);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
+}



Mime
View raw message