|
svn commit: r488235 - /db/torque/test/trunk/test-project/src/java/org/apach: msg#00072jakarta.turbine.torque.devel
Author: tfischer Date: Mon Dec 18 03:35:20 2006 New Revision: 488235 URL: http://svn.apache.org/viewvc?view=rev&rev=488235 Log: Added a check to the dataTest in the test project whether updating an object with a primary key works. Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java?view=diff&rev=488235&r1=488234&r2=488235 ============================================================================== --- db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java (original) +++ db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java Mon Dec 18 03:35:20 2006 @@ -607,6 +607,51 @@ } /** + * Test whether an update works and whether it only affects the + * specified record. + * @throws Exception if anything in the test goes wrong. + */ + public void testUpdate() throws Exception + { + cleanBookstore(); + + Author otherAuthor = new Author(); + otherAuthor.setName("OtherName"); + otherAuthor.save(); + + Author author = new Author(); + author.setName("Name"); + author.save(); + + Criteria criteria = new Criteria(); + criteria.addAscendingOrderByColumn(AuthorPeer.NAME); + + List authors = AuthorPeer.doSelect(criteria); + assertEquals("List should contain 2 authors", 2, authors.size()); + assertEquals("First Author's name should be \"Name\"", + "Name", + ((Author) authors.get(0)).getName()); + assertEquals("Second Author's name should be \"OtherName\"", + "OtherName", + ((Author) authors.get(1)).getName()); + + author.setName("NewName"); + author.save(); + + criteria.clear(); + criteria.addAscendingOrderByColumn(AuthorPeer.NAME); + + authors = AuthorPeer.doSelect(criteria); + assertEquals("List should contain 2 authors", 2, authors.size()); + assertEquals("First Author's name should be \"NewName\"", + "NewName", + ((Author) authors.get(0)).getName()); + assertEquals("Second Author's name should be \"OtherName\"", + "OtherName", + ((Author) authors.get(1)).getName()); + } + + /** * test special cases in the select clause * @throws Exception if the test fails */ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [jira] Commented: (TORQUE-68) DatabaseMap remains empty if Torque is stopped and restarted, causes NPEs: 00072, Thomas Vandahl (JIRA) |
|---|---|
| Next by Date: | [jira] Commented: (TORQUE-69) Record.save() may not work if there is no primary key but no error is thrown.: 00072, Thomas Fischer (JIRA) |
| Previous by Thread: | [jira] Commented: (TORQUE-68) DatabaseMap remains empty if Torque is stopped and restarted, causes NPEsi: 00072, Thomas Fischer (JIRA) |
| Next by Thread: | [jira] Commented: (TORQUE-69) Record.save() may not work if there is no primary key but no error is thrown.: 00072, Thomas Fischer (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |