ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1054679 - 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-testsuite/src/m...
Date Mon, 03 Jan 2011 16:25:10 GMT
Author: veithen
Date: Mon Jan  3 16:25:09 2011
New Revision: 1054679

URL: http://svn.apache.org/viewvc?rev=1054679&view=rev
Log:
AXIOM-311: Refactored OMTextTestBase into the new test suite and eliminated a redundant test
case.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java
  (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
  (with props)
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/OMTextTestBase.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMTextImplTest.java
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/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?rev=1054679&r1=1054678&r2=1054679&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/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
Mon Jan  3 16:25:09 2011
@@ -21,20 +21,15 @@ package org.apache.axiom.om.impl.dom;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.apache.axiom.om.AbstractTestCase;
 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 OMTextTestBase {
-    public TextImplTest() {
-        super(new OMDOMMetaFactory());
-    }
-    
+public class TextImplTest extends AbstractTestCase {
     public void testAppendText() {
         OMDOMFactory factory = new OMDOMFactory();
         String localName = "TestLocalName";

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java?rev=1054679&r1=1054678&r2=1054679&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
Mon Jan  3 16:25:09 2011
@@ -98,6 +98,8 @@ public class AxiomTestSuiteBuilder {
         }
         addTest(new org.apache.axiom.ts.om.element.TestSetTextQName(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMElement(metaFactory));
+        addTest(new org.apache.axiom.ts.om.factory.TestCreateOMText(metaFactory));
+        addTest(new org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory));
         addTest(new org.apache.axiom.ts.om.node.TestDetach(metaFactory, true));
         addTest(new org.apache.axiom.ts.om.node.TestDetach(metaFactory, false));
         addTest(new org.apache.axiom.ts.om.node.TestInsertSiblingAfter(metaFactory));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java?rev=1054679&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java
Mon Jan  3 16:25:09 2011
@@ -0,0 +1,47 @@
+/*
+ * 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.ts.om.factory;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestCreateOMText extends AxiomTestCase {
+    public TestCreateOMText(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = metaFactory.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()));
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMText.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java?rev=1054679&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
Mon Jan  3 16:25:09 2011
@@ -0,0 +1,61 @@
+/*
+ * 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.ts.om.factory;
+
+import javax.activation.DataHandler;
+
+import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestCreateOMTextFromDataHandlerProvider extends AxiomTestCase {
+    static class TestDataHandlerProvider implements DataHandlerProvider {
+        private DataHandler dh;
+        
+        public boolean isLoaded() {
+            return false;
+        }
+
+        public DataHandler getDataHandler() {
+            if (dh == null) {
+                dh = new DataHandler("Data", "text/plain");
+            }
+            return dh;
+        }
+        
+        public boolean isDataHandlerCreated() {
+            return dh != null;
+        }
+    }
+    
+    public TestCreateOMTextFromDataHandlerProvider(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        TestDataHandlerProvider prov = new TestDataHandlerProvider();
+        OMFactory factory = metaFactory.getOMFactory();
+        OMText text = factory.createOMText(null, prov, true);
+        assertFalse(prov.isDataHandlerCreated());
+        assertEquals(((DataHandler)text.getDataHandler()).getContent(), "Data");
+        assertTrue(prov.isDataHandlerCreated());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestCreateOMTextFromDataHandlerProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message