tfischer 2005/06/10 23:31:27
Modified: src/rttest/org/apache/torque DataTest.java
Log:
added the testcase testSingleRecords
changed the position of the exit point in testJoins for HSQLDB just before
the first right join
Revision Changes Path
1.25 +37 -9 db-torque/src/rttest/org/apache/torque/DataTest.java
Index: DataTest.java
===================================================================
RCS file: /home/cvs/db-torque/src/rttest/org/apache/torque/DataTest.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- DataTest.java 10 Jun 2005 06:02:07 -0000 1.24
+++ DataTest.java 11 Jun 2005 06:31:27 -0000 1.25
@@ -204,6 +204,34 @@
}
/**
+ * Checks whether the setSingleRecord() method in criteria works
+ */
+ public void testSingleRecord() throws Exception
+ {
+ Criteria criteria = new Criteria();
+ criteria.setSingleRecord(true);
+ criteria.setLimit(1);
+ criteria.setOffset(5);
+ List books = BookPeer.doSelect(criteria);
+ assertTrue("List should have 1 books, not " + books.size(),
+ books.size() == 1);
+
+ criteria.clear();
+ criteria.setSingleRecord(true);
+ criteria.setLimit(2);
+ try
+ {
+ books = BookPeer.doSelect(criteria);
+ fail("doSelect should have failed "
+ + "because two records were selected "
+ + " and one was expected");
+ }
+ catch (TorqueException e)
+ {
+ }
+ }
+
+ /**
* tests whether null values can be processed successfully by datadump
* For this, a row containing null values is inserted here,
* the actual test is done later
@@ -424,13 +452,6 @@
*/
public void testJoins() throws Exception
{
- if (Torque.getDB(Torque.getDefaultDB()) instanceof DBHypersonicSQL)
- {
- log.error("testJoins(): Right joins are not supported by
HSQLDB");
- // failing is "expected", so exit without error
- return;
- }
-
cleanBookstore();
// insert test data
@@ -491,7 +512,14 @@
+ authorList.size()
+ ", should be 4");
}
-
+
+ if (Torque.getDB(Torque.getDefaultDB()) instanceof DBHypersonicSQL)
+ {
+ log.error("testJoins(): Right joins are not supported by
HSQLDB");
+ // failing is "expected", so exit without error
+ return;
+ }
+
// test right join
criteria = new Criteria();
criteria.addJoin(
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]