db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r386309 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java
Date Thu, 16 Mar 2006 11:23:40 GMT
Author: arminw
Date: Thu Mar 16 03:23:37 2006
New Revision: 386309

URL: http://svn.apache.org/viewcvs?rev=386309&view=rev
Log:
fix test

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java?rev=386309&r1=386308&r2=386309&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/CircularTest.java Thu Mar
16 03:23:37 2006
@@ -24,6 +24,7 @@
 import org.apache.ojb.broker.metadata.ClassDescriptor;
 import org.apache.ojb.broker.Identity;
 import org.apache.ojb.junit.ODMGTestCase;
+import org.apache.commons.lang.builder.EqualsBuilder;
 import org.odmg.OQLQuery;
 import org.odmg.Transaction;
 
@@ -120,13 +121,16 @@
         tx.begin();
         // to make this test more transparent disable implicit locking
         tx.setImplicitLocking(false);
+        // get the object to move
+        ShopDetail sd = s1.getDetail();
         // create new Shop
         Shop s2 = new Shop(name + "_2");
         // now lock all relevant objects
         tx.lock(s2, Transaction.WRITE);
         tx.lock(s1, Transaction.WRITE);
-        tx.lock(s1.getDetail(), Transaction.WRITE);
-        s2.setDetail(s1.getDetail());
+        tx.lock(sd, Transaction.WRITE);
+        s2.setDetail(sd);
+        sd.setShop(s2);
         s1.setDetail(null);
         database.deletePersistent(s1);
         tx.commit();
@@ -146,6 +150,8 @@
         assertNotNull(s2_);
         assertNotNull(s2_.getDetail());
         assertEquals(sd_new.getId(), s2_.getDetail().getId());
+        assertNotNull(s2_.getDetail().getShop());
+        assertEquals(s2_, s2_.getDetail().getShop());
     }
 
     /**
@@ -2067,6 +2073,19 @@
             }
             this.distributors.add(d);
         }
+
+        public boolean equals(Object obj)
+        {
+            if(obj instanceof Shop)
+            {
+                Shop tmp = (Shop) obj;
+                return new EqualsBuilder().append(id, tmp.id).append(name, tmp.name).isEquals();
+            }
+            else
+            {
+                return this == obj;
+            }
+        }
     }
 
     public static class Distributor
@@ -2255,6 +2274,19 @@
         public void setShop(Shop shop)
         {
             this.shop = shop;
+        }
+
+        public boolean equals(Object obj)
+        {
+            if(obj instanceof ShopDetail)
+            {
+                ShopDetail tmp = (ShopDetail) obj;
+                return new EqualsBuilder().append(id, tmp.id).append(name, tmp.name).isEquals();
+            }
+            else
+            {
+                return this == obj;
+            }
         }
     }
 



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