camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-8314: Added unit test
Date Fri, 06 Feb 2015 05:24:29 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7b1f7ce13 -> 6aa5fd87b


CAMEL-8314: Added unit test


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

Branch: refs/heads/master
Commit: d8b54568b0645f95f18b1373f6661de0d20d46df
Parents: 7b1f7ce
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Feb 5 16:28:34 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Feb 5 16:28:34 2015 +0100

----------------------------------------------------------------------
 .../builder/saxon/XQueryTransformTextTest.java  | 64 ++++++++++++++++++++
 1 file changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d8b54568/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryTransformTextTest.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryTransformTextTest.java
b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryTransformTextTest.java
new file mode 100644
index 0000000..325fd43
--- /dev/null
+++ b/components/camel-saxon/src/test/java/org/apache/camel/builder/saxon/XQueryTransformTextTest.java
@@ -0,0 +1,64 @@
+/**
+ * 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 org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class XQueryTransformTextTest extends CamelTestSupport {
+
+    protected Endpoint startEndpoint;
+    protected MockEndpoint resultEndpoint;
+
+    @Test
+    public void testSendMatchingMessage() throws Exception {
+        // saxon converts all quotes to "
+        resultEndpoint.expectedBodiesReceived("Jonathan");
+
+        template.sendBody("direct:start", "<people><person>Jonathan</person></people>");
+
+        resultEndpoint.assertIsSatisfied();
+    }
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        startEndpoint = resolveMandatoryEndpoint("direct:start");
+        resultEndpoint = getMockEndpoint("mock:result");
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // START SNIPPET: example
+                from("direct:start").
+                    transform().xquery("/people/person/text()", String.class).
+                    to("mock:result");
+                // END SNIPPET: example
+            }
+        };
+    }
+}


Mime
View raw message