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 2011/11/23 15:36:42 UTC
svn commit: r1205417 -
/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java
Author: davsclaus
Date: Wed Nov 23 14:36:42 2011
New Revision: 1205417
URL: http://svn.apache.org/viewvc?rev=1205417&view=rev
Log:
Added unit test based on user forum issue
Added:
camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java
Added: camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java?rev=1205417&view=auto
==============================================================================
--- camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java (added)
+++ camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcTransformSimpleTest.java Wed Nov 23 14:36:42 2011
@@ -0,0 +1,47 @@
+/**
+ * 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.jdbc;
+
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class JdbcTransformSimpleTest extends JdbcRouteTest {
+
+ public void testJdbcRoutes() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("jstrachan");
+
+ template.sendBody("direct:hello", "select * from customer order by ID");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:hello")
+ .to("jdbc:testdb")
+ // grab the first row, and the name column
+ .transform().simple("${body[0]['NAME']}")
+ .to("mock:result");
+ }
+ };
+ }
+}