Repository: camel
Updated Branches:
  refs/heads/master a8e26febf -> 8cba9e856


CAMEL-8830: Upgrade to Saxon HE 9.7


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8cba9e85
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8cba9e85
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8cba9e85

Branch: refs/heads/master
Commit: 8cba9e856acde2705ef13354691f4f48cb477756
Parents: a8e26fe
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Tue Sep 13 16:58:02 2016 +0200
Committer: lburgazzoli <lburgazz...@gmail.com>
Committed: Wed Sep 21 13:10:31 2016 +0200

----------------------------------------------------------------------
 .../apache/camel/builder/xml/XPathBuilder.java  | 43 +++++++++++--
 .../apache/camel/builder/xml/XsltBuilder.java   |  2 +-
 .../camel/builder/xml/XsltUriResolver.java      | 11 ++--
 .../xslt/DefaultXsltUriResolverFactory.java     |  2 +-
 .../camel/component/xslt/XsltEndpoint.java      |  1 +
 .../util/toolbox/XsltAggregationStrategy.java   |  2 +-
 .../xslt/XsltUriResolverFactoryTest.java        | 20 ++----
 components/camel-saxon/pom.xml                  | 13 ++++
 .../XQueryAnnotationExpressionFactory.java      |  6 +-
 .../camel/component/xquery/XQueryBuilder.java   | 30 ++++++---
 .../camel/component/xquery/XQueryEndpoint.java  | 22 +++----
 .../saxon/XPathAnnotationResultTypeTest.java    |  4 +-
 .../apache/camel/builder/saxon/XPathTest.java   |  2 +
 .../component/xslt/SaxonUriResolverTest.java    | 68 ++++++++++++++++++++
 .../xslt/SaxonXslIncludeEmptyHrefTest.java      | 51 +++++++++++++++
 .../xslt/SaxonXslIncludetEmptyHrefTest.java     | 49 --------------
 .../converter/saxon/SaxonConverterTest.java     |  2 +-
 .../camel/language/xpath/XPathLanguageTest.java |  3 +
 .../camel/language/xpath/XPathLanguageTest.xml  |  4 ++
 parent/pom.xml                                  |  6 +-
 20 files changed, 237 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java 
b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index 8b0c2f6..932d1ce 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -85,6 +85,7 @@ import static 
org.apache.camel.builder.xml.Namespaces.isMatchingNamespaceOrEmpty
 public class XPathBuilder extends ServiceSupport implements Expression, 
Predicate, NamespaceAware {
     private static final Logger LOG = 
LoggerFactory.getLogger(XPathBuilder.class);
     private static final String SAXON_OBJECT_MODEL_URI = 
"http://saxon.sf.net/jaxp/xpath/om";;
+    private static final String SAXON_FACTORY_CLASS_NAME = 
"net.sf.saxon.xpath.XPathFactoryImpl";
     private static final String OBTAIN_ALL_NS_XPATH = "//*/namespace::*";
 
     private static volatile XPathFactory defaultXPathFactory;
@@ -104,6 +105,7 @@ public class XPathBuilder extends ServiceSupport implements 
Expression, Predicat
     private volatile Class<?> resultType;
     private volatile QName resultQName = XPathConstants.NODESET;
     private volatile String objectModelUri;
+    private volatile String factoryClassName;
     private volatile DefaultNamespaceContext namespaceContext;
     private volatile boolean logNamespaces;
     private volatile XPathFunctionResolver functionResolver;
@@ -322,6 +324,18 @@ public class XPathBuilder extends ServiceSupport 
implements Expression, Predicat
         return this;
     }
 
+
+    /**
+     * Sets the factory class name to use
+     *
+     * @return the current builder
+     */
+    public XPathBuilder factoryClassName(String factoryClassName) {
+        this.factoryClassName = factoryClassName;
+        return this;
+    }
+
+
     /**
      * Configures to use Saxon as the XPathFactory which allows you to use 
XPath 2.0 functions
      * which may not be part of the build in JDK XPath parser.
@@ -330,6 +344,7 @@ public class XPathBuilder extends ServiceSupport implements 
Expression, Predicat
      */
     public XPathBuilder saxon() {
         this.objectModelUri = SAXON_OBJECT_MODEL_URI;
+        this.factoryClassName = SAXON_FACTORY_CLASS_NAME;
         return this;
     }
 
