You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/07/25 16:38:52 UTC
svn commit: r797777 [2/2] - in
/webservices/commons/trunk/modules/axiom/modules: axiom-api/
axiom-api/src/main/java/org/apache/axiom/om/impl/builder/
axiom-api/src/main/java/org/apache/axiom/om/util/
axiom-api/src/main/java/org/apache/axiom/util/stax/d...
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java?rev=797777&r1=797776&r2=797777&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java Sat Jul 25 14:38:51 2009
@@ -25,11 +25,10 @@
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
@@ -75,18 +74,14 @@
protected void setUp() throws Exception {
- readerOne =
- XMLInputFactory.newInstance().
- createXMLStreamReader(
+ readerOne = StAXUtils.createXMLStreamReader(
new InputStreamReader(
new ByteArrayInputStream(xmlTextOne.getBytes())));
- readerTwo =
- XMLInputFactory.newInstance().
- createXMLStreamReader(
+ readerTwo = StAXUtils.createXMLStreamReader(
new InputStreamReader(
new ByteArrayInputStream(xmlTextTwo.getBytes())));
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(new ByteArrayOutputStream(), OMConstants.DEFAULT_CHAR_SET_ENCODING);
+ writer = StAXUtils.createXMLStreamWriter(new ByteArrayOutputStream(),
+ OMConstants.DEFAULT_CHAR_SET_ENCODING);
builderOne =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(
OMAbstractFactory.getSOAP11Factory(), readerOne);
@@ -117,8 +112,7 @@
SOAPEnvelope env = omFactory.getDefaultEnvelope();
OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
omFactory,
- XMLInputFactory.newInstance().
- createXMLStreamReader(
+ StAXUtils.createXMLStreamReader(
new InputStreamReader(
new ByteArrayInputStream(xmlText2.getBytes()))));
env.getBody().addChild(builder.getDocumentElement());
@@ -132,8 +126,8 @@
/** Will just do a probe test to check serialize with caching on works without any exception */
public void testSerilizationWithCacheOn() throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream, OMConstants.DEFAULT_CHAR_SET_ENCODING);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream,
+ OMConstants.DEFAULT_CHAR_SET_ENCODING);
SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
env.serialize(writer);
@@ -143,8 +137,8 @@
/** Will just do a probe test to check serialize with caching off works without any exception */
public void testSerilizationWithCacheOff() throws Exception {
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(new ByteArrayOutputStream(), OMConstants.DEFAULT_CHAR_SET_ENCODING);
+ writer = StAXUtils.createXMLStreamWriter(new ByteArrayOutputStream(),
+ OMConstants.DEFAULT_CHAR_SET_ENCODING);
SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
env.serializeAndConsume(writer);
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java?rev=797777&r1=797776&r2=797777&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java Sat Jul 25 14:38:51 2009
@@ -27,12 +27,11 @@
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;
+import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
@@ -51,9 +50,7 @@
}
protected void setUp() throws Exception {
- reader =
- XMLInputFactory.newInstance().
- createXMLStreamReader(getTestResource(TestConstants.SOAP_SOAPMESSAGE));
+ reader = StAXUtils.createXMLStreamReader(getTestResource(TestConstants.SOAP_SOAPMESSAGE));
tempFile = File.createTempFile("temp", "xml");
// writer =
// XMLOutputFactory.newInstance().
@@ -65,9 +62,7 @@
public void testRawSerializer() throws Exception {
StreamingOMSerializer serializer = new StreamingOMSerializer();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- writer =
- XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);
//serializer.setNamespacePrefixStack(new Stack());
serializer.serialize(reader, writer);
writer.flush();
@@ -84,9 +79,7 @@
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
StreamingOMSerializer serializer = new StreamingOMSerializer();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- writer =
- XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);
serializer.serialize(env.getXMLStreamReaderWithoutCaching(), writer);
writer.flush();
@@ -99,9 +92,8 @@
StAXSOAPModelBuilder soapBuilder = new StAXSOAPModelBuilder(reader, null);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- writer =
- XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream, OMConstants.DEFAULT_CHAR_SET_ENCODING);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream,
+ OMConstants.DEFAULT_CHAR_SET_ENCODING);
SOAPEnvelope env = (SOAPEnvelope) soapBuilder.getDocumentElement();
env.serializeAndConsume(writer);
@@ -110,9 +102,8 @@
String outputString = new String(byteArrayOutputStream.toByteArray());
assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);
- writer =
- XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream, OMConstants.DEFAULT_CHAR_SET_ENCODING);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream,
+ OMConstants.DEFAULT_CHAR_SET_ENCODING);
StringWriter stringWriter = new StringWriter();
@@ -136,9 +127,7 @@
OMAbstractFactory.getSOAP11Factory(),
reader);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- writer =
- XMLOutputFactory.newInstance().
- createXMLStreamWriter(byteArrayOutputStream);
+ writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);
SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
SOAPBody body = env.getBody();