Author: bvahdat
Date: Sun Mar  4 20:19:16 2012
New Revision: 1296872

URL: http://svn.apache.org/viewvc?rev=1296872&view=rev
Log:
Fixed the failed MyBatisBatchConsumerTest on the CI-Server.

Modified:
    
camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
    
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisQueueTest.java
    
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java

Modified: 
camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java?rev=1296872&r1=1296871&r2=1296872&view=diff
==============================================================================
--- 
camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
 (original)
+++ 
camel/trunk/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
 Sun Mar  4 20:19:16 2012
@@ -88,7 +88,7 @@ public class MyBatisConsumer extends Sch
         // poll data from the database
         MyBatisEndpoint endpoint = getEndpoint();
         LOG.trace("Polling: {}", endpoint);
-        List<Object> data = 
CastUtils.cast(endpoint.getProcessingStrategy().poll(this, getEndpoint()));
+        List<?> data = endpoint.getProcessingStrategy().poll(this, 
getEndpoint());
 
         // create a list of exchange objects with the data
         Queue<DataHolder> answer = new LinkedList<DataHolder>();

Modified: 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisQueueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisQueueTest.java?rev=1296872&r1=1296871&r2=1296872&view=diff
==============================================================================
--- 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisQueueTest.java
 (original)
+++ 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisQueueTest.java
 Sun Mar  4 20:19:16 2012
@@ -32,7 +32,7 @@ public class MyBatisQueueTest extends My
     }
     
     protected String createStatement() {
-        return "create table ACCOUNT ( ACC_ID INTEGER , ACC_FIRST_NAME 
VARCHAR(255), ACC_LAST_NAME VARCHAR(255), ACC_EMAIL VARCHAR(255), PROCESSED 
BOOLEAN DEFAULT false)";
+        return "create table ACCOUNT (ACC_ID INTEGER, ACC_FIRST_NAME 
VARCHAR(255), ACC_LAST_NAME VARCHAR(255), ACC_EMAIL VARCHAR(255), PROCESSED 
BOOLEAN DEFAULT false)";
     }
 
     @Test

Modified: 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java?rev=1296872&r1=1296871&r2=1296872&view=diff
==============================================================================
--- 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
 (original)
+++ 
camel/trunk/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisTestSupport.java
 Sun Mar  4 20:19:16 2012
@@ -17,12 +17,10 @@
 package org.apache.camel.component.mybatis;
 
 import java.sql.Connection;
-import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Properties;
 
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.derby.jdbc.EmbeddedDriver;
+
 import org.junit.After;
 import org.junit.Before;
 
@@ -36,7 +34,7 @@ public abstract class MyBatisTestSupport
     }
     
     protected String createStatement() {
-        return "create table ACCOUNT ( ACC_ID INTEGER , ACC_FIRST_NAME 
VARCHAR(255), ACC_LAST_NAME VARCHAR(255), ACC_EMAIL VARCHAR(255)  )";
+        return "create table ACCOUNT (ACC_ID INTEGER, ACC_FIRST_NAME 
VARCHAR(255), ACC_LAST_NAME VARCHAR(255), ACC_EMAIL VARCHAR(255))";
     }
 
     @Override
@@ -44,11 +42,12 @@ public abstract class MyBatisTestSupport
     public void setUp() throws Exception {
         super.setUp();
 
-        // lets create the database...
+        // lets create the table...
         Connection connection = createConnection();
         Statement statement = connection.createStatement();
         statement.execute(createStatement());
         connection.commit();
+        statement.close();
         connection.close();
 
         if (createTestData()) {
@@ -71,15 +70,15 @@ public abstract class MyBatisTestSupport
     @Override
     @After
     public void tearDown() throws Exception {
+        // should drop the table properly to avoid any side effects while 
running all the tests together under maven
+        Connection connection = createConnection();
+        Statement statement = connection.createStatement();
+        statement.execute("drop table ACCOUNT");
+        connection.commit();
+        statement.close();
+        connection.close();
+
         super.tearDown();
-        
-        try {
-            new 
EmbeddedDriver().connect("jdbc:derby:memory:mybatis;drop=true", new 
Properties());
-        } catch (SQLException ex) {
-            if (!"08006".equals(ex.getSQLState())) {
-                throw ex;
-            }
-        }
     }
 
     private Connection createConnection() throws Exception {


Reply via email to