brj 2005/05/07 13:04:47
Modified: src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
repository_junit_odmg.xml
src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
M2NTest.java
Log:
Added a second m:n relationship from Movie to Actor
Testcases fail because the actors show up in the wrong collection after
retrieval !!
Revision Changes Path
No revision
No revision
1.13.2.11 +18 -1 db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml
Index: repository_junit_odmg.xml
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml,v
retrieving revision 1.13.2.10
retrieving revision 1.13.2.11
diff -u -r1.13.2.10 -r1.13.2.11
--- repository_junit_odmg.xml 7 May 2005 16:02:57 -0000 1.13.2.10
+++ repository_junit_odmg.xml 7 May 2005 20:04:47 -0000 1.13.2.11
@@ -1202,6 +1202,23 @@
<fk-pointing-to-element-class column="ACTOR_ID"/>
<fk-pointing-to-element-class column="ACTOR_ID2"/>
</collection-descriptor>
+
+ <collection-descriptor
+ name="actors2"
+ element-class-ref="org.apache.ojb.broker.M2NTest$Actor"
+ indirection-table="M2N_TEST_ROLE_2"
+ proxy="false"
+ auto-retrieve="true"
+ auto-update="none"
+ auto-delete="none"
+ >
+ <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
+ <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
+ <fk-pointing-to-this-class column="MOVIE_ID_STR"/>
+ <fk-pointing-to-element-class column="ACTOR_ID"/>
+ <fk-pointing-to-element-class column="ACTOR_ID2"/>
+ </collection-descriptor>
+
</class-descriptor>
<class-descriptor
No revision
No revision
1.3.2.4 +33 -10 db-ojb/src/test/org/apache/ojb/odmg/M2NTest.java
Index: M2NTest.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/M2NTest.java,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -r1.3.2.3 -r1.3.2.4
--- M2NTest.java 7 May 2005 16:02:57 -0000 1.3.2.3
+++ M2NTest.java 7 May 2005 20:04:47 -0000 1.3.2.4
@@ -12,6 +12,9 @@
import org.apache.ojb.broker.ManageableCollection;
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.PersistenceBrokerException;
+import org.apache.ojb.broker.M2NTest.Actor;
+import org.apache.ojb.broker.M2NTest.Movie;
+import org.apache.ojb.broker.M2NTest.MovieImpl;
import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
import org.apache.ojb.broker.query.Criteria;
import org.apache.ojb.broker.query.Query;
@@ -200,15 +203,16 @@
Movie newMovie = (Movie) resultMovie.iterator().next();
assertNotNull(newMovie.getActors());
assertEquals(3, newMovie.getActors().size());
+ assertEquals(2, newMovie.getActors2().size());
OQLQuery queryActor = actorQuery(postfix);
Collection resultActor = (Collection) queryActor.execute();
- assertEquals(3, resultActor.size());
+ assertEquals(3 + 2, resultActor.size());
OQLQuery queryRole = roleQuery(null, movie);
Collection resultRole = (Collection) queryRole.execute();
assertEquals(3, resultRole.size());
- }
+ }
public void testStore_2() throws Exception
{
@@ -628,7 +632,8 @@
}
/**
- * Returns 1 movie object with 3 actor objects
+ * Returns 1 movie object with 3 actor objects in actors-collection
+ * and 2 actor objects in actors2-collection
*/
Movie buildMovieWithActors(String postfixId)
{
@@ -636,6 +641,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);
@@ -644,6 +650,14 @@
list.add(a2);
list.add(a3);
m.setActors(list);
+
+ Actor a4 = new Actor("Actor 2 A " + postfixId);
+ Actor a5 = new Actor("Actor 2 B " + postfixId);
+ ArrayList list2 = new ArrayList();
+ list2.add(a4);
+ list2.add(a5);
+ m.setActors2(list2);
+
return m;
}
@@ -703,6 +717,7 @@
void changeMovieCollectionDescriptorTo(boolean autoRetrieve, int
autoUpdate, int autoDelete, boolean proxy)
{
ojbChangeReferenceSetting(MovieImpl.class, "actors", autoRetrieve,
autoUpdate, autoDelete, proxy);
+ ojbChangeReferenceSetting(MovieImpl.class, "actors2", autoRetrieve,
autoUpdate, autoDelete, proxy);
}
@@ -862,27 +877,24 @@
public static interface Movie
{
public Collection getActors();
-
public void setActors(Collection actors);
- public Integer getIdInt2();
+ public Collection getActors2();
+ public void setActors2(Collection actors);
+ public Integer getIdInt2();
public Integer getIdInt();
public void setIdInt2(Integer id2Int);
-
public void setIdInt(Integer idInt);
public String getIdStr();
-
public void setIdStr(String idStr);
public String getTitle();
-
public void setTitle(String title);
public String getDescription();
-
public void setDescription(String description);
}
@@ -894,6 +906,7 @@
private String title;
private String description;
private Collection actors;
+ private Collection actors2;
public MovieImpl()
{
@@ -916,6 +929,16 @@
this.actors = actors;
}
+ public Collection getActors2()
+ {
+ return actors2;
+ }
+
+ public void setActors2(Collection actors)
+ {
+ this.actors2 = actors;
+ }
+
public Integer getIdInt()
{
return idInt;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]