db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1848531 - /db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
Date Sun, 09 Dec 2018 16:31:16 GMT
Author: tv
Date: Sun Dec  9 16:31:16 2018
New Revision: 1848531

URL: http://svn.apache.org/viewvc?rev=1848531&view=rev
Log:
TORQUE-356: HSQLDB: Remove special handling for ignoreCaseInOrderBy(), Add native limit/offset-support

Modified:
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1848531&r1=1848530&r2=1848531&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Sun
Dec  9 16:31:16 2018
@@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.adapter.Adapter;
 import org.apache.torque.adapter.DerbyAdapter;
+import org.apache.torque.adapter.HsqldbAdapter;
 import org.apache.torque.adapter.MssqlAdapter;
 import org.apache.torque.adapter.MysqlAdapter;
 import org.apache.torque.criteria.Criteria;
@@ -164,8 +165,7 @@ public class DataTest extends BaseDataba
         crit.setLimit(10);
         crit.setOffset(5);
         List<Book> books = BookPeer.doSelect(crit);
-        assertTrue("List should have 10 books, not " + books.size(),
-                books.size() == 10);
+        assertEquals("List should have 10 books", 10, books.size());
         for (Book book : books)
         {
             String title = book.getTitle();
@@ -173,43 +173,26 @@ public class DataTest extends BaseDataba
                     titleSet.contains(title));
         }
 
+
         // Test limit of zero works
-        crit = new Criteria();
-        crit.setLimit(0);
-        try
+        if (defaultAdapter instanceof DerbyAdapter || defaultAdapter instanceof HsqldbAdapter)
         {
-            books = BookPeer.doSelect(crit);
-            assertTrue("List should have 0 books, not " + books.size(),
-                    books.size() == 0);
+            log.info("testLimitOffset(): "
+                    + "A limit of 0 is not supported for Derby or Hsqldb");
         }
-        catch (TorqueException e)
+        else
         {
-            if (defaultAdapter.supportsNativeLimit())
-            {
-                if (!(defaultAdapter instanceof DerbyAdapter))
-                {
-                    throw e;
-                }
-                else
-                {
-                    log.error("testLimitOffset(): "
-                            + "A limit of 0 is not supported for Derby");
-                }
-            }
-            else
-            {
-                log.error("testLimitOffset(): "
-                        + "A limit of 0 is not supported for Databases "
-                        + "without native limit support");
-            }
+            crit = new Criteria();
+            crit.setLimit(0);
+            books = BookPeer.doSelect(crit);
+            assertEquals("List should have 0 books", 0, books.size());
         }
 
         // check that Offset also works without limit
         crit = new Criteria();
         crit.setOffset(5);
         books = BookPeer.doSelect(crit);
-        assertTrue("List should have 95 books, not " + books.size(),
-                books.size() == 95);
+        assertEquals("List should have 95 books", 95, books.size());
 
         // Check that limiting also works if a table with an equal column name
         // is joined. This is problematic for oracle, see TORQUE-10.
@@ -218,8 +201,7 @@ public class DataTest extends BaseDataba
         crit.setLimit(10);
         crit.setOffset(5);
         books = BookPeer.doSelectJoinAuthor(crit);
-        assertTrue("List should have 10 books, not " + books.size(),
-                books.size() == 10);
+        assertEquals("List should have 10 books", 10, books.size());
     }
 
     /**
@@ -811,10 +793,10 @@ public class DataTest extends BaseDataba
         result = AuthorPeer.doSelect(criteria);
         assertTrue("Size of result is not 4, but " + result.size(),
                 result.size() == 4);
-        assertEquals(result.get(0).getName(), "AA");
-        assertEquals(result.get(1).getName(), "ab");
-        assertEquals(result.get(2).getName(), "ba");
-        assertEquals(result.get(3).getName(), "BB");
+        assertEquals("AA", result.get(0).getName());
+        assertEquals("ab", result.get(1).getName());
+        assertEquals("ba", result.get(2).getName());
+        assertEquals("BB", result.get(3).getName());
 
         // check ignoreCase in orderBy
         criteria = new Criteria();



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message