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 di...@apache.org on 2005/07/14 02:30:59 UTC

svn commit: r216290 [7/8] - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/transport/ core/src/org/apache/axis2/transport/http/ core/webapp/ saaj/src/org/apache/axis2/saaj/ samples/src/sample/amazon/search/ samples/src/userguide/cli...

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java Wed Jul 13 17:30:55 2005
@@ -1,154 +1,153 @@
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-package org.apache.axis2.attachments;
-
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.impl.llom.OMElementImpl;
-import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
-import org.apache.axis2.om.impl.llom.OMTextImpl;
-import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.awt.*;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
-
-public class ImageSampleTest extends AbstractTestCase {
-
-    public ImageSampleTest(String testName) {
-        super(testName);
-    }
-
-    /*
-     * @see TestCase#setUp()
-     */
-    Image expectedImage;
-
-    MTOMStAXSOAPModelBuilder builder;
-
-    DataHandler expectedDH;
-
-    File outMTOMFile;
-
-    File outBase64File;
-
-    String outFileName = "mtom/ActualImageMTOMOut.bin";
-
-    String outBase64FileName = "mtom/OMSerializeBase64Out.xml";
-
-    String imageInFileName = "mtom/img/test.jpg";
-
-    String imageOutFileName = "mtom/img/testOut.jpg";
-
-    String inMimeFileName = "mtom/ImageMTOMOut.bin";
-
-    String contentTypeString = "multipart/Related; type=\"application/xop+xml\";start=\"<SOAPPart>\"; boundary=\"----=_AxIs2_Def_boundary_=42214532\"";
-
-
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-
-    }
-
-    public void testImageSampleSerialize() throws Exception {
-
-        outMTOMFile = getTestResourceFile(outFileName);
-        outBase64File = getTestResourceFile(outBase64FileName);
-        OMOutput mtomOutput = new OMOutput(new FileOutputStream(outMTOMFile),
-                true);
-        OMOutput baseOutput = new OMOutput(new FileOutputStream(outBase64File),
-                false);
-
-        OMNamespaceImpl soap = new OMNamespaceImpl(
-                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
-        OMElement envelope = new OMElementImpl("Envelope", soap);
-        OMElement body = new OMElementImpl("Body", soap);
-
-        OMNamespaceImpl dataName = new OMNamespaceImpl(
-                "http://www.example.org/stuff", "m");
-        OMElement data = new OMElementImpl("data", dataName);
-
-        expectedImage =
-                new JDK13IO().loadImage(
-                        new FileInputStream(
-                                getTestResourceFile(imageInFileName)));
-        ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
-                expectedImage);
-        expectedDH = new DataHandler(dataSource);
-        OMText binaryNode = new OMTextImpl(expectedDH, true);
-
-        envelope.addChild(body);
-        body.addChild(data);
-        data.addChild(binaryNode);
-
-        envelope.serialize(baseOutput);
-        baseOutput.flush();
-
-        envelope.serialize(mtomOutput);
-        mtomOutput.flush();
-        mtomOutput.complete();
-    }
-
-    public void testImageSampleDeserialize() throws Exception {
-        InputStream inStream = new FileInputStream(
-                getTestResourceFile(inMimeFileName));
-        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString);
-        XMLStreamReader reader = XMLInputFactory.newInstance()
-                .createXMLStreamReader(
-                        new BufferedReader(
-                                new InputStreamReader(
-                                        mimeHelper
-                .getSOAPPartInputStream())));
-        builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
-        OMElement root = (OMElement) builder.getDocumentElement();
-        OMElement body = (OMElement) root.getFirstChild();
-        OMElement data = (OMElement) body.getFirstChild();
-        OMText blob = (OMText) data.getFirstChild();
-        /*
-         * Following is the procedure the user has to follow to read objects in
-         * OBBlob User has to know the object type & whether it is serializable.
-         * If it is not he has to use a Custom Defined DataSource to get the
-         * Object.
-         */
-
-        DataHandler actualDH;
-        actualDH = blob.getDataHandler();
-        Image actualObject = new JDK13IO().loadImage(actualDH.getDataSource()
-                .getInputStream());
-        FileOutputStream imageOutStream = new FileOutputStream(
-                getTestResourceFile(imageOutFileName));
-        new JDK13IO().saveImage("image/jpeg", actualObject, imageOutStream);
-
-    }
-
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+package org.apache.axis2.attachments;
+
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.impl.llom.OMElementImpl;
+import org.apache.axis2.om.impl.llom.OMNamespaceImpl;
+import org.apache.axis2.om.impl.llom.OMTextImpl;
+import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
+
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.awt.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
+ */
+
+public class ImageSampleTest extends AbstractTestCase {
+
+    public ImageSampleTest(String testName) {
+        super(testName);
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    Image expectedImage;
+
+    MTOMStAXSOAPModelBuilder builder;
+
+    DataHandler expectedDH;
+
+    File outMTOMFile;
+
+    File outBase64File;
+
+    String outFileName = "mtom/ActualImageMTOMOut.bin";
+
+    String outBase64FileName = "mtom/OMSerializeBase64Out.xml";
+
+    String imageInFileName = "mtom/img/test.jpg";
+
+    String imageOutFileName = "mtom/img/testOut.jpg";
+
+    String inMimeFileName = "mtom/ImageMTOMOut.bin";
+
+    String contentTypeString = "multipart/Related; type=\"application/xop+xml\";start=\"<SOAPPart>\"; boundary=\"----=_AxIs2_Def_boundary_=42214532\"";
+
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+
+    }
+
+    public void testImageSampleSerialize() throws Exception {
+
+        outMTOMFile = getTestResourceFile(outFileName);
+        outBase64File = getTestResourceFile(outBase64FileName);
+        org.apache.axis2.om.impl.OMOutputImpl mtomOutput = new OMOutputImpl(new FileOutputStream(outMTOMFile),
+                true);
+        org.apache.axis2.om.impl.OMOutputImpl baseOutput = new OMOutputImpl(new FileOutputStream(outBase64File),
+                false);
+
+        OMNamespaceImpl soap = new OMNamespaceImpl(
+                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
+        OMElement envelope = new OMElementImpl("Envelope", soap);
+        OMElement body = new OMElementImpl("Body", soap);
+
+        OMNamespaceImpl dataName = new OMNamespaceImpl(
+                "http://www.example.org/stuff", "m");
+        OMElement data = new OMElementImpl("data", dataName);
+
+        expectedImage =
+                new JDK13IO().loadImage(
+                        new FileInputStream(
+                                getTestResourceFile(imageInFileName)));
+        ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
+                expectedImage);
+        expectedDH = new DataHandler(dataSource);
+        OMText binaryNode = new OMTextImpl(expectedDH, true);
+
+        envelope.addChild(body);
+        body.addChild(data);
+        data.addChild(binaryNode);
+
+        envelope.serialize(baseOutput);
+        baseOutput.flush();
+
+        envelope.serialize(mtomOutput);
+        mtomOutput.flush();
+    }
+
+    public void testImageSampleDeserialize() throws Exception {
+        InputStream inStream = new FileInputStream(
+                getTestResourceFile(inMimeFileName));
+        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString);
+        XMLStreamReader reader = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new BufferedReader(
+                                new InputStreamReader(
+                                        mimeHelper
+                .getSOAPPartInputStream())));
+        builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
+        OMElement root = (OMElement) builder.getDocumentElement();
+        OMElement body = (OMElement) root.getFirstChild();
+        OMElement data = (OMElement) body.getFirstChild();
+        OMText blob = (OMText) data.getFirstChild();
+        /*
+         * Following is the procedure the user has to follow to read objects in
+         * OBBlob User has to know the object type & whether it is serializable.
+         * If it is not he has to use a Custom Defined DataSource to get the
+         * Object.
+         */
+
+        DataHandler actualDH;
+        actualDH = blob.getDataHandler();
+        Image actualObject = new JDK13IO().loadImage(actualDH.getDataSource()
+                .getInputStream());
+        FileOutputStream imageOutStream = new FileOutputStream(
+                getTestResourceFile(imageOutFileName));
+        new JDK13IO().saveImage("image/jpeg", actualObject, imageOutStream);
+
+    }
+
 }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/MIMEOutputUtilsTest.java Wed Jul 13 17:30:55 2005
