commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r918659 - in /commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath: VendorUpper.xml ri/model/XMLUpperCaseElementsTest.java
Date Wed, 03 Mar 2010 19:41:06 GMT
Author: mbenson
Date: Wed Mar  3 19:41:06 2010
New Revision: 918659

URL: http://svn.apache.org/viewvc?rev=918659&view=rev
Log:
[JXPATH-136] Cannot reproduce

Added:
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml   (with
props)
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java
  (with props)

Added: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml?rev=918659&view=auto
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml (added)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml Wed Mar
 3 19:41:06 2010
@@ -0,0 +1,72 @@
+<?xml version="1.0" ?>
+<!--
+   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.
+-->
+
+<!DOCTYPE vendor [
+  <!ELEMENT Vendor (Location, Contact, Product)>
+  <!ELEMENT Location ANY>
+  <!ATTLIST Location
+      id ID #REQUIRED
+      name CDATA #IMPLIED
+      manager CDATA #IMPLIED
+  >
+  <!ELEMENT Contact ANY>
+  <!ELEMENT Product ANY>
+]>
+
+<Vendor name="fruitco" xmlns:price="priceNS">
+  <Contact>John</Contact>
+  <Contact name='jack'>Jack</Contact>
+  <Contact name='jim'>Jim</Contact>
+  <Contact name='jack'>Jack Black</Contact>
+  <Location id="100" name="local" manager="">
+    <Address>
+      <Street>Orchard Road</Street>
+    </Address>
+    <EmployeeCount>10</EmployeeCount>
+  </Location>
+
+  <Location id="101">
+    Text before address.
+    <Address>
+      <Street>Tangerine Drive</Street>
+      <City>Fruit Market</City>
+    </Address>
+    Text after address.
+  </Location>
+
+  <Product xmlns:value="priceNS">
+     <Name xmlns="productNS">Box of oranges</Name>
+     We love this product.
+     <!-- We are not buying this product, ever -->
+     <value:Amount price:discount="10%" discount="20%">45.95</value:Amount>
+     <Prix xml:lang="fr">934.99</Prix>
+     <price:Sale stores="all">
+        <SaleEnds>never</SaleEnds>
+        <Promotion></Promotion>
+     </price:Sale>
+     <?security do not show anybody ?>
+     <?report average only ?>
+  </Product>
+
+  <Pos xmlns="temp">
+    <Register xmlns="">
+       <Number>109</Number>
+    </Register>
+  </Pos>
+
+</Vendor>
\ No newline at end of file

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/VendorUpper.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java?rev=918659&view=auto
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java
(added)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java
Wed Mar  3 19:41:06 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.commons.jxpath.ri.model;
+
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.JXPathTestCase;
+import org.apache.commons.jxpath.xml.DocumentContainer;
+
+/**
+ * Test for uppercase element matching, etc. from JXPATH-136.
+ * 
+ * @author Matt Benson
+ * @version $Revision$ $Date$
+ */
+public class XMLUpperCaseElementsTest extends JXPathTestCase {
+    protected JXPathContext context;
+
+    protected DocumentContainer createDocumentContainer(String model) {
+        return new DocumentContainer(JXPathTestCase.class.getResource("VendorUpper.xml"),
model);
+    }
+
+    protected JXPathContext createContext(String model) {
+        JXPathContext context = JXPathContext.newContext(createDocumentContainer(model));
+        return context;
+    }
+
+    protected void doTest(String id, String model, String expectedValue) {
+        JXPathContext context = JXPathContext.newContext(createDocumentContainer(model));
+        assertEquals(context.getValue("test/text[@id='" + id + "']"), expectedValue);
+    }
+
+    public void testBasicGetDOM() {
+        assertXPathValue(createContext(DocumentContainer.MODEL_DOM), "/Vendor[1]/Contact[1]",
+                "John");
+    }
+
+    public void testBasicGetJDOM() {
+        assertXPathValue(createContext(DocumentContainer.MODEL_JDOM), "/Vendor[1]/Contact[1]",
+                "John");
+    }
+
+    public void testBasicIterateDOM() {
+        assertXPathValueIterator(createContext(DocumentContainer.MODEL_DOM), "/Vendor/Contact",
+                list("John", "Jack", "Jim", "Jack Black"));
+    }
+
+    public void testBasicIterateJDOM() {
+        assertXPathValueIterator(createContext(DocumentContainer.MODEL_JDOM), "/Vendor/Contact",
+                list("John", "Jack", "Jim", "Jack Black"));
+    }
+}
\ No newline at end of file

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/XMLUpperCaseElementsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message