Author: veithen
Date: Sun Jan  3 13:58:50 2010
New Revision: 895391

URL: http://svn.apache.org/viewvc?rev=895391&view=rev
Log:
Split OMElementTestBase and move the unit tests for methods defined by OMNode 
to a different class.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMNodeTestBase.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/NodeImplTest.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMNodeImplTest.java
   (with props)
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMElementTestBase.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMElementTestBase.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMElementTestBase.java?rev=895391&r1=895390&r2=895391&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMElementTestBase.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMElementTestBase.java
 Sun Jan  3 13:58:50 2010
@@ -230,55 +230,6 @@
         assertEquals("In correct number of children", 1, count);
     }
     
-    // Regression test for WSCOMMONS-337
-    public void testInsertSiblingAfterLastChild() throws Exception {
-        OMFactory fac = omMetaFactory.getOMFactory();
-        OMNamespace ns = fac.createOMNamespace("http://www.testuri.com","ns";);
-        OMElement parent = fac.createOMElement("parent", ns);
-        
-        // Create three OMElements
-        OMElement c1 = fac.createOMElement("c1", ns);
-        OMElement c2 = fac.createOMElement("c2", ns);
-        OMElement c3 = fac.createOMElement("c3", ns);
-
-        // Add c1 to parent using parent.addChild()
-        parent.addChild(c1);
-        // Add c2 to c1 as a sibling after
-        c1.insertSiblingAfter(c2);
-        // Now add c3 to parent using parent.addChild()
-        parent.addChild(c3);
-        assertXMLEqual("<ns:parent xmlns:ns=\"http://www.testuri.com\";>" +
-                "<ns:c1 /><ns:c2 /><ns:c3 /></ns:parent>", parent.toString());
-    }
-
-    private void testDetach(boolean build) throws Exception {
-        OMElement root = AXIOMUtil.stringToOM(omMetaFactory.getOMFactory(), 
"<root><a/><b/><c/></root>");
-        if (build) {
-            root.build();
-        } else {
-            assertFalse(root.isComplete());
-        }
-        OMElement a = (OMElement)root.getFirstOMChild();
-        assertEquals("a", a.getLocalName());
-        OMElement b = (OMElement)a.getNextOMSibling();
-        assertEquals("b", b.getLocalName());
-        b.detach();
-        assertNull(b.getParent());
-        OMElement c = (OMElement)a.getNextOMSibling();
-        assertEquals("c", c.getLocalName());
-        assertSame(c, a.getNextOMSibling());
-        assertSame(a, c.getPreviousOMSibling());
-        root.close(false);
-    }
-    
-    public void testDetachWithBuild() throws Exception {
-        testDetach(true);
-    }
-    
-    public void testDetachWithoutBuild() throws Exception {
-        testDetach(false);
-    }
-
     public void testFindNamespaceByPrefix() throws Exception {
         OMElement root =
                 AXIOMUtil.stringToOM(omMetaFactory.getOMFactory(), "<a:root 
xmlns:a='urn:a'><child/></a:root>");

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMNodeTestBase.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMNodeTestBase.java?rev=895391&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMNodeTestBase.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMNodeTestBase.java
 Sun Jan  3 13:58:50 2010
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+import org.apache.axiom.om.util.AXIOMUtil;
+
+public class OMNodeTestBase extends AbstractTestCase {
+    protected final OMMetaFactory omMetaFactory;
+
+    public OMNodeTestBase(OMMetaFactory omMetaFactory) {
+        this.omMetaFactory = omMetaFactory;
+    }
+
+    // Regression test for WSCOMMONS-337
+    public void testInsertSiblingAfterLastChild() throws Exception {
+        OMFactory fac = omMetaFactory.getOMFactory();
+        OMNamespace ns = fac.createOMNamespace("http://www.testuri.com","ns";);
+        OMElement parent = fac.createOMElement("parent", ns);
+        
+        // Create three OMElements
+        OMElement c1 = fac.createOMElement("c1", ns);
+        OMElement c2 = fac.createOMElement("c2", ns);
+        OMElement c3 = fac.createOMElement("c3", ns);
+
+        // Add c1 to parent using parent.addChild()
+        parent.addChild(c1);
+        // Add c2 to c1 as a sibling after
+        c1.insertSiblingAfter(c2);
+        // Now add c3 to parent using parent.addChild()
+        parent.addChild(c3);
+        assertXMLEqual("<ns:parent xmlns:ns=\"http://www.testuri.com\";>" +
+                "<ns:c1 /><ns:c2 /><ns:c3 /></ns:parent>", parent.toString());
+    }
+
+    private void testDetach(boolean build) throws Exception {
+        OMElement root = AXIOMUtil.stringToOM(omMetaFactory.getOMFactory(), 
"<root><a/><b/><c/></root>");
+        if (build) {
+            root.build();
+        } else {
+            assertFalse(root.isComplete());
+        }
+        OMElement a = (OMElement)root.getFirstOMChild();
+        assertEquals("a", a.getLocalName());
+        OMElement b = (OMElement)a.getNextOMSibling();
+        assertEquals("b", b.getLocalName());
+        b.detach();
+        assertNull(b.getParent());
+        OMElement c = (OMElement)a.getNextOMSibling();
+        assertEquals("c", c.getLocalName());
+        assertSame(c, a.getNextOMSibling());
+        assertSame(a, c.getPreviousOMSibling());
+        root.close(false);
+    }
+    
+    public void testDetachWithBuild() throws Exception {
+        testDetach(true);
+    }
+    
+    public void testDetachWithoutBuild() throws Exception {
+        testDetach(false);
+    }
+
+
+}

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

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/NodeImplTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/NodeImplTest.java?rev=895391&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/NodeImplTest.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/NodeImplTest.java
 Sun Jan  3 13:58:50 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.OMNodeTestBase;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
+
+public class NodeImplTest extends OMNodeTestBase {
+    public NodeImplTest() {
+        super(new OMDOMMetaFactory());
+    }
+}

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

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMNodeImplTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMNodeImplTest.java?rev=895391&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMNodeImplTest.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMNodeImplTest.java
 Sun Jan  3 13:58:50 2010
@@ -0,0 +1,29 @@
+/*
+ * 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.OMNodeTestBase;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
+
+public class OMNodeImplTest extends OMNodeTestBase {
+    public OMNodeImplTest() {
+        super(new OMLinkedListMetaFactory());
+    }
+}

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


Reply via email to