tfischer 2005/06/26 03:46:48
Modified: src/rttest/org/apache/torque DataTest.java
Log:
Added a Testcase for XPeer.DoSelectJoinY and another one for invoking
Torque.shutdown()
Revision Changes Path
1.26 +44 -3 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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- DataTest.java 11 Jun 2005 06:31:27 -0000 1.25
+++ DataTest.java 26 Jun 2005 10:46:48 -0000 1.26
@@ -580,6 +580,26 @@
+ ", should be 11");
}
}
+
+
+ /**
+ * Test joins using the XPeer.DoSelectJoinYYY methods
+ * @throws Exception if the Test fails
+ */
+ public void testDoSelectJoinY() throws Exception
+ {
+ // using the test data from testJoins()
+ Criteria criteria = new Criteria();
+ criteria.addAscendingOrderByColumn(BookPeer.TITLE);
+ List books = MyBookPeer.doSelectJoinAuthor(criteria);
+ assertTrue("books should contain 4 books but contains "
+ + books.size(), books.size() == 4);
+ Book bookTwo = (Book) books.get(1);
+ Book bookThree = (Book) books.get(2);
+ assertTrue ("the authors of BookTwo and BookThree"
+ + " should point to the same instance",
+ bookTwo.getAuthor() == bookThree.getAuthor());
+ }
/**
* test the order by, especially in joins and with aliases
@@ -1101,8 +1121,16 @@
assertTrue("read and written clobs should be equal",
clobTest.getClobValue().equals(readClobTest.getClobValue()));
}
-
-
+
+ /**
+ * Tests whether shutdown complains about anything
+ * @throws TorqueException if shutdown does not exit cleanly
+ */
+ public void testShutdown() throws TorqueException
+ {
+ Torque.shutdown();
+ }
+
/**
* Deletes all authors and books in the bookstore tables
* @throws Exception if the bookstore could not be cleaned
@@ -1140,4 +1168,17 @@
fullyQualifiedColumnName.length());
return result;
}
+
+
+ /**
+ * Subclass of BookPeer to make the doSelectJoinAuthors() visible
+ */
+ static class MyBookPeer extends BookPeer
+ {
+ public static List doSelectJoinAuthor(Criteria criteria)
+ throws TorqueException
+ {
+ return BookPeer.doSelectJoinAuthor(criteria);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]