You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ma...@apache.org on 2003/08/20 22:52:02 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/otm SwizzleTests.java
mattbaird 2003/08/20 13:52:02
Modified: src/test/org/apache/ojb/otm SwizzleTests.java
Log:
new swizzle test. Fails now, solution to come soon.
Revision Changes Path
1.11 +40 -0 db-ojb/src/test/org/apache/ojb/otm/SwizzleTests.java
Index: SwizzleTests.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/SwizzleTests.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SwizzleTests.java 13 Jul 2003 14:08:14 -0000 1.10
+++ SwizzleTests.java 20 Aug 2003 20:52:02 -0000 1.11
@@ -89,6 +89,46 @@
assertTrue("contract object should have a RelatedToContract instance attached", ((Effectiveness) retval).getVersion().getContract().getRelatedToContract() != null);
}
+ public void testSwizzle3() throws TransactionException, LockingException, PBFactoryException, PersistenceBrokerException
+ {
+ clearTestData();
+ TestClassA a = generateTestData();
+ Transaction tx = _kit.getTransaction(_conn);
+ tx.begin();
+ _conn.makePersistent(a.getB());
+ _conn.makePersistent(a);
+ TestClassB b = a.getB();
+ tx.commit();
+ /**
+ * clear to start test
+ */
+ _conn.invalidateAll();
+ tx = _kit.getTransaction(_conn);
+ tx.begin();
+ /**
+ * load B
+ */
+ Identity oidb = _conn.getIdentity(b);
+ TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(oidb);
+ assertTrue(b1 != null);
+ /**
+ * load A
+ */
+ Identity oida = _conn.getIdentity(a);
+ TestClassA a1 = (TestClassA) _conn.getObjectByIdentity(oida);
+
+ /**
+ * B, as navigated from A, should be the same as B gotten directly.
+ */
+ assertTrue(a1.getB().equals(b1));
+ tx.commit();
+
+ /**
+ * clear
+ */
+ clearTestData();
+ }
+
private void createTestData() throws TransactionException, LockingException
{
for (int i = 0; i < COUNT; i++)
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org