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/06 00:17:13 UTC

svn commit: r791329 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/test/java/org/apache/axiom/om/ 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/test/j...

Author: veithen
Date: Sun Jul  5 22:17:13 2009
New Revision: 791329

URL: http://svn.apache.org/viewvc?rev=791329&view=rev
Log:
Reorganized the (few existing) test cases for OMText.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
      - copied, changed from r791328, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java   (with props)
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java?rev=791329&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java Sun Jul  5 22:17:13 2009
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+public class OMTextTestBase extends AbstractTestCase {
+    protected final OMMetaFactory omMetaFactory;
+
+    public OMTextTestBase(OMMetaFactory omMetaFactory) {
+        this.omMetaFactory = omMetaFactory;
+    }
+
+    public void testCreateText() {
+        OMFactory factory = omMetaFactory.getOMFactory();
+        OMNamespace namespace =
+                factory.createOMNamespace("http://www.apache.org/~chinthaka", "myhome");
+        OMElement omElement = factory.createOMElement("chinthaka",
+                                                        namespace);
+        String text = "sampleText";
+        OMText omText = factory.createOMText(omElement, text);
+        assertTrue("Programatically created OMText should have done = true ",
+                   omText.isComplete());
+        assertTrue(
+                "Programatically created OMText should have correct text value ",
+                text.equals(omText.getText()));
+
+    }
+
+    public void testSetText() {
+        OMFactory factory = omMetaFactory.getOMFactory();
+        String localName = "TestLocalName";
+        String namespace = "http://ws.apache.org/axis2/ns";
+        String prefix = "axis2";
+        String tempText = "The quick brown fox jumps over the lazy dog";
+
+        OMElement elem = factory.createOMElement(localName, namespace, prefix);
+        OMText textNode = factory.createOMText(elem, tempText);
+
+        assertEquals("Text value mismatch", tempText, textNode.getText());
+    }
+}

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

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java (from r791328, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java&r1=791328&r2=791329&rev=791329&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java Sun Jul  5 22:17:13 2009
@@ -21,28 +21,20 @@
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import junit.framework.TestCase;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMTextTestBase;
 import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 
-public class TextImplTest extends TestCase {
-    public void testSetText() {
-        OMDOMFactory factory = new OMDOMFactory();
-        String localName = "TestLocalName";
-        String namespace = "http://ws.apache.org/axis2/ns";
-        String prefix = "axis2";
-        String tempText = "The quick brown fox jumps over the lazy dog";
-
-        OMElement elem = factory.createOMElement(localName, namespace, prefix);
-        OMText textNode = factory.createOMText(elem, tempText);
-
-        assertEquals("Text value mismatch", tempText, textNode.getText());
+public class TextImplTest extends OMTextTestBase {
+    public TextImplTest() {
+        super(new OMDOMMetaFactory());
     }
-
+    
     public void testAppendText() {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";

Added: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java?rev=791329&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java Sun Jul  5 22:17:13 2009
@@ -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.OMTextTestBase;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
+
+public class OMTextImplTest extends OMTextTestBase {
+    public OMTextImplTest() {
+        super(new OMLinkedListMetaFactory());
+    }
+}

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

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java?rev=791329&r1=791328&r2=791329&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java Sun Jul  5 22:17:13 2009
@@ -25,7 +25,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMTestUtils;
-import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.TestConstants;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -110,19 +109,6 @@
                            namespace.getPrefix()));  // here equalsIgnoreCase should not be used as case does matter
     }
 
-    public void testCreateText() {
-        OMElement omElement = omFactory.createOMElement("chinthaka",
-                                                        namespace);
-        String text = "sampleText";
-        OMText omText = omFactory.createOMText(omElement, text);
-        assertTrue("Programatically created OMText should have done = true ",
-                   omText.isComplete());
-        assertTrue(
-                "Programatically created OMText should have correct text value ",
-                text.equals(omText.getText()));
-
-    }
-
     public void testCreateSOAPBody() throws Exception {
         OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
                 getTestResource(TestConstants.MINIMAL_MESSAGE));