[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-torque-dev
Subject:    svn commit: r488235 -
From:       tfischer () apache ! org
Date:       2006-12-18 11:35:21
Message-ID: 20061218113521.2CA201A981A () eris ! apache ! org
[Download RAW message or body]

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



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic