Repository: camel Updated Branches: refs/heads/master b925b0174 -> 1a7cce0f2
Added test based on user forum issue Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1a7cce0f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1a7cce0f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1a7cce0f Branch: refs/heads/master Commit: 1a7cce0f26fba19ef9e870f66efc8b7c0f85f4f5 Parents: b925b01 Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Dec 10 16:59:42 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Dec 10 16:59:42 2015 +0100 ---------------------------------------------------------------------- .../component/sql/SpringSqlMultilineTest.java | 45 ++++++++++++++++++++ .../component/sql/SpringSqlMultilineTest.xml | 43 +++++++++++++++++++ 2 files changed, 88 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1a7cce0f/components/camel-sql/src/test/java/org/apache/camel/component/sql/SpringSqlMultilineTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SpringSqlMultilineTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SpringSqlMultilineTest.java new file mode 100755 index 0000000..536ba0f --- /dev/null +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SpringSqlMultilineTest.java @@ -0,0 +1,45 @@ +/** + * 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.sql; + +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.spring.CamelSpringTestSupport; +import org.junit.Test; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * @version + */ +public class SpringSqlMultilineTest extends CamelSpringTestSupport { + + @Override + protected AbstractApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/component/sql/SpringSqlMultilineTest.xml"); + } + + @Test + public void testSQLEndpoint() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(2); + + template.sendBody("direct:start", ""); + + assertMockEndpointsSatisfied(); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/1a7cce0f/components/camel-sql/src/test/resources/org/apache/camel/component/sql/SpringSqlMultilineTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/resources/org/apache/camel/component/sql/SpringSqlMultilineTest.xml b/components/camel-sql/src/test/resources/org/apache/camel/component/sql/SpringSqlMultilineTest.xml new file mode 100644 index 0000000..bef92b9 --- /dev/null +++ b/components/camel-sql/src/test/resources/org/apache/camel/component/sql/SpringSqlMultilineTest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <!-- In Memory Database --> + <jdbc:embedded-database id="myDataSource" type="DERBY"> + <jdbc:script location="classpath:/sql/createAndPopulateDatabase.sql"/> + </jdbc:embedded-database> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start"/> + <!-- need to use %20 on each line when we break up the SQL into new lines --> + <to uri="sql:select * from projects + %20where license like 'A%25'?dataSource=#myDataSource"/> + <split> + <simple>body</simple> + <to uri="mock:result"/> + </split> + </route> + </camelContext> + +</beans>