You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/05/29 09:09:29 UTC

[camel] branch main updated: camel-saxon - Lets remove those problematic tests

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 59c2945  camel-saxon - Lets remove those problematic tests
59c2945 is described below

commit 59c2945bfe707892ceef46985244ab2a1e991f5e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat May 29 11:08:40 2021 +0200

    camel-saxon - Lets remove those problematic tests
---
 .../saxon/XPathAnnotationResultTypeTest.java       | 74 ----------------------
 .../org/apache/camel/builder/saxon/XPathTest.java  | 30 ---------
 2 files changed, 104 deletions(-)

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
deleted file mode 100644
index 05e77a0..0000000
--- a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XPathAnnotationResultTypeTest.java
+++ /dev/null
@@ -1,74 +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.builder.saxon;
-
-import javax.xml.xpath.XPathFactory;
-
-import net.sf.saxon.lib.NamespaceConstant;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.language.xpath.XPath;
-import org.apache.camel.spi.Registry;
-import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.parallel.ResourceLock;
-import org.junit.jupiter.api.parallel.Resources;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-@ResourceLock(Resources.SYSTEM_PROPERTIES)
-public class XPathAnnotationResultTypeTest extends CamelTestSupport {
-    protected MyBean myBean = new MyBean();
-
-    @Test
-    public void testSendMessage() throws Exception {
-
-        String response = (String) template.requestBody("direct:in1", "<a><b>hello</b></a>");
-        assertEquals("HELLO", response);
-
-        response = (String) template.requestBody("direct:in2", "<a><b>hello</b></a>");
-        assertEquals("HELLO", response);
-    }
-
-    @Override
-    protected void bindToRegistry(Registry registry) throws Exception {
-        registry.bind("myBean", myBean);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() {
-        return new RouteBuilder() {
-            public void configure() {
-                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");
-            }
-        };
-    }
-
-    public static class MyBean {
-        public String abText;
-
-        public String readImplicit(@XPath("upper-case(//a/b/text())") String abText) {
-            return abText;
-        }
-
-        public String readExplicit(@XPath(value = "upper-case(//a/b/text())", resultType = String.class) String abText) {
-            return abText;
-        }
-    }
-}
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 137b7d0..3668178 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,7 +21,6 @@ import javax.xml.xpath.XPathFactory;
 import net.sf.saxon.xpath.XPathFactoryImpl;
 import org.apache.camel.language.xpath.XPathBuilder;
 import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.parallel.ResourceLock;
 import org.junit.jupiter.api.parallel.Resources;
@@ -75,20 +74,6 @@ public class XPathTest extends CamelTestSupport {
         // END SNIPPET: e1
     }
 
-    @Disabled("See http://www.saxonica.com/documentation/index.html#!xpath-api/jaxp-xpath/factory")
-    @Test
-    public void testXPathFunctionTokenizeUsingObjectModel() throws Exception {
-        // START SNIPPET: e2
-        // create a builder to evaluate the xpath using saxon based on its object model uri
-        XPathBuilder builder
-                = XPathBuilder.xpath("tokenize(/foo/bar, '_')[2]").objectModel("http://saxon.sf.net/jaxp/xpath/om");
-
-        // evaluate as a String result
-        String result = builder.evaluate(context, "<foo><bar>abc_def_ghi</bar></foo>");
-        assertEquals("def", result);
-        // END SNIPPET: e2
-    }
-
     @Test
     public void testXPathFunctionTokenizeUsingSaxon() throws Exception {
         // START SNIPPET: e3
@@ -101,19 +86,4 @@ public class XPathTest extends CamelTestSupport {
         // END SNIPPET: e3
     }
 
-    @Test
-    public void testXPathFunctionTokenizeUsingSystemProperty() throws Exception {
-        // START SNIPPET: e4
-        // set system property with the XPath factory to use which is Saxon 
-        System.setProperty(XPathFactory.DEFAULT_PROPERTY_NAME + ":" + "http://saxon.sf.net/jaxp/xpath/om",
-                "net.sf.saxon.xpath.XPathFactoryImpl");
-
-        // create a builder to evaluate the xpath using saxon
-        XPathBuilder builder = XPathBuilder.xpath("tokenize(/foo/bar, '_')[2]");
-
-        // evaluate as a String result
-        String result = builder.evaluate(context, "<foo><bar>abc_def_ghi</bar></foo>");
-        assertEquals("def", result);
-        // END SNIPPET: e4
-    }
 }