db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker M2NTest.java
Date Sat, 20 Nov 2004 09:28:14 GMT
brj         2004/11/20 01:28:14

  Modified:    src/test/org/apache/ojb/broker M2NTest.java
  Log:
  auto-update = OBJECT for bidirectional m:n-relationship
  
  Revision  Changes    Path
  1.14      +41 -2     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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- M2NTest.java	24 Oct 2004 15:36:15 -0000	1.13
  +++ M2NTest.java	20 Nov 2004 09:28:14 -0000	1.14
  @@ -18,7 +18,7 @@
   import java.util.Iterator;
   import java.util.List;
   
  -/**
  +/** 
    * Test (non-decomposed) M:N relations.
    *
    * IMPORTANT NOTE: The global runtime metadata changes made by this test case
  @@ -752,6 +752,45 @@
           assertEquals(3, readMovie.getActors().size());
       }
   
  +    /**
  +     * movies with back-references
  +     * auto-update = OBJECT 
  +     */
  +    public void testStoreTTFT_2()
  +    {
  +        changeMovieCollectionDescriptorTo(true, OBJECT, NONE, true);
  +        changeActorCollectionDescriptorTo(true, OBJECT, NONE, false);
  +        doTestStoreTTXX_2();
  +    }
  +
  +    public void doTestStoreTTXX_2()
  +    {
  +        String postfix = "" + System.currentTimeMillis();
  +        Movie movie = buildMovieWithActorsAndBackReferences(postfix);
  +
  +        broker.beginTransaction();
  +        broker.store(movie);
  +        broker.commitTransaction();
  +
  +        Query queryMovie = movieQuery(postfix);
  +        Collection resultMovie = broker.getCollectionByQuery(queryMovie);
  +        assertEquals(3, resultMovie.size());
  +
  +        Query queryActor = actorQuery(postfix);
  +        Collection resultActor = broker.getCollectionByQuery(queryActor);
  +        assertEquals(3, resultActor.size());
  +
  +        Query queryRole = roleQuery(null, movie);
  +        Collection resultRole = broker.getCollectionByQuery(queryRole);
  +        assertEquals(3, resultRole.size());
  +
  +        broker.clearCache();
  +        Identity oid = new Identity(movie, broker);
  +        Movie readMovie = (Movie) broker.getObjectByIdentity(oid);
  +        assertNotNull(readMovie);
  +        assertEquals(3, readMovie.getActors().size());
  +    }
  +    
       public void testStoreUpdateTTFF()
       {
           changeMovieCollectionDescriptorTo(true, OBJECT, NONE, false);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message