You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/12/27 13:09:58 UTC

svn commit: r1426175 - in /webservices/commons/trunk/modules/axiom/modules: axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/ axiom-testsuite/src/main/java/org/apache/axiom/ts/om/ axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/

Author: veithen
Date: Thu Dec 27 12:09:58 2012
New Revision: 1426175

URL: http://svn.apache.org/viewvc?rev=1426175&view=rev
Log:
AXIOM-311: Refactored XOPRoundtripTest.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java
      - copied, changed from r1426166, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/XOPRoundtripTest.java
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1426175&r1=1426174&r2=1426175&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Thu Dec 27 12:09:58 2012
@@ -485,6 +485,7 @@ public class OMTestSuiteBuilder extends 
         addTest(new org.apache.axiom.ts.om.text.TestDigest(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestGetTextCharactersFromDataHandler(metaFactory));
         addTest(new org.apache.axiom.ts.om.xop.TestSerialize(metaFactory));
+        addTest(new org.apache.axiom.ts.om.xop.XOPRoundtripTest(metaFactory));
         Method[] methods = AXIOMXPathTestCase.class.getMethods();
         for (int i=0; i<methods.length; i++) {
             String methodName = methods[i].getName();

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java (from r1426166, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/XOPRoundtripTest.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/XOPRoundtripTest.java&r1=1426166&r2=1426175&rev=1426175&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/util/stax/xop/XOPRoundtripTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/XOPRoundtripTest.java Thu Dec 27 12:09:58 2012
@@ -16,25 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-package org.apache.axiom.util.stax.xop;
+package org.apache.axiom.ts.om.xop;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.testutils.activation.TestDataSource;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.util.stax.xop.ContentIDGenerator;
+import org.apache.axiom.util.stax.xop.OptimizationPolicy;
+import org.apache.axiom.util.stax.xop.XOPDecodingStreamReader;
+import org.apache.axiom.util.stax.xop.XOPEncodingStreamReader;
+
+public class XOPRoundtripTest extends AxiomTestCase {
+    public XOPRoundtripTest(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
 
-public class XOPRoundtripTest extends TestCase {
-    public void test() {
-        OMFactory factory = OMAbstractFactory.getOMFactory();
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
         DataHandler dh = new DataHandler(new TestDataSource('x', Runtime.getRuntime().maxMemory()));
         OMElement element1 = factory.createOMElement(new QName("test"));
         element1.addChild(factory.createOMText(dh, true));
@@ -42,7 +48,7 @@ public class XOPRoundtripTest extends Te
         XOPEncodingStreamReader encodedReader = new XOPEncodingStreamReader(originalReader,
                 ContentIDGenerator.DEFAULT, OptimizationPolicy.DEFAULT);
         XMLStreamReader decodedReader = new XOPDecodingStreamReader(encodedReader, encodedReader);
-        OMElement element2 = OMXMLBuilderFactory.createStAXOMBuilder(decodedReader).getDocumentElement();
+        OMElement element2 = OMXMLBuilderFactory.createStAXOMBuilder(factory, decodedReader).getDocumentElement();
         OMText child = (OMText)element2.getFirstOMChild();
         assertNotNull(child);
         assertTrue(child.isBinary());