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/03/10 22:43:49 UTC

svn commit: r752278 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/test/java/org/apache/axiom/om/impl/ axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/ axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/ axiom-tests/src/t...

Author: veithen
Date: Tue Mar 10 21:43:48 2009
New Revision: 752278

URL: http://svn.apache.org/viewvc?rev=752278&view=rev
Log:
Transformed OMStAXWrapperTest into a generic test for LLOM and DOOM.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java   (contents, props changed)
      - copied, changed from r751843, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java   (with props)
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java (from r751843, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java&r1=751843&r2=752278&rev=752278&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java Tue Mar 10 21:43:48 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.axiom.om.impl.llom;
+package org.apache.axiom.om.impl;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -29,14 +29,19 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.util.AXIOMUtil;
+
+public class OMStAXWrapperTestBase extends TestCase {
+    private final OMMetaFactory omMetaFactory;
+    
+    public OMStAXWrapperTestBase(OMMetaFactory omMetaFactory) {
+        this.omMetaFactory = omMetaFactory;
+    }
 
-public class OMStAXWrapperTest extends TestCase {
     // Regression test for WSCOMMONS-338 and WSCOMMONS-341
     public void testCDATAEvent_FromParser() throws Exception {
         // Make sure that the parser is non coalescing (otherwise no CDATA events will be
@@ -47,7 +52,7 @@
         InputStream is = new ByteArrayInputStream("<test><![CDATA[hello world]]></test>".getBytes());
         XMLStreamReader reader = factory.createXMLStreamReader(is);
         
-        OMFactory omfactory = new OMLinkedListImplFactory();
+        OMFactory omfactory = omMetaFactory.getOMFactory();
         OMElement element = new StAXOMBuilder(omfactory, reader).getDocumentElement();
         
         // Build the element so we have a full StAX tree
@@ -73,7 +78,7 @@
     }
     
     public void testCDATAEvent_FromElement() throws Exception {
-        OMFactory omfactory = new OMLinkedListImplFactory();
+        OMFactory omfactory = omMetaFactory.getOMFactory();
         OMElement element = omfactory.createOMElement("test", null);
         OMText cdata = omfactory.createOMText("hello world", OMNode.CDATA_SECTION_NODE);
         element.addChild(cdata);
@@ -95,7 +100,8 @@
     }
     
     public void testCommentEvent() throws Exception {
-        OMStAXWrapper reader = (OMStAXWrapper)AXIOMUtil.stringToOM("<a><!--comment text--></a>").getXMLStreamReader();
+        XMLStreamReader reader = AXIOMUtil.stringToOM(omMetaFactory.getOMFactory(),
+                "<a><!--comment text--></a>").getXMLStreamReader();
         assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
         assertEquals(XMLStreamReader.COMMENT, reader.next());
         assertEquals("comment text", reader.getText());

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/impl/OMStAXWrapperTestBase.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java?rev=752278&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java Tue Mar 10 21:43:48 2009
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.dom;
+
+import org.apache.axiom.om.impl.OMStAXWrapperTestBase;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
+
+public class DOMStAXWrapperTest extends OMStAXWrapperTestBase {
+    public DOMStAXWrapperTest() {
+        super(new OMDOMMetaFactory());
+    }
+
+    // DOOM doesn't support CDATA sections; since @Ignore only exists starting from JUnit 4,
+    // just override the tests with empty implementations.
+    public void testCDATAEvent_FromElement() throws Exception {}
+    public void testCDATAEvent_FromParser() throws Exception {}
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMStAXWrapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java?rev=752278&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java Tue Mar 10 21:43:48 2009
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.llom;
+
+import org.apache.axiom.om.impl.OMStAXWrapperTestBase;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
+
+public class OMStAXWrapperTest extends OMStAXWrapperTestBase {
+    public OMStAXWrapperTest() {
+        super(new OMLinkedListMetaFactory());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMStAXWrapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native