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 br...@apache.org on 2003/06/21 15:25:35 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/broker PersistenceBrokerTest.java
brj 2003/06/21 06:25:34
Modified: src/test/org/apache/ojb/broker PersistenceBrokerTest.java
Log:
new testcase for update references to proxies
Revision Changes Path
1.25 +33 -0 db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
Index: PersistenceBrokerTest.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- PersistenceBrokerTest.java 8 Apr 2003 16:52:49 -0000 1.24
+++ PersistenceBrokerTest.java 21 Jun 2003 13:25:34 -0000 1.25
@@ -1147,4 +1147,37 @@
b = readArticleByIdentity(testId);
assertEquals("should be equal after update", newname, b.getArticleName());
}
+
+ /**
+ * test if reference to Proxy is updated
+ * @throws Exception
+ */
+ public void testUpdateReferencedProxy() throws Exception
+ {
+ int id = 11;
+
+ deleteArticle(testId);
+ Article a = readArticleByIdentity(id);
+ InterfaceProductGroup pga = a.getProductGroup();
+ Article b = createArticle(testId);
+ b.setProductGroup(pga);
+ storeArticle(b);
+
+ broker.clearCache();
+ b = readArticleByIdentity(testId);
+ InterfaceProductGroup pgb = b.getProductGroup();
+ assertEquals("should be equal after update", pga.getId(), pgb.getId());
+
+ // clear ProductGroup
+ // this one fails because
+ // fld.getPersistentField().set(obj, null) has a problem with primitives
+ /*
+ b.setProductGroup(null);
+ storeArticle(b);
+
+ broker.clearCache();
+ b = readArticleByIdentity(testId);
+ assertEquals("should be null after update", null, b.getProductGroup());
+ */
+ }
}