@@ -1,86 +1,87 @@
-/*
- * 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;
-
-import junit.framework.TestCase;
-import org.apache.axis2.attachments.ByteArrayDataSource;
-import org.apache.axis2.soap.SOAPFactory;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimePartDataSource;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * @author Thilina
- */
-public class MIMEOutputUtilsTest extends TestCase {
-    byte[] buffer;
-    byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
-                                  98};
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-        ByteArrayOutputStream outStream;
-        String boundary = "----TemporaryBoundary";
-
-        String contentType = MIMEOutputUtils.getContentTypeForMime(boundary);
-        DataHandler dataHandler;
-        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
-        OMText textData = factory.createText(dataHandler, true);
-
-        DataHandler dataHandler2 = new DataHandler(
-                "Apache Software Foundation", "text/plain");
-        OMText text = factory.createText(dataHandler2, true);
-        outStream = new ByteArrayOutputStream();
-        outStream.write(("Content-Type: " + contentType).getBytes());
-        outStream.write(new byte[]{13, 10});
-        //outStream.write("\n\n".getBytes());
-        MIMEOutputUtils.startWritingMime(outStream, boundary);
-        MimeBodyPart part1 = MIMEOutputUtils.createMimeBodyPart(textData);
-        MIMEOutputUtils.writeBodyPart(outStream, part1, boundary);
-        MimeBodyPart part2 = MIMEOutputUtils.createMimeBodyPart(text);
-        MIMEOutputUtils.writeBodyPart(outStream, part2, boundary);
-        MIMEOutputUtils.finishWritingMime(outStream);
-        buffer = outStream.toByteArray();
-        System.out.println(new String(buffer));
-        System.out.println("Axis2");
-    }
-
-    public void testMIMEWriting() throws IOException, MessagingException {
-        ByteArrayInputStream inStream = new ByteArrayInputStream(buffer);
-        Properties props = new Properties();
-        javax.mail.Session session = javax.mail.Session
-                .getInstance(props, null);
-        MimeMessage mimeMessage = new MimeMessage(session, inStream);
-        DataHandler dh = mimeMessage.getDataHandler();
-        MimeMultipart multiPart = new MimeMultipart(
-                (MimePartDataSource) dh
-                .getDataSource());
-        MimeBodyPart mimeBodyPart2 = (MimeBodyPart) multiPart.getBodyPart(0);
-        Object object = mimeBodyPart2.getContent();
-        MimeBodyPart mimeBodyPart1 = (MimeBodyPart) multiPart.getBodyPart(0);
-
-    }
-
+/*
+ * 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;
+
+import junit.framework.TestCase;
+import org.apache.axis2.attachments.ByteArrayDataSource;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.om.impl.MIMEOutputUtils;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimePartDataSource;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * @author Thilina
+ */
+public class MIMEOutputUtilsTest extends TestCase {
+    byte[] buffer;
+    byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
+                                  98};
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        ByteArrayOutputStream outStream;
+        String boundary = "----TemporaryBoundary";
+
+        String contentType = org.apache.axis2.om.impl.MIMEOutputUtils.getContentTypeForMime(boundary);
+        DataHandler dataHandler;
+        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
+        OMText textData = factory.createText(dataHandler, true);
+
+        DataHandler dataHandler2 = new DataHandler(
+                "Apache Software Foundation", "text/plain");
+        OMText text = factory.createText(dataHandler2, true);
+        outStream = new ByteArrayOutputStream();
+        outStream.write(("Content-Type: " + contentType).getBytes());
+        outStream.write(new byte[]{13, 10});
+        //outStream.write("\n\n".getBytes());
+        MIMEOutputUtils.startWritingMime(outStream, boundary);
+        MimeBodyPart part1 = MIMEOutputUtils.createMimeBodyPart(textData);
+        MIMEOutputUtils.writeBodyPart(outStream, part1, boundary);
+        MimeBodyPart part2 = MIMEOutputUtils.createMimeBodyPart(text);
+        MIMEOutputUtils.writeBodyPart(outStream, part2, boundary);
+        MIMEOutputUtils.finishWritingMime(outStream);
+        buffer = outStream.toByteArray();
+        System.out.println(new String(buffer));
+        System.out.println("Axis2");
+    }
+
+    public void testMIMEWriting() throws IOException, MessagingException {
+        ByteArrayInputStream inStream = new ByteArrayInputStream(buffer);
+        Properties props = new Properties();
+        javax.mail.Session session = javax.mail.Session
+                .getInstance(props, null);
+        MimeMessage mimeMessage = new MimeMessage(session, inStream);
+        DataHandler dh = mimeMessage.getDataHandler();
+        MimeMultipart multiPart = new MimeMultipart(
+                (MimePartDataSource) dh
+                .getDataSource());
+        MimeBodyPart mimeBodyPart2 = (MimeBodyPart) multiPart.getBodyPart(0);
+        Object object = mimeBodyPart2.getContent();
+        MimeBodyPart mimeBodyPart1 = (MimeBodyPart) multiPart.getBodyPart(0);
+
+    }
+
 }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMNavigatorTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMNavigatorTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMNavigatorTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/OMNavigatorTest.java Wed Jul 13 17:30:55 2005
