You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/06/04 11:58:45 UTC

svn commit: r1797576 - in /axis/axis2/java/core/trunk/modules: jaxws-integration/test/org/apache/axis2/jaxws/dispatch/ jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/ jaxws/test/org/apache/axis2/jaxws/message/

Author: veithen
Date: Sun Jun  4 11:58:45 2017
New Revision: 1797576

URL: http://svn.apache.org/viewvc?rev=1797576&view=rev
Log:
Eliminate usages of Reader2Writer from test cases.

Modified:
    axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
    axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java
    axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java Sun Jun  4 11:58:45 2017
@@ -21,16 +21,15 @@ package org.apache.axis2.jaxws.dispatch;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axis2.jaxws.TestLogger;
 import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.Dispatch;
@@ -38,6 +37,7 @@ import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
 import java.util.concurrent.Future;
 
 /**
@@ -45,9 +45,6 @@ import java.util.concurrent.Future;
  * javax.xml.transform.dom.DOMSource 
  */
 public class DOMSourceDispatchTests extends AbstractTestCase{
-
-    private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
     public static Test suite() {
         return getTestSetup(new TestSuite(DOMSourceDispatchTests.class));
     }
@@ -467,9 +464,8 @@ public class DOMSourceDispatchTests exte
      * @return
      */
     private String createStringFromSource(Source input) throws Exception {
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(input);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String text = r2w.getAsString();
-        return text;
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(input).getDocument().serializeAndConsume(sw);
+        return sw.toString();
     }
 }

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java Sun Jun  4 11:58:45 2017
@@ -21,13 +21,12 @@ package org.apache.axis2.jaxws.dispatch;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axis2.jaxws.TestLogger;
 import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.xml.sax.InputSource;
 
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.ws.Dispatch;
@@ -35,6 +34,7 @@ import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
 import java.util.concurrent.Future;
 
 /**
@@ -42,9 +42,6 @@ import java.util.concurrent.Future;
  * forms of a javax.xml.transform.sax.SAXSource.
  */
 public class SAXSourceDispatchTests extends AbstractTestCase{
-
-    private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
     public static Test suite() {
         return getTestSetup(new TestSuite(SAXSourceDispatchTests.class));
     }
@@ -71,9 +68,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -93,9 +90,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -128,9 +125,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -151,9 +148,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -194,9 +191,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -225,9 +222,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -268,9 +265,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -299,9 +296,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -339,9 +336,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -368,9 +365,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -408,9 +405,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -437,9 +434,9 @@ public class SAXSourceDispatchTests exte
         assertNotNull("dispatch invoke returned null", response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java Sun Jun  4 11:58:45 2017
@@ -21,12 +21,11 @@ package org.apache.axis2.jaxws.dispatch;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axis2.jaxws.TestLogger;
 import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Dispatch;
@@ -35,6 +34,7 @@ import javax.xml.ws.Service;
 import javax.xml.ws.Service.Mode;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.util.concurrent.Future;
 
 /**
@@ -43,10 +43,6 @@ import java.util.concurrent.Future;
  *
  */
 public class StreamSourceDispatchTests extends AbstractTestCase {
-
-    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-    
-    
     public static Test suite() {
         return getTestSetup(new TestSuite(StreamSourceDispatchTests.class));
     }
@@ -75,9 +71,9 @@ public class StreamSourceDispatchTests e
 		assertNotNull(response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -96,9 +92,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -131,9 +127,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -151,9 +147,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -197,9 +193,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -226,9 +222,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -272,9 +268,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -306,9 +302,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -348,9 +344,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -376,9 +372,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -419,9 +415,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String responseText = r2w.getAsString();
+        StringWriter sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        String responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct
@@ -448,9 +444,9 @@ public class StreamSourceDispatchTests e
         assertNotNull(response);
 
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(response);
-        r2w = new Reader2Writer(reader);
-        responseText = r2w.getAsString();
+        sw = new StringWriter();
+        OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+        responseText = sw.toString();
         TestLogger.logger.debug(responseText);
         
         // Check to make sure the content is correct

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java Sun Jun  4 11:58:45 2017
@@ -19,14 +19,11 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.apache.axis2.testutils.Axis2Server;
 import org.junit.ClassRule;
 import org.junit.Test;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Dispatch;
@@ -35,8 +32,8 @@ import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.http.HTTPBinding;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
@@ -46,8 +43,6 @@ public class DispatchXMessageSourceTests
     @ClassRule
     public static Axis2Server server = new Axis2Server("target/repo");
 
-    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XMessageSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XMessageSourceProviderPort");
  
@@ -77,12 +72,7 @@ public class DispatchXMessageSourceTests
         Source outSource = dispatch.invoke(inSource);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String response = r2w.getAsString();
-        
-        assertTrue(response != null);
-        assertTrue(request.equals(response));
+        assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
         
         // Test a second time to verify
         stream = new ByteArrayInputStream(request.getBytes());
@@ -91,12 +81,7 @@ public class DispatchXMessageSourceTests
         outSource = dispatch.invoke(inSource);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(outSource);
-        r2w = new Reader2Writer(reader);
-        response = r2w.getAsString();
-        
-        assertTrue(response != null);
-        assertTrue(request.equals(response));
+        assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
     }
     
     @Test
@@ -115,10 +100,7 @@ public class DispatchXMessageSourceTests
         dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, "GET"); 
         Source outSource = dispatch.invoke(null);
         
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String response = r2w.getAsString();        
-        assertEquals(GET_RESPONSE, response);     
+        assertAbout(xml()).that(outSource).hasSameContentAs(GET_RESPONSE);
         
         // this should fail again
         dispatch.getRequestContext().remove(MessageContext.HTTP_REQUEST_METHOD);

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java Sun Jun  4 11:58:45 2017
@@ -19,21 +19,19 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.apache.axis2.testutils.Axis2Server;
 import org.junit.ClassRule;
 import org.junit.Test;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.http.HTTPBinding;
 
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -42,8 +40,6 @@ public class DispatchXPayloadSourceTests
     @ClassRule
     public static Axis2Server server = new Axis2Server("target/repo");
 
-    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XPayloadSourceProviderPort");
  
@@ -71,12 +67,7 @@ public class DispatchXPayloadSourceTests
         Source outSource = dispatch.invoke(inSource);
         
         // Prepare the response content for checking
-        XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String response = r2w.getAsString();
-        
-        assertTrue(response != null);
-        assertTrue(request.equals(response));
+        assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
         
         // Try a second time to verify
         stream = new ByteArrayInputStream(request.getBytes());
@@ -85,12 +76,7 @@ public class DispatchXPayloadSourceTests
         outSource = dispatch.invoke(inSource);
         
         // Prepare the response content for checking
-        reader = inputFactory.createXMLStreamReader(outSource);
-        r2w = new Reader2Writer(reader);
-        response = r2w.getAsString();
-        
-        assertTrue(response != null);
-        assertTrue(request.equals(response));
+        assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
     }
     
    

Modified: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java Sun Jun  4 11:58:45 2017
@@ -37,7 +37,6 @@ import org.apache.axis2.jaxws.message.fa
 import org.apache.axis2.jaxws.message.factory.OMBlockFactory;
 import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
 import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.unitTest.TestLogger;
 import org.w3c.dom.Document;
@@ -62,6 +61,10 @@ import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
+
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.StringReader;
@@ -123,10 +126,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -162,10 +162,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -197,9 +194,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -346,8 +341,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
+        String newText = OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement().toString();
         assertTrue(newText.contains("Hello World"));
         assertTrue(newText.contains("echoString"));
 
@@ -395,8 +389,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
+        String newText = OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement().toString();
         assertTrue(newText.contains("Hello World"));
         assertTrue(newText.contains("echoString"));
 
@@ -642,10 +635,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
 
@@ -684,10 +674,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -755,10 +742,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -796,10 +780,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -836,9 +817,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -868,11 +847,7 @@ public class BlockTests extends TestCase
         assertTrue(block.isConsumed());
 
         // Check the String for accuracy
-        XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
     }
 
     /**
@@ -908,11 +883,7 @@ public class BlockTests extends TestCase
         assertTrue(block.isConsumed());
 
         // Check the String for accuracy
-        XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
     }
 
     /**
@@ -950,11 +921,7 @@ public class BlockTests extends TestCase
         assertTrue(block.isConsumed());
 
         // Check the String for accuracy
-        XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
-
+        assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
     }
     /*
      * Testing JAXBSource, Creating Source Block using JAXBSource and then
@@ -1027,9 +994,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(echoSample.equals(newText));
+        assertAbout(xml()).that(reader).hasSameContentAs(echoSample);
     }
     /**
      * Create a Block representing a DOMSource instance and simulate an 
@@ -1073,9 +1038,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
     /**
@@ -1111,9 +1074,7 @@ public class BlockTests extends TestCase
 
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(reader);
-        String newText = r2w.getAsString();
-        assertTrue(sampleText.equals(newText));
+        assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
     }
 
 }

Modified: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java?rev=1797576&r1=1797575&r2=1797576&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java Sun Jun  4 11:58:45 2017
@@ -27,7 +27,6 @@ import org.apache.axiom.soap.SOAPEnvelop
 import org.apache.axiom.soap.SOAPModelBuilder;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
 import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.unitTest.TestLogger;
 import org.apache.log4j.BasicConfigurator;
@@ -102,8 +101,7 @@ public class SOAP12Tests extends TestCas
         
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReader());
-        String newText = r2w.getAsString();
+        String newText = OMXMLBuilderFactory.createStAXOMBuilder(om.getXMLStreamReader()).getDocumentElement().toString();
         TestLogger.logger.debug(newText);
         assertTrue(newText.contains(sampleText));
         assertTrue(newText.contains("soap"));
@@ -147,8 +145,7 @@ public class SOAP12Tests extends TestCas
         
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
-        String newText = r2w.getAsString();
+        String newText = OMXMLBuilderFactory.createStAXOMBuilder(om.getXMLStreamReaderWithoutCaching()).getDocumentElement().toString();
         TestLogger.logger.debug(newText);
         assertTrue(newText.contains(sampleText));
         assertTrue(newText.contains("soap"));