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/10/18 13:21:52 UTC
svn commit: r1185582 - in /camel/trunk/tests/camel-itest-osgi: ./
src/test/java/org/apache/camel/itest/osgi/sql/
src/test/resources/org/apache/camel/itest/osgi/sql/
Author: davsclaus
Date: Tue Oct 18 11:21:51 2011
New Revision: 1185582
URL: http://svn.apache.org/viewvc?rev=1185582&view=rev
Log:
CAMEL-4465: Added OSGi unit tests for camel-sql. Thanks to Ioannis for the patch.
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java (with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java (with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java (with props)
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml (with props)
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml (with props)
Modified:
camel/trunk/tests/camel-itest-osgi/pom.xml
Modified: camel/trunk/tests/camel-itest-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=1185582&r1=1185581&r2=1185582&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/pom.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/pom.xml Tue Oct 18 11:21:51 2011
@@ -189,6 +189,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-sql</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-syslog</artifactId>
<scope>test</scope>
</dependency>
@@ -318,6 +323,11 @@
<artifactId>camel-aws</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java?rev=1185582&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java Tue Oct 18 11:21:51 2011
@@ -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.itest.osgi.sql;
+
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import javax.sql.DataSource;
+
+public class DatabaseManager {
+
+ private DataSource dataSource;
+
+ public DatabaseManager(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public void init() {
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+ jdbcTemplate.execute("create table projects (id integer primary key,"
+ + "project varchar(10), license varchar(5))");
+ jdbcTemplate.execute("insert into projects values (1, 'Camel', 'ASF')");
+ jdbcTemplate.execute("insert into projects values (2, 'AMQ', 'ASF')");
+ jdbcTemplate.execute("insert into projects values (3, 'Linux', 'XXX')");
+ }
+
+ public void destroy() {
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+ jdbcTemplate.execute("drop table projects");
+ }
+}
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/DatabaseManager.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java?rev=1185582&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java Tue Oct 18 11:21:51 2011
@@ -0,0 +1,160 @@
+/*
+ * 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.itest.osgi.sql;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.sql.SqlConstants;
+import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Customizer;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.springframework.dao.DataAccessException;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import javax.sql.DataSource;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.modifyBundle;
+
+@RunWith(JUnit4TestRunner.class)
+public class SqlBlueprintRoute extends OSGiBlueprintTestSupport {
+
+
+ @Test
+ public void testListBody() throws Exception {
+ getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+
+ MockEndpoint mock = (MockEndpoint) ctx.getEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+ List<Object> body = new ArrayList<Object>();
+ body.add("ASF");
+ body.add("Camel");
+ ProducerTemplate template = ctx.createProducerTemplate();
+ template.sendBody("direct:list", body);
+ mock.assertIsSatisfied();
+ List<?> received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
+ Map<?, ?> firstRow = assertIsInstanceOf(Map.class, received.get(0));
+ assertEquals(1, firstRow.get("ID"));
+
+ // unlikely to have accidental ordering with 3 rows x 3 columns
+ for (Object obj : received) {
+ Map<?, ?> row = assertIsInstanceOf(Map.class, obj);
+ assertTrue("not preserving key ordering for a given row keys: " + row.keySet(), isOrdered(row.keySet()));
+ }
+ }
+
+ @Test
+ public void testLowNumberOfParameter() throws Exception {
+ getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+
+ MockEndpoint mock = (MockEndpoint) ctx.getEndpoint("mock:result");
+ try {
+ ProducerTemplate template = ctx.createProducerTemplate();
+ template.sendBody("direct:list", "ASF");
+ fail();
+ } catch (RuntimeCamelException e) {
+ // should have DataAccessException thrown
+ assertTrue("Exception thrown is wrong", e.getCause() instanceof DataAccessException);
+ }
+ }
+
+
+
+ @Test
+ public void testInsert() throws Exception {
+ getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+ DataSource ds = getOsgiService(DataSource.class,10000);
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);
+ ProducerTemplate template = ctx.createProducerTemplate();
+ MockEndpoint mock = (MockEndpoint) ctx.getEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ template.sendBody("direct:insert", new Object[] {10, "test", "test"});
+ mock.assertIsSatisfied();
+ try {
+ String projectName = (String)jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
+ assertEquals("test", projectName);
+ } catch (EmptyResultDataAccessException e) {
+ fail("no row inserted");
+ }
+
+ Integer actualUpdateCount = mock.getExchanges().get(0).getIn().getHeader(SqlConstants.SQL_UPDATE_COUNT, Integer.class);
+ assertEquals((Integer) 1, actualUpdateCount);
+ }
+
+
+ private boolean isOrdered(Set<?> keySet) {
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("id"));
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("project"));
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("license"));
+
+ // the implementation uses a case insensitive Map
+ final Iterator<?> it = keySet.iterator();
+ return "id".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()))
+ && "project".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()))
+ && "license".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()));
+ }
+ @Configuration
+ public static Option[] configure() throws Exception {
+
+ Option[] options = combine(
+ getDefaultCamelKarafOptions(),
+ new Customizer() {
+ @Override
+ public InputStream customizeTestProbe(InputStream testProbe) {
+ return modifyBundle(testProbe)
+ .add("OSGI-INF/blueprint/test.xml", SqlBlueprintRoute.class.getResource("blueprintSqlCamelContext.xml"))
+ .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintSqlTestBundle")
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .build();
+ }
+ },
+ scanFeatures(getKarafFeatureUrl(), "spring"),
+ mavenBundle("org.apache.derby", "derby", "10.4.2.0"),
+ // using the features to install the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-blueprint", "camel-sql"),
+ felix(), equinox());
+
+ return options;
+ }
+}
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java?rev=1185582&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java Tue Oct 18 11:21:51 2011
@@ -0,0 +1,172 @@
+/*
+ * 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.itest.osgi.sql;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.sql.SqlComponent;
+import org.apache.camel.component.sql.SqlConstants;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+import org.apache.camel.spring.SpringCamelContext;
+import org.apache.derby.jdbc.EmbeddedDataSource;
+import org.apache.karaf.testing.Helper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.springframework.dao.DataAccessException;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.SingleConnectionDataSource;
+import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
+
+import javax.sql.DataSource;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+@RunWith(JUnit4TestRunner.class)
+public class SqlRouteTest extends OSGiIntegrationTestSupport {
+
+ protected String driverClass = "org.apache.derby.jdbc.EmbeddedDriver";
+ private DataSource ds;
+ private JdbcTemplate jdbcTemplate;
+
+ protected OsgiBundleXmlApplicationContext applicationContext;
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ applicationContext.destroy();
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ setThreadContextClassLoader();
+ applicationContext = new OsgiBundleXmlApplicationContext(
+ new String[]{"org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml"});
+ if (bundleContext != null) {
+ applicationContext.setBundleContext(bundleContext);
+ applicationContext.refresh();
+ }
+ ds = (DataSource) applicationContext.getBean("dataSource");
+ jdbcTemplate = new JdbcTemplate(ds);
+ return SpringCamelContext.springCamelContext(applicationContext);
+ }
+
+ @Test
+ public void testListBody() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+ List<Object> body = new ArrayList<Object>();
+ body.add("ASF");
+ body.add("Camel");
+ template.sendBody("direct:list", body);
+ mock.assertIsSatisfied();
+ List<?> received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
+ Map<?, ?> firstRow = assertIsInstanceOf(Map.class, received.get(0));
+ assertEquals(1, firstRow.get("ID"));
+
+ // unlikely to have accidental ordering with 3 rows x 3 columns
+ for (Object obj : received) {
+ Map<?, ?> row = assertIsInstanceOf(Map.class, obj);
+ assertTrue("not preserving key ordering for a given row keys: " + row.keySet(), isOrdered(row.keySet()));
+ }
+ }
+
+ @Test
+ public void testLowNumberOfParameter() throws Exception {
+ try {
+ template.sendBody("direct:list", "ASF");
+ fail();
+ } catch (RuntimeCamelException e) {
+ // should have DataAccessException thrown
+ assertTrue("Exception thrown is wrong", e.getCause() instanceof DataAccessException);
+ }
+ }
+
+
+
+ @Test
+ public void testInsert() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ template.sendBody("direct:insert", new Object[] {10, "test", "test"});
+ mock.assertIsSatisfied();
+ try {
+ String projectName = (String)jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
+ assertEquals("test", projectName);
+ } catch (EmptyResultDataAccessException e) {
+ fail("no row inserted");
+ }
+
+ Integer actualUpdateCount = mock.getExchanges().get(0).getIn().getHeader(SqlConstants.SQL_UPDATE_COUNT, Integer.class);
+ assertEquals((Integer) 1, actualUpdateCount);
+ }
+
+
+ private boolean isOrdered(Set<?> keySet) {
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("id"));
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("project"));
+ assertTrue("isOrdered() requires the following keys: id, project, license", keySet.contains("license"));
+
+ // the implementation uses a case insensitive Map
+ final Iterator<?> it = keySet.iterator();
+ return "id".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()))
+ && "project".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()))
+ && "license".equalsIgnoreCase(assertIsInstanceOf(String.class, it.next()));
+ }
+
+ @Configuration
+ public static Option[] configure() throws Exception {
+ Option[] options = combine(
+ // Default karaf environment
+ Helper.getDefaultOptions(
+ // this is how you set the default log level when using pax logging (logProfile)
+ Helper.setLogLevel("WARN")),
+
+ // install the spring.
+ scanFeatures(getKarafFeatureUrl(), "spring"),
+ // using the features to install the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-spring", "camel-test", "camel-sql"),
+
+ mavenBundle().groupId("org.apache.derby").artifactId("derby").version("10.4.2.0"),
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+}
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml?rev=1185582&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml Tue Oct 18 11:21:51 2011
@@ -0,0 +1,48 @@
+<?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.
+ -->
+ <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="direct:list"/>
+ <to uri="sql:select * from projects where license = # and project = # order by id"/>
+ <to uri="mock:result"/>
+ </route>
+ <route>
+ <from uri="direct:insert"/>
+ <to uri="sql:insert into projects values (#, #, #)"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <bean id="dataSource" class="org.apache.derby.jdbc.EmbeddedDataSource">
+ <property name="databaseName" value="ProductsDB"/>
+ <property name="createDatabase" value="create" />
+ </bean>
+
+ <bean id="manager" class="org.apache.camel.itest.osgi.sql.DatabaseManager" init-method="init" destroy-method="destroy">
+ <argument ref="dataSource"/>
+ </bean>
+
+ <bean id="sql" class="org.apache.camel.component.sql.SqlComponent" depends-on="manager">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+ <service ref="dataSource" interface="javax.sql.DataSource"/>
+
+</blueprint>
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/blueprintSqlCamelContext.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml?rev=1185582&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml Tue Oct 18 11:21:51 2011
@@ -0,0 +1,51 @@
+<?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:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation=
+ "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:list"/>
+ <to uri="sql:select * from projects where license = # and project = # order by id"/>
+ <to uri="mock:result"/>
+ </route>
+ <route>
+ <from uri="direct:insert"/>
+ <to uri="sql:insert into projects values (#, #, #)"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <bean id="dataSource" class="org.apache.derby.jdbc.EmbeddedDataSource">
+ <property name="databaseName" value="ProductsDB"/>
+ <property name="createDatabase" value="create" />
+ </bean>
+
+ <bean id="manager" class="org.apache.camel.itest.osgi.sql.DatabaseManager" init-method="init" destroy-method="destroy">
+ <constructor-arg ref="dataSource"/>
+ </bean>
+
+ <bean id="sql" class="org.apache.camel.component.sql.SqlComponent" depends-on="manager">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/sql/springSqlRouteContext.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml