svn commit: r734903 - in /activemq/camel/trunk/components/camel-jdbc: ./ src/test/java/org/apache/camel/component/jdbc/ src/test/resources/org/ src/test/resources/org/apache/ src/test/resources/org/apache/camel/ src/test/resources/org/apache/camel/comp...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r734903 - in /activemq/camel/trunk/components/camel-jdbc: ./ src/test/java/org/apache/camel/component/jdbc/ src/test/resources/org/ src/test/resources/org/apache/ src/test/resources/org/apache/camel/ src/test/resources/org/apache/camel/comp...

ningjiang
Author: ningjiang
Date: Thu Jan 15 19:55:36 2009
New Revision: 734903

URL: http://svn.apache.org/viewvc?rev=734903&view=rev
Log:
Added a simple spring unit test for camel-jdbc

Added:
    activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java   (with props)
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/
    activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml   (with props)
Modified:
    activemq/camel/trunk/components/camel-jdbc/pom.xml

Modified: activemq/camel/trunk/components/camel-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jdbc/pom.xml?rev=734903&r1=734902&r2=734903&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jdbc/pom.xml (original)
+++ activemq/camel/trunk/components/camel-jdbc/pom.xml Thu Jan 15 19:55:36 2009
@@ -38,14 +38,25 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core</artifactId>
         </dependency>
+
+        <!-- test dependencies -->
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core</artifactId>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
-
-        <!-- test dependencies -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Added: activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java?rev=734903&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java (added)
+++ activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java Thu Jan 15 19:55:36 2009
@@ -0,0 +1,53 @@
+/**
+ * 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.CamelContext;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+public class JdbcSpringAnotherRouteTest extends JdbcAnotherRouteTest {
+    private ClassPathXmlApplicationContext applicationContext;
+    @Override
+    protected void setUp() throws Exception {
+        setUseRouteBuilder(false);
+        applicationContext = createApplicationContext();
+        super.setUp();        
+        assertNotNull("Should have created a valid spring context", applicationContext);
+
+
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (applicationContext != null) {
+            applicationContext.destroy();
+        }
+        super.tearDown();
+    }
+    
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/jdbc/camelContext.xml");
+    }
+}

Propchange: activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml?rev=734903&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml (added)
+++ activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml Thu Jan 15 19:55:36 2009
@@ -0,0 +1,47 @@
+<?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"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+    ">
+
+  
+  <!-- START SNIPPET: example -->  
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+    <route>
+       <from uri="timer://kickoff?period=10000"/>
+       <setBody>
+         <constant>select * from customer</constant>
+       </setBody>
+       <to uri="jdbc:testdb"/>
+       <to uri="mock:result"/>
+    </route>
+  </camelContext>
+  <!-- Just add a demo to show how to bind a date source for camel in Spring-->
+  <bean id="testdb" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+   <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+   <property name="url" value="jdbc:hsqldb:mem:camel_jdbc" />
+   <property name="username" value="sa" />
+    <property name="password" value="" />
+  </bean>
+  
+  <!-- END SNIPPET: example -->
+
+</beans>

Propchange: activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml