ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1201422 - in /webservices/commons/trunk/modules/axiom/modules: 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/main/java/org/apache/axiom/ts/ axiom-testsuite...
Date Sun, 13 Nov 2011 11:47:12 GMT
Author: veithen
Date: Sun Nov 13 11:47:11 2011
New Revision: 1201422

URL: http://svn.apache.org/viewvc?rev=1201422&view=rev
Log:
Added some test cases for AXIOM-398.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java
  (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
  (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1201422&r1=1201421&r2=1201422&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
Sun Nov 13 11:47:11 2011
@@ -27,6 +27,8 @@ import org.apache.axiom.ts.om.builder.Te
 import org.apache.axiom.ts.om.container.TestSerialize;
 import org.apache.axiom.ts.om.document.TestDigest;
 import org.apache.axiom.ts.om.element.TestGetChildrenWithName4;
+import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithParser;
+import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithSAXSource;
 import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderCDATAEventFromElement;
 import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithOMSourcedElementDescendant;
 import org.apache.axiom.ts.om.element.TestSetTextQName;
@@ -82,6 +84,10 @@ public class OMImplementationTest extend
         // TODO: if there is a comment node surrounded by text, then these text nodes need
to be merged
         builder.exclude(TestDigest.class, "(|(file=digest3.xml)(file=digest4.xml))");
         
+        // TODO: AXIOM-398
+        builder.exclude(TestGetNamespaceNormalizedWithParser.class);
+        builder.exclude(TestGetNamespaceNormalizedWithSAXSource.class);
+        
         return builder.build();
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1201422&r1=1201421&r2=1201422&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
Sun Nov 13 11:47:11 2011
@@ -26,6 +26,8 @@ import org.apache.axiom.ts.OMTestSuiteBu
 import org.apache.axiom.ts.om.builder.TestCreateOMBuilderFromDOMSource;
 import org.apache.axiom.ts.om.container.TestSerialize;
 import org.apache.axiom.ts.om.document.TestDigest;
+import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithParser;
+import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithSAXSource;
 import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithOMSourcedElementDescendant;
 import org.apache.axiom.ts.om.node.TestInsertSiblingAfterOnChild;
 import org.apache.axiom.ts.om.node.TestInsertSiblingBeforeOnChild;
@@ -56,6 +58,10 @@ public class OMImplementationTest extend
         // TODO: if there is a comment node surrounded by text, then these text nodes need
to be merged
         builder.exclude(TestDigest.class, "(|(file=digest3.xml)(file=digest4.xml))");
         
+        // TODO: AXIOM-398
+        builder.exclude(TestGetNamespaceNormalizedWithParser.class);
+        builder.exclude(TestGetNamespaceNormalizedWithSAXSource.class);
+        
         return builder.build();
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java?rev=1201422&r1=1201421&r2=1201422&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
Sun Nov 13 11:47:11 2011
@@ -154,6 +154,8 @@ public class OMTestSuiteBuilder extends 
         addTest(new org.apache.axiom.ts.om.element.TestGetFirstChildWithNameOnIncompleteElement(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceContext(metaFactory, false));
         addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceContext(metaFactory, true));
+        addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithParser(metaFactory));
+        addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithSAXSource(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetNamespacesInScope(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetNamespacesInScopeWithDefaultNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetNamespacesInScopeWithMaskedDefaultNamespace(metaFactory));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java?rev=1201422&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java
Sun Nov 13 11:47:11 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.element;
+
+import java.io.StringReader;
+
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamedInformationItem;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that {@link OMNamedInformationItem#getNamespace()} returns <code>null</code>
for an element
+ * with no namespace. The case considered in this test is an element created using a
+ * {@link SAXSource} and that has an explicit namespace declaration for the default namespace,
i.e.
+ * <tt>xmlns=""</tt>. This is a regression test for <a
+ * href="https://issues.apache.org/jira/browse/AXIOM-398">AXIOM-398</a>.
+ */
+public class TestGetNamespaceNormalizedWithParser extends AxiomTestCase {
+    public TestGetNamespaceNormalizedWithParser(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMElement element = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
+                new StringReader("<root xmlns=''/>")).getDocumentElement();
+        assertNull(element.getNamespace());
+    }
+}

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

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java?rev=1201422&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
Sun Nov 13 11:47:11 2011
@@ -0,0 +1,56 @@
+/*
+ * 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.element;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamedInformationItem;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.xml.sax.InputSource;
+
+/**
+ * Tests that {@link OMNamedInformationItem#getNamespace()} returns <code>null</code>
for an element
+ * with no namespace. The case considered in this test is an element created using a parser
and that
+ * has an explicit namespace declaration for the default namespace, i.e. <tt>xmlns=""</tt>.
This is
+ * a regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-398">AXIOM-398</a>.
+ */
+public class TestGetNamespaceNormalizedWithSAXSource extends AxiomTestCase {
+    public TestGetNamespaceNormalizedWithSAXSource(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+        SAXParser parser = factory.newSAXParser();
+        SAXSource source = new SAXSource(parser.getXMLReader(),
+                new InputSource(new StringReader("<root xmlns=''/>")));
+        OMElement element = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
+                source).getDocumentElement();
+        assertNull(element.getNamespace());
+    }
+}

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



Mime
View raw message