You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/11/15 21:32:53 UTC

svn commit: r1202411 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/xpath/ axiom-testsuite/src/main/java/org/apache/axiom/ts/ axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/

Author: veithen
Date: Tue Nov 15 20:32:52 2011
New Revision: 1202411

URL: http://svn.apache.org/viewvc?rev=1202411&view=rev
Log:
Fixed an issue in the XPath implementation.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/TestGetAttributeQName.java   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.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-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java?rev=1202411&r1=1202410&r2=1202411&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java Tue Nov 15 20:32:52 2011
@@ -140,7 +140,7 @@ public class DocumentNavigator extends D
         if (prefix == null || "".equals(prefix)) {
             return attr.getLocalName();
         }
-        return prefix + ":" + attr.getNamespace().getNamespaceURI();
+        return prefix + ":" + attr.getLocalName();
     }
 
     /**

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=1202411&r1=1202410&r2=1202411&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 Tue Nov 15 20:32:52 2011
@@ -310,5 +310,6 @@ public class OMTestSuiteBuilder extends 
                 addTest(new TestAXIOMXPath(metaFactory, methodName));
             }
         }
+        addTest(new org.apache.axiom.ts.xpath.TestGetAttributeQName(metaFactory));
     }
 }

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/TestGetAttributeQName.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/TestGetAttributeQName.java?rev=1202411&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/TestGetAttributeQName.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/xpath/TestGetAttributeQName.java Tue Nov 15 20:32:52 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.xpath;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.om.xpath.DocumentNavigator;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that {@link DocumentNavigator#getAttributeQName(Object)} returns the correct result for an
+ * attribute with namespace.
+ */
+public class TestGetAttributeQName extends AxiomTestCase {
+    public TestGetAttributeQName(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement element = factory.createOMElement("test", null);
+        element.addAttribute("att", "value", factory.createOMNamespace("urn:test", "p"));
+        assertEquals("p:att", new AXIOMXPath("name(@*)").stringValueOf(element));
+    }
+}

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