@@ -1,108 +1,105 @@
-/*
- * 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;
-
-import org.apache.axis2.om.impl.llom.OMNavigator;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
-public class OMNavigatorTest extends AbstractTestCase {
-    private SOAPEnvelope envelope = null;
-    private OMXMLParserWrapper builder;
-    private File tempFile;
-    private OMOutput omOutput;
-
-    public OMNavigatorTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new FileReader(
-                                getTestResourceFile("soap/soapmessage1.xml")));
-        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-        builder = new StAXSOAPModelBuilder(xmlStreamReader);
-        envelope = (SOAPEnvelope) builder.getDocumentElement();
-        tempFile = File.createTempFile("temp", "xml");
-        omOutput =
-                new OMOutput(
-                        XMLOutputFactory.newInstance().createXMLStreamWriter(
-                                new FileOutputStream(tempFile)));
-        //        writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-
-
-    }
-
-    public void testnavigatorFullyBuilt() throws Exception {
-        assertNotNull(envelope);
-        //dump the out put to a  temporary file
-        envelope.serializeWithCache(omOutput);
-
-        //now the OM is fully created test the navigation
-        OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node = null;
-        while (navigator.isNavigable()) {
-            node = navigator.next();
-            assertNotNull(node);
-        }
-    }
-
-    public void testnavigatorHalfBuilt() {
-        assertNotNull(envelope);
-        //now the OM is not fully created. Try to navigate it
-        OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node = null;
-        while (navigator.isNavigable()) {
-            node = navigator.next();
-            assertNotNull(node);
-        }
-    }
-
-    public void testnavigatorHalfBuiltStep() {
-        assertNotNull(envelope);
-
-        //now the OM is not fully created
-        OMNavigator navigator = new OMNavigator(envelope);
-        OMNode node = null;
-        while (!navigator.isCompleted()) {
-            if (navigator.isNavigable()) {
-                node = navigator.next();
-            } else {
-                builder.next();
-                navigator.step();
-                node = navigator.next();
-            }
-            assertNotNull(node);
-
-        }
-
-    }
-
-    protected void tearDown() throws Exception {
-        omOutput.flush();
-        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.axis2.om;
+
+import org.apache.axis2.om.impl.llom.OMNavigator;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+public class OMNavigatorTest extends AbstractTestCase {
+    private SOAPEnvelope envelope = null;
+    private OMXMLParserWrapper builder;
+    private File tempFile;
+    private XMLStreamWriter output;
+
+    public OMNavigatorTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage1.xml")));
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        builder = new StAXSOAPModelBuilder(xmlStreamReader);
+        envelope = (SOAPEnvelope) builder.getDocumentElement();
+        tempFile = File.createTempFile("temp", "xml");
+        output =
+                XMLOutputFactory.newInstance().createXMLStreamWriter(
+                        new FileOutputStream(tempFile));
+    }
+
+    public void testnavigatorFullyBuilt() throws Exception {
+        assertNotNull(envelope);
+        //dump the out put to a  temporary file
+        envelope.serializeWithCache(output);
+
+        //now the OM is fully created test the navigation
+        OMNavigator navigator = new OMNavigator(envelope);
+        OMNode node = null;
+        while (navigator.isNavigable()) {
+            node = navigator.next();
+            assertNotNull(node);
+        }
+    }
+
+    public void testnavigatorHalfBuilt() {
+        assertNotNull(envelope);
+        //now the OM is not fully created. Try to navigate it
+        OMNavigator navigator = new OMNavigator(envelope);
+        OMNode node = null;
+        while (navigator.isNavigable()) {
+            node = navigator.next();
+            assertNotNull(node);
+        }
+    }
+
+    public void testnavigatorHalfBuiltStep() {
+        assertNotNull(envelope);
+
+        //now the OM is not fully created
+        OMNavigator navigator = new OMNavigator(envelope);
+        OMNode node = null;
+        while (!navigator.isCompleted()) {
+            if (navigator.isNavigable()) {
+                node = navigator.next();
+            } else {
+                builder.next();
+                navigator.step();
+                node = navigator.next();
+            }
+            assertNotNull(node);
+
+        }
+
+    }
+
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
+
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/SOAPFaultTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/SOAPFaultTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/SOAPFaultTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/SOAPFaultTest.java Wed Jul 13 17:30:55 2005
@@ -1,57 +1,57 @@
-/*
- * 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;
-
-import org.apache.axis2.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-
-
-public class SOAPFaultTest extends AbstractTestCase {
-    private SOAPEnvelope soapEnvelope;
-    private OMOutput omOutput;
-
-    /**
-     * Constructor.
-     */
-    public SOAPFaultTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        omOutput = new OMOutput(XMLOutputFactory.newInstance().
-                createXMLStreamWriter(System.out));
-    }
-
-    public void testSOAPFault() throws Exception {
-//        soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")).getDocumentElement();
-//        SOAPBody soapBody = soapEnvelope.getBody();
-//        SOAPFault soapFault = OMAbstractFactory.getSOAP11Factory().createSOAPFault(soapBody, new Exception("Something has gone wrong som where !!"));
-//        soapBody.addFault(soapFault);
-//        soapFault.setCode(null);
-//        assertEquals("faultcode returned is incorrect", soapFault.getCode().getLocalName(), "Axis");
-//        assertEquals("faultcode returned is incorrect", soapFault.getCode().getNamespace().getPrefix(), "SOAP-ENV");
-
-
-    }
-
-    private void print() throws XMLStreamException {
-        soapEnvelope.serializeWithCache(omOutput);
-        omOutput.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.axis2.om;
+
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.om.impl.OMOutputImpl;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAPFaultTest extends AbstractTestCase {
+    private SOAPEnvelope soapEnvelope;
+    private XMLStreamWriter output;
+
+    /**
+     * Constructor.
+     */
+    public SOAPFaultTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        output = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(System.out);
+    }
+
+    public void testSOAPFault() throws Exception {
+//        soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")).getDocumentElement();
+//        SOAPBody soapBody = soapEnvelope.getBody();
+//        SOAPFault soapFault = OMAbstractFactory.getSOAP11Factory().createSOAPFault(soapBody, new Exception("Something has gone wrong som where !!"));
+//        soapBody.addFault(soapFault);
+//        soapFault.setCode(null);
+//        assertEquals("faultcode returned is incorrect", soapFault.getCode().getLocalName(), "Axis");
+//        assertEquals("faultcode returned is incorrect", soapFault.getCode().getNamespace().getPrefix(), "SOAP-ENV");
+
+
+    }
+
+    private void print() throws XMLStreamException {
+        soapEnvelope.serializeWithCache(output);
+    }
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMOutputTest.java Wed Jul 13 17:30:55 2005
@@ -1,119 +1,117 @@
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-package org.apache.axis2.om.impl.llom;
-
-import org.apache.axis2.attachments.ByteArrayDataSource;
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-
-import javax.activation.DataHandler;
-import java.io.File;
-import java.io.FileOutputStream;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
- */
-
-public class OMOutputTest extends AbstractTestCase {
-
-    /**
-     * @param testName
-     */
-    public OMOutputTest(String testName) {
-        super(testName);
-    }
-
-    String outFileName;
-
-    String outBase64FileName;
-
-    OMElement envelope;
-
-    File outMTOMFile;
-
-    File outBase64File;
-
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        Object object;
-        DataHandler dataHandler;
-
-        outFileName = "mtom/OMSerializeMTOMOut.txt";
-        outBase64FileName = "mtom/OMSerializeBase64Out.xml";
-        outMTOMFile = getTestResourceFile(outFileName);
-        outBase64File = getTestResourceFile(outBase64FileName);
-
-        OMNamespaceImpl soap = new OMNamespaceImpl(
-                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
-        envelope = new OMElementImpl("Envelope", soap);
-        OMElement body = new OMElementImpl("Body", soap);
-
-        OMNamespaceImpl dataName = new OMNamespaceImpl(
-                "http://www.example.org/stuff", "m");
-        OMElement data = new OMElementImpl("data", dataName);
-
-        OMNamespaceImpl mime = new OMNamespaceImpl(
-                "http://www.w3.org/2003/06/xmlmime", "m");
-
-        OMElement text = new OMElementImpl("name", dataName);
-        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
-                "text/plain");
-        text.addAttribute(cType1);
-        byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
-                                      98};
-        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
-        OMTextImpl textData = new OMTextImpl(dataHandler, false);
-
-        envelope.addChild(body);
-        body.addChild(data);
-        data.addChild(text);
-        text.addChild(textData);
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        if (this.outMTOMFile.exists()) {
-            this.outMTOMFile.delete();
-        }
-        if (this.outBase64File.exists()) {
-            this.outBase64File.delete();
-        }
-    }
-
-    public void testComplete() throws Exception {
-
-        OMOutput mtomOutput = new OMOutput(new FileOutputStream(outMTOMFile),
-                true);
-        OMOutput baseOutput = new OMOutput(new FileOutputStream(outBase64File),
-                false);
-
-        envelope.serialize(baseOutput);
-        baseOutput.flush();
-
-        envelope.serialize(mtomOutput);
-
-        mtomOutput.complete();
-    }
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+package org.apache.axis2.om.impl.llom;
+
+import org.apache.axis2.attachments.ByteArrayDataSource;
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+
+import javax.activation.DataHandler;
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
+ */
+
+public class OMOutputTest extends AbstractTestCase {
+
+    /**
+     * @param testName
+     */
+    public OMOutputTest(String testName) {
+        super(testName);
+    }
+
+    String outFileName;
+
+    String outBase64FileName;
+
+    OMElement envelope;
+
+    File outMTOMFile;
+
+    File outBase64File;
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        Object object;
+        DataHandler dataHandler;
+
+        outFileName = "mtom/OMSerializeMTOMOut.txt";
+        outBase64FileName = "mtom/OMSerializeBase64Out.xml";
+        outMTOMFile = getTestResourceFile(outFileName);
+        outBase64File = getTestResourceFile(outBase64FileName);
+
+        OMNamespaceImpl soap = new OMNamespaceImpl(
+                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
+        envelope = new OMElementImpl("Envelope", soap);
+        OMElement body = new OMElementImpl("Body", soap);
+
+        OMNamespaceImpl dataName = new OMNamespaceImpl(
+                "http://www.example.org/stuff", "m");
+        OMElement data = new OMElementImpl("data", dataName);
+
+        OMNamespaceImpl mime = new OMNamespaceImpl(
+                "http://www.w3.org/2003/06/xmlmime", "m");
+
+        OMElement text = new OMElementImpl("name", dataName);
+        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
+                "text/plain");
+        text.addAttribute(cType1);
+        byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
+                                      98};
+        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
+        OMTextImpl textData = new OMTextImpl(dataHandler, false);
+
+        envelope.addChild(body);
+        body.addChild(data);
+        data.addChild(text);
+        text.addChild(textData);
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        if (this.outMTOMFile.exists()) {
+            this.outMTOMFile.delete();
+        }
+        if (this.outBase64File.exists()) {
+            this.outBase64File.delete();
+        }
+    }
+
+    public void testComplete() throws Exception {
+
+        org.apache.axis2.om.impl.OMOutputImpl mtomOutput = new org.apache.axis2.om.impl.OMOutputImpl(new FileOutputStream(outMTOMFile),
+                true);
+        org.apache.axis2.om.impl.OMOutputImpl baseOutput = new org.apache.axis2.om.impl.OMOutputImpl(new FileOutputStream(outBase64File),
+                false);
+
+        envelope.serialize(baseOutput);
+        baseOutput.flush();
+
+        envelope.serialize(mtomOutput);
+        mtomOutput.flush();
+    }
 }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/ElementSerializerTest.java Wed Jul 13 17:30:55 2005
@@ -1,134 +1,132 @@
-/*
- * 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.serializer;
-
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axis2.soap.SOAPBody;
-import org.apache.axis2.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
-public class ElementSerializerTest extends AbstractTestCase {
-    private XMLStreamReader reader;
-    private OMOutput omOutput;
-    private OMXMLParserWrapper builder;
-    private File tempFile;
-
-    public ElementSerializerTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        reader =
-                XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new FileReader(
-                                getTestResourceFile("soap/soapmessage.xml")));
-        tempFile = File.createTempFile("temp", "xml");
-        omOutput =
-                new OMOutput(
-                        XMLOutputFactory.newInstance().
-                createXMLStreamWriter(new FileOutputStream(tempFile)));
-        builder =
-                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                        OMAbstractFactory.getSOAP11Factory(), reader);
-    }
-
-    public void testElementSerilization() throws Exception {
-        OMElement elt = builder.getDocumentElement();
-        elt.serializeWithCache(omOutput);
-
-    }
-
-    public void testElementSerilizationCacheOff() throws Exception {
-        OMElement elt = builder.getDocumentElement();
-        elt.serializeWithCache(omOutput);
-
-    }
-
-    public void testElementSerilizationChild() throws Exception {
-        OMElement elt = builder.getDocumentElement();
-        OMNode node = elt.getFirstChild().getNextSibling();
-        node.serializeWithCache(omOutput);
-
-    }
-
-    public void testElementSerilizationSOAPBodyCacheOff() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        OMNode node = env.getBody();
-        node.serializeWithCache(omOutput);
-    }
-
-    public void testElement() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        SOAPBody body = env.getBody();
-        body.serializeWithCache(omOutput);
-    }
-
-    public void testCompleteElement() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        env.serializeWithCache(omOutput);
-    }
-
-    public void testDualNamespaces1() throws Exception {
-        OMFactory factory = OMAbstractFactory.getOMFactory();
-        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
-        OMNamespace ns2 = factory.createOMNamespace("bar", "y");
-        OMElement root = factory.createOMElement("root", ns1);
-        OMElement elt11 = factory.createOMElement("foo1", ns1);
-        OMElement elt12 = factory.createOMElement("foo2", ns1);
-        OMElement elt21 = factory.createOMElement("yuck", ns2);
-        OMElement elt22 = factory.createOMElement("yuck", ns2);
-        elt11.addChild(elt21);
-        elt12.addChild(elt22);
-        root.addChild(elt11);
-        root.addChild(elt12);
-        root.serializeWithCache(omOutput);
-    }
-
-    public void testDualNamespaces2() throws Exception {
-        OMFactory factory = OMAbstractFactory.getOMFactory();
-        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
-        OMElement root = factory.createOMElement("root", ns1);
-        OMNamespace ns2 = root.declareNamespace("bar", "y");
-        OMElement elt1 = factory.createOMElement("foo", ns1);
-        OMElement elt2 = factory.createOMElement("yuck", ns2);
-        OMText txt1 = factory.createText(elt2, "blah");
-        elt2.addChild(txt1);
-        elt1.addChild(elt2);
-        root.addChild(elt1);
-        root.serializeWithCache(omOutput);
-    }
-
-    protected void tearDown() throws Exception {
-        omOutput.flush();
-        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.axis2.om.impl.serializer;
+
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+public class ElementSerializerTest extends AbstractTestCase {
+    private XMLStreamReader reader;
+    private XMLStreamWriter writer;
+    private OMXMLParserWrapper builder;
+    private File tempFile;
+
+    public ElementSerializerTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        reader =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage.xml")));
+        tempFile = File.createTempFile("temp", "xml");
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(new FileOutputStream(tempFile));
+        builder =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                        OMAbstractFactory.getSOAP11Factory(), reader);
+    }
+
+    public void testElementSerilization() throws Exception {
+        OMElement elt = builder.getDocumentElement();
+        elt.serializeWithCache(writer);
+
+    }
+
+    public void testElementSerilizationCacheOff() throws Exception {
+        OMElement elt = builder.getDocumentElement();
+        elt.serializeWithCache(writer);
+
+    }
+
+    public void testElementSerilizationChild() throws Exception {
+        OMElement elt = builder.getDocumentElement();
+        OMNode node = elt.getFirstChild().getNextSibling();
+        node.serializeWithCache(writer);
+
+    }
+
+    public void testElementSerilizationSOAPBodyCacheOff() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        OMNode node = env.getBody();
+        node.serializeWithCache(writer);
+    }
+
+    public void testElement() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        SOAPBody body = env.getBody();
+        body.serializeWithCache(writer);
+    }
+
+    public void testCompleteElement() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        env.serializeWithCache(writer);
+    }
+
+    public void testDualNamespaces1() throws Exception {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
+        OMNamespace ns2 = factory.createOMNamespace("bar", "y");
+        OMElement root = factory.createOMElement("root", ns1);
+        OMElement elt11 = factory.createOMElement("foo1", ns1);
+        OMElement elt12 = factory.createOMElement("foo2", ns1);
+        OMElement elt21 = factory.createOMElement("yuck", ns2);
+        OMElement elt22 = factory.createOMElement("yuck", ns2);
+        elt11.addChild(elt21);
+        elt12.addChild(elt22);
+        root.addChild(elt11);
+        root.addChild(elt12);
+        root.serializeWithCache(writer);
+    }
+
+    public void testDualNamespaces2() throws Exception {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMNamespace ns1 = factory.createOMNamespace("bar", "x");
+        OMElement root = factory.createOMElement("root", ns1);
+        OMNamespace ns2 = root.declareNamespace("bar", "y");
+        OMElement elt1 = factory.createOMElement("foo", ns1);
+        OMElement elt2 = factory.createOMElement("yuck", ns2);
+        OMText txt1 = factory.createText(elt2, "blah");
+        elt2.addChild(txt1);
+        elt1.addChild(elt2);
+        root.addChild(elt1);
+        root.serializeWithCache(writer);
+    }
+
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java Wed Jul 13 17:30:55 2005
@@ -1,159 +1,159 @@
-package org.apache.axis2.om.impl.serializer;
-
-import junit.framework.TestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
-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.SOAPFactory;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-
-/*
-* 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.
-*
-*
-*/
-
-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 OMOutput omOutput;
-
-    // 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())));
-        omOutput = new OMOutput(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.serializeWithCache(writer, false);
-//        writer.flush();
-//
-//
-//    }
-//
-//    public void testSerilizationWithCacheOn() throws Exception {
-//        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-//        env.serializeWithCache(writer, true);
-//        writer.flush();
-//    }
-
-
-    public void testSerilizationWithDefaultNamespaces() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
-        env.serializeWithCache(omOutput);
-        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());
-
-        OMOutput omOutput = new OMOutput(System.out, false);
-        //env.getBody().addChild(builder.getDocumentElement());
-        
-        env.serializeWithCache(omOutput);
-        // env.serializeWithCache(xmlStreamWriter, true);
-
-        omOutput.flush();
-
-    }
-
-    public void testSerilizationWithCacheOn() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-        env.serializeWithCache(omOutput);
-        omOutput.flush();
-    }
-
-    public void testSerilizationWithCacheOff() throws Exception {
-        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
-        env.serializeWithCache(omOutput);
-        omOutput.flush();
-    }
-}
+package org.apache.axis2.om.impl.serializer;
+
+import junit.framework.TestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+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.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;
+
+/*
+* 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.
+*
+*
+*/
+
+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.serializeWithCache(writer, false);
+//        writer.flush();
+//
+//
+//    }
+//
+//    public void testSerilizationWithCacheOn() throws Exception {
+//        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+//        env.serializeWithCache(writer, true);
+//        writer.flush();
+//    }
+
+
+    public void testSerilizationWithDefaultNamespaces() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
+        env.serializeWithCache(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());
+
+        org.apache.axis2.om.impl.OMOutputImpl omOutput = new org.apache.axis2.om.impl.OMOutputImpl(System.out, false);
+        //env.getBody().addChild(builder.getDocumentElement());
+        
+        env.serializeWithCache(omOutput);
+        // env.serializeWithCache(xmlStreamWriter, true);
+
+        omOutput.flush();
+
+    }
+
+    public void testSerilizationWithCacheOn() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serializeWithCache(writer);
+        writer.flush();
+    }
+
+    public void testSerilizationWithCacheOff() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serializeWithCache(writer);
+        writer.flush();
+    }
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/OMSerializerTest.java Wed Jul 13 17:30:55 2005
@@ -1,98 +1,96 @@
-/*
- * 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.serializer;
-
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axis2.om.impl.llom.serialize.StreamingOMSerializer;
-import org.apache.axis2.soap.SOAPBody;
-import org.apache.axis2.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
-public class OMSerializerTest extends AbstractTestCase {
-    private XMLStreamReader reader;
-    private OMOutput omOutput;
-    private File tempFile;
-
-    public OMSerializerTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        reader =
-                XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new FileReader(
-                                getTestResourceFile("soap/soapmessage.xml")));
-        tempFile = File.createTempFile("temp", "xml");
-        omOutput =
-                new OMOutput(
-                        XMLOutputFactory.newInstance().
-                createXMLStreamWriter(new FileOutputStream(tempFile)));
-        //        writer = XMLOutputFactory.newInstance().
-        //                createXMLStreamWriter(System.out);
-    }
-
-    public void testRawSerializer() throws Exception {
-        StreamingOMSerializer serializer = new StreamingOMSerializer();
-        //serializer.setNamespacePrefixStack(new Stack());
-        serializer.serialize(reader, omOutput);
-
-    }
-
-    public void testElementPullStream1() throws Exception {
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                OMAbstractFactory.getSOAP11Factory(),
-                reader);
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        StreamingOMSerializer serializer = new StreamingOMSerializer();
-        serializer.serialize(env.getXMLStreamReaderWithoutCaching(), omOutput);
-    }
-
-    public void testElementPullStream1WithCacheOff() throws Exception {
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                OMAbstractFactory.getSOAP11Factory(),
-                reader);
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        StreamingOMSerializer serializer = new StreamingOMSerializer();
-        serializer.serialize(env.getXMLStreamReader(), omOutput);
-    }
-
-    public void testElementPullStream2() throws Exception {
-        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
-                OMAbstractFactory.getSOAP11Factory(),
-                reader);
-        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
-        SOAPBody body = env.getBody();
-        StreamingOMSerializer serializer = new StreamingOMSerializer();
-        serializer.serialize(body.getXMLStreamReaderWithoutCaching(),
-                omOutput);
-    }
-
-    protected void tearDown() throws Exception {
-        omOutput.flush();
-        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.axis2.om.impl.serializer;
+
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.om.impl.llom.serialize.StreamingOMSerializer;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+public class OMSerializerTest extends AbstractTestCase {
+    private XMLStreamReader reader;
+    private XMLStreamWriter writer;
+    private File tempFile;
+
+    public OMSerializerTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        reader =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage.xml")));
+        tempFile = File.createTempFile("temp", "xml");
+        writer =
+                XMLOutputFactory.newInstance().
+                        createXMLStreamWriter(new FileOutputStream(tempFile));
+    }
+
+    public void testRawSerializer() throws Exception {
+        StreamingOMSerializer serializer = new StreamingOMSerializer();
+        //serializer.setNamespacePrefixStack(new Stack());
+        serializer.serialize(reader, writer);
+
+    }
+
+    public void testElementPullStream1() throws Exception {
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(),
+                reader);
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        StreamingOMSerializer serializer = new StreamingOMSerializer();
+        serializer.serialize(env.getXMLStreamReaderWithoutCaching(), writer);
+    }
+
+    public void testElementPullStream1WithCacheOff() throws Exception {
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(),
+                reader);
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        StreamingOMSerializer serializer = new StreamingOMSerializer();
+        serializer.serialize(env.getXMLStreamReader(), writer);
+    }
+
+    public void testElementPullStream2() throws Exception {
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(),
+                reader);
+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
+        SOAPBody body = env.getBody();
+        StreamingOMSerializer serializer = new StreamingOMSerializer();
+        serializer.serialize(body.getXMLStreamReaderWithoutCaching(),
+                writer);
+    }
+
+    protected void tearDown() throws Exception {
+        writer.flush();
+        tempFile.delete();
+    }
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java Wed Jul 13 17:30:55 2005
@@ -1,69 +1,68 @@
-/*
- * 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.streamwrapper;
-
-import org.apache.axis2.om.AbstractTestCase;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMOutput;
-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.SOAPFactory;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
-public class OmStAXBuilderTest extends AbstractTestCase {
-    private SOAPFactory factory = null;
-    private OMXMLParserWrapper builder;
-    private File tempFile;
-
-    public OmStAXBuilderTest(String testName) {
-        super(testName);
-    }
-
-    protected void setUp() throws Exception {
-        factory = OMAbstractFactory.getSOAP11Factory();
-        XMLStreamReader reader = XMLInputFactory.newInstance().
-                createXMLStreamReader(
-                        new FileReader(
-                                getTestResourceFile("soap/soapmessage.xml")));
-        builder =
-                OMXMLBuilderFactory.createStAXSOAPModelBuilder(factory,
-                        reader);
-        tempFile = File.createTempFile("temp", "xml");
-    }
-
-    public void testStaxBuilder() throws Exception {
-        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
-        assertNotNull(envelope);
-        OMOutput omOutput = new OMOutput(new FileOutputStream(tempFile),
-                false);
-        //        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-        envelope.serializeWithCache(omOutput);
-
-
-    }
-
-    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.axis2.om.impl.streamwrapper;
+
+import org.apache.axis2.om.AbstractTestCase;
+import org.apache.axis2.om.OMAbstractFactory;
+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.SOAPFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+public class OmStAXBuilderTest extends AbstractTestCase {
+    private SOAPFactory factory = null;
+    private OMXMLParserWrapper builder;
+    private File tempFile;
+
+    public OmStAXBuilderTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        factory = OMAbstractFactory.getSOAP11Factory();
+        XMLStreamReader reader = XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage.xml")));
+        builder =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(factory,
+                        reader);
+        tempFile = File.createTempFile("temp", "xml");
+    }
+
+    public void testStaxBuilder() throws Exception {
+        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+        assertNotNull(envelope);
+        org.apache.axis2.om.impl.OMOutputImpl omOutput = new org.apache.axis2.om.impl.OMOutputImpl(new FileOutputStream(tempFile),
+                false);
+        //        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+        envelope.serializeWithCache(omOutput);
+
+
+    }
+
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
+
+
+}

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceTest.java?rev=216290&r1=216289&r2=216290&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceTest.java Wed Jul 13 17:30:55 2005
@@ -17,7 +17,6 @@
 
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMOutput;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
 import org.custommonkey.xmlunit.Diff;
@@ -104,7 +103,7 @@
         try {
             writer = XMLOutputFactory.newInstance().
                     createXMLStreamWriter(new FileOutputStream(tempFile));
-            rootElement.serializeWithCache(new OMOutput(writer));
+            rootElement.serializeWithCache(writer);
         } catch (XMLStreamException e) {
             System.err.println(
                     "Error in creating XMLStreamWriter to write parsed xml into");