db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r432281 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java
Date Thu, 17 Aug 2006 16:22:02 GMT
Author: arminw
Date: Thu Aug 17 09:22:00 2006
New Revision: 432281

URL: http://svn.apache.org/viewvc?rev=432281&view=rev
Log:
add test to check deprecated PK assignment of transient objects on Identity creation (before
the object is written to DB)

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java?rev=432281&r1=432280&r2=432281&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/AutoIncrementTest.java
Thu Aug 17 09:22:00 2006
@@ -18,6 +18,28 @@
         junit.textui.TestRunner.main(arr);
     }
 
+    /**
+     * add test to check deprecated PK assignment of transient objects
+     * on Identity creation (before the object is written to DB)
+     */
+    public void testBackwardCompatibilityIdentityCreation()
+    {
+        IncrementObject obj_1 = new IncrementObject();
+        IncrementObject obj_2 = new IncrementObject();
+        broker.beginTransaction();
+        broker.store(obj_1);
+        broker.store(obj_2);
+        broker.commitTransaction();
+
+        int lastId = obj_2.getIntId();
+        IncrementObject obj_3 = new IncrementObject();
+
+        assertTrue(lastId > obj_3.getIntId());
+        // force assigment of PK fields
+        Identity oid_3 = new Identity(obj_3, broker);
+        assertTrue(lastId < obj_3.getIntId());
+    }
+
     public void testAutoIncrement()
     {
         IncrementObject obj_1 = new IncrementObject();



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


Mime
View raw message