| /******************************************************************************* |
| * Copyright (c) 2009 Standards for Technology in Automotive Retail and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * David Carver - STAR - initial api and implementation bug 262765 |
| * Jesper Steen Moeller - bug 285145 - fix expected outcome |
| for iri-to-uri-1args-6 |
| *******************************************************************************/ |
| |
| package org.eclipse.wst.xml.xpath2.processor.testsuite.functions; |
| |
| import java.net.URL; |
| |
| import org.apache.xerces.xs.XSModel; |
| import org.eclipse.wst.xml.xpath2.processor.DynamicError; |
| import org.eclipse.wst.xml.xpath2.processor.ResultSequence; |
| import org.eclipse.wst.xml.xpath2.processor.StaticError; |
| import org.eclipse.wst.xml.xpath2.processor.XPathParserException; |
| import org.eclipse.wst.xml.xpath2.processor.test.AbstractPsychoPathTest; |
| |
| |
| public class IRIToURIfuncTest extends AbstractPsychoPathTest { |
| |
| //Test iri-to-uri from example defined in functions and operators specification. |
| public void test_fn_iri_to_uri1args_1() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-1.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-1.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri from example defined in functions and operators specification. |
| public void test_fn_iri_to_uri1args_2() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-2.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-2.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri with zero-length string argument. |
| public void test_fn_iri_to_uri1args_3() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-3.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-3.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri with empty sequence argument. |
| public void test_fn_iri_to_uri1args_4() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-4.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-4.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri with invalid argument type. |
| public void test_fn_iri_to_uri1args_5() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-5.xq"; |
| String expectedResult = "XPTY0004"; |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri with incorrect arity. |
| public void test_fn_iri_to_uri1args_6() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri1args-6.xq"; |
| String expectedResult = "XPST0017"; |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Test iri-to-uri with nothing to escape. |
| public void test_fn_iri_to_uri_1() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-1.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-1.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape numbers. |
| public void test_fn_iri_to_uri_2() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-2.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-2.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "#" symbol. |
| public void test_fn_iri_to_uri_3() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-3.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-3.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "-" symbol. |
| public void test_fn_iri_to_uri_4() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-4.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-4.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "_" symbol. |
| public void test_fn_iri_to_uri_5() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-5.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-5.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "." symbol. |
| public void test_fn_iri_to_uri_6() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-6.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-6.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "!" symbol. |
| public void test_fn_iri_to_uri_7() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-7.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-7.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "~" symbol. |
| public void test_fn_iri_to_uri_8() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-8.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-8.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "*" symbol. |
| public void test_fn_iri_to_uri_9() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-9.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-9.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "'" symbol. |
| public void test_fn_iri_to_uri_10() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-10.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-10.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "(" symbol. |
| public void test_fn_iri_to_uri_11() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-11.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-11.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the ")" symbol. |
| public void test_fn_iri_to_uri_12() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-12.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-12.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the ";" symbol. |
| public void test_fn_iri_to_uri_13() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-13.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-13.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "/" symbol. |
| public void test_fn_iri_to_uri_14() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-14.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-14.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "?" symbol. |
| public void test_fn_iri_to_uri_15() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-15.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-15.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the ":" symbol. |
| public void test_fn_iri_to_uri_16() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-16.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-16.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "@" symbol. |
| public void test_fn_iri_to_uri_17() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-17.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-17.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the ampersand symbol. |
| public void test_fn_iri_to_uri_18() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-18.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-18.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "=" symbol. |
| public void test_fn_iri_to_uri_19() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-19.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-19.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "+" symbol. |
| public void test_fn_iri_to_uri_20() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-20.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-20.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "$" symbol. |
| public void test_fn_iri_to_uri_21() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-21.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-21.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "," symbol. |
| public void test_fn_iri_to_uri_22() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-22.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-22.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "[" symbol. |
| public void test_fn_iri_to_uri_23() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-23.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-23.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "]" symbol. |
| public void test_fn_iri_to_uri_24() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-24.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-24.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines that iri-to-uri does not escape the "%" symbol. |
| public void test_fn_iri_to_uri_25() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-25.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-25.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| //Examines the iri-to-uri function with the iri containing a space. |
| public void test_fn_iri_to_uri_26() throws Exception { |
| String inputFile = "/TestSources/emptydoc.xml"; |
| String xqFile = "/Queries/XQuery/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-26.xq"; |
| String resultFile = "/ExpectedTestResults/Functions/AllStringFunc/EscapingFuncs/IRIToURIfunc/fn-iri-to-uri-26.txt"; |
| String expectedResult = getExpectedResult(resultFile); |
| URL fileURL = bundle.getEntry(inputFile); |
| loadDOMDocument(fileURL); |
| |
| // Get XML Schema Information for the Document |
| XSModel schema = getGrammar(); |
| |
| setupDynamicContext(schema); |
| |
| String xpath = extractXPathExpression(xqFile, inputFile); |
| String actual = null; |
| try { |
| compileXPath(xpath); |
| ResultSequence rs = evaluate(domDoc); |
| |
| |
| actual = buildResultString(rs); |
| |
| } catch (XPathParserException ex) { |
| actual = ex.code(); |
| } catch (StaticError ex) { |
| actual = ex.code(); |
| } catch (DynamicError ex) { |
| actual = ex.code(); |
| } |
| |
| assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual); |
| |
| |
| } |
| |
| } |
| |