jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1832876 - /jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java
Date Mon, 04 Jun 2018 18:33:39 GMT
Author: pmouawad
Date: Mon Jun  4 18:33:39 2018
New Revision: 1832876

URL: http://svn.apache.org/viewvc?rev=1832876&view=rev
Log:
Bug 60991 - XPath Extractor : Implement XPath 2.0

Make test fail on exception
Bugzilla Id: 60991

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java?rev=1832876&r1=1832875&r2=1832876&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/util/XPathUtilTest.java Mon Jun  4 18:33:39 2018
@@ -41,60 +41,50 @@ public class XPathUtilTest {
     final String xmlDoc = JMeterUtils.getResourceFileAsText("XPathUtilTestXml.xml");
     
     @Test
-    public void testputValuesForXPathInListUsingSaxon(){
-        
+    public void testputValuesForXPathInListUsingSaxon() throws SaxonApiException, FactoryConfigurationError{
+
         String xPathQuery="//Employees/Employee/role";
         ArrayList<String> matchStrings = new ArrayList<String>();
         boolean fragment = false;
         String namespaces = "age=http://www.w3.org/2003/01/geo/wgs84_pos#";
         int matchNumber = 3;
-        
-        try {
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals("Manager",matchStrings.get(0));
-            
-            matchNumber = 0;
-            xPathQuery="//Employees/Employee[1]/age:ag";
-            fragment = true;
-            matchStrings.clear();
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals("<age:ag xmlns:age=\"http://www.w3.org/2003/01/geo/wgs84_pos#\">29</age:ag>",matchStrings.get(0));
-            assertEquals(1,matchStrings.size());
-            
-            matchNumber = -1;
-            xPathQuery="//Employees/Employee/age:ag";
-            matchStrings.clear();
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals("<age:ag xmlns:age=\"http://www.w3.org/2003/01/geo/wgs84_pos#\">29</age:ag>",matchStrings.get(0));
-            assertEquals(4,matchStrings.size());
-            
-            fragment = false;
-            matchStrings.clear();
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals("29",matchStrings.get(0));
-            assertEquals(4,matchStrings.size());
-            
-            matchStrings.clear();
-            xPathQuery="regtsgwsdfstgsdf";
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals(new ArrayList<String>(),matchStrings);
-            assertEquals(0,matchStrings.size());
-            
-            matchStrings.clear();
-            xPathQuery="//Employees/Employee[1]/age:ag";
-            matchNumber = 555;
-            XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings,
fragment, matchNumber, namespaces);
-            assertEquals(new ArrayList<String>(),matchStrings);
-            assertEquals(0,matchStrings.size());
-
-        } catch (SaxonApiException e) {
-            if (log.isWarnEnabled()) {
-                log.warn("SaxonApiException while processing ({}). {}", xPathQuery, e.getLocalizedMessage());
-            }
-        }catch(FactoryConfigurationError e) {
-            log.error("FactoryConfigurationError on {}", e);
-            log.warn("FactoryConfigurationError while processing {}", e.getLocalizedMessage());
-        }
+
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals("Manager",matchStrings.get(0));
+
+        matchNumber = 0;
+        xPathQuery="//Employees/Employee[1]/age:ag";
+        fragment = true;
+        matchStrings.clear();
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals("<age:ag xmlns:age=\"http://www.w3.org/2003/01/geo/wgs84_pos#\">29</age:ag>",matchStrings.get(0));
+        assertEquals(1,matchStrings.size());
+
+        matchNumber = -1;
+        xPathQuery="//Employees/Employee/age:ag";
+        matchStrings.clear();
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals("<age:ag xmlns:age=\"http://www.w3.org/2003/01/geo/wgs84_pos#\">29</age:ag>",matchStrings.get(0));
+        assertEquals(4,matchStrings.size());
+
+        fragment = false;
+        matchStrings.clear();
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals("29",matchStrings.get(0));
+        assertEquals(4,matchStrings.size());
+
+        matchStrings.clear();
+        xPathQuery="regtsgwsdfstgsdf";
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals(new ArrayList<String>(),matchStrings);
+        assertEquals(0,matchStrings.size());
+
+        matchStrings.clear();
+        xPathQuery="//Employees/Employee[1]/age:ag";
+        matchNumber = 555;
+        XPathUtil.putValuesForXPathInListUsingSaxon(xmlDoc, xPathQuery, matchStrings, fragment,
matchNumber, namespaces);
+        assertEquals(new ArrayList<String>(),matchStrings);
+        assertEquals(0,matchStrings.size());
     }
 
     @Test



Mime
View raw message