cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r889543 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/conn/ main/java/org/apache/cayenne/dba/sqlite/ test/java/org/apache/cayenne/access/jdbc/ test/java/org/apache/cayenne/query/
Date Fri, 11 Dec 2009 09:31:03 GMT
Author: oltka
Date: Fri Dec 11 09:31:03 2009
New Revision: 889543

URL: http://svn.apache.org/viewvc?rev=889543&view=rev
Log:
sqlite tests

- fix some error/failed tests in sqlite

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteDateType.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java?rev=889543&r1=889542&r2=889543&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/ConnectionWrapper.java
Fri Dec 11 09:31:03 2009
@@ -450,6 +450,8 @@
                     resultSetHoldability);
         }
     }
+    
+    
 
     public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
             throws SQLException {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java?rev=889543&r1=889542&r2=889543&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteAdapter.java
Fri Dec 11 09:31:03 2009
@@ -108,5 +108,4 @@
 
         super.createTableAppendPKClause(sqlBuffer, entity);
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteDateType.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteDateType.java?rev=889543&r1=889542&r2=889543&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteDateType.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteDateType.java
Fri Dec 11 09:31:03 2009
@@ -69,7 +69,7 @@
             case Types.DATE:
                 return getDate(string);
             case Types.TIME:
-                return getTime(string);
+                return rs.getTime(index);
             default:
                 return getTimestamp(string);
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java?rev=889543&r1=889542&r2=889543&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
Fri Dec 11 09:31:03 2009
@@ -40,15 +40,18 @@
     }
 
     public void testFetchLimit_DistinctResultIterator() throws Exception {
-        insertClobDb();
+        if (accessStack.getAdapter(getNode()).supportsLobs()) {
 
-        Expression qual = Expression.fromString("clobValue.value = 100");
-        SelectQuery select = new SelectQuery(ClobTestEntity.class, qual);
-        select.setFetchLimit(25);
-        List<DataRow> resultRows = context.performQuery(select);
+            insertClobDb();
 
-        assertNotNull(resultRows);
-        assertEquals(25, resultRows.size());
+            Expression qual = Expression.fromString("clobValue.value = 100");
+            SelectQuery select = new SelectQuery(ClobTestEntity.class, qual);
+            select.setFetchLimit(25);
+            List<DataRow> resultRows = context.performQuery(select);
+
+            assertNotNull(resultRows);
+            assertEquals(25, resultRows.size());
+        }
     }
 
     protected void insertClobDb() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java?rev=889543&r1=889542&r2=889543&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryTest.java
Fri Dec 11 09:31:03 2009
@@ -67,7 +67,7 @@
         assertEquals(totalRows - 5, results.size());
         assertEquals("artist6", results.get(0).getArtistName());
     }
-    
+
     public void testDbEntityRoot() {
         ObjectContext context = createDataContext();
 
@@ -235,7 +235,7 @@
         assertNotNull(objects);
         assertEquals(_artistCount, objects.size());
     }
-    
+
     /** Test how "like ignore case" works when using lowercase parameter. */
     public void testSelectLikeIgnoreCaseObjects2() throws Exception {
         query.setRoot(Artist.class);
@@ -248,23 +248,22 @@
         assertNotNull(objects);
         assertEquals(_artistCount, objects.size());
     }
-    
+
     /** Test how "like ignore case" works when using uppercase parameter. */
     public void testSelectLikeIgnoreCaseClob() throws Exception {
-        
-        
-        query.setRoot(ClobTestEntity.class);
-        Expression qual = ExpressionFactory.likeIgnoreCaseExp("clobCol", "clob%");
-        query.setQualifier(qual);
-        performQuery();
-
-        // check query results
-        List objects = opObserver.rowsForQuery(query);
-        assertNotNull(objects);
-        assertEquals(_clobCount, objects.size());
+        if (accessStack.getAdapter(getNode()).supportsLobs()) {
+            query.setRoot(ClobTestEntity.class);
+            Expression qual = ExpressionFactory.likeIgnoreCaseExp("clobCol", "clob%");
+            query.setQualifier(qual);
+            performQuery();
+
+            // check query results
+            List objects = opObserver.rowsForQuery(query);
+            assertNotNull(objects);
+            assertEquals(_clobCount, objects.size());
+        }
     }
 
-
     public void testSelectIn() throws Exception {
         query.setRoot(Artist.class);
         Expression qual = Expression.fromString("artistName in ('artist1', 'artist2')");
@@ -515,28 +514,28 @@
         finally {
             conn.close();
         }
-        
-        String insertClob = "INSERT INTO CLOB_TEST (CLOB_TEST_ID, CLOB_COL) VALUES (?,?)";
-        Connection connection = getConnection();
 
-        try {
-            connection.setAutoCommit(false);
-
-          
-            PreparedStatement stmt = connection.prepareStatement(insertClob);
-            long dateBase = System.currentTimeMillis();
+        if (accessStack.getAdapter(getNode()).supportsLobs()) {
+            String insertClob = "INSERT INTO CLOB_TEST (CLOB_TEST_ID, CLOB_COL) VALUES (?,?)";
+            Connection connection = getConnection();
+
+            try {
+                connection.setAutoCommit(false);
+
+                PreparedStatement stmt = connection.prepareStatement(insertClob);
+
+                for (int i = 1; i <= _clobCount; i++) {
+                    stmt.setInt(1, i);
+                    stmt.setString(2, "clob" + i);
+                    stmt.executeUpdate();
+                }
 
-            for (int i = 1; i <= _clobCount; i++) {
-                stmt.setInt(1, i);
-                stmt.setString(2, "clob" + i);
-                stmt.executeUpdate();
+                stmt.close();
+                connection.commit();
+            }
+            finally {
+                connection.close();
             }
-
-            stmt.close();
-            connection.commit();
-        }
-        finally {
-            connection.close();
         }
     }
 }



Mime
View raw message