db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1148411 - /db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
Date Tue, 19 Jul 2011 15:47:07 GMT
Author: tfischer
Date: Tue Jul 19 15:47:07 2011
New Revision: 1148411

URL: http://svn.apache.org/viewvc?rev=1148411&view=rev
Log:
subquery test: use IN clause also in subquery itself

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=1148411&r1=1148410&r2=1148411&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 Tue
Jul 19 15:47:07 2011
@@ -2026,7 +2026,10 @@ public class DataTest extends BaseRuntim
         {
             Criteria subquery = new Criteria();
             subquery.addSelectColumn(AuthorPeer.AUTHOR_ID);
-            subquery.add(AuthorPeer.NAME, author2.getName());
+            List<String> authorIds = new ArrayList<String>();
+            authorIds.add(author1.getName());
+            authorIds.add(author2.getName());
+            subquery.add(AuthorPeer.NAME, authorIds, Criteria.IN);
             Criteria criteria = new Criteria();
             criteria.add(AuthorPeer.AUTHOR_ID, subquery, Criteria.IN);
             criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);
@@ -2034,7 +2037,7 @@ public class DataTest extends BaseRuntim
             List<?> result = AuthorPeer.doSelect(criteria);
             assertEquals("Expected result of size 2 but got " + result.size(),
                     result.size(), 
-                    2);
+                    3);
             Author author = (Author) result.get(0);
             assertEquals("Expected author with Id " 
                     + author2b.getAuthorId() 
@@ -2049,6 +2052,13 @@ public class DataTest extends BaseRuntim
                     + author.getAuthorId(),
                     author2.getAuthorId(),
                     author.getAuthorId());
+            author = (Author) result.get(2);
+            assertEquals("Expected author with Id " 
+                    + author1.getAuthorId() 
+                    + " at second position but got "
+                    + author.getAuthorId(),
+                    author1.getAuthorId(),
+                    author.getAuthorId());
         }
         
         // subquery with =



---------------------------------------------------------------------
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