@@ -727,22 +742,32 @@ public class XPathBuilder extends ServiceSupport 
implements Expression, Predicat
         return logNamespaces;
     }
 
-    public String getObjectModelUri() {
-        return objectModelUri;
-    }
-
     /**
      * Enables Saxon on this particular XPath expression, as {@link #saxon()} 
sets the default static XPathFactory which may have already been initialised
      * by previous XPath expressions
      */
     public void enableSaxon() {
         this.setObjectModelUri(SAXON_OBJECT_MODEL_URI);
+        this.setFactoryClassName(SAXON_FACTORY_CLASS_NAME);
+
+    }
+
+    public String getObjectModelUri() {
+        return objectModelUri;
     }
 
     public void setObjectModelUri(String objectModelUri) {
         this.objectModelUri = objectModelUri;
     }
 
+    public String getFactoryClassName() {
+        return factoryClassName;
+    }
+
+    public void setFactoryClassName(String factoryClassName) {
+        this.factoryClassName = factoryClassName;
+    }
+
     // Implementation methods
     // 
-------------------------------------------------------------------------
 
@@ -1179,7 +1204,15 @@ public class XPathBuilder extends ServiceSupport 
implements Expression, Predicat
 
     protected synchronized XPathFactory createXPathFactory() throws 
XPathFactoryConfigurationException {
         if (objectModelUri != null) {
-            xpathFactory = XPathFactory.newInstance(objectModelUri);
+            String xpathFactoryClassName = factoryClassName;
+            if (objectModelUri.equals(SAXON_OBJECT_MODEL_URI) && 
ObjectHelper.isEmpty(xpathFactoryClassName)) {
+                xpathFactoryClassName = SAXON_FACTORY_CLASS_NAME;
+            }
+
+            xpathFactory = ObjectHelper.isEmpty(xpathFactoryClassName)
+                ? XPathFactory.newInstance(objectModelUri)
+                : XPathFactory.newInstance(objectModelUri, 
xpathFactoryClassName, null);
+
             LOG.info("Using objectModelUri " + objectModelUri + " when created 
XPathFactory {}", xpathFactory);
             return xpathFactory;
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java 
b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
index 4179107..035d4ab 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
@@ -545,7 +545,7 @@ public class XsltBuilder implements Processor {
      */
     protected void configureTransformer(Transformer transformer, Exchange 
exchange) throws Exception {
         if (uriResolver == null) {
-            uriResolver = new 
XsltUriResolver(exchange.getContext().getClassResolver(), null);
+            uriResolver = new XsltUriResolver(exchange.getContext(), null);
         }
         transformer.setURIResolver(uriResolver);
         if (errorListener == null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java 
b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
index 58dbb65..638af2d 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XsltUriResolver.java
@@ -23,7 +23,7 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.CamelContext;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResourceHelper;
@@ -46,12 +46,12 @@ public class XsltUriResolver implements URIResolver {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(XsltUriResolver.class);
 
-    private final ClassResolver resolver;
+    private final CamelContext context;
     private final String location;
     private final String baseScheme;
 
-    public XsltUriResolver(ClassResolver resolver, String location) {
-        this.resolver = resolver;
+    public XsltUriResolver(CamelContext context, String location) {
+        this.context = context;
         this.location = location;
         if (ResourceHelper.hasScheme(location)) {
             baseScheme = ResourceHelper.getScheme(location);
@@ -61,6 +61,7 @@ public class XsltUriResolver implements URIResolver {
         }
     }
 
+    @Override
     public Source resolve(String href, String base) throws 
TransformerException {
         // supports the empty href
         if (ObjectHelper.isEmpty(href)) {
@@ -86,7 +87,7 @@ public class XsltUriResolver implements URIResolver {
 
             InputStream is;
             try {
-                is = 
ResourceHelper.resolveMandatoryResourceAsInputStream(resolver, href);
+                is = 
ResourceHelper.resolveMandatoryResourceAsInputStream(context, href);
             } catch (IOException e) {
                 throw new TransformerException(e);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/component/xslt/DefaultXsltUriResolverFactory.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/xslt/DefaultXsltUriResolverFactory.java
 
b/camel-core/src/main/java/org/apache/camel/component/xslt/DefaultXsltUriResolverFactory.java
index a82498f..533150a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/xslt/DefaultXsltUriResolverFactory.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/xslt/DefaultXsltUriResolverFactory.java
@@ -30,7 +30,7 @@ public class DefaultXsltUriResolverFactory implements 
XsltUriResolverFactory {
 
     @Override
     public URIResolver createUriResolver(CamelContext camelContext, String 
resourceUri) {
-        return new XsltUriResolver(camelContext.getClassResolver(), 
resourceUri);
+        return new XsltUriResolver(camelContext, resourceUri);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java 
b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index c7ec0a2..1455c19 100644
--- a/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -378,6 +378,7 @@ public class XsltEndpoint extends ProcessorEndpoint {
         if (source == null) {
             throw new IOException("Cannot load schema resource " + 
resourceUri);
         } else {
+            source.setSystemId(resourceUri);
             xslt.setTransformerSource(source);
         }
         // now loaded so clear flag

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/main/java/org/apache/camel/util/toolbox/XsltAggregationStrategy.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/util/toolbox/XsltAggregationStrategy.java
 
b/camel-core/src/main/java/org/apache/camel/util/toolbox/XsltAggregationStrategy.java
index 31b4f7a..057503a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/util/toolbox/XsltAggregationStrategy.java
+++ 
b/camel-core/src/main/java/org/apache/camel/util/toolbox/XsltAggregationStrategy.java
@@ -154,7 +154,7 @@ public class XsltAggregationStrategy implements 
AggregationStrategy {
         }
 
         if (uriResolver == null) {
-            uriResolver = new XsltUriResolver(context.getClassResolver(), 
xslFile);
+            uriResolver = new XsltUriResolver(context, xslFile);
         }
 
         xslt.setUriResolver(uriResolver);

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/camel-core/src/test/java/org/apache/camel/component/xslt/XsltUriResolverFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltUriResolverFactoryTest.java
 
b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltUriResolverFactoryTest.java
index 07ec801..2fe7a74 100644
--- 
a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltUriResolverFactoryTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltUriResolverFactoryTest.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.xslt;
 import java.io.InputStream;
 import java.util.HashSet;
 import java.util.Set;
-
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.URIResolver;
@@ -32,7 +31,6 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.model.language.ConstantExpression;
 import org.apache.camel.model.language.SimpleExpression;
-import org.apache.camel.spi.ClassResolver;
 import org.junit.Assert;
 
 /**
@@ -82,8 +80,8 @@ public class XsltUriResolverFactoryTest extends 
ContextTestSupport {
         assertMockEndpointsSatisfied();
         assertNotNull(xsltEndpoint);
         CustomXsltUriResolver resolver = 
(CustomXsltUriResolver)xsltEndpoint.getUriResolver();
-        checkResourceUri(resolver.resolvedRsourceUris, "xslt/staff/staff.xsl");
-        checkResourceUri(resolver.resolvedRsourceUris, 
"../common/staff_template.xsl");
+        checkResourceUri(resolver.resolvedResourceUris, 
"xslt/staff/staff.xsl");
+        checkResourceUri(resolver.resolvedResourceUris, 
"../common/staff_template.xsl");
     }
 
     @Override
@@ -120,27 +118,23 @@ public class XsltUriResolverFactoryTest extends 
ContextTestSupport {
     }
 
     static class CustomXsltUriResolverFactory implements 
XsltUriResolverFactory {
-
         @Override
         public URIResolver createUriResolver(CamelContext camelContext, String 
resourceUri) {
-            return new CustomXsltUriResolver(camelContext.getClassResolver(), 
resourceUri);
+            return new CustomXsltUriResolver(camelContext, resourceUri);
         }
-
     }
 
     static class CustomXsltUriResolver extends XsltUriResolver {
+        private final Set<String> resolvedResourceUris = new HashSet<>();
 
-        private final Set<String> resolvedRsourceUris = new HashSet<>();
-
-        CustomXsltUriResolver(ClassResolver resolver, String location) {
-            super(resolver, location);
+        CustomXsltUriResolver(CamelContext context, String location) {
+            super(context, location);
         }
 
         public Source resolve(String href, String base) throws 
TransformerException {
             Source result = super.resolve(href, base);
-            resolvedRsourceUris.add(href);
+            resolvedResourceUris.add(href);
             return result;
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-saxon/pom.xml b/components/camel-saxon/pom.xml
index 65a695d..b7542c8 100644
--- a/components/camel-saxon/pom.xml
+++ b/components/camel-saxon/pom.xml
@@ -81,4 +81,17 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <forkCount>1</forkCount>
+            <reuseForks>false</reuseForks>
+          </configuration>
+        </plugin>
+    </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
index 224f90b..19f9ffa 100644
--- 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
+++ 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
@@ -19,9 +19,7 @@ package org.apache.camel.component.xquery;
 import java.lang.annotation.Annotation;
 
 import org.w3c.dom.Node;
-
-import net.sf.saxon.functions.Collection;
-
+import net.sf.saxon.functions.CollectionFn;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.component.bean.DefaultAnnotationExpressionFactory;
@@ -54,7 +52,7 @@ public class XQueryAnnotationExpressionFactory extends 
DefaultAnnotationExpressi
         }
         if (expressionReturnType.isAssignableFrom(String.class)) {
             builder.setResultsFormat(ResultFormat.String);
-        } else if (expressionReturnType.isAssignableFrom(Collection.class)) {
+        } else if (expressionReturnType.isAssignableFrom(CollectionFn.class)) {
             builder.setResultsFormat(ResultFormat.List);
         } else if (expressionReturnType.isAssignableFrom(Node.class)) {
             builder.setResultsFormat(ResultFormat.DOM);

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
index 732bbff..a8bf247 100644
--- 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
+++ 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
@@ -30,7 +30,6 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
-
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMResult;
@@ -40,17 +39,17 @@ import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import org.w3c.dom.Node;
-
 import net.sf.saxon.Configuration;
 import net.sf.saxon.lib.ModuleURIResolver;
 import net.sf.saxon.om.DocumentInfo;
 import net.sf.saxon.om.Item;
 import net.sf.saxon.om.SequenceIterator;
+import net.sf.saxon.om.StructuredQName;
 import net.sf.saxon.query.DynamicQueryContext;
 import net.sf.saxon.query.StaticQueryContext;
 import net.sf.saxon.query.XQueryExpression;
 import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.ObjectValue;
 import net.sf.saxon.value.Whitespace;
 import org.apache.camel.BytesSource;
 import org.apache.camel.Exchange;
@@ -69,6 +68,7 @@ import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.w3c.dom.Node;
 
 /**
  * Creates an XQuery builder.
@@ -604,12 +604,23 @@ public abstract class XQueryBuilder implements 
Expression, Predicate, NamespaceA
         throws Exception {
         addParameters(dynamicQueryContext, exchange.getProperties());
         addParameters(dynamicQueryContext, exchange.getIn().getHeaders(), 
"in.headers.");
-        dynamicQueryContext.setParameter("in.body", 
exchange.getIn().getBody());
+        dynamicQueryContext.setParameter(
+            StructuredQName.fromClarkName("in.body"),
+            new ObjectValue(exchange.getIn().getBody())
+        );
+
         addParameters(dynamicQueryContext, getParameters());
 
-        dynamicQueryContext.setParameter("exchange", exchange);
+        dynamicQueryContext.setParameter(
+            StructuredQName.fromClarkName("exchange"),
+            new ObjectValue(exchange)
+        );
         if (exchange.hasOut() && exchange.getPattern().isOutCapable()) {
-            dynamicQueryContext.setParameter("out.body", 
exchange.getOut().getBody());
+            dynamicQueryContext.setParameter(
+                StructuredQName.fromClarkName("out.body"),
+                new ObjectValue(exchange.getOut().getBody())
+            );
+
             addParameters(dynamicQueryContext, exchange.getOut().getHeaders(), 
"out.headers.");
         }
     }
@@ -621,7 +632,10 @@ public abstract class XQueryBuilder implements Expression, 
Predicate, NamespaceA
     protected void addParameters(DynamicQueryContext dynamicQueryContext, 
Map<String, Object> map, String parameterPrefix) {
         Set<Map.Entry<String, Object>> propertyEntries = map.entrySet();
         for (Map.Entry<String, Object> entry : propertyEntries) {
-            dynamicQueryContext.setParameter(parameterPrefix + entry.getKey(), 
entry.getValue());
+            dynamicQueryContext.setParameter(
+                StructuredQName.fromClarkName(parameterPrefix + 
entry.getKey()),
+                new ObjectValue(entry.getValue())
+            );
         }
     }
 
@@ -638,7 +652,7 @@ public abstract class XQueryBuilder implements Expression, 
Predicate, NamespaceA
             LOG.debug("Initializing XQueryBuilder {}", this);
             if (configuration == null) {
                 configuration = new Configuration();
-                configuration.setHostLanguage(Configuration.XQUERY);
+                //configuration.setHostLanguage(Configuration.XQUERY);
                 configuration.setStripsWhiteSpace(isStripsAllWhiteSpace() ? 
Whitespace.ALL : Whitespace.IGNORABLE);
                 LOG.debug("Created new Configuration {}", configuration);
             } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
index 9c1a801..44a5eb3 100644
--- 
a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
+++ 
b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryEndpoint.java
@@ -212,18 +212,18 @@ public class XQueryEndpoint extends ProcessorEndpoint {
 
         LOG.debug("{} using schema resource: {}", this, resourceUri);
         URL url = 
ResourceHelper.resolveMandatoryResourceAsUrl(getCamelContext().getClassResolver(),
 resourceUri);
-        this.xquery = XQueryBuilder.xquery(url);
 
-        xquery.setConfiguration(getConfiguration());
-        xquery.setStaticQueryContext(getStaticQueryContext());
-        xquery.setParameters(getParameters());
-        xquery.setNamespaces(namespacePrefixes);
-        xquery.setResultsFormat(getResultsFormat());
-        xquery.setProperties(getProperties());
-        xquery.setResultType(getResultType());
-        xquery.setStripsAllWhiteSpace(isStripsAllWhiteSpace());
-        xquery.setAllowStAX(isAllowStAX());
-        xquery.setHeaderName(getHeaderName());
+        this.xquery = XQueryBuilder.xquery(url);
+        this.xquery.setConfiguration(getConfiguration());
+        this.xquery.setStaticQueryContext(getStaticQueryContext());
+        this.xquery.setParameters(getParameters());
+        this.xquery.setNamespaces(namespacePrefixes);
+        this.xquery.setResultsFormat(getResultsFormat());
+        this.xquery.setProperties(getProperties());
+        this.xquery.setResultType(getResultType());
+        this.xquery.setStripsAllWhiteSpace(isStripsAllWhiteSpace());
+        this.xquery.setAllowStAX(isAllowStAX());
+        this.xquery.setHeaderName(getHeaderName());
 
         setProcessor(xquery);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
index a4bb61c..1a057e2 100644
--- 
a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
@@ -19,11 +19,11 @@ package org.apache.camel.builder.saxon;
 import javax.naming.Context;
 import javax.xml.xpath.XPathFactory;
 
+import net.sf.saxon.lib.NamespaceConstant;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.language.XPath;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.jndi.JndiContext;
-
 import org.junit.Test;
 
 /**
@@ -52,7 +52,7 @@ public class XPathAnnotationResultTypeTest extends 
CamelTestSupport {
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                System.setProperty(XPathFactory.DEFAULT_PROPERTY_NAME + ":" + 
"http://saxon.sf.net/jaxp/xpath/om";, "net.sf.saxon.xpath.XPathFactoryImpl");
+                System.setProperty(XPathFactory.DEFAULT_PROPERTY_NAME + ":" + 
NamespaceConstant.OBJECT_MODEL_SAXON, "net.sf.saxon.xpath.XPathFactoryImpl");
                 from("direct:in1").bean("myBean", "readImplicit");
                 from("direct:in2").bean("myBean", "readExplicit");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
index c0afa28..26ec2a3 100644
--- 
a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathTest.java
@@ -21,6 +21,7 @@ import javax.xml.xpath.XPathFactory;
 import net.sf.saxon.xpath.XPathFactoryImpl;
 import org.apache.camel.builder.xml.XPathBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -72,6 +73,7 @@ public class XPathTest extends CamelTestSupport {
         // END SNIPPET: e1
     }
 
+    @Ignore("See 
http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory";)
     @Test
     public void testXPathFunctionTokenizeUsingObjectModel() throws Exception {
         // START SNIPPET: e2

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonUriResolverTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonUriResolverTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonUriResolverTest.java
new file mode 100644
index 0000000..a705893
--- /dev/null
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonUriResolverTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.camel.component.xslt;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import net.sf.saxon.TransformerFactoryImpl;
+import org.apache.camel.builder.xml.XsltUriResolver;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.ResourceHelper;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SaxonUriResolverTest extends CamelTestSupport {
+    private static final String XSL_PATH = 
"org/apache/camel/component/xslt/transform_includes_data.xsl";
+    private static final String XML_DATA = "<?xml version=\"1.0\" 
encoding=\"ISO-8859-1\"?><root>1</root>";
+    private static final String XML_RESP = "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><MyDate>February</MyDate>";
+
+    @Test
+    public void test() throws Exception {
+        StringWriter writer = new StringWriter();
+        StreamResult result = new StreamResult(writer);
+
+        Source xsl = fromClasspath(XSL_PATH);
+        xsl.setSystemId("classpath:/" + XSL_PATH);
+
+        Source xml = fromString(XML_DATA);
+
+        TransformerFactory factory = new TransformerFactoryImpl();
+        Transformer transformer = factory.newTransformer(xsl);
+        transformer.setURIResolver(new XsltUriResolver(context(), XSL_PATH));
+        transformer.transform(xml, result);
+
+        Assert.assertEquals(XML_RESP, writer.toString());
+    }
+
+    protected Source fromString(String data) throws IOException {
+        return new StreamSource(new StringReader(data));
+    }
+
+    protected Source fromClasspath(String path) throws IOException {
+        return new StreamSource(
+            ResourceHelper.resolveMandatoryResourceAsInputStream(context(), 
path)
+        );
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludeEmptyHrefTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludeEmptyHrefTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludeEmptyHrefTest.java
new file mode 100644
index 0000000..66e4e02
--- /dev/null
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludeEmptyHrefTest.java
@@ -0,0 +1,51 @@
+/**
+ * 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.camel.component.xslt;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class SaxonXslIncludeEmptyHrefTest extends CamelTestSupport {
+
+    //TODO: fix
+    //@Ignore("To Fix")
+    @Test
+    public void testXsltOutput() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        
+        mock.expectedBodiesReceived("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><MyDate>February</MyDate>");
+        mock.message(0).body().isInstanceOf(String.class);
+
+        template.sendBody("direct:start", "<root>1</root>");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    
.to("xslt:org/apache/camel/component/xslt/transform_includes_data.xsl")
+                    .to("mock:result");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludetEmptyHrefTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludetEmptyHrefTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludetEmptyHrefTest.java
deleted file mode 100644
index ad7e14f..0000000
--- 
a/components/camel-saxon/src/test/java/org/apache/camel/component/xslt/SaxonXslIncludetEmptyHrefTest.java
+++ /dev/null
@@ -1,49 +0,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.
- */
-package org.apache.camel.component.xslt;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class SaxonXslIncludetEmptyHrefTest extends CamelTestSupport {
-
-    @Test
-    public void testXsltOutput() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        
-        mock.expectedBodiesReceived("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><MyDate>February</MyDate>");
-        mock.message(0).body().isInstanceOf(String.class);
-
-        template.sendBody("direct:start", "<root>1</root>");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    
.to("xslt:org/apache/camel/component/xslt/transform_includes_data.xsl")
-                    .to("mock:result");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
index 5509dc3..7a46cf0 100644
--- 
a/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/converter/saxon/SaxonConverterTest.java
@@ -55,7 +55,7 @@ public class SaxonConverterTest extends CamelTestSupport {
         super.setUp();
         exchange = new DefaultExchange(context);
         evaluator = new XPathEvaluator();
-        doc = evaluator.setSource(new StringSource(CONTENT));
+        doc = evaluator.getConfiguration().buildDocumentTree(new 
StringSource(CONTENT)).getRootNode();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathLanguageTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathLanguageTest.java
 
b/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathLanguageTest.java
index f9d7836..84e16a7 100644
--- 
a/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathLanguageTest.java
+++ 
b/components/camel-saxon/src/test/java/org/apache/camel/language/xpath/XPathLanguageTest.java
@@ -21,6 +21,7 @@ import javax.xml.xpath.XPathFactory;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -94,6 +95,7 @@ public class XPathLanguageTest extends CamelSpringTestSupport 
{
         assertEquals("Hello", body);
     }
 
+    @Ignore("See 
http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory";)
     @Test
     public void testSpringDSLXPathObjectModel() throws Exception {
         if (!jvmAdequate) {
@@ -139,6 +141,7 @@ public class XPathLanguageTest extends 
CamelSpringTestSupport {
         assertMockEndpointsSatisfied();
     }
 
+    @Ignore("See 
http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory";)
     @Test
     public void testSpringDSLXPathObjectModelPredicate() throws Exception {
         if (!jvmAdequate) {

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
 
b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
index 46fefc6..b9428b0 100644
--- 
a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
+++ 
b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
@@ -48,6 +48,7 @@
       <to uri="mock:testSaxonWithFactoryResult"/>
     </route>
 
+    <!-- See 
http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory
     <route>
       <from uri="direct:testSaxonWithObjectModel"/>
       <setBody>
@@ -56,6 +57,7 @@
       <log message="Test Saxon with object model: ${body}"/>
       <to uri="mock:testSaxonWithObjectModelResult"/>
     </route>
+    -->
 
     <!-- ************************ -->
     <!-- *** XPath Predicates *** -->
@@ -79,6 +81,7 @@
       </filter>
     </route>
 
+    <!-- See 
http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory
     <route>
       <from uri="direct:testSaxonWithObjectModelPredicate"/>
       <filter>
@@ -87,6 +90,7 @@
         <to uri="mock:testSaxonWithObjectModelResultPredicate"/>
       </filter>
     </route>
+    -->
 
   </camelContext>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8cba9e85/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 5905bd2..3879ce8 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -506,8 +506,8 @@
     <rome-version>1.0</rome-version>
     <rxjava-version>1.2.0</rxjava-version>
     <saaj-impl-version>1.3.2_2</saaj-impl-version>
-    <saxon-bundle-version>9.5.1-5_1</saxon-bundle-version>
-    <saxon-version>9.5.1-5</saxon-version>
+    <saxon-bundle-version>9.7.0-6_1</saxon-bundle-version>
+    <saxon-version>9.7.0-6</saxon-version>
     <scala-version>2.11.7</scala-version>
     <scala-2.10-version>2.10.6</scala-2.10-version>
     <scala-maven-plugin-version>3.2.2</scala-maven-plugin-version>
@@ -673,7 +673,7 @@
       org.mortbay.cometd.*;version="[6.1,7)",
       org.slf4j.*;version="[1.7,2)",
       net.sf.flatpack.*;version="[3.1.1,4)",
-      net.sf.saxon.*;version="[9.3.0,9.6)",
+      net.sf.saxon.*;version="[9.7.0,9.8)",
       freemarker.*;version="[2.3.15,3)",
       javax.persistence.*;version="[1.1,3)",
       org.apache.lucene.*;version="${lucene-version-range}",

Reply via email to