tfischer 2005/03/26 09:38:40 Modified: src/rttest bookstore-schema.xml src/rttest/org/apache/torque DataTest.java Log: Added a test case to chekct whether large primary keys are inserted and read correctly. This check is related to TQRS245 Revision Changes Path 1.17 +21 -1 db-torque/src/rttest/bookstore-schema.xml Index: bookstore-schema.xml =================================================================== RCS file: /home/cvs/db-torque/src/rttest/bookstore-schema.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- bookstore-schema.xml 31 Jan 2005 19:43:59 -0000 1.16 +++ bookstore-schema.xml 26 Mar 2005 17:38:39 -0000 1.17 @@ -255,7 +255,7 @@ name="DATE_TEST_ID" required="true" primaryKey="true" - type="INTEGER" + type="BIGINT" /> <column name="DATE_VALUE" @@ -275,4 +275,24 @@ </table> + <!-- =================================================== --> + <!-- L A R G E _ P K T A B L E --> + <!-- =================================================== --> + + <table name="LARGE_PK" idMethod="none" description="Table to test large Primary keys"> + <column + name="LARGE_PK_ID" + required="true" + primaryKey="true" + type="BIGINT" + /> + <column + name="NAME" + type="VARCHAR" + size="100" + required="false" + /> + </table> + + </database> 1.14 +34 -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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- DataTest.java 19 Mar 2005 06:25:27 -0000 1.13 +++ DataTest.java 26 Mar 2005 17:38:39 -0000 1.14 @@ -25,15 +25,17 @@ import java.util.Map; import org.apache.torque.om.StringKey; +import org.apache.torque.test.A; import org.apache.torque.test.Author; import org.apache.torque.test.AuthorPeer; import org.apache.torque.test.Book; import org.apache.torque.test.BookPeer; import org.apache.torque.test.BooleanCheck; import org.apache.torque.test.BooleanCheckPeer; -import org.apache.torque.test.A; import org.apache.torque.test.DateTest; import org.apache.torque.test.DateTestPeer; +import org.apache.torque.test.LargePk; +import org.apache.torque.test.LargePkPeer; import org.apache.torque.test.MultiPk; import org.apache.torque.test.MultiPkPeer; import org.apache.torque.test.NullValueTable; @@ -870,6 +872,36 @@ } /** + * tests whether large primary keys are inserted and read correctly + */ + public void testLargePk() throws Exception + { + // clean Date table + Criteria criteria = new Criteria(); + criteria.add( + LargePkPeer.LARGE_PK_ID, + (Long) null, + Criteria.NOT_EQUAL); + LargePkPeer.doDelete(criteria); + + long longId = 8771507845873286l; + LargePk largePk = new LargePk(); + largePk.setLargePkId(longId); + largePk.setName("testLargePk"); + largePk.save(); + + List largePkList = LargePkPeer.doSelect(new Criteria()); + LargePk readLargePk = (LargePk) largePkList.get(0); + assertTrue("the inserted Id, " + largePk.getLargePkId() + + " , and the read id, " + readLargePk.getLargePkId() + + " , should be equal", + readLargePk.getLargePkId() == largePk.getLargePkId()); + assertTrue("the inserted Id, " + largePk.getLargePkId() + + " , should be equal to " + longId, + longId == largePk.getLargePkId()); + } + + /** * Deletes all authors and books in the bookstore tables */ protected void cleanBookstore() @@ -1005,5 +1037,4 @@ fullyQualifiedColumnName.length()); return result; } - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]