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 th...@apache.org on 2005/06/23 17:19:00 UTC
svn commit: r193162 - in
/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl:
serializer/ElementSerializerTest.java
serializer/NoNamespaceSerializerTest.java serializer/OMSerailizerTest.java
streamwrapper/OmStAXBuilderTest.java
Author: thilina
Date: Thu Jun 23 08:18:58 2005
New Revision: 193162
URL: http://svn.apache.org/viewcvs?rev=193162&view=rev
Log: (empty)
Modified:
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java
webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java?rev=193162&r1=193161&r2=193162&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/ElementSerializerTest.java Thu Jun 23 08:18:58 2005
@@ -15,22 +15,30 @@
*/
package org.apache.axis.om.impl.serializer;
-import org.apache.axis.om.*;
-import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axis.soap.SOAPBody;
-import org.apache.axis.soap.SOAPEnvelope;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
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;
+
+import org.apache.axis.om.AbstractTestCase;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.OMOutputer;
+import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis.soap.SOAPBody;
+import org.apache.axis.soap.SOAPEnvelope;
public class ElementSerializerTest extends AbstractTestCase {
private XMLStreamReader reader;
- private XMLStreamWriter writer;
+ private OMOutputer outputer;
private OMXMLParserWrapper builder;
private File tempFile;
@@ -42,45 +50,45 @@
reader = XMLInputFactory.newInstance().
createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage.xml")));
tempFile = File.createTempFile("temp", "xml");
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(new FileOutputStream(tempFile));
+ outputer = new OMOutputer(XMLOutputFactory.newInstance().
+ createXMLStreamWriter(new FileOutputStream(tempFile)));
builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), reader);
}
public void testElementSerilization() throws Exception {
OMElement elt = builder.getDocumentElement();
- elt.serializeWithCache(writer);
+ elt.serializeWithCache(outputer);
}
public void testElementSerilizationCacheOff() throws Exception {
OMElement elt = builder.getDocumentElement();
- elt.serializeWithCache(writer);
+ elt.serializeWithCache(outputer);
}
public void testElementSerilizationChild() throws Exception {
OMElement elt = builder.getDocumentElement();
OMNode node = elt.getFirstChild().getNextSibling();
- node.serializeWithCache(writer);
+ node.serializeWithCache(outputer);
}
public void testElementSerilizationSOAPBodyCacheOff() throws Exception {
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
OMNode node = env.getBody();
- node.serializeWithCache(writer);
+ node.serializeWithCache(outputer);
}
public void testElement() throws Exception {
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
SOAPBody body = env.getBody();
- body.serializeWithCache(writer);
+ body.serializeWithCache(outputer);
}
public void testCompleteElement() throws Exception {
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
- env.serializeWithCache(writer);
+ env.serializeWithCache(outputer);
}
public void testDualNamespaces1() throws Exception {
@@ -96,7 +104,7 @@
elt12.addChild(elt22);
root.addChild(elt11);
root.addChild(elt12);
- root.serializeWithCache(writer);
+ root.serializeWithCache(outputer);
}
public void testDualNamespaces2() throws Exception {
@@ -110,11 +118,11 @@
elt2.addChild(txt1);
elt1.addChild(elt2);
root.addChild(elt1);
- root.serializeWithCache(writer);
+ root.serializeWithCache(outputer);
}
protected void tearDown() throws Exception {
- writer.flush();
+ outputer.flush();
tempFile.delete();
}
}
Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java?rev=193162&r1=193161&r2=193162&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/NoNamespaceSerializerTest.java Thu Jun 23 08:18:58 2005
@@ -1,20 +1,22 @@
package org.apache.axis.om.impl.serializer;
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
import junit.framework.TestCase;
+
import org.apache.axis.om.OMAbstractFactory;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.OMOutputer;
import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.axis.soap.SOAPEnvelope;
import org.apache.axis.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.
*
@@ -59,7 +61,7 @@
private XMLStreamReader readerOne;
private XMLStreamReader readerTwo;
- private XMLStreamWriter writer;
+ private OMOutputer outputer;
// private OMXMLParserWrapper builder;
// private File tempFile;
@@ -75,8 +77,8 @@
createXMLStreamReader(new InputStreamReader(new ByteArrayInputStream(xmlTextOne.getBytes())));
readerTwo = XMLInputFactory.newInstance().
createXMLStreamReader(new InputStreamReader(new ByteArrayInputStream(xmlTextTwo.getBytes())));
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(System.out);
+ outputer = new OMOutputer(XMLOutputFactory.newInstance().
+ createXMLStreamWriter(System.out));
builderOne = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), readerOne);
builderTwo = OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getSOAP11Factory(), readerTwo);
}
@@ -99,7 +101,7 @@
public void testSerilizationWithDefaultNamespaces() throws Exception {
SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
- env.serializeWithCache(writer);
+ env.serializeWithCache(outputer);
OMElement balanceElement = env.getBody().getFirstElement();
assertEquals("Deafualt namespace has not been set properly", balanceElement.getNamespace().getName(), "http://localhost:8081/axis/services/BankPort/");
@@ -116,23 +118,24 @@
createXMLStreamReader(new InputStreamReader(new ByteArrayInputStream(xmlText2.getBytes()))));
env.getBody().addChild(builder.getDocumentElement());
- XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+ OMOutputer omOutputer = new OMOutputer(System.out,false);
//env.getBody().addChild(builder.getDocumentElement());
- env.serializeWithCache(xmlStreamWriter);
+
+ env.serializeWithCache(omOutputer);
// env.serializeWithCache(xmlStreamWriter, true);
- xmlStreamWriter.flush();
+ omOutputer.flush();
}
public void testSerilizationWithCacheOn() throws Exception{
SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
- env.serializeWithCache(writer);
- writer.flush();
+ env.serializeWithCache(outputer);
+ outputer.flush();
}
public void testSerilizationWithCacheOff() throws Exception{
SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
- env.serializeWithCache(writer);
- writer.flush();
+ env.serializeWithCache(outputer);
+ outputer.flush();
}
}
Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java?rev=193162&r1=193161&r2=193162&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/serializer/OMSerailizerTest.java Thu Jun 23 08:18:58 2005
@@ -15,25 +15,26 @@
*/
package org.apache.axis.om.impl.serializer;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.axis.om.AbstractTestCase;
import org.apache.axis.om.OMAbstractFactory;
import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.OMOutputer;
import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.axis.om.impl.llom.serialize.StreamingOMSerializer;
import org.apache.axis.soap.SOAPBody;
import org.apache.axis.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 OMSerailizerTest extends AbstractTestCase {
private XMLStreamReader reader;
- private XMLStreamWriter writer;
+ private OMOutputer outputer;
private File tempFile;
public OMSerailizerTest(String testName) {
@@ -44,8 +45,8 @@
reader = XMLInputFactory.newInstance().
createXMLStreamReader(new FileReader(getTestResourceFile("soap/soapmessage.xml")));
tempFile = File.createTempFile("temp", "xml");
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(new FileOutputStream(tempFile));
+ outputer = new OMOutputer(XMLOutputFactory.newInstance().
+ createXMLStreamWriter(new FileOutputStream(tempFile)));
// writer = XMLOutputFactory.newInstance().
// createXMLStreamWriter(System.out);
}
@@ -53,7 +54,7 @@
public void testRawSerializer() throws Exception {
StreamingOMSerializer serializer = new StreamingOMSerializer();
//serializer.setNamespacePrefixStack(new Stack());
- serializer.serialize(reader, writer);
+ serializer.serialize(reader, outputer);
}
@@ -62,7 +63,7 @@
reader);
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
StreamingOMSerializer serializer = new StreamingOMSerializer();
- serializer.serialize(env.getXMLStreamReaderWithoutCaching(), writer);
+ serializer.serialize(env.getXMLStreamReaderWithoutCaching(), outputer);
}
public void testElementPullStream1WithCacheOff() throws Exception {
@@ -70,7 +71,7 @@
reader);
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
StreamingOMSerializer serializer = new StreamingOMSerializer();
- serializer.serialize(env.getXMLStreamReader(), writer);
+ serializer.serialize(env.getXMLStreamReader(), outputer);
}
public void testElementPullStream2() throws Exception {
@@ -79,11 +80,11 @@
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
SOAPBody body = env.getBody();
StreamingOMSerializer serializer = new StreamingOMSerializer();
- serializer.serialize(body.getXMLStreamReaderWithoutCaching(), writer);
+ serializer.serialize(body.getXMLStreamReaderWithoutCaching(), outputer);
}
protected void tearDown() throws Exception {
- writer.flush();
+ outputer.flush();
tempFile.delete();
}
}
Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java?rev=193162&r1=193161&r2=193162&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/impl/streamwrapper/OmStAXBuilderTest.java Thu Jun 23 08:18:58 2005
@@ -15,21 +15,21 @@
*/
package org.apache.axis.om.impl.streamwrapper;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.axis.om.AbstractTestCase;
import org.apache.axis.om.OMAbstractFactory;
import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.impl.llom.OMOutputer;
import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.axis.soap.SOAPEnvelope;
import org.apache.axis.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.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-
public class OmStAXBuilderTest extends AbstractTestCase {
private SOAPFactory factory = null;
private OMXMLParserWrapper builder;
@@ -50,9 +50,9 @@
public void testStaxBuilder() throws Exception {
SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
assertNotNull(envelope);
- XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(tempFile));
+ OMOutputer outputer = new OMOutputer(new FileOutputStream(tempFile),false);
// XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- envelope.serializeWithCache(writer);
+ envelope.serializeWithCache(outputer);
}