arminw 2005/10/29 02:15:06
Modified: src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
CircularTest.java
Log:
fix test
Revision Changes Path
No revision
No revision
1.1.2.7 +5 -95 db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java
Index: CircularTest.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- CircularTest.java 22 Aug 2005 15:34:50 -0000 1.1.2.6
+++ CircularTest.java 29 Oct 2005 09:15:06 -0000 1.1.2.7
@@ -604,98 +604,10 @@
}
/**
- * This test fails!! The ordering isn't able to handle this without
causing
- * a key constraint violation.
- */
- public void testCircularOneToOne_1c() throws Exception
- {
- String name = "testCircularOneToOne_1c_" +
System.currentTimeMillis();
-
- TransactionExt tx = (TransactionExt) odmg.newTransaction();
- tx.begin();
-
- ObjectA a = new ObjectA(name + "_ObjectA");
- ObjectAA aa = new ObjectAA(name + "_ObjectAA");
- ObjectAAA aaa = new ObjectAAA(name + "_ObjectAAA");
- ObjectAAAA aaaa = new ObjectAAAA(name + "_ObjectAAAA");
- // now set the circular references
- a.setRefAA(aa);
- aa.setRefAAA(aaa);
- aaa.setRefAAAA(aaaa);
- aaaa.setRefA(a);
- // use any object to store the whole graph
- //database.makePersistent(aaaa);
- //database.makePersistent(aaa);
- database.makePersistent(aaa);
- //database.makePersistent(a);
- tx.commit();
-
- tx.begin();
- OQLQuery query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- Collection result = (Collection) query.execute();
- assertEquals(1, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(1, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(1, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAAAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(1, result.size());
- tx.commit();
-
- tx.begin();
- // we specify the objects to delete in the correct order
- database.deletePersistent(a);
- database.deletePersistent(aa);
- database.deletePersistent(aaa);
- database.deletePersistent(aaaa);
- tx.commit();
-
- tx.begin();
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(0, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(0, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(0, result.size());
-
- query = odmg.newOQLQuery();
- query.create("select objects from " + ObjectAAAA.class.getName() + "
where name like $1");
- query.bind(name + "%");
- result = (Collection) query.execute();
- assertEquals(0, result.size());
- tx.commit();
- }
-
- /**
* Do manually ordering using [EMAIL PROTECTED]
TransactionExt#setOrdering(boolean)} to disable
* OJB's ordering algorithm (and implicit locking).
*/
- public void testCircularOneToOne_1d() throws Exception
+ public void testCircularOneToOne_1c() throws Exception
{
String name = "testCircularOneToOne_1d_" +
System.currentTimeMillis();
@@ -753,7 +665,7 @@
tx.begin();
/*
- the ordering/implicit locking of the tx is still disabled,
+ the ordering/implicit locking of the tx is still disabled (tx
instance hasn't changed),
so we have to take care of correct order of objects while deletion
*/
database.deletePersistent(a);
@@ -812,9 +724,8 @@
/*
we manually determine the insert object order
*/
- tx.setOrdering(true);
- tx.setImplicitLocking(true);
- tx.setNoteUserOrder(true);
+ tx.setOrdering(false);
+ tx.setImplicitLocking(false);
database.makePersistent(aaaa);
database.makePersistent(aaa);
@@ -1738,7 +1649,6 @@
database.deletePersistent(newShop);
database.makePersistent(newShop);
tx.flush();
-
query = odmg.newOQLQuery();
query.create("select shops from " + Shop.class.getName() + " where
name like $1");
query.bind(name);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]