arminw 2005/11/25 18:37:03
Modified: src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
M2NTest.java
Log:
add test
Revision Changes Path
No revision
No revision
1.7.2.11 +31 -7 db-ojb/src/test/org/apache/ojb/broker/M2NTest.java
Index: M2NTest.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NTest.java,v
retrieving revision 1.7.2.10
retrieving revision 1.7.2.11
diff -u -r1.7.2.10 -r1.7.2.11
--- M2NTest.java 13 Nov 2005 16:04:36 -0000 1.7.2.10
+++ M2NTest.java 26 Nov 2005 02:37:03 -0000 1.7.2.11
@@ -108,12 +108,12 @@
assertNull(new_p_1);
}
- public void testSimpleStore()
+ public void testSimpleStore_1()
{
ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT,
OBJECT, false);
ojbChangeReferenceSetting(MovieImpl.class, "actors2", true, OBJECT,
OBJECT, false);
ojbChangeReferenceSetting(Actor.class, "movies", true, OBJECT,
OBJECT, false);
- String postfix = "testSimple_" + System.currentTimeMillis();
+ String postfix = "testSimpleStore_1_" + System.currentTimeMillis();
Movie m = new MovieImpl(postfix, postfix, null);
Actor a = new Actor(postfix);
@@ -131,6 +131,30 @@
assertEquals(1, a.getMovies().size());
}
+ public void testSimpleStore_2()
+ {
+ ojbChangeReferenceSetting(MovieImpl.class, "actors", false, OBJECT,
OBJECT, false);
+ ojbChangeReferenceSetting(MovieImpl.class, "actors2", false, OBJECT,
OBJECT, false);
+ ojbChangeReferenceSetting(Actor.class, "movies", false, OBJECT,
OBJECT, false);
+ String postfix = "testSimpleStore_2_" + System.currentTimeMillis();
+ Movie m = new MovieImpl(postfix, postfix, null);
+ Actor a = new Actor(postfix);
+
+ broker.beginTransaction();
+ broker.store(m);
+ broker.store(a);
+
+ m.addActor(a);
+ broker.store(m);
+ broker.commitTransaction();
+
+ // needed, because autoretrieve is set false
+ broker.retrieveAllReferences(a);
+
+ assertNotNull(a.getMovies());
+ assertEquals(1, a.getMovies().size());
+ }
+
/**
* Test deprecated auto Settings
*/
@@ -918,7 +942,7 @@
/**
* movies with back-references
- * auto-update = OBJECT
+ * auto-update = OBJECT
*/
public void testStoreTTFT_2()
{
@@ -956,7 +980,7 @@
assertNotNull(readMovie);
assertEquals(3, readMovie.getActors().size());
}
-
+
public void testStoreUpdateTTFF()
{
ojbChangeReferenceSetting(MovieImpl.class, "actors", true, OBJECT,
NONE, false);
@@ -1237,7 +1261,7 @@
"Dr. Strangelove or: How I Learned to Stop Worrying and Love
the Bomb " + postfixId,
"An insane general starts a process to nuclear holocaust
that a war" +
" room of politicians and generals frantically try to stop.
" + postfixId);
-
+
Actor a1 = new Actor("Peter Sellers " + postfixId);
Actor a2 = new Actor("George C. Scott " + postfixId);
Actor a3 = new Actor("Sterling Hayden " + postfixId);
@@ -1837,4 +1861,4 @@
return ToStringBuilder.reflectionToString(this);
}
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]