svn commit: r589568 - in /db/ojb/branches/OJB_1_0_RELEASE/src: schema/ test/org/apache/ojb/ test/org/apache/ojb/broker/ test/org/apache/ojb/odmg/

[email protected] Mon, 29 Oct 2007 10:11:58 -0000
Newsgroups gmane.comp.jakarta.ojb.devel
Message-ID <[email protected]>
Author: arminw
Date: Mon Oct 29 03:11:56 2007
New Revision: 589568

URL: http://svn.apache.org/viewvc?rev=589568&view=rev
Log:
update, add tests

Added:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/BrokerInjectOdmgTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/Sample.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_sample.xml
      - copied, changed from r562306, db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_pagination.xml
Removed:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_pagination.xml
Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/AllTests.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToOneWithoutFKTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/ObjectImageTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_meta_seq.xml

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/schema/ojbtest-schema.xml Mon Oct 29 03:11:56 2007
@@ -1945,7 +1945,7 @@
 	</table>
 
 
-    <table name="PAGE_BOOK">
+    <table name="SAMPLE_BOOK">
         <column
            name="ID_"
            type="INTEGER"
@@ -1967,12 +1967,12 @@
         <column
            name="FK_PUBLISHER"
            type="INTEGER"/>
-        <foreign-key foreignTable="PAGE_PUBLISHER">
+        <foreign-key foreignTable="SAMPLE_PUBLISHER">
                 <reference local="FK_PUBLISHER" foreign="ID_"/>
         </foreign-key>
     </table>
 
-    <table name="PAGE_PUBLICATION">
+    <table name="SAMPLE_PUBLICATION">
         <column
            name="BOOK_ID"
            type="INTEGER"
@@ -1983,15 +1983,15 @@
            type="INTEGER"
            primaryKey="true"
            required="true"/>
-        <foreign-key foreignTable="PAGE_BOOK">
+        <foreign-key foreignTable="SAMPLE_BOOK">
                 <reference local="BOOK_ID" foreign="ID_"/>
         </foreign-key>
-        <foreign-key foreignTable="PAGE_AUTHOR">
+        <foreign-key foreignTable="SAMPLE_AUTHOR">
                 <reference local="AUTHOR_ID" foreign="ID_"/>
         </foreign-key>
     </table>
 
-    <table name="PAGE_PUBLISHER">
+    <table name="SAMPLE_PUBLISHER">
         <column
            name="ID_"
            type="INTEGER"
@@ -2006,7 +2006,7 @@
            type="INTEGER"/>
     </table>
 
-    <table name="PAGE_AUTHOR">
+    <table name="SAMPLE_AUTHOR">
         <column
            name="ID_"
            type="INTEGER"
@@ -2022,12 +2022,12 @@
         <column
            name="FK_PUBLISHER"
            type="INTEGER"/>
-        <foreign-key foreignTable="PAGE_PUBLISHER">
+        <foreign-key foreignTable="SAMPLE_PUBLISHER">
                 <reference local="FK_PUBLISHER" foreign="ID_"/>
         </foreign-key>
     </table>
 
-    <table name="PAGE_REVIEW">
+    <table name="SAMPLE_REVIEW">
         <column
            name="ID_"
            type="INTEGER"
@@ -2049,10 +2049,10 @@
         <column
            name="FK_BOOK"
            type="INTEGER"/>
-        <foreign-key foreignTable="PAGE_AUTHOR">
+        <foreign-key foreignTable="SAMPLE_AUTHOR">
                 <reference local="FK_AUTHOR" foreign="ID_"/>
         </foreign-key>
-        <foreign-key foreignTable="PAGE_BOOK">
+        <foreign-key foreignTable="SAMPLE_BOOK">
                 <reference local="FK_BOOK" foreign="ID_"/>
         </foreign-key>
     </table>

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/AllTests.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/AllTests.java?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/AllTests.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/AllTests.java Mon Oct 29 03:11:56 2007
@@ -138,6 +138,7 @@
         suite.addTestSuite(DatabaseIdentityMaxDBTest.class);
         suite.addTestSuite(SeqManMultiHsqlTest.class);
         suite.addTestSuite(FunctionTest.class);
+        suite.addTestSuite(BrokerInjectOdmgTest.class);
 
         // BRJ: ensure shutdown of hsqldb
         suite.addTestSuite(HsqldbShutdown.class);

Added: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/BrokerInjectOdmgTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/BrokerInjectOdmgTest.java?rev=589568&view=auto
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/BrokerInjectOdmgTest.java (added)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/BrokerInjectOdmgTest.java Mon Oct 29 03:11:56 2007
@@ -0,0 +1,291 @@
+package org.apache.ojb.broker;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.ojb.broker.query.Query;
+import org.apache.ojb.broker.query.QueryFactory;
+import org.apache.ojb.broker.util.ObjectModification;
+import org.apache.ojb.junit.PBTestCase;
+import org.apache.ojb.odmg.ImplementationExt;
+import org.apache.ojb.odmg.OJB;
+import org.apache.ojb.odmg.DatabaseImpl;
+import org.odmg.Transaction;
+import org.odmg.Database;
+
+/**
+ * This class tests the use of the ODMG-api within the PB-api.
+ *
+ * @version $Id$
+ */
+public class BrokerInjectOdmgTest extends PBTestCase
+{
+    // Entry point to the ODMG-api
+    ImplementationExt odmg;
+
+    public void testGetTransaction_1() throws Exception
+    {
+        Transaction tx = odmg.newTransaction(broker, false);
+        // Lookup the current database instance
+        Database db = odmg.getDatabase(null);
+        tx.begin();
+        // ....
+        tx.commit();
+    }
+
+    public void testGetTransaction_2() throws Exception
+    {
+        // Associate mock access connection
+        ((DatabaseImpl) odmg.newDatabase()).open(new PBKey("test_1234", "test", "test"));
+        try
+        {
+            Transaction tx = odmg.newTransaction(broker, false);
+            fail("Expect an exception about wrong database");
+        }
+        catch(Exception e)
+        {
+            // we expect a runtime exception
+        }
+    }
+
+    public void testInsertDelete_1()
+    {
+        String name = ojbTestMethodIdentifier();
+        Sample.Book book = new Sample.Book(name, null, null);
+
+        Transaction tx = odmg.newTransaction(broker, false);
+        // Lookup the current database instance
+        Database db = odmg.getDatabase(null);
+        // start the odmg-tx
+        tx.begin();
+        // make the object persistent
+        db.makePersistent(book);
+        // commit the odmg-tx
+        tx.commit();
+
+        Query q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addEqualTo("title", name));
+        List books = new ArrayList(broker.getCollectionByQuery(q));
+        assertEquals(1, books.size());
+
+        tx = odmg.newTransaction(broker, false);
+        // Lookup the current database instance
+        db = odmg.getDatabase(null);
+        // start the odmg-tx
+        tx.begin();
+        // delete the object
+        db.deletePersistent(book);
+        // commit the odmg-tx
+        tx.commit();
+
+        books = new ArrayList(broker.getCollectionByQuery(q));
+        assertEquals(0, books.size());
+    }
+
+    public void testPerpareData()
+    {
+        String appendix = ojbTestMethodIdentifier();
+        insertTestData(appendix);
+        deleteTestData(appendix);
+    }
+
+    public void testInsertDelete_2()
+    {
+        String appendix = ojbTestMethodIdentifier();
+        insertTestData(appendix);
+
+        Query q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        List books = new ArrayList(broker.getCollectionByQuery(q));
+        assertNotNull(books);
+        assertEquals(1, books.size());
+        Sample.Book book = (Sample.Book) books.get(0);
+        assertNotNull(book.getPublisher());
+        Sample.Publisher publisher = book.getPublisher();
+        assertEquals("publisher" + appendix, publisher.getName());
+        List publisherAuthors = publisher.getAuthors();
+        assertEquals(4, publisherAuthors.size());
+        for(int i = 0; i < publisherAuthors.size(); i++)
+        {
+            Sample.Author author = (Sample.Author) publisherAuthors.get(i);
+            assertNotNull(author);
+            assertEquals(publisher.getId(), author.getPublisher().getId());
+        }
+        Sample.Author publisherAuthor = (Sample.Author) publisherAuthors.get(0);
+        assertEquals("a_author_book"+appendix, publisherAuthor.getName());
+        assertNotNull(publisherAuthor.getPublisher());
+        assertEquals(publisher.getId(), publisherAuthor.getPublisher().getId());
+        List publisherBooks = publisher.getBooks();
+        assertEquals(1, publisherBooks.size());
+        Sample.Book publisherBook = (Sample.Book) publisherBooks.get(0);
+        assertEquals(book.getId(), publisherBook.getId());
+        List reviews = book.getReviews();
+        assertEquals(3, reviews.size());
+        for(int i = 0; i < reviews.size(); i++)
+        {
+            Sample.Review r = (Sample.Review) reviews.get(i);
+            assertEquals(i + "_review" + appendix, r.getSummary());
+            assertNotNull(r.getAuthor());
+            assertTrue(r.getAuthor().getName().endsWith("review_author" +appendix));
+        }
+
+        broker.clearCache();
+        q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        books = new ArrayList(broker.getCollectionByQuery(q));
+        assertNotNull(books);
+        assertEquals(1, books.size());
+        book = (Sample.Book) books.get(0);
+        assertNotNull(book.getPublisher());
+        publisher = book.getPublisher();
+        assertEquals("publisher" + appendix, publisher.getName());
+        publisherAuthors = publisher.getAuthors();
+        assertEquals(4, publisherAuthors.size());
+        for(int i = 0; i < publisherAuthors.size(); i++)
+        {
+            Sample.Author author = (Sample.Author) publisherAuthors.get(i);
+            assertNotNull(author);
+            assertEquals(publisher.getId(), author.getPublisher().getId());
+        }
+        publisherAuthor = (Sample.Author) publisherAuthors.get(0);
+        assertTrue(publisherAuthor.getName().endsWith("author_book"+appendix));
+        assertNotNull(publisherAuthor.getPublisher());
+        assertEquals("a_author_book" + appendix, publisherAuthor.getName());
+        assertEquals(publisher.getId(), publisherAuthor.getPublisher().getId());
+        publisherBooks = publisher.getBooks();
+        assertEquals(1, publisherBooks.size());
+        publisherBook = (Sample.Book) publisherBooks.get(0);
+        assertEquals(book.getId(), publisherBook.getId());
+        reviews = book.getReviews();
+        assertEquals(3, reviews.size());
+        for(int i = 0; i < reviews.size(); i++)
+        {
+            Sample.Review r = (Sample.Review) reviews.get(i);
+            assertEquals(i + "_review" + appendix, r.getSummary());
+            assertNotNull(r.getAuthor());
+            assertTrue(r.getAuthor().getName().endsWith("review_author" + appendix));
+        }
+
+        deleteTestData(appendix);
+
+        q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        List result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Publisher.class, new Criteria().addLike("name", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Author.class, new Criteria().addLike("name", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Review.class, new Criteria().addLike("summary", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+    }
+
+    void insertTestData(String appendix)
+    {
+        Sample.Book book = new Sample.Book("book" + appendix, new Date(1), null);
+        Sample.Author a1 = new Sample.Author("a_author_book" + appendix, null);
+        Sample.Author a2 = new Sample.Author("b_author_book" + appendix, null);
+        Sample.Author a3 = new Sample.Author("c_author_book" + appendix, null);
+        Sample.Author a4 = new Sample.Author("d_author_book" + appendix, null);
+        Sample.Publisher publisher = new Sample.PublisherImpl("publisher" + appendix);
+
+        publisher.addAuthor(a1);
+        publisher.addAuthor(a2);
+        publisher.addAuthor(a3);
+        publisher.addAuthor(a4);
+        a1.setPublisher(publisher);
+        a2.setPublisher(publisher);
+        a3.setPublisher(publisher);
+        a4.setPublisher(publisher);
+
+        for(int i=0; i<3; i++)
+        {
+            Sample.Review rev = new Sample.Review(i+ "_review"  + appendix, new Integer(10 * i));
+            rev.setAuthor(new Sample.Author(i + "_review_author" + appendix, null));
+            rev.setBook(book);
+            book.addReview(rev);
+        }
+        a1.addBook(book);
+        book.addAuthor(a1);
+        book.setPublisher(publisher);
+        publisher.addBook(book);
+
+        // now inject the broker instance into the ODMG-api
+        Transaction tx = odmg.newTransaction(broker, false);
+        tx.begin();
+        // first lock the object
+        tx.lock(book, Transaction.WRITE);
+        // it's a circular object graph, so insert the plain main object first
+        // and then update it with all references
+//        tx.checkpoint();
+
+        tx.commit();
+    }
+
+    private void deleteTestData(String appendix)
+    {
+        broker.serviceConnectionManager().setBatchMode(false);
+        Query q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        List books = new ArrayList(broker.getCollectionByQuery(q));
+
+        // now inject the broker instance into the ODMG-api
+        Transaction tx = odmg.newTransaction(broker, false);
+        // Lookup the current database instance
+        Database db = odmg.getDatabase(null);
+        tx.begin();
+        for(int i = 0; i < books.size(); i++)
+        {
+            Sample.Book b = (Sample.Book) books.get(i);
+            db.deletePersistent(b);
+        }
+        tx.commit();
+    }
+
+
+
+
+    public static void main(String[] args)
+    {
+        String[] arr = {BrokerInjectOdmgTest.class.getName()};
+        junit.textui.TestRunner.main(arr);
+    }
+
+    public BrokerInjectOdmgTest(String name)
+    {
+        super(name);
+    }
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        odmg = OJB.getInstance();
+    }
+
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+}

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java Mon Oct 29 03:11:56 2007
@@ -10,6 +10,7 @@
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
+import org.apache.ojb.broker.metadata.CollectionDescriptor;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.query.QueryFactory;
@@ -222,32 +223,42 @@
 
     public void testDeleteProxyCollection() throws Exception
     {
-        String name = "testDeleteProxyCollection_"+System.currentTimeMillis();
-        Gatherer gat = new Gatherer(null, name);
-        CollectibleB[] cols = prepareCollectibleB(name);
-
-        gat.setCollectiblesB(Arrays.asList(cols));
-        broker.beginTransaction();
-        broker.store(gat);
-        broker.commitTransaction();
-
-        broker.clearCache();
-        broker.beginTransaction();
-        Criteria crit1 = new Criteria();
-        crit1.addLike("name", name);
-        Query q1 = QueryFactory.newQuery(Gatherer.class, crit1);
-        Gatherer newGat1 = (Gatherer)broker.getObjectByQuery(q1);
-        newGat1.getCollectiblesB().clear();
-        broker.store(newGat1);			// should delete CollectibleBs
-        broker.commitTransaction();
-
-        broker.clearCache();
-        Criteria crit2 = new Criteria();
-        crit2.addLike("name", name);
-        Query q2 = QueryFactory.newQuery(Gatherer.class, crit2);
-        Gatherer newGat2 = (Gatherer)broker.getObjectByQuery(q2);
-        int size = newGat2.getCollectiblesB().size();
-        assertEquals(0, size);
+        String name = ojbTestMethodIdentifier();
+        CollectionDescriptor cod = broker.getClassDescriptor(Gatherer.class)
+                .getCollectionDescriptorByName("collectiblesB");
+        Class oldCollectionClass = cod.getCollectionClass();
+        try
+        {
+            cod.setCollectionClass(RemovalAwareList.class);
+            
+            Gatherer gat = new Gatherer(null, name);
+            CollectibleB[] cols = prepareCollectibleB(name);
+
+            gat.setCollectiblesB(Arrays.asList(cols));
+            broker.beginTransaction();
+            broker.store(gat);
+            broker.commitTransaction();
+
+            broker.clearCache();
+            broker.beginTransaction();
+            Criteria crit1 = new Criteria().addLike("name", name);
+            Query q1 = QueryFactory.newQuery(Gatherer.class, crit1);
+            Gatherer newGat1 = (Gatherer)broker.getObjectByQuery(q1);
+            newGat1.getCollectiblesB().clear();
+            broker.store(newGat1);			// should delete CollectibleBs
+            broker.commitTransaction();
+
+            broker.clearCache();
+            Criteria crit2 = new Criteria().addLike("name", name);
+            Query q2 = QueryFactory.newQuery(Gatherer.class, crit2);
+            Gatherer newGat2 = (Gatherer)broker.getObjectByQuery(q2);
+            int size = newGat2.getCollectiblesB().size();
+            assertEquals(0, size);
+        }
+        finally
+        {
+            cod.setCollectionClass(oldCollectionClass);
+        }
     }
 
     public void testStoreReadOfUserDefinedCollectionClass()
@@ -934,59 +945,70 @@
      */
     public void testRemovalAwareCollection()
     {
-        String prefix = "testRemovalAwareCollection_" + System.currentTimeMillis();
-
-        Identity gathererId;
-        Gatherer loadedCopy;
-        Gatherer gatherer = new Gatherer(null, "Gatherer_" + prefix);
-        List coll = new ArrayList();
-        coll.add(new CollectibleBase("Base_1_" + prefix));
-        coll.add(new CollectibleBase("Base_2_" + prefix));
-        coll.add(new CollectibleBase("Base_3_" + prefix));
-        gatherer.setCollectiblesBase(coll);
-
-        broker.beginTransaction();
-        broker.store(gatherer);
-        broker.commitTransaction();
-        assertTrue(gatherer.getGatId() != null);
-        gathererId = broker.serviceIdentity().buildIdentity(gatherer);
-
-        broker.clearCache();
-        loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getCollectiblesBase());
-        assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
-        assertEquals(3, loadedCopy.getCollectiblesBase().size());
-
-        //
-        // Remove a single element
-        //
-        broker.beginTransaction();
-        loadedCopy.getCollectiblesBase().remove(2);
-        broker.store(loadedCopy);
-        broker.commitTransaction();
-
-        broker.clearCache();
-        loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getCollectiblesBase());
-        assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
-        assertEquals(2, loadedCopy.getCollectiblesBase().size());
-
-        //
-        // Remove all elements
-        //
-        broker.beginTransaction();
-        loadedCopy.getCollectiblesBase().clear();
-        broker.store(loadedCopy);
-        broker.commitTransaction();
+        String prefix = ojbTestMethodIdentifier();
+        CollectionDescriptor cod = broker.getClassDescriptor(Gatherer.class)
+                .getCollectionDescriptorByName("collectiblesBase");
+        Class oldCollectionClass = cod.getCollectionClass();
+        try
+        {
+            cod.setCollectionClass(RemovalAwareList.class);
 
-        broker.clearCache();
-        loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getCollectiblesBase());
-        assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
-        assertEquals(0, loadedCopy.getCollectiblesBase().size());
+            Identity gathererId;
+            Gatherer loadedCopy;
+            Gatherer gatherer = new Gatherer(null, "Gatherer_" + prefix);
+            List coll = new ArrayList();
+            coll.add(new CollectibleBase("Base_1_" + prefix));
+            coll.add(new CollectibleBase("Base_2_" + prefix));
+            coll.add(new CollectibleBase("Base_3_" + prefix));
+            gatherer.setCollectiblesBase(coll);
+
+            broker.beginTransaction();
+            broker.store(gatherer);
+            broker.commitTransaction();
+            assertTrue(gatherer.getGatId() != null);
+            gathererId = broker.serviceIdentity().buildIdentity(gatherer);
+
+            broker.clearCache();
+            loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getCollectiblesBase());
+            assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
+            assertEquals(3, loadedCopy.getCollectiblesBase().size());
+
+            //
+            // Remove a single element
+            //
+            broker.beginTransaction();
+            loadedCopy.getCollectiblesBase().remove(2);
+            broker.store(loadedCopy);
+            broker.commitTransaction();
+
+            broker.clearCache();
+            loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getCollectiblesBase());
+            assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
+            assertEquals(2, loadedCopy.getCollectiblesBase().size());
+
+            //
+            // Remove all elements
+            //
+            broker.beginTransaction();
+            loadedCopy.getCollectiblesBase().clear();
+            broker.store(loadedCopy);
+            broker.commitTransaction();
+
+            broker.clearCache();
+            loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getCollectiblesBase());
+            assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
+            assertEquals(0, loadedCopy.getCollectiblesBase().size());
+        }
+        finally
+        {
+            cod.setCollectionClass(oldCollectionClass);
+        }
     }
 
     /**
@@ -994,37 +1016,47 @@
      */
     public void testRemovalAwareCollection2()
     {
-        String prefix = "testRemovalAwareCollection2_" + System.currentTimeMillis();
-
-        Identity gathererId;
-        Gatherer loadedCopy;
-        Gatherer gatherer = new Gatherer(null, "Gatherer_" + prefix);
-        List coll = new ArrayList();
-        coll.add(new CollectibleBase("Base_1_" + prefix));
-        coll.add(new CollectibleBase("Base_2_" + prefix));
-        gatherer.setCollectiblesBase(coll);
-
-        broker.beginTransaction();
-        broker.store(gatherer);
-        broker.commitTransaction();
-        assertTrue(gatherer.getGatId() != null);
-        gathererId = broker.serviceIdentity().buildIdentity(gatherer);
-
-        broker.clearCache();
-        loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getCollectiblesBase());
-        assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
-        assertEquals(2, loadedCopy.getCollectiblesBase().size());
-
-        // add and remove non persistent obj
-        loadedCopy.getCollectiblesBase().add(new CollectibleBase("Base_3_" + prefix));
-        assertEquals(3, loadedCopy.getCollectiblesBase().size());
-        loadedCopy.getCollectiblesBase().remove(2);
-
-        broker.beginTransaction();
-        broker.store(loadedCopy);
-        broker.commitTransaction();
+        String prefix = ojbTestMethodIdentifier();
+        CollectionDescriptor cod = broker.getClassDescriptor(Gatherer.class)
+                .getCollectionDescriptorByName("collectiblesBase");
+        Class oldCollectionClass = cod.getCollectionClass();
+        try
+        {
+            cod.setCollectionClass(RemovalAwareList.class);
+            Identity gathererId;
+            Gatherer loadedCopy;
+            Gatherer gatherer = new Gatherer(null, "Gatherer_" + prefix);
+            List coll = new ArrayList();
+            coll.add(new CollectibleBase("Base_1_" + prefix));
+            coll.add(new CollectibleBase("Base_2_" + prefix));
+            gatherer.setCollectiblesBase(coll);
+
+            broker.beginTransaction();
+            broker.store(gatherer);
+            broker.commitTransaction();
+            assertTrue(gatherer.getGatId() != null);
+            gathererId = broker.serviceIdentity().buildIdentity(gatherer);
+
+            broker.clearCache();
+            loadedCopy = (Gatherer) broker.getObjectByIdentity(gathererId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getCollectiblesBase());
+            assertTrue(loadedCopy.getCollectiblesBase() instanceof RemovalAwareList);
+            assertEquals(2, loadedCopy.getCollectiblesBase().size());
+
+            // add and remove non persistent obj
+            loadedCopy.getCollectiblesBase().add(new CollectibleBase("Base_3_" + prefix));
+            assertEquals(3, loadedCopy.getCollectiblesBase().size());
+            loadedCopy.getCollectiblesBase().remove(2);
+
+            broker.beginTransaction();
+            broker.store(loadedCopy);
+            broker.commitTransaction();
+        }
+        finally
+        {
+            cod.setCollectionClass(oldCollectionClass);
+        }
     }
 
     /**
@@ -1032,64 +1064,75 @@
      */
     public void testRemovalAwareCollectionProxy()
     {
-        String prefix = "testRemovalAwareCollectionProxy_" + System.currentTimeMillis();
-
-        Identity pgId;
-        ProductGroup loadedCopy;
-        InterfaceArticle article;
-        ProductGroup pg = new ProductGroup(null, "PG_" + prefix, null);
-        article = new Article();
-        article.setArticleName("Art_1_" + prefix);
-        pg.add(article);
-        article = new Article();
-        article.setArticleName("Art_2_" + prefix);
-        pg.add(article);
-        article = new Article();
-        article.setArticleName("Art_3_" + prefix);
-        pg.add(article);
-
-        broker.beginTransaction();
-        broker.store(pg);
-        broker.commitTransaction();
-        assertTrue(pg.getGroupId() != null);
-        pgId = broker.serviceIdentity().buildIdentity(pg);
-
-        broker.clearCache();
-        loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getAllArticlesInGroup());
-        assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
-        assertEquals(3, loadedCopy.getAllArticlesInGroup().size());
-
-        //
-        // Remove a single element
-        //
-        broker.beginTransaction();
-        loadedCopy.getAllArticlesInGroup().remove(2);
-        broker.store(loadedCopy);
-        broker.commitTransaction();
-
-        broker.clearCache();
-        loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getAllArticlesInGroup());
-        assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
-        assertEquals(2, loadedCopy.getAllArticlesInGroup().size());
-
-        //
-        // Remove all elements
-        //
-        broker.beginTransaction();
-        loadedCopy.getAllArticlesInGroup().clear();
-        broker.store(loadedCopy);
-        broker.commitTransaction();
+        String prefix = ojbTestMethodIdentifier();
+        CollectionDescriptor cod = broker.getClassDescriptor(ProductGroup.class)
+                .getCollectionDescriptorByName("allArticlesInGroup");
+        Class oldCollectionClass = cod.getCollectionClass();
+        try
+        {
+            cod.setCollectionClass(RemovalAwareList.class);
 
-        broker.clearCache();
-        loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
-        assertNotNull(loadedCopy);
-        assertNotNull(loadedCopy.getAllArticlesInGroup());
-        assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
-        assertEquals(0, loadedCopy.getAllArticlesInGroup().size());
+            Identity pgId;
+            ProductGroup loadedCopy;
+            InterfaceArticle article;
+            ProductGroup pg = new ProductGroup(null, "PG_" + prefix, null);
+            article = new Article();
+            article.setArticleName("Art_1_" + prefix);
+            pg.add(article);
+            article = new Article();
+            article.setArticleName("Art_2_" + prefix);
+            pg.add(article);
+            article = new Article();
+            article.setArticleName("Art_3_" + prefix);
+            pg.add(article);
+
+            broker.beginTransaction();
+            broker.store(pg);
+            broker.commitTransaction();
+            assertTrue(pg.getGroupId() != null);
+            pgId = broker.serviceIdentity().buildIdentity(pg);
+
+            broker.clearCache();
+            loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getAllArticlesInGroup());
+            assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
+            assertEquals(3, loadedCopy.getAllArticlesInGroup().size());
+
+            //
+            // Remove a single element
+            //
+            broker.beginTransaction();
+            loadedCopy.getAllArticlesInGroup().remove(2);
+            broker.store(loadedCopy);
+            broker.commitTransaction();
+
+            broker.clearCache();
+            loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getAllArticlesInGroup());
+            assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
+            assertEquals(2, loadedCopy.getAllArticlesInGroup().size());
+
+            //
+            // Remove all elements
+            //
+            broker.beginTransaction();
+            loadedCopy.getAllArticlesInGroup().clear();
+            broker.store(loadedCopy);
+            broker.commitTransaction();
+
+            broker.clearCache();
+            loadedCopy = (ProductGroup) broker.getObjectByIdentity(pgId);
+            assertNotNull(loadedCopy);
+            assertNotNull(loadedCopy.getAllArticlesInGroup());
+            assertTrue(loadedCopy.getAllArticlesInGroup() instanceof RemovalAwareList);
+            assertEquals(0, loadedCopy.getAllArticlesInGroup().size());
+        }
+        finally
+        {
+            cod.setCollectionClass(oldCollectionClass);
+        }
     }
 
     //************************************************************

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToOneWithoutFKTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToOneWithoutFKTest.java?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToOneWithoutFKTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToOneWithoutFKTest.java Mon Oct 29 03:11:56 2007
@@ -168,6 +168,8 @@
         pers_new.setPassport(null);
         broker.store(pers_new);
         broker.commitTransaction();
+        // clear cache to garantee new instance
+        broker.clearCache();
         pers_new = (Person) broker.getObjectByIdentity(oid);
         assertNotNull(pers_new);
         // we alway get a proxy placeholder object

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java Mon Oct 29 03:11:56 2007
@@ -20,8 +20,6 @@
  */
 
 
-import java.lang.Object;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
 import java.util.ArrayList;
@@ -38,9 +36,6 @@
 import org.apache.ojb.broker.accesslayer.RsIterator;
 import org.apache.ojb.broker.accesslayer.ChainingIterator;
 import org.apache.ojb.broker.accesslayer.PagingIterator;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
 import org.apache.commons.lang.ClassUtils;
 
 /**
@@ -69,58 +64,166 @@
         super.tearDown();
     }
 
+    public void testPerpareData()
+    {
+        String appendix = ojbTestMethodIdentifier();
+        insertTestData(appendix);
+        deleteTestData(appendix);
+    }
+
+    public void testInsertDelete()
+    {
+        String appendix = ojbTestMethodIdentifier();
+        insertTestData(appendix);
+
+        Query q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        List books = new ArrayList(broker.getCollectionByQuery(q));
+        assertNotNull(books);
+        assertEquals(1, books.size());
+        Sample.Book book = (Sample.Book) books.get(0);
+        assertNotNull(book.getPublisher());
+        Sample.Publisher publisher = book.getPublisher();
+        assertEquals("publisher" + appendix, publisher.getName());
+        List publisherAuthors = publisher.getAuthors();
+        assertEquals(4, publisherAuthors.size());
+        for(int i = 0; i < publisherAuthors.size(); i++)
+        {
+            Sample.Author author = (Sample.Author) publisherAuthors.get(i);
+            assertNotNull(author);
+            assertEquals(publisher.getId(), author.getPublisher().getId());
+        }
+        Sample.Author publisherAuthor = (Sample.Author) publisherAuthors.get(0);
+        assertEquals("a_author_book"+appendix, publisherAuthor.getName());
+        assertNotNull(publisherAuthor.getPublisher());
+        assertEquals(publisher.getId(), publisherAuthor.getPublisher().getId());
+        List publisherBooks = publisher.getBooks();
+        assertEquals(1, publisherBooks.size());
+        Sample.Book publisherBook = (Sample.Book) publisherBooks.get(0);
+        assertEquals(book.getId(), publisherBook.getId());
+        List reviews = book.getReviews();
+        assertEquals(10, reviews.size());
+        for(int i = 0; i < reviews.size(); i++)
+        {
+            Sample.Review r = (Sample.Review) reviews.get(i);
+            assertEquals(i + "_review" + appendix, r.getSummary());
+            assertNotNull(r.getAuthor());
+            assertTrue(r.getAuthor().getName().endsWith("review_author" +appendix));
+        }
+
+        broker.clearCache();
+        q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        books = new ArrayList(broker.getCollectionByQuery(q));
+        assertNotNull(books);
+        assertEquals(1, books.size());
+        book = (Sample.Book) books.get(0);
+        assertNotNull(book.getPublisher());
+        publisher = book.getPublisher();
+        assertEquals("publisher" + appendix, publisher.getName());
+        publisherAuthors = publisher.getAuthors();
+        assertEquals(4, publisherAuthors.size());
+        for(int i = 0; i < publisherAuthors.size(); i++)
+        {
+            Sample.Author author = (Sample.Author) publisherAuthors.get(i);
+            assertNotNull(author);
+            assertEquals(publisher.getId(), author.getPublisher().getId());
+        }
+        publisherAuthor = (Sample.Author) publisherAuthors.get(0);
+        assertTrue(publisherAuthor.getName().endsWith("author_book"+appendix));
+        assertNotNull(publisherAuthor.getPublisher());
+        assertEquals("a_author_book" + appendix, publisherAuthor.getName());
+        assertEquals(publisher.getId(), publisherAuthor.getPublisher().getId());
+        publisherBooks = publisher.getBooks();
+        assertEquals(1, publisherBooks.size());
+        publisherBook = (Sample.Book) publisherBooks.get(0);
+        assertEquals(book.getId(), publisherBook.getId());
+        reviews = book.getReviews();
+        assertEquals(10, reviews.size());
+        for(int i = 0; i < reviews.size(); i++)
+        {
+            Sample.Review r = (Sample.Review) reviews.get(i);
+            assertEquals(i + "_review" + appendix, r.getSummary());
+            assertNotNull(r.getAuthor());
+            assertTrue(r.getAuthor().getName().endsWith("review_author" + appendix));
+        }
+
+        deleteTestData(appendix);
+
+        q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
+        List result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Publisher.class, new Criteria().addLike("name", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Author.class, new Criteria().addLike("name", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+
+        q = QueryFactory.newQuery(Sample.Review.class, new Criteria().addLike("summary", "%"+appendix));
+        result = new ArrayList(broker.getCollectionByQuery(q));
+        assertTrue(result.isEmpty());
+    }
+
     private void insertTestData(String appendix)
     {
-        Book b1 = new Book("book_1" + appendix, new Date(1), null);
-        Author a1 = new Author("author_1" + appendix, null);
-        Author a2 = new Author("author_2" + appendix, null);
-        Author a3 = new Author("author_3" + appendix, null);
-        Author a4 = new Author("author_4" + appendix, null);
-        Review r = new Review("review" + appendix, new Integer(30));
-        Publisher p = new PublisherImpl("publisher" + appendix);
-
-        p.addAuthor(a1);
-        p.addAuthor(a2);
-        p.addAuthor(a3);
-        p.addAuthor(a4);
-        a1.setPublisher(p);
-        a2.setPublisher(p);
-        a3.setPublisher(p);
-        a4.setPublisher(p);
+        Sample.Book book = new Sample.Book("book" + appendix, new Date(1), null);
+        Sample.Author a1 = new Sample.Author("a_author_book" + appendix, null);
+        Sample.Author a2 = new Sample.Author("b_author_book" + appendix, null);
+        Sample.Author a3 = new Sample.Author("c_author_book" + appendix, null);
+        Sample.Author a4 = new Sample.Author("d_author_book" + appendix, null);
+        Sample.Publisher publisher = new Sample.PublisherImpl("publisher" + appendix);
+
+        publisher.addAuthor(a1);
+        publisher.addAuthor(a2);
+        publisher.addAuthor(a3);
+        publisher.addAuthor(a4);
+        a1.setPublisher(publisher);
+        a2.setPublisher(publisher);
+        a3.setPublisher(publisher);
+        a4.setPublisher(publisher);
 
-        List reviews = new ArrayList();
         for(int i=0; i<10; i++)
         {
-            Review rev = new Review("review_" + i  + appendix, new Integer(10 * i));
-            rev.setAuthor(new Author("review_author" + i + appendix, null));
-            rev.setBook(b1);
-            reviews.add(rev);
-        }
-        b1.setReviews(reviews);
-        a1.addBook(b1);
-        b1.addAuthor(a1);
-        b1.setPublisher(p);
+            Sample.Review rev = new Sample.Review(i+ "_review"  + appendix, new Integer(10 * i));
+            rev.setAuthor(new Sample.Author(i + "_review_author" + appendix, null));
+            rev.setBook(book);
+            book.addReview(rev);
+        }
+        a1.addBook(book);
+        book.addAuthor(a1);
+        book.setPublisher(publisher);
+        publisher.addBook(book);
 
         broker.beginTransaction();
         // it's a circular object graph, so insert the plain start object first
         // and then update it with all references
-        broker.store(b1, ObjectModification.INSERT, true);
+        broker.store(book, ObjectModification.INSERT, true);
         broker.serviceConnectionManager().executeBatch();
-        broker.store(b1);
+        broker.store(book);
         broker.commitTransaction();
-
     }
 
     private void deleteTestData(String appendix)
     {
         broker.serviceConnectionManager().setBatchMode(false);
         broker.beginTransaction();
-        Query q = QueryFactory.newQuery(Book.class, new Criteria().addLike("title", "%"+appendix));
+        Query q = QueryFactory.newQuery(Sample.Book.class, new Criteria().addLike("title", "%"+appendix));
         List books = new ArrayList(broker.getCollectionByQuery(q));
         for(int i = 0; i < books.size(); i++)
         {
-            Object o =  books.get(i);
-            broker.delete(o);
+            Sample.Book b = (Sample.Book) books.get(i);
+            Sample.Publisher p = b.getPublisher();
+//            b.setPublisher(null);
+//            // break circular object graph first
+//            broker.store(p, ObjectModification.UPDATE);
+            b.setPublisher(null);
+            broker.store(b, ObjectModification.UPDATE);
+            broker.delete(b);
+            if(p != null) 
+            {
+                broker.delete(p);
+            }
         }
         broker.commitTransaction();
     }
@@ -170,7 +273,7 @@
         Criteria crit = new Criteria()
                         .addGreaterOrEqualThan("vote", new Integer(10))
                         .addLike("book.title", "%"+appendix);
-        QueryByCriteria query = QueryFactory.newQuery(Review.class, crit);
+        QueryByCriteria query = QueryFactory.newQuery(Sample.Review.class, crit);
         // NOTE: If pagination/limit is used it's strongly recommended to order by
         // a unique column to avoid problems with different result order
         // ('vote' isn't unique, thus add PK field)
@@ -187,14 +290,14 @@
         assertEquals(9, result.size());
         for(Iterator iterator = result.iterator(); iterator.hasNext();)
         {
-            Review r =  (Review) iterator.next();
+            Sample.Review r =  (Sample.Review) iterator.next();
             assertTrue(r.getVote().intValue() >= 10);
             assertNotNull(r.getBook());
             assertTrue(r.getBook().getTitle().endsWith(appendix));
         }
 
         // now start the real work: perform LIMIT query
-        query = QueryFactory.newQuery(Review.class, crit);
+        query = QueryFactory.newQuery(Sample.Review.class, crit);
         // NOTE: If pagination/limit is used it's strongly recommended to order by
         // a unique column to avoid problems with different result order
         // ('vote' isn't unique, thus add PK field)
@@ -212,7 +315,7 @@
         assertEquals(expectedSize, result.size());
         for(Iterator iterator = result.iterator(); iterator.hasNext();)
         {
-            Review r =  (Review) iterator.next();
+            Sample.Review r =  (Sample.Review) iterator.next();
             assertTrue(r.getVote().intValue() >= 10);
             assertTrue(r.getVote().intValue() <= voteLessOrEqual);
             assertNotNull(r.getBook());
@@ -358,7 +461,7 @@
         Criteria crit = new Criteria()
                         .addGreaterOrEqualThan("vote", new Integer(10))
                         .addLike("book.title", "%"+appendix);
-        QueryByCriteria query = QueryFactory.newQuery(Review.class, crit);
+        QueryByCriteria query = QueryFactory.newQuery(Sample.Review.class, crit);
         // NOTE: If pagination/limit is used it's strongly recommended to order by
         // a unique column to avoid problems with different result order
         // ('vote' isn't unique, thus add PK field)
@@ -375,14 +478,14 @@
         assertEquals(9, result.size());
         for(Iterator iterator = result.iterator(); iterator.hasNext();)
         {
-            Review r =  (Review) iterator.next();
+            Sample.Review r =  (Sample.Review) iterator.next();
             assertTrue(r.getVote().intValue() >= 10);
             assertNotNull(r.getBook());
             assertTrue(r.getBook().getTitle().endsWith(appendix));
         }
 
         // now start the real work: perform LIMIT query
-        query = QueryFactory.newQuery(Review.class, crit);
+        query = QueryFactory.newQuery(Sample.Review.class, crit);
         // NOTE: If pagination/limit is used it's strongly recommended to order by
         // a unique column to avoid problems with different result order
         // ('vote' isn't unique, thus add PK field)
@@ -400,7 +503,7 @@
         assertEquals(expectedSize, result.size());
         for(Iterator iterator = result.iterator(); iterator.hasNext();)
         {
-            Review r =  (Review) iterator.next();
+            Sample.Review r =  (Sample.Review) iterator.next();
             // we skip the first one thus we expect 60
             assertTrue("Expected Review.vote >=" + voteGreaterEquals + " but get: "
                     + r.getVote().intValue(), r.getVote().intValue() >= voteGreaterEquals);
@@ -953,464 +1056,4 @@
         a.setUnit("bottle");
         return a;
     }
-
-
-
-
-    //=======================================================
-    // inner test classes
-    //=======================================================
-    /*
-    NOTE: Take care of endless loops when change override toString method!!!!
-    */
-    public static class Book implements Serializable
-    {
-        private Integer id;
-        private String title;
-        private Date publicationDate;
-        private byte[] cover;
-        private Integer version;
-        private Integer fkPublisher;
-
-        private List authors;
-        private List reviews;
-        private Publisher publisher;
-
-        public Book()
-        {
-        }
-
-        public Book(String title, Date publicationDate, byte[] cover)
-        {
-            this.title = title;
-            this.publicationDate = publicationDate;
-            this.cover = cover;
-        }
-
-        public String toString()
-        {
-            return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                    .append("id", id)
-                    .append("title", title)
-                    .append("publicationDate", publicationDate)
-                    .append("version", version)
-                    .append("fkPublisher", fkPublisher)
-                    .append("cover", cover)
-                    .append("authors.size", authors != null ? authors.size() : 0)
-                    .append("reviews.size", reviews != null ? reviews.size() : 0)
-                    .append("publisher", publisher)
-                    .toString();
-        }
-
-        public void addAuthor(Author author)
-        {
-            if(authors == null)
-            {
-                authors = new ArrayList();
-            }
-            authors.add(author);
-        }
-
-        public void addReview(Review review)
-        {
-            if(reviews == null)
-            {
-                reviews = new ArrayList();
-            }
-            reviews.add(review);
-        }
-
-        public boolean removeReview(Review review)
-        {
-            if(reviews != null) return reviews.remove(review);
-            else return false;
-        }
-
-        public Integer getId()
-        {
-            return id;
-        }
-
-        public void setId(Integer id)
-        {
-            this.id = id;
-        }
-
-        public String getTitle()
-        {
-            return title;
-        }
-
-        public void setTitle(String title)
-        {
-            this.title = title;
-        }
-
-        public Date getPublicationDate()
-        {
-            return publicationDate;
-        }
-
-        public void setPublicationDate(Date publicationDate)
-        {
-            this.publicationDate = publicationDate;
-        }
-
-        public byte[] getCover()
-        {
-            return cover;
-        }
-
-        public void setCover(byte[] cover)
-        {
-            this.cover = cover;
-        }
-
-        public Integer getVersion()
-        {
-            return version;
-        }
-
-        public void setVersion(Integer version)
-        {
-            this.version = version;
-        }
-
-        public List getAuthors()
-        {
-            return authors;
-        }
-
-        public void setAuthors(List authors)
-        {
-            this.authors = authors;
-        }
-
-        public List getReviews()
-        {
-            return reviews;
-        }
-
-        public void setReviews(List reviews)
-        {
-            this.reviews = reviews;
-        }
-
-        public Publisher getPublisher()
-        {
-            return publisher;
-        }
-
-        public void setPublisher(Publisher publisher)
-        {
-            this.publisher = publisher;
-        }
-    }
-
-    public static class Author implements Serializable
-    {
-        private Integer id;
-        private String name;
-        private List books;
-        private Integer version;
-        private Publisher publisher;
-        private Integer fkPublisher;
-
-        public Author()
-        {
-        }
-
-        public Author(String name, List books)
-        {
-            this.name = name;
-            this.books = books;
-        }
-
-        public void addBook(Book book)
-        {
-            if(books == null)
-            {
-                books = new ArrayList();
-            }
-            books.add(book);
-        }
-
-        public Integer getId()
-        {
-            return id;
-        }
-
-        public void setId(Integer id)
-        {
-            this.id = id;
-        }
-
-        public String getName()
-        {
-            return name;
-        }
-
-        public void setName(String name)
-        {
-            this.name = name;
-        }
-
-        public Integer getVersion()
-        {
-            return version;
-        }
-
-        public void setVersion(Integer version)
-        {
-            this.version = version;
-        }
-
-        public List getBooks()
-        {
-            return books;
-        }
-
-        public void setBooks(List books)
-        {
-            this.books = books;
-        }
-
-        public Publisher getPublisher()
-        {
-            return publisher;
-        }
-
-        public void setPublisher(Publisher publisher)
-        {
-            this.publisher = publisher;
-        }
-    }
-
-    public static interface Publisher extends Serializable
-    {
-        public Integer getId();
-        public void setId(Integer id);
-        public String getName();
-        public void setName(String name);
-        public Integer getVersion();
-        public void setVersion(Integer version);
-        public List getAuthors();
-        public void setAuthors(List authors);
-        public void addAuthor(Author author);
-        public List getBooks();
-        public void setBooks(List books);
-        public void addBook(Book book);
-    }
-
-    public static class PublisherImpl implements Publisher
-    {
-        private Integer id;
-        private String name;
-        private Integer version;
-        private List authors;
-        private List books;
-
-        public PublisherImpl()
-        {
-        }
-
-        public PublisherImpl(String name)
-        {
-            this.name = name;
-        }
-
-        public Integer getId()
-        {
-            return id;
-        }
-
-        public void setId(Integer id)
-        {
-            this.id = id;
-        }
-
-        public String getName()
-        {
-            return name;
-        }
-
-        public void setName(String name)
-        {
-            this.name = name;
-        }
-
-        public Integer getVersion()
-        {
-            return version;
-        }
-
-        public void setVersion(Integer version)
-        {
-            this.version = version;
-        }
-
-        public List getAuthors()
-        {
-            return authors;
-        }
-
-        public void setAuthors(List authors)
-        {
-            this.authors = authors;
-        }
-
-        public void addAuthor(Author author)
-        {
-            if(authors == null)
-            {
-                authors = new ArrayList();
-            }
-            if(! authors.contains(author)) authors.add(author);
-        }
-
-        public List getBooks()
-        {
-            return books;
-        }
-
-        public void setBooks(List books)
-        {
-            this.books = books;
-        }
-
-        public void addBook(Book book)
-        {
-            if(books == null)
-            {
-                books = new ArrayList();
-            }
-            if(! books.contains(book)) books.add(book);
-        }
-    }
-
-    public static class Review implements Serializable
-    {
-        private Integer id;
-        private Integer vote;
-        private String summary;
-        private Integer fkBook;
-        private Integer version;
-        private Author author;
-        private Book book;
-
-        public Review()
-        {
-        }
-
-        public Review(String summary, Integer vote, Book book)
-        {
-            this.summary = summary;
-            this.vote = vote;
-            this.book = book;
-        }
-
-        public Review(String summary, Integer vote)
-        {
-            this.summary = summary;
-            this.vote = vote;
-        }
-
-        public Review(String summary)
-        {
-            this.summary = summary;
-        }
-
-        public Integer getId()
-        {
-            return id;
-        }
-
-        public Integer getVote()
-        {
-            return vote;
-        }
-
-        public void setVote(Integer vote)
-        {
-            this.vote = vote;
-        }
-
-        public void setId(Integer id)
-        {
-            this.id = id;
-        }
-
-        public Integer getFkBook()
-        {
-            return fkBook;
-        }
-
-        public void setFkBook(Integer fkBook)
-        {
-            this.fkBook = fkBook;
-        }
-
-        public String getSummary()
-        {
-            return summary;
-        }
-
-        public void setSummary(String summary)
-        {
-            this.summary = summary;
-        }
-
-        public Integer getVersion()
-        {
-            return version;
-        }
-
-        public void setVersion(Integer version)
-        {
-            this.version = version;
-        }
-
-        public Author getAuthor()
-        {
-            return author;
-        }
-
-        public void setAuthor(Author author)
-        {
-            this.author = author;
-        }
-
-        public Book getBook()
-        {
-            return book;
-        }
-
-        public void setBook(Book book)
-        {
-            this.book = book;
-        }
-
-        public boolean equals(Object obj)
-        {
-            boolean result = false;
-            if(obj instanceof Review)
-            {
-                Review other = (Review) obj;
-                result = new EqualsBuilder()
-                        .append(id, other.id)
-                        .append(summary, other.summary)
-                        .append(version, other.version)
-                        .append(fkBook, other.fkBook)
-                        .append(author, other.author)
-                        .isEquals();
-            }
-            return result;
-        }
-
-        public String toString()
-        {
-            return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE, false);
-        }
-    }
-
 }

Added: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/Sample.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/Sample.java?rev=589568&view=auto
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/Sample.java (added)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/Sample.java Mon Oct 29 03:11:56 2007
@@ -0,0 +1,540 @@
+package org.apache.ojb.broker;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.lang.Object;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.commons.lang.builder.EqualsBuilder;
+
+/**
+ * This class
+ *
+ * @version $Id$
+ */
+public class Sample
+{
+    //=======================================================
+    // inner test classes
+    //=======================================================
+    /*
+    NOTE: Take care of endless loops when change override toString method!!!!
+    */
+    public static class Book implements Serializable
+    {
+        private Integer id;
+        private String title;
+        private Date publicationDate;
+        private byte[] cover;
+        private Integer version;
+        private Integer fkPublisher;
+
+        private List authors;
+        private List reviews;
+        private Publisher publisher;
+
+        public Book()
+        {
+        }
+
+        public Book(String title, Date publicationDate, byte[] cover)
+        {
+            this.title = title;
+            this.publicationDate = publicationDate;
+            this.cover = cover;
+        }
+
+        public String toString()
+        {
+            return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                    .append("id", id)
+                    .append("title", title)
+                    .append("publicationDate", publicationDate)
+                    .append("version", version)
+                    .append("fkPublisher", fkPublisher)
+                    .append("cover", cover)
+                    .append("authors.size", authors != null ? authors.size() : 0)
+                    .append("reviews.size", reviews != null ? reviews.size() : 0)
+                    .append("publisher", publisher)
+                    .toString();
+        }
+
+        public void addAuthor(Author author)
+        {
+            if(authors == null)
+            {
+                authors = new ArrayList();
+            }
+            if(!authors.contains(author))
+            {
+                authors.add(author);
+                author.addBook(this);
+            }
+        }
+
+        public boolean removeAuthor(Author author)
+        {
+            return this.authors != null ? this.authors.remove(author) : false;
+        }
+
+        public void addReview(Review review)
+        {
+            if(reviews == null)
+            {
+                reviews = new ArrayList();
+            }
+            if(!reviews.contains(review)) reviews.add(review);
+        }
+
+        public boolean removeReview(Review review)
+        {
+            boolean result = false;
+            if(reviews != null)
+            {
+                result = reviews.remove(review);
+                if(result)
+                {
+                    review.setBook(null);
+                }
+            }
+            return result;
+        }
+
+        public Integer getId()
+        {
+            return id;
+        }
+
+        public void setId(Integer id)
+        {
+            this.id = id;
+        }
+
+        public String getTitle()
+        {
+            return title;
+        }
+
+        public void setTitle(String title)
+        {
+            this.title = title;
+        }
+
+        public Date getPublicationDate()
+        {
+            return publicationDate;
+        }
+
+        public void setPublicationDate(Date publicationDate)
+        {
+            this.publicationDate = publicationDate;
+        }
+
+        public byte[] getCover()
+        {
+            return cover;
+        }
+
+        public void setCover(byte[] cover)
+        {
+            this.cover = cover;
+        }
+
+        public Integer getVersion()
+        {
+            return version;
+        }
+
+        public void setVersion(Integer version)
+        {
+            this.version = version;
+        }
+
+        public List getAuthors()
+        {
+            return authors;
+        }
+
+        public void setAuthors(List authors)
+        {
+            this.authors = authors;
+        }
+
+        public List getReviews()
+        {
+            return reviews;
+        }
+
+        public void setReviews(List reviews)
+        {
+            this.reviews = reviews;
+        }
+
+        public Publisher getPublisher()
+        {
+            return publisher;
+        }
+
+        public void setPublisher(Publisher publisher)
+        {
+            if(this.publisher != null) this.publisher.removeBook(this);
+            this.publisher = publisher;
+            if(publisher != null) publisher.addBook(this);
+        }
+    }
+
+    public static class Author implements Serializable
+    {
+        private Integer id;
+        private String name;
+        private List books;
+        private Integer version;
+        private Publisher publisher;
+        private Integer fkPublisher;
+
+        public Author()
+        {
+        }
+
+        public Author(String name, List books)
+        {
+            this.name = name;
+            this.books = books;
+        }
+
+        public void addBook(Book book)
+        {
+            if(books == null)
+            {
+                books = new ArrayList();
+            }
+            if(!books.contains(book))
+            {
+                books.add(book);
+                book.addAuthor(this);
+            }
+        }
+
+        public boolean removeBook(Book book)
+        {
+            return books != null ? books.remove(book) : false;
+        }
+
+        public Integer getId()
+        {
+            return id;
+        }
+
+        public void setId(Integer id)
+        {
+            this.id = id;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public Integer getVersion()
+        {
+            return version;
+        }
+
+        public void setVersion(Integer version)
+        {
+            this.version = version;
+        }
+
+        public List getBooks()
+        {
+            return books;
+        }
+
+        public void setBooks(List books)
+        {
+            this.books = books;
+        }
+
+        public Publisher getPublisher()
+        {
+            return publisher;
+        }
+
+        public void setPublisher(Publisher publisher)
+        {
+            if(this.publisher != null) this.publisher.removeAuthor(this);
+            this.publisher = publisher;
+            if(publisher != null) publisher.addAuthor(this);
+        }
+    }
+
+    public static interface Publisher extends Serializable
+    {
+        public Integer getId();
+        public void setId(Integer id);
+        public String getName();
+        public void setName(String name);
+        public Integer getVersion();
+        public void setVersion(Integer version);
+        public List getAuthors();
+        public void setAuthors(List authors);
+        public void addAuthor(Author author);
+        public boolean removeAuthor(Author author);
+        public List getBooks();
+        public void setBooks(List books);
+        public void addBook(Book book);
+        public boolean removeBook(Book book);
+    }
+
+    public static class PublisherImpl implements Publisher
+    {
+        private Integer id;
+        private String name;
+        private Integer version;
+        private List authors;
+        private List books;
+
+        public PublisherImpl()
+        {
+        }
+
+        public PublisherImpl(String name)
+        {
+            this.name = name;
+        }
+
+        public Integer getId()
+        {
+            return id;
+        }
+
+        public void setId(Integer id)
+        {
+            this.id = id;
+        }
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public Integer getVersion()
+        {
+            return version;
+        }
+
+        public void setVersion(Integer version)
+        {
+            this.version = version;
+        }
+
+        public List getAuthors()
+        {
+            return authors;
+        }
+
+        public void setAuthors(List authors)
+        {
+            this.authors = authors;
+        }
+
+        public void addAuthor(Author author)
+        {
+            if(authors == null)
+            {
+                authors = new ArrayList();
+            }
+            if(! authors.contains(author)) authors.add(author);
+        }
+
+
+        public boolean removeAuthor(Author author)
+        {
+            return authors != null && authors.remove(author);
+        }
+
+        public List getBooks()
+        {
+            return books;
+        }
+
+        public void setBooks(List books)
+        {
+            this.books = books;
+        }
+
+        public void addBook(Book book)
+        {
+            if(books == null)
+            {
+                books = new ArrayList();
+            }
+            if(!books.contains(book)) books.add(book);
+        }
+
+
+        public boolean removeBook(Book book)
+        {
+            return books != null && books.remove(book);
+        }
+    }
+
+    public static class Review implements Serializable
+    {
+        private Integer id;
+        private Integer vote;
+        private String summary;
+        private Integer fkBook;
+        private Integer version;
+        private Author author;
+        private Book book;
+
+        public Review()
+        {
+        }
+
+        public Review(String summary, Integer vote, Book book)
+        {
+            this.summary = summary;
+            this.vote = vote;
+            this.book = book;
+        }
+
+        public Review(String summary, Integer vote)
+        {
+            this.summary = summary;
+            this.vote = vote;
+        }
+
+        public Review(String summary)
+        {
+            this.summary = summary;
+        }
+
+        public Integer getId()
+        {
+            return id;
+        }
+
+        public Integer getVote()
+        {
+            return vote;
+        }
+
+        public void setVote(Integer vote)
+        {
+            this.vote = vote;
+        }
+
+        public void setId(Integer id)
+        {
+            this.id = id;
+        }
+
+        public Integer getFkBook()
+        {
+            return fkBook;
+        }
+
+        public void setFkBook(Integer fkBook)
+        {
+            this.fkBook = fkBook;
+        }
+
+        public String getSummary()
+        {
+            return summary;
+        }
+
+        public void setSummary(String summary)
+        {
+            this.summary = summary;
+        }
+
+        public Integer getVersion()
+        {
+            return version;
+        }
+
+        public void setVersion(Integer version)
+        {
+            this.version = version;
+        }
+
+        public Author getAuthor()
+        {
+            return author;
+        }
+
+        public void setAuthor(Author author)
+        {
+            this.author = author;
+        }
+
+        public Book getBook()
+        {
+            return book;
+        }
+
+        public void setBook(Book book)
+        {
+            if(this.book != null) this.book.removeReview(this);
+            this.book = book;
+            if(book != null) book.addReview(this);
+        }
+
+        public boolean equals(Object obj)
+        {
+            boolean result = false;
+            if(obj instanceof Review)
+            {
+                Review other = (Review) obj;
+                result = new EqualsBuilder()
+                        .append(id, other.id)
+                        .append(summary, other.summary)
+                        .append(version, other.version)
+                        .append(fkBook, other.fkBook)
+                        .append(author, other.author)
+                        .isEquals();
+            }
+            return result;
+        }
+
+        public String toString()
+        {
+            return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE, false);
+        }
+    }
+}

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/ObjectImageTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/ObjectImageTest.java?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/ObjectImageTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/ObjectImageTest.java Mon Oct 29 03:11:56 2007
@@ -369,7 +369,7 @@
 
     public void testAddCollectionObjectToExistingObject() throws Exception
     {
-        String prefix = "testAddCollectionObjectToExistingObject_" + System.currentTimeMillis();
+        String prefix = ojbTestMethodIdentifier();
         ojbChangeReferenceSetting(Book.class, "reviews", true, NONE, NONE, false);
 
         TransactionExt tx = (TransactionExt) odmg.newTransaction();
@@ -424,6 +424,7 @@
         tx.begin();
         tx.lock(loadedCopy, Transaction.WRITE);
         Review removed = (Review) loadedCopy.getReviews().remove(0);
+        //System.out.println("removed: " + removed.getId());
         Review stayed =  (Review) loadedCopy.getReviews().get(0);
         tx.commit();
         // expect same version, nothing should be changed
@@ -432,6 +433,8 @@
         //assertEquals(r_1_version, removed.getVersion());
 
         tx.begin();
+        // clear cache to avoid synchronization issues when using a read-only cache
+        tx.getBroker().clearCache();
         OQLQuery query = odmg.newOQLQuery();
         query.create("select books from " + Book.class.getName() + " where title like $1");
         query.bind(prefix);
@@ -454,7 +457,7 @@
      */
     public void testPersistenceByReachability_1() throws Exception
     {
-        String name = "testPersistenceByReachability_1_" + System.currentTimeMillis();
+        String name = ojbTestMethodIdentifier();
         ojbChangeReferenceSetting(Book.class, "reviews", true, NONE, NONE, true);
 
         Date date = new Date();
@@ -475,7 +478,7 @@
         Review r4 = new Review(name + "_new_added");
         // add a new review after make persistent main object
         book.addReview(r4);
-        tx.setCascadingDelete(Book.class, true);
+        tx.setDeleteOrphan(Book.class, true);
         // remove object after make persistent main object
         book.removeReview(r3);
         tx.commit();
@@ -535,7 +538,7 @@
         Review r4 = new Review(name + "_new_added");
         // add a new review after make persistent main object
         book.addReview(r4);
-        tx.setCascadingDelete(Book.class, true);
+        tx.setDeleteOrphan(Book.class, true);
         // remove object after make persistent main object
         book.removeReview(r3);
         tx.checkpoint();
@@ -936,7 +939,7 @@
      */
     public void testReplaceOneToOneReference_2() throws Exception
     {
-        String name = "testChangeOneToOneReference_2_" + System.currentTimeMillis();
+        String name = ojbTestMethodIdentifier();
         Date date = new Date();
         byte[] cover = new byte[]{2,3,4,5,6,7,8,9};
         Book book = new Book(name, date, cover);
@@ -1714,7 +1717,7 @@
         assertEquals(1, b.getReviews().size());
 
         tx.lock(b, Transaction.WRITE);
-        tx.setCascadingDelete(Book.class, "reviews", true);
+        tx.setDeleteOrphan(Book.class, "reviews", true);
         // remove from collection with cascading delete
         b.getReviews().remove(0);
         tx.commit();

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository.xml?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository.xml Mon Oct 29 03:11:56 2007
@@ -57,7 +57,7 @@
 <!ENTITY junit_cloneable SYSTEM "repository_junit_cloneable.xml">
 <!ENTITY junit_inheritance SYSTEM "repository_junit_inheritance.xml">
 <!ENTITY junit_pathClass SYSTEM "repository_junit_pathClass.xml">
-<!ENTITY junit_pagination SYSTEM "repository_junit_pagination.xml">
+<!ENTITY junit_sample SYSTEM "repository_junit_sample.xml">
 <!ENTITY junit_sqlcount SYSTEM "repository_junit_sqlcount.xml">
 
 <!ENTITY user SYSTEM "repository_user.xml">
@@ -94,7 +94,7 @@
     &junit_cloneable;
     &junit_inheritance;
     &junit_pathClass;
-    &junit_pagination;
+    &junit_sample;
     &junit_sqlcount;
 
     <!-- include mappings for the EJB-examples, comment in before run

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_meta_seq.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_meta_seq.xml?rev=589568&r1=589567&r2=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_meta_seq.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_meta_seq.xml Mon Oct 29 03:11:56 2007
@@ -540,6 +540,7 @@
         name="ojbConcreteClass"
         column="CLASS_NAME"
         jdbc-type="VARCHAR"
+        field-class="direct"
         />
 
         <field-descriptor

Copied: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_sample.xml (from r562306, db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_pagination.xml)
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_sample.xml?p2=db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_sample.xml&p1=db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_pagination.xml&r1=562306&r2=589568&rev=589568&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_pagination.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/repository_junit_sample.xml Mon Oct 29 03:11:56 2007
@@ -22,11 +22,11 @@
 
 
 <!-- =================================================== -->
-<!--     Mapping for ImageContainerTest                  -->
+<!--     Sample mapping                                  -->
 <!-- =================================================== -->
 <class-descriptor
-    class="org.apache.ojb.broker.PaginationTest$Book"
-    table="PAGE_BOOK"
+    class="org.apache.ojb.broker.Sample$Book"
+    table="SAMPLE_BOOK"
     >
     <field-descriptor
         name="id"
@@ -46,7 +46,7 @@
         name="publicationDate"
         column="DATE_"
         jdbc-type="TIMESTAMP"
-        conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion"
+        conversion="JavaDate2SqlTimestamp"
         />
 
     <field-descriptor
@@ -66,11 +66,11 @@
         name="fkPublisher"
         column="FK_PUBLISHER"
         jdbc-type="INTEGER"
-        field-class="org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl"
+        field-class="direct"
         />
 
     <reference-descriptor name="publisher"
-        class-ref="org.apache.ojb.broker.PaginationTest$Publisher"
+        class-ref="org.apache.ojb.broker.Sample$Publisher"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
@@ -81,38 +81,38 @@
 
     <collection-descriptor
         name="reviews"
-        element-class-ref="org.apache.ojb.broker.PaginationTest$Review"
+        element-class-ref="org.apache.ojb.broker.Sample$Review"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
         auto-delete="object"
         >
-        <orderby name="fkBook" sort="ASC"/>
+        <orderby name="summary" sort="ASC"/>
         <inverse-foreignkey field-ref="fkBook"/>
     </collection-descriptor>
 
     <collection-descriptor
         name="authors"
-        collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
-        element-class-ref="org.apache.ojb.broker.PaginationTest$Author"
-        indirection-table="PAGE_PUBLICATION"
+        element-class-ref="org.apache.ojb.broker.Sample$Author"
+        indirection-table="SAMPLE_PUBLICATION"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
         auto-delete="object"
         >
+        <orderby name="id" sort="ASC"/>
         <fk-pointing-to-this-class column="BOOK_ID"/>
         <fk-pointing-to-element-class column="AUTHOR_ID"/>
     </collection-descriptor>
 </class-descriptor>
 
-<class-descriptor class="org.apache.ojb.broker.PaginationTest$Publisher">
-    <extent-class class-ref="org.apache.ojb.broker.PaginationTest$PublisherImpl"/>
+<class-descriptor class="org.apache.ojb.broker.Sample$Publisher">
+    <extent-class class-ref="org.apache.ojb.broker.Sample$PublisherImpl"/>
 </class-descriptor>
 
 <class-descriptor
-    class="org.apache.ojb.broker.PaginationTest$PublisherImpl"
-    table="PAGE_PUBLISHER"
+    class="org.apache.ojb.broker.Sample$PublisherImpl"
+    table="SAMPLE_PUBLISHER"
     >
     <field-descriptor
         name="id"
@@ -137,31 +137,33 @@
 
     <collection-descriptor
         name="authors"
-        element-class-ref="org.apache.ojb.broker.PaginationTest$Author"
+        element-class-ref="org.apache.ojb.broker.Sample$Author"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
         auto-delete="object"
         >
+        <orderby name="name" sort="ASC"/>
         <inverse-foreignkey field-ref="fkPublisher"/>
     </collection-descriptor>
 
     <collection-descriptor
         name="books"
-        element-class-ref="org.apache.ojb.broker.PaginationTest$Book"
+        element-class-ref="org.apache.ojb.broker.Sample$Book"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
         auto-delete="object"
         >
+        <orderby name="id" sort="ASC"/>
         <inverse-foreignkey field-ref="fkPublisher"/>
     </collection-descriptor>
 
 </class-descriptor>
 
 <class-descriptor
-    class="org.apache.ojb.broker.PaginationTest$Author"
-    table="PAGE_AUTHOR"
+    class="org.apache.ojb.broker.Sample$Author"
+    table="SAMPLE_AUTHOR"
     >
     <field-descriptor
         name="id"
@@ -188,11 +190,11 @@
         name="fkPublisher"
         column="FK_PUBLISHER"
         jdbc-type="INTEGER"
-        field-class="org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl"
+        field-class="direct"
     />
 
     <reference-descriptor name="publisher"
-        class-ref="org.apache.ojb.broker.PaginationTest$Publisher"
+        class-ref="org.apache.ojb.broker.Sample$Publisher"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
@@ -203,14 +205,14 @@
 
     <collection-descriptor
         name="books"
-        collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
-        element-class-ref="org.apache.ojb.broker.PaginationTest$Book"
-        indirection-table="PAGE_PUBLICATION"
+        element-class-ref="org.apache.ojb.broker.Sample$Book"
+        indirection-table="SAMPLE_PUBLICATION"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
         auto-delete="object"
         >
+        <orderby name="id" sort="ASC"/>
         <fk-pointing-to-this-class column="AUTHOR_ID"/>
         <fk-pointing-to-element-class column="BOOK_ID"/>
     </collection-descriptor>
@@ -218,8 +220,8 @@
 </class-descriptor>
 
 <class-descriptor
-    class="org.apache.ojb.broker.PaginationTest$Review"
-    table="PAGE_REVIEW"
+    class="org.apache.ojb.broker.Sample$Review"
+    table="SAMPLE_REVIEW"
     >
     <field-descriptor
         name="id"
@@ -262,7 +264,7 @@
         />
 
     <reference-descriptor name="author"
-        class-ref="org.apache.ojb.broker.PaginationTest$Author"
+        class-ref="org.apache.ojb.broker.Sample$Author"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"
@@ -272,7 +274,7 @@
     </reference-descriptor>
 
     <reference-descriptor name="book"
-        class-ref="org.apache.ojb.broker.PaginationTest$Book"
+        class-ref="org.apache.ojb.broker.Sample$Book"
         proxy="true"
         auto-retrieve="true"
         auto-update="object"