db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb repository_junit_odmg.xml
Date Sun, 03 Apr 2005 01:48:11 GMT
arminw      2005/04/02 17:48:10

  Modified:    src/schema Tag: OJB_1_0_RELEASE ojbtest-schema.xml
               src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        AllTests.java DListTest.java DMapTest.java
                        NamedRootsTest.java OdmgExamples.java
               src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
                        repository_junit_odmg.xml
  Added:       src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        CircularTest.java DSetTest.java
  Log:
  add new tests, update tests for
  - named object handling
  - circular references handling
  - DCollection handling
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.80.2.15 +48 -1     db-ojb/src/schema/ojbtest-schema.xml
  
  Index: ojbtest-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/schema/ojbtest-schema.xml,v
  retrieving revision 1.80.2.14
  retrieving revision 1.80.2.15
  diff -u -r1.80.2.14 -r1.80.2.15
  --- ojbtest-schema.xml	18 Mar 2005 19:22:30 -0000	1.80.2.14
  +++ ojbtest-schema.xml	3 Apr 2005 01:48:10 -0000	1.80.2.15
  @@ -1336,6 +1336,53 @@
       </table>
   
       <!-- =================================================== -->
  +    <!-- LockCircularTest - odmg                             -->
  +    <!-- =================================================== -->
  +    <table name="CT_SHOP">
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +        <column name="DETAIL_FK" type="INTEGER"/>
  +    </table>
  +
  +    <table name="CT_DETAIL">
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +        <column name="SHOP_FK" type="INTEGER"/>
  +        <foreign-key foreignTable="CT_SHOP">
  +            <reference local="SHOP_FK" foreign="OBJ_ID"/>
  +        </foreign-key>
  +    </table>
  +
  +    <table name="CT_DISTRIBUTOR">
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +    </table>
  +
  +    <table name="CT_PRODUCT">
  +        <column name="OBJ_ID" required="true" primaryKey="true" type="INTEGER"/>
  +        <column name="NAME" type="VARCHAR" size="250"/>
  +        <column name="SHOP_FK" type="INTEGER"/>
  +        <column name="SUB_PRODUCT_FK" type="INTEGER"/>
  +        <foreign-key foreignTable="CT_PRODUCT">
  +            <reference local="SUB_PRODUCT_FK" foreign="OBJ_ID"/>
  +        </foreign-key>
  +        <foreign-key foreignTable="CT_SHOP">
  +            <reference local="SHOP_FK" foreign="OBJ_ID"/>
  +        </foreign-key>
  +    </table>
  +
  +    <table name="CT_SHOP_DISTRIBUTOR">
  +        <column name="SHOP_ID" type="INTEGER"/>
  +        <column name="DISTRIBUTOR_ID" type="INTEGER"/>
  +        <foreign-key foreignTable="CT_SHOP">
  +            <reference local="SHOP_ID" foreign="OBJ_ID"/>
  +        </foreign-key>
  +        <foreign-key foreignTable="CT_DISTRIBUTOR">
  +            <reference local="DISTRIBUTOR_ID" foreign="OBJ_ID"/>
  +        </foreign-key>
  +    </table>
  +
  +    <!-- =================================================== -->
       <!-- Complex test model tables                           -->
       <!-- =================================================== -->
       <table name="CRT_EMPLOYEE">
  
  
  
  No                   revision
  No                   revision
  1.18.2.5  +2 -0      db-ojb/src/test/org/apache/ojb/odmg/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/AllTests.java,v
  retrieving revision 1.18.2.4
  retrieving revision 1.18.2.5
  diff -u -r1.18.2.4 -r1.18.2.5
  --- AllTests.java	22 Mar 2005 15:04:54 -0000	1.18.2.4
  +++ AllTests.java	3 Apr 2005 01:48:10 -0000	1.18.2.5
  @@ -26,6 +26,7 @@
           suite.addTestSuite(NamedRootsTest.class);
           suite.addTestSuite(DListTest.class);
           suite.addTestSuite(DMapTest.class);
  +        suite.addTestSuite(DSetTest.class);
           suite.addTestSuite(LockingTest.class);
           suite.addTestSuite(LockingMultithreadedTest.class);
           suite.addTestSuite(ProxyTest.class);
  @@ -50,6 +51,7 @@
   		suite.addTestSuite(M2NTest.class);
   		suite.addTestSuite(ObjectImageTest.class);
           suite.addTestSuite(InheritanceMultipleTableTest.class);
  +        suite.addTestSuite(CircularTest.class);
           return suite;
       }
   }
  
  
  
  1.19.2.1  +160 -169  db-ojb/src/test/org/apache/ojb/odmg/DListTest.java
  
  Index: DListTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/DListTest.java,v
  retrieving revision 1.19
  retrieving revision 1.19.2.1
  diff -u -r1.19 -r1.19.2.1
  --- DListTest.java	5 Apr 2004 00:14:51 -0000	1.19
  +++ DListTest.java	3 Apr 2005 01:48:10 -0000	1.19.2.1
  @@ -4,22 +4,19 @@
   import java.util.Collection;
   import java.util.Iterator;
   
  -import junit.framework.TestCase;
   import org.apache.commons.lang.builder.ToStringBuilder;
  -import org.apache.ojb.broker.TestHelper;
  +import org.apache.commons.lang.builder.HashCodeBuilder;
  +import org.apache.commons.lang.builder.EqualsBuilder;
  +import org.apache.ojb.junit.ODMGTestCase;
   import org.odmg.DBag;
   import org.odmg.DList;
  -import org.odmg.DSet;
  -import org.odmg.Database;
  -import org.odmg.Implementation;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
   
   /**
  - * Demo Application that shows basic concepts for Applications using the OJB ODMG
  - * implementation as an transactional object server.
  + * Tests for OJB {@link org.odmg.DList} implementation.
    */
  -public class DListTest extends TestCase
  +public class DListTest extends ODMGTestCase
   {
       public static void main(String[] args)
       {
  @@ -27,62 +24,44 @@
           junit.textui.TestRunner.main(arr);
       }
   
  -    private String databaseName;
  -
       public DListTest(String name)
   
       {
           super(name);
       }
   
  -    protected DListObject createObject(String name) throws Exception
  +    protected DObject createObject(String name) throws Exception
       {
  -        DListObject obj = new DListObject();
  +        DObject obj = new DObject();
           obj.setName(name);
           obj.setRandomName("rnd_"+((int)(Math.random()*1000)));
   
           return obj;
       }
   
  -    public void setUp()
  -    {
  -        databaseName = TestHelper.DEF_DATABASE_NAME;
  -    }
  -
  -    public void tearDown()
  -    {
  -        databaseName = null;
  -    }
  -
       public void testAddingLockupWithTx() throws Exception
       {
           // create a unique name:
           final String name = "testAdding_" + System.currentTimeMillis();
   
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
  -
  -        Transaction tx = odmg.newTransaction();
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           // create DList and bound by name
           DList list = odmg.newDList();
  -        db.bind(list, name);
  +        database.bind(list, name);
           tx.commit();
  -        tx = odmg.newTransaction();
  +
           tx.begin();
  -        Object obj = db.lookup(name);
  +        tx.getBroker().clearCache();
  +        Object obj = database.lookup(name);
           tx.commit();
           assertNotNull("binded DList not found", obj);
   
  -        tx = odmg.newTransaction();
           tx.begin();
           // add objects to list
           for (int i = 0; i < 5; i++)
           {
  -            DListObject a = createObject(name);
  +            DObject a = createObject(name);
               list.add(a);
           }
           tx.commit();
  @@ -91,16 +70,15 @@
           Iterator iter = list.iterator();
           while (iter.hasNext())
           {
  -            DListObject a = (DListObject) iter.next();
  +            DObject a = (DObject) iter.next();
               assertNotNull(a);
           }
   
  -        tx = odmg.newTransaction();
           tx.begin();
  -        ((TransactionExt) odmg.currentTransaction()).getBroker().clearCache();
  +        tx.getBroker().clearCache();
   
           // lookup list and check entries
  -        DList lookedUp = (DList) db.lookup(name);
  +        DList lookedUp = (DList) database.lookup(name);
           assertNotNull("binded DList not found", lookedUp);
   
           //System.out.println("sequence of items in lookedup list:");
  @@ -108,8 +86,8 @@
           Iterator iter1 = list.iterator();
           while (iter.hasNext())
           {
  -            DListObject a = (DListObject) iter.next();
  -            DListObject b = (DListObject) iter1.next();
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
               assertNotNull(a);
               assertNotNull(b);
               assertEquals(a.getId(), b.getId());
  @@ -120,22 +98,124 @@
           tx.begin();
           for (int i = 0; i < 3; i++)
           {
  -            DListObject a = createObject(name + "_new_entry");
  +            DObject a = createObject(name + "_new_entry");
               list.add(a);
           }
           tx.commit();
   
  -        tx = odmg.newTransaction();
           tx.begin();
  -        ((TransactionExt) odmg.currentTransaction()).getBroker().clearCache();
  -        lookedUp = (DList) db.lookup(name);
  +        tx.getBroker().clearCache();
  +        lookedUp = (DList) database.lookup(name);
           iter = lookedUp.iterator();
           iter1 = list.iterator();
           assertEquals("Wrong number of DListEntry found", 8, list.size());
           while (iter.hasNext())
           {
  -            DListObject a = (DListObject) iter.next();
  -            DListObject b = (DListObject) iter1.next();
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
  +            assertNotNull(a);
  +            assertNotNull(b);
  +            assertEquals(a.getId(), b.getId());
  +        }
  +        tx.commit();
  +        assertNotNull("binded DList not found", lookedUp);
  +    }
  +
  +    public void testRemoveAdd() throws Exception
  +    {
  +        // create a unique name:
  +        final String name = "testRemoveAdd_" + System.currentTimeMillis();
  +
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
  +        tx.begin();
  +        // create DList and bound by name
  +        DList list = odmg.newDList();
  +        database.bind(list, name);
  +
  +        // add object to list
  +        for (int i = 0; i < 5; i++)
  +        {
  +            DObject a = createObject(name);
  +            list.add(a);
  +        }
  +        tx.commit();
  +
  +        // check current list
  +        Iterator iter = list.iterator();
  +        while (iter.hasNext())
  +        {
  +            DObject a = (DObject) iter.next();
  +            assertNotNull(a);
  +        }
  +
  +        tx.begin();
  +        tx.getBroker().clearCache();
  +
  +        // lookup list and check entries
  +        DList lookedUp = (DList) database.lookup(name);
  +        assertNotNull("binded DList not found", lookedUp);
  +
  +        //System.out.println("sequence of items in lookedup list:");
  +        iter = lookedUp.iterator();
  +        Iterator iter1 = list.iterator();
  +        while (iter.hasNext())
  +        {
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
  +            assertNotNull(a);
  +            assertNotNull(b);
  +            assertEquals(a.getId(), b.getId());
  +        }
  +        tx.commit();
  +
  +        // add and remove new entries
  +        tx.begin();
  +        for (int i = 0; i < 3; i++)
  +        {
  +            DObject a = createObject(name + "_new_entry_NOT_PERSIST");
  +            list.add(a);
  +            list.remove(list.size()-1);
  +        }
  +        tx.commit();
  +
  +
  +        tx.begin();
  +        tx.getBroker().clearCache();
  +        lookedUp = (DList) database.lookup(name);
  +        iter = lookedUp.iterator();
  +        iter1 = list.iterator();
  +        assertEquals("Wrong number of DListEntry found", 5, list.size());
  +        while (iter.hasNext())
  +        {
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
  +            assertNotNull(a);
  +            assertNotNull(b);
  +            assertEquals(a.getId(), b.getId());
  +        }
  +        tx.commit();
  +        assertNotNull("binded DList not found", lookedUp);
  +
  +
  +        tx.begin();
  +        for (int i = 0; i < 3; i++)
  +        {
  +            DObject a = createObject(name + "_new_entry_new_persist");
  +            list.add(a);
  +            list.remove(0);
  +        }
  +        tx.commit();
  +
  +        tx.begin();
  +        tx.getBroker().clearCache();
  +        lookedUp = (DList) database.lookup(name);
  +        iter = lookedUp.iterator();
  +        iter1 = list.iterator();
  +        assertEquals("Wrong number of DListEntry found", 5, list.size());
  +        while (iter.hasNext())
  +        {
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
               assertNotNull(a);
               assertNotNull(b);
               assertEquals(a.getId(), b.getId());
  @@ -149,12 +229,6 @@
           // create a unique name:
           final String name = "testReadAndStore_" + System.currentTimeMillis();
   
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
  -
           // create test objects
           Transaction tx = odmg.newTransaction();
           tx.begin();
  @@ -168,7 +242,7 @@
           tx.begin();
           // query test objects
           OQLQuery q = odmg.newOQLQuery();
  -        q.create("select all from "+DListObject.class.getName()+" where name=$1");
  +        q.create("select all from "+DObject.class.getName()+" where name=$1");
           q.bind(name);
           Collection ret = (Collection) q.execute();
           // check result list size
  @@ -189,27 +263,22 @@
           // create a unique name:
           final String name = "testAdding_" + System.currentTimeMillis();
   
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
           // get DList and fill with objects
           DList list = odmg.newDList();
           Transaction tx = odmg.newTransaction();
           tx.begin();
           for (int i = 0; i < 5; i++)
           {
  -            DListObject a = createObject(name);
  +            DObject a = createObject(name);
               list.add(a);
           }
           // bind the new list
  -        db.bind(list, name);
  +        database.bind(list, name);
           tx.commit();
   
           tx = odmg.newTransaction();
           tx.begin();
  -        Object obj = db.lookup(name);
  +        Object obj = database.lookup(name);
           tx.commit();
           assertNotNull("binded DList not found", obj);
   
  @@ -217,7 +286,7 @@
           Iterator iter = list.iterator();
           while (iter.hasNext())
           {
  -            DListObject a = (DListObject) iter.next();
  +            DObject a = (DObject) iter.next();
               assertNotNull(a);
           }
           assertEquals(5, list.size());
  @@ -225,7 +294,7 @@
           tx = odmg.newTransaction();
           tx.begin();
           ((TransactionExt) odmg.currentTransaction()).getBroker().clearCache();
  -        DList lookedUp = (DList) db.lookup(name);
  +        DList lookedUp = (DList) database.lookup(name);
           tx.commit();
           assertNotNull("binded DList not found", lookedUp);
   
  @@ -234,8 +303,8 @@
           Iterator iter1 = list.iterator();
           while (iter.hasNext())
           {
  -            DListObject a = (DListObject) iter.next();
  -            DListObject b = (DListObject) iter1.next();
  +            DObject a = (DObject) iter.next();
  +            DObject b = (DObject) iter1.next();
               assertNotNull(a);
               assertNotNull(b);
               assertEquals(a.getId(), b.getId());
  @@ -250,21 +319,15 @@
           // create a unique name:
           String name = "testRemoving_" + System.currentTimeMillis();
   
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
           Transaction tx = odmg.newTransaction();
  -
           tx.begin();
           DList list = odmg.newDList();
           // bind the list to the name:
  -        db.bind(list, name);
  +        database.bind(list, name);
   
           for (int i = 0; i < 5; i++)
           {
  -            DListObject a = createObject(name);
  +            DObject a = createObject(name);
               list.add(a);
           }
           assertEquals(5, list.size());
  @@ -274,7 +337,7 @@
           tx = odmg.newTransaction();
           tx.begin();
           ((HasBroker) odmg.currentTransaction()).getBroker().clearCache();
  -        DList lookedUp = (DList) db.lookup(name);
  +        DList lookedUp = (DList) database.lookup(name);
           assertNotNull("database lookup does not find the named DList", lookedUp);
           assertEquals("Wrong number of list entries", 5, lookedUp.size());
           lookedUp.remove(2);
  @@ -285,7 +348,7 @@
           tx = odmg.newTransaction();
           tx.begin();
           ((HasBroker) odmg.currentTransaction()).getBroker().clearCache();
  -        lookedUp = (DList) db.lookup(name);
  +        lookedUp = (DList) database.lookup(name);
           tx.commit();
   
           assertEquals(3, lookedUp.size());
  @@ -297,23 +360,17 @@
           // create a unique name:
           String name = "testAddingWithIndex_" + System.currentTimeMillis();
   
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
           Transaction tx = odmg.newTransaction();
  -
           tx.begin();
           DList list = odmg.newDList();
  -        db.bind(list, name);
  +        database.bind(list, name);
           tx.commit();
   
           tx = odmg.newTransaction();
           tx.begin();
           for (int i = 0; i < 5; i++)
           {
  -            DListObject a = createObject(name);
  +            DObject a = createObject(name);
               list.add(a);
           }
   
  @@ -330,10 +387,10 @@
   
           //System.out.println("sequence of items in list:");
           Iterator iter = list.iterator();
  -        DListObject a;
  +        DObject a;
           while (iter.hasNext())
           {
  -            a = (DListObject) iter.next();
  +            a = (DObject) iter.next();
               assertNotNull(a);
               //System.out.print(a.getArticleId() + ", ");
           }
  @@ -342,14 +399,14 @@
           tx = odmg.newTransaction();
           tx.begin();
           ((TransactionImpl) tx).getBroker().clearCache();
  -        DList lookedUp = (DList) db.lookup(name);
  +        DList lookedUp = (DList) database.lookup(name);
           // System.out.println("lookup list: " + lookedUp);
           assertNotNull("database lookup does not find DList", lookedUp);
           assertEquals(8, lookedUp.size());
           iter = lookedUp.iterator();
           while (iter.hasNext())
           {
  -            a = (DListObject) iter.next();
  +            a = (DObject) iter.next();
           }
           tx.commit();
       }
  @@ -357,16 +414,12 @@
       public void testDBag() throws Exception
       {
           String name = "testDBag_" + System.currentTimeMillis();
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
  +
           Transaction tx = odmg.newTransaction();
           tx.begin();
           DBag bag1 = odmg.newDBag();
           DBag bag2 = odmg.newDBag();
  -        DListObject a, b, c, d, e;
  +        DObject a, b, c, d, e;
           a = createObject(name);
           b = createObject(name);
           c = createObject(name);
  @@ -388,93 +441,26 @@
           tx.commit();
       }
   
  -    public void testDSet() throws Exception
  -    {
  -        String name = "testDSet_" + System.currentTimeMillis();
  -        String set_1 = "set_1_" + System.currentTimeMillis();
  -        String set_2 = "set_2_" + System.currentTimeMillis();
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
  -        Transaction tx = odmg.newTransaction();
  -        tx.begin();
  -
  -        DListObject a, b, c, d, e;
  -        a = createObject(name);
  -        b = createObject(name);
  -        c = createObject(name);
  -        d = createObject(name);
  -        e = createObject(name);
  -
  -        DSet set1 = odmg.newDSet();
  -        DSet set2 = odmg.newDSet();
  -
  -        set1.add(a);
  -        set1.add(b);
  -        set1.add(c);
  -
  -        set2.add(b);
  -        set2.add(c);
  -        set2.add(d);
  -        set2.add(e);
  -
  -        db.bind(set1, set_1);
  -        db.bind(set2, set_2);
  -        tx.commit();
  -
  -        // low lookup both sets
  -        tx = odmg.newTransaction();
  -        tx.begin();
  -        ((HasBroker) tx).getBroker().clearCache();
  -        DSet set1a = (DSet) db.lookup(set_1);
  -        DSet set2a = (DSet) db.lookup(set_2);
  -
  -        // check looked up sets
  -        assertTrue(set1a.containsAll(set1));
  -        assertTrue(set2a.containsAll(set2));
  -
  -        // now TestThreadsNLocks set operations:
  -        DSet set3 = set1.difference(set2);
  -        assertEquals(1, set3.size());
  -
  -        set3 = set1.intersection(set2);
  -        assertEquals(2, set3.size());
  -
  -        set3 = set1.union(set2);
  -        assertEquals(5, set3.size());
  -
  -        assertTrue(set1.properSubsetOf(set3));
  -        assertTrue(set2.properSubsetOf(set3));
  -
  -        assertTrue(set3.properSupersetOf(set1));
  -        assertTrue(set3.properSupersetOf(set2));
  -
  -        assertTrue(!set1.properSubsetOf(set2));
  -
  -        tx.commit();
  -    }
  -
  -    public static class DListObject
  +    public static class DObject
       {
           Integer id;
           String name;
           String randomName;
   
  -        public DListObject()
  +        public DObject()
           {
           }
   
           public boolean equals(Object obj)
           {
  -            if(obj instanceof DListObject)
  +            if(obj instanceof DObject)
               {
  -                String all = id + name+ randomName;
  -                DListObject target = ((DListObject)obj);
  -                return all != null
  -                        ? all.equals(target.getId()+target.getName()+target.getRandomName())
  -                        : target.getId()+target.getName()+target.getRandomName() == null;
  +                DObject target = ((DObject)obj);
  +                return new EqualsBuilder()
  +                        .append(id, target.getId())
  +                        .append(name, target.getName())
  +                        .append(randomName, target.getRandomName())
  +                        .isEquals();
               }
               else
               {
  @@ -482,6 +468,11 @@
               }
           }
   
  +        public int hashCode()
  +        {
  +            return new HashCodeBuilder().append(id).append(name).append(randomName).hashCode();
  +        }
  +
           public String toString()
           {
               ToStringBuilder buf = new ToStringBuilder(this);
  
  
  
  1.13.2.1  +107 -91   db-ojb/src/test/org/apache/ojb/odmg/DMapTest.java
  
  Index: DMapTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/DMapTest.java,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- DMapTest.java	22 Jun 2004 18:16:22 -0000	1.13
  +++ DMapTest.java	3 Apr 2005 01:48:10 -0000	1.13.2.1
  @@ -1,144 +1,160 @@
   package org.apache.ojb.odmg;
   
   
  -import java.util.Iterator;
  -
  -import junit.framework.TestCase;
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.broker.metadata.FieldDescriptor;
  +import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.Article;
  -import org.odmg.DList;
  +import org.apache.ojb.odmg.shared.ProductGroup;
   import org.odmg.DMap;
  -import org.odmg.Database;
  -import org.odmg.Implementation;
   import org.odmg.Transaction;
   
  -/** Demo Application that shows basic concepts for Applications using the OJB ODMG
  - * implementation as an transactional object server.
  +/**
  + * Tests for OJB {@link org.odmg.DSet} implementation.
    */
  -public class DMapTest extends TestCase
  +public class DMapTest extends ODMGTestCase
   {
  +    private ProductGroup productGroup;
  +
       public static void main(String[] args)
       {
  -        String[] arr = {CLASS.getName()};
  +        String[] arr = {DMapTest.class.getName()};
           junit.textui.TestRunner.main(arr);
       }
   
  -    private static Class CLASS = DMapTest.class;
  -    private String databaseName;
  -
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (24.12.2000 00:33:40)
  -     */
       public DMapTest(String name)
       {
           super(name);
       }
   
  -    protected Article createArticle(Implementation odmg) throws Exception
  +    protected void setUp() throws Exception
       {
  +        super.setUp();
  +        Transaction tx = odmg.newTransaction();
  +        tx.begin();
  +        productGroup = new ProductGroup();
  +        productGroup.setName("DMapTest_" + System.currentTimeMillis() + "_");
  +        database.makePersistent(productGroup);
  +        tx.commit();
  +    }
   
  -        Article a = new Article();
  -        PersistenceBroker broker = ((HasBroker) odmg.currentTransaction()).getBroker();
  -        FieldDescriptor fld = broker.getClassDescriptor(Article.class).getFieldDescriptorByName("articleId");
  -        Integer val = (Integer) broker.serviceSequenceManager().getUniqueValue(fld);
  +    protected Article createArticle(String name) throws Exception
  +    {
   
  -        a.setArticleId(val.intValue());
  -        a.setArticleName("New Funny Article " + a.getArticleId());
  +        Article a = new Article();
  +        a.setArticleName(productGroup.getName() + name);
           a.setStock(234);
  -        a.setProductGroupId(7);
  -
  +        a.setProductGroup(productGroup);
           return a;
       }
   
  -    protected void printDList(DList list)
  +    public void XXXtestAdding() throws Exception
       {
  -        Iterator iter = list.iterator();
  -        while (iter.hasNext())
  -        {
  -            Article a = (Article) iter.next();
  -            //System.out.print(a.getArticleId() + ", ");
  -        }
  -        //System.out.println();
  -    }
  +        String name = "testAdding";
  +        String namedObject = "testAdding_" + System.currentTimeMillis();
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
   
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:58:53)
  -     */
  -    public void setUp()
  -    {
  -        databaseName = TestHelper.DEF_DATABASE_NAME;
  -    }
  +        tx.begin();
  +        DMap map = odmg.newDMap();
  +
  +        database.bind(map, namedObject);
  +        Article key1 = createArticle(name + "_key1");
  +        Article val1 = createArticle(name + "_val1");
  +        Article key2 = createArticle(name + "_key2");
  +        Article val2 = createArticle(name + "_val2");
  +
  +        map.put(key1, val1);
  +        map.put(key2, val2);
  +        tx.commit();
   
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (06.12.2000 21:59:14)
  -     */
  -    public void tearDown()
  -    {
  -        try
  -        {
  -//            OJB.getInstance().currentTransaction().abort();
  -//            OJB.getInstance().getDatabase(null).close();
  -            databaseName = null;
   
  +        tx = (TransactionExt) odmg.newTransaction();
  +        tx.begin();
  +        tx.getBroker().clearCache();
   
  -        }
  -        catch (Throwable t)
  -        {
  -        }
  +        DMap mapA = (DMap) database.lookup(namedObject);
  +        assertNotNull(mapA);
  +        Article val1A = (Article) mapA.get(key1);
  +        assertNotNull(val1A);
  +        assertEquals(val1.getArticleId(), val1A.getArticleId());
  +        Article val2A = (Article) mapA.get(key2);
  +        assertNotNull(val2A);
  +        assertEquals(val2.getArticleId(), val2A.getArticleId());
  +        tx.commit();
       }
   
  -    public void testAdding() throws Exception
  +    public void testRemove() throws Exception
       {
  -        // get facade instance
  -        Implementation odmg = OJB.getInstance();
  -        Database db = odmg.newDatabase();
  -        //open database
  -        db.open(databaseName, Database.OPEN_READ_WRITE);
  -
  +        String name = "testAdding";
  +        String namedObject = "testAdding_" + System.currentTimeMillis();
  +        TransactionExt tx = (TransactionExt) odmg.newTransaction();
   
  -        Transaction tx = odmg.newTransaction();
           tx.begin();
           DMap map = odmg.newDMap();
  -        PersistenceBroker broker = ((HasBroker) tx).getBroker();
  -        String name = null;
  -        try
  -        {
  -            // name = "the_dmap_" + (broker.getUniqueId(DMapImpl.class, "id") - 1);
  -            name = "the_dmap_" + System.currentTimeMillis();
  -        }
  -        catch (PersistenceBrokerException e)
  -        {
  -        }
  -        db.bind(map, name);
  -        Article key1 = createArticle(odmg);
  -        Article val1 = createArticle(odmg);
  -        Article key2 = createArticle(odmg);
  -        Article val2 = createArticle(odmg);
  +
  +        database.bind(map, namedObject);
  +        Article key1 = createArticle(name + "_key1");
  +        Article val1 = createArticle(name + "_val1");
  +        Article key2 = createArticle(name + "_key2");
  +        Article val2 = createArticle(name + "_val2");
   
           map.put(key1, val1);
           map.put(key2, val2);
           tx.commit();
   
   
  -        tx = odmg.newTransaction();
  +        tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
  +        tx.getBroker().clearCache();
   
  -        broker = ((HasBroker) tx).getBroker();
  -        broker.clearCache();
  -
  -        DMap mapA = (DMap) db.lookup(name);
  +        DMap mapA = (DMap) database.lookup(namedObject);
  +        assertNotNull(mapA);
           Article val1A = (Article) mapA.get(key1);
  +        assertNotNull(val1A);
           assertEquals(val1.getArticleId(), val1A.getArticleId());
           Article val2A = (Article) mapA.get(key2);
  +        assertNotNull(val2A);
           assertEquals(val2.getArticleId(), val2A.getArticleId());
           tx.commit();
  -    }
   
  +        tx.begin();
  +        mapA.remove(key1);
  +
  +        tx.checkpoint();
  +
  +        mapA = (DMap) database.lookup(namedObject);
  +        assertNotNull(mapA);
  +        val1A = (Article) mapA.get(key1);
  +        assertNull(val1A);
  +        val2A = (Article) mapA.get(key2);
  +        assertNotNull(val2A);
  +        assertEquals(val2.getArticleId(), val2A.getArticleId());
  +        tx.commit();
   
  +        tx.begin();
  +        mapA.remove(key2);
  +        mapA.put(key2, val2);
  +
  +        tx.checkpoint();
  +
  +        mapA = (DMap) database.lookup(namedObject);
  +        assertNotNull(mapA);
  +        val1A = (Article) mapA.get(key1);
  +        assertNull(val1A);
  +        val2A = (Article) mapA.get(key2);
  +        assertNotNull(val2A);
  +        assertEquals(val2.getArticleId(), val2A.getArticleId());
  +        tx.commit();
  +
  +        tx.begin();
  +        mapA.remove(key2);
  +        tx.commit();
  +
  +        tx.begin();
  +        mapA = (DMap) database.lookup(namedObject);
  +        assertNotNull(mapA);
  +        val1A = (Article) mapA.get(key1);
  +        assertNull(val1A);
  +        val2A = (Article) mapA.get(key2);
  +        assertNull(val2A);
  +        tx.commit();
  +    }
   }
  
  
  
  1.1.2.2   +74 -81    db-ojb/src/test/org/apache/ojb/odmg/NamedRootsTest.java
  
  Index: NamedRootsTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/NamedRootsTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- NamedRootsTest.java	16 Mar 2005 01:11:58 -0000	1.1.2.1
  +++ NamedRootsTest.java	3 Apr 2005 01:48:10 -0000	1.1.2.2
  @@ -1,10 +1,12 @@
   package org.apache.ojb.odmg;
   
   
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.Article;
   import org.apache.ojb.odmg.shared.ProductGroup;
  -import org.odmg.DList;
   import org.odmg.ObjectNameNotFoundException;
   import org.odmg.ObjectNameNotUniqueException;
   import org.odmg.Transaction;
  @@ -49,35 +51,52 @@
           return example;
       }
   
  -    public void testBind() throws Exception
  +    public void testBindPersistentCapableObject() throws Exception
       {
           String bindingName = "testBind_" + System.currentTimeMillis();
           TransactionImpl tx = (TransactionImpl) odmg.newTransaction();
           //bind object to name
           tx.begin();
           Article example = createArticle();
  -        database.makePersistent(example);
  +        database.bind(example, bindingName);
  +        Article value = (Article) database.lookup(bindingName);
  +        assertTrue("Could not lookup object for binding name: "+bindingName, value != null);
           tx.commit();
   
  -        tx.begin();
           try
           {
  +            tx.begin();
               database.bind(example, bindingName);
  -            Article value = (Article) database.lookup(bindingName);
  -            assertTrue("Could not lookup object for binding name: "+bindingName, value != null);
               tx.commit();
  +            fail("We expected a ObjectNameNotUniqueException, but was not thrown");
           }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            // tx.abort();
  -            fail("name " + bindingName + " should not be unknown. "+ex.getMessage());
  -        }
  -        catch (ObjectNameNotUniqueException e)
  +        catch (ObjectNameNotUniqueException ex)
           {
  -            // tx.abort();
  -            fail("should not have happened: " + e.getMessage());
  +            // we wait for this exception
  +            assertTrue(true);
  +            tx.abort();
           }
   
  +        tx.begin();
  +        database.unbind(bindingName);
  +        tx.commit();
  +    }
  +
  +    public void testBindPersistentSerialzableObject() throws Exception
  +    {
  +        String bindingName = "testBindPersistentSerialzableObject_" + System.currentTimeMillis();
  +        TransactionImpl tx = (TransactionImpl) odmg.newTransaction();
  +        //bind object to name
  +        tx.begin();
  +        List example = new ArrayList();
  +        example.add("Merkur");
  +        example.add("Venus");
  +        database.bind(example, bindingName);
  +        List value = (List) database.lookup(bindingName);
  +        assertNotNull("Could not lookup object for binding name: "+bindingName, value);
  +        assertEquals(2, value.size());
  +        tx.commit();
  +
           try
           {
               tx.begin();
  @@ -92,65 +111,62 @@
               tx.abort();
           }
   
  -        try
  -        {
  -            tx.begin();
  -            database.unbind(bindingName);
  -            tx.commit();
  -        }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            fail("Can't unbind " + bindingName + ": "+ex.getMessage());
  -        }
  +        tx.begin();
  +        database.unbind(bindingName);
  +        tx.commit();
  +
  +        tx.begin();
  +        example.add("earth");
  +        example.add("mars");
  +        database.bind(example, bindingName);
  +        value = (List) database.lookup(bindingName);
  +        assertNotNull("Could not lookup object for binding name: "+bindingName, value);
  +        assertEquals(4, value.size());
  +        tx.commit();
  +
  +        tx.begin();
  +        database.unbind(bindingName);
  +        tx.commit();
       }
   
       public void testDoubleBindInOneTx() throws Exception
       {
           String bindingName = "testDoubleBindInOneTx_" + System.currentTimeMillis();
   
  -        DList foundList = null;
  +        Article article = createArticle();
  +        Article foundArticle = null;
  +
           Transaction tx = odmg.newTransaction();
           tx.begin();
  -        database.bind(odmg.newDList(), bindingName);
  +        database.bind(article, bindingName);
   
  -        foundList = (DList)database.lookup(bindingName);
  -        assertTrue("Could not found bound DList", foundList != null);
  -        foundList = null;
  +        foundArticle = (Article) database.lookup(bindingName);
  +        assertNotNull(foundArticle);
   
  +        foundArticle = null;
           database.unbind(bindingName);
           try
           {
  -            foundList = (DList) database.lookup(bindingName);
  +            foundArticle = (Article) database.lookup(bindingName);
               fail("Found unbound DList");
           }
           catch (ObjectNameNotFoundException ex)
           {
  +            // expected exception
  +            assertTrue(true);
           }
   
  -        database.bind(odmg.newDList(), bindingName);
  -        try
  -        {
  -            foundList = (DList) database.lookup(bindingName);
  -        }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            fail("Could not found bound DList, binding name was: "+bindingName);
  -        }
  -        foundList = null;
  +        database.bind(article, bindingName);
  +        foundArticle = (Article) database.lookup(bindingName);
  +
  +        foundArticle = null;
           tx.commit();
   
           tx = odmg.newTransaction();
           tx.begin();
  -        try
  -        {
  -            DList newList = (DList) database.lookup(bindingName);
  -            assertNotNull(newList);
  -            database.unbind(bindingName);
  -        }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            fail("Could not found bound DList in new tx");
  -        }
  +        foundArticle = (Article) database.lookup(bindingName);
  +        assertNotNull(foundArticle);
  +        database.unbind(bindingName);
           tx.commit();
       }
   
  @@ -167,46 +183,23 @@
           tx.commit();
   
           tx.begin();
  -        try 
  -        {
  -            database.bind(example, bindingName);
  -            tx.commit();
  -        }
  -        catch (ObjectNameNotUniqueException ex)
  -        {
  -            tx.abort();
  -            fail(ex.getMessage());
  -        }
  +        database.bind(example, bindingName);
  +        tx.commit();
   
           // TestThreadsNLocks look up
           Article lookedUp1 = null;
           tx = (TransactionImpl) odmg.newTransaction();
           tx.begin();
  -        try
  -        {
  -            // lookup by name binding
  -            lookedUp1 = (Article) database.lookup(bindingName);
  -        }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            fail("lookup by name: " + bindingName + " should not be unknown");
  -        }
  -
  +        // lookup by name binding
  +        lookedUp1 = (Article) database.lookup(bindingName);
           tx.commit();
   
           // looking up object by OID should return same Object as by name
           assertEquals("lookups should return identical object", example, lookedUp1);
   
  -        try
  -        {
  -            tx.begin();
  -            database.unbind(bindingName);
  -            tx.commit();
  -        }
  -        catch (ObjectNameNotFoundException ex)
  -        {
  -            fail("Can't unbind " + bindingName + ": "+ex.getMessage());
  -        }
  +        tx.begin();
  +        database.unbind(bindingName);
  +        tx.commit();
       }
   
       public void testUnBind() throws Exception
  
  
  
  1.14.2.2  +2 -3      db-ojb/src/test/org/apache/ojb/odmg/OdmgExamples.java
  
  Index: OdmgExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OdmgExamples.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- OdmgExamples.java	18 Mar 2005 19:22:30 -0000	1.14.2.1
  +++ OdmgExamples.java	3 Apr 2005 01:48:10 -0000	1.14.2.2
  @@ -1,19 +1,18 @@
   package org.apache.ojb.odmg;
   
   import java.util.List;
  -import java.util.ArrayList;
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.junit.OJBTestCase;
  +import org.apache.ojb.odmg.collections.DListImpl;
   import org.apache.ojb.odmg.shared.Article;
   import org.apache.ojb.odmg.shared.ProductGroup;
   import org.apache.ojb.odmg.states.ModificationState;
   import org.apache.ojb.odmg.states.StateNewClean;
   import org.apache.ojb.odmg.states.StateNewDirty;
  -import org.apache.ojb.odmg.collections.DListImpl_2;
   import org.odmg.DCollection;
   import org.odmg.Database;
   import org.odmg.Implementation;
  @@ -262,7 +261,7 @@
           {
               //=============================
               // this test needs DList impl as oql query collection class
  -            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl_2.class);
  +            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl.class);
               //=============================
   
               tx.begin();
  
  
  
  No                   revision
  
  Index: OdmgExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OdmgExamples.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- OdmgExamples.java	18 Mar 2005 19:22:30 -0000	1.14.2.1
  +++ OdmgExamples.java	3 Apr 2005 01:48:10 -0000	1.14.2.2
  @@ -1,19 +1,18 @@
   package org.apache.ojb.odmg;
   
   import java.util.List;
  -import java.util.ArrayList;
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.junit.OJBTestCase;
  +import org.apache.ojb.odmg.collections.DListImpl;
   import org.apache.ojb.odmg.shared.Article;
   import org.apache.ojb.odmg.shared.ProductGroup;
   import org.apache.ojb.odmg.states.ModificationState;
   import org.apache.ojb.odmg.states.StateNewClean;
   import org.apache.ojb.odmg.states.StateNewDirty;
  -import org.apache.ojb.odmg.collections.DListImpl_2;
   import org.odmg.DCollection;
   import org.odmg.Database;
   import org.odmg.Implementation;
  @@ -262,7 +261,7 @@
           {
               //=============================
               // this test needs DList impl as oql query collection class
  -            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl_2.class);
  +            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl.class);
               //=============================
   
               tx.begin();
  
  
  
  No                   revision
  
  Index: OdmgExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OdmgExamples.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- OdmgExamples.java	18 Mar 2005 19:22:30 -0000	1.14.2.1
  +++ OdmgExamples.java	3 Apr 2005 01:48:10 -0000	1.14.2.2
  @@ -1,19 +1,18 @@
   package org.apache.ojb.odmg;
   
   import java.util.List;
  -import java.util.ArrayList;
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.TestHelper;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.junit.OJBTestCase;
  +import org.apache.ojb.odmg.collections.DListImpl;
   import org.apache.ojb.odmg.shared.Article;
   import org.apache.ojb.odmg.shared.ProductGroup;
   import org.apache.ojb.odmg.states.ModificationState;
   import org.apache.ojb.odmg.states.StateNewClean;
   import org.apache.ojb.odmg.states.StateNewDirty;
  -import org.apache.ojb.odmg.collections.DListImpl_2;
   import org.odmg.DCollection;
   import org.odmg.Database;
   import org.odmg.Implementation;
  @@ -262,7 +261,7 @@
           {
               //=============================
               // this test needs DList impl as oql query collection class
  -            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl_2.class);
  +            ((ImplementationImpl) odmg).setOqlCollectionClass(DListImpl.class);
               //=============================
   
               tx.begin();
  
  
  
  1.1.2.1   +890 -0    db-ojb/src/test/org/apache/ojb/odmg/Attic/CircularTest.java
  
  
  
  
  1.1.2.1   +375 -0    db-ojb/src/test/org/apache/ojb/odmg/Attic/DSetTest.java
  
  
  
  
  No                   revision
  No                   revision
  1.13.2.7  +193 -3    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.6
  retrieving revision 1.13.2.7
  diff -u -r1.13.2.6 -r1.13.2.7
  --- repository_junit_odmg.xml	18 Mar 2005 19:22:31 -0000	1.13.2.6
  +++ repository_junit_odmg.xml	3 Apr 2005 01:48:10 -0000	1.13.2.7
  @@ -556,7 +556,6 @@
           />
       <collection-descriptor
           name="favoriteFood"
  -        collection-class="org.apache.ojb.odmg.collections.DListImpl"
           element-class-ref="org.apache.ojb.broker.InterfaceFood"
           indirection-table="GOURMET_FOOD"
           proxy="false"
  @@ -617,7 +616,7 @@
   
   
   <class-descriptor
  -    class="org.apache.ojb.odmg.DListTest$DListObject"
  +    class="org.apache.ojb.odmg.DListTest$DObject"
       table="ODMG_DLIST"
       >
       <field-descriptor
  @@ -1830,4 +1829,195 @@
   
   </class-descriptor>
   
  +
  +
  +<!-- =================================================== -->
  +<!--     Mapping for LockCircularTest                    -->
  +<!-- =================================================== -->
  +<class-descriptor
  +    class="org.apache.ojb.odmg.CircularTest$Shop"
  +    table="CT_SHOP"
  +    >
  +    <field-descriptor
  +        name="id"
  +        column="OBJ_ID"
  +        jdbc-type="INTEGER"
  +        primarykey="true"
  +        autoincrement="true"
  +        />
  +
  +    <field-descriptor
  +        name="name"
  +        column="NAME"
  +        jdbc-type="VARCHAR"
  +        />
  +
  +    <field-descriptor
  +        name="detailFk"
  +        column="DETAIL_FK"
  +        jdbc-type="INTEGER"
  +        access="anonymous"
  +        />
  +
  +    <reference-descriptor name="detail"
  +        class-ref="org.apache.ojb.odmg.CircularTest$ShopDetail"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <foreignkey field-ref="detailFk"/>
  +    </reference-descriptor>
  +
  +    <collection-descriptor
  +        name="products"
  +        element-class-ref="org.apache.ojb.odmg.CircularTest$Product"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <inverse-foreignkey field-ref="shopFk"/>
  +    </collection-descriptor>
  +
  +    <collection-descriptor
  +        name="distributors"
  +        collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
  +        element-class-ref="org.apache.ojb.odmg.CircularTest$Distributor"
  +        indirection-table="CT_SHOP_DISTRIBUTOR"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <fk-pointing-to-this-class column="SHOP_ID"/>
  +        <fk-pointing-to-element-class column="DISTRIBUTOR_ID"/>
  +    </collection-descriptor>
  +
  +</class-descriptor>
  +
  +<class-descriptor
  +    class="org.apache.ojb.odmg.CircularTest$Distributor"
  +    table="CT_DISTRIBUTOR"
  +    >
  +    <field-descriptor
  +        name="id"
  +        column="OBJ_ID"
  +        jdbc-type="INTEGER"
  +        primarykey="true"
  +        autoincrement="true"
  +        />
  +
  +    <field-descriptor
  +        name="name"
  +        column="NAME"
  +        jdbc-type="VARCHAR"
  +        />
  +
  +    <collection-descriptor
  +        name="shops"
  +        collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
  +        element-class-ref="org.apache.ojb.odmg.CircularTest$Shop"
  +        indirection-table="CT_SHOP_DISTRIBUTOR"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <fk-pointing-to-this-class column="DISTRIBUTOR_ID"/>
  +        <fk-pointing-to-element-class column="SHOP_ID"/>
  +    </collection-descriptor>
  +
  +</class-descriptor>
  +
  +<class-descriptor
  +    class="org.apache.ojb.odmg.CircularTest$Product"
  +    table="CT_PRODUCT"
  +    >
  +    <field-descriptor
  +        name="id"
  +        column="OBJ_ID"
  +        jdbc-type="INTEGER"
  +        primarykey="true"
  +        autoincrement="true"
  +        />
  +
  +    <field-descriptor
  +        name="name"
  +        column="NAME"
  +        jdbc-type="VARCHAR"
  +        />
  +
  +    <field-descriptor
  +        name="subProductFK"
  +        column="SUB_PRODUCT_FK"
  +        jdbc-type="INTEGER"
  +        />
  +
  +    <field-descriptor
  +        name="shopFk"
  +        column="SHOP_FK"
  +        jdbc-type="INTEGER"
  +        />
  +
  +    <reference-descriptor name="shop"
  +        class-ref="org.apache.ojb.odmg.CircularTest$Shop"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <foreignkey field-ref="shopFk"/>
  +    </reference-descriptor>
  +
  +    <collection-descriptor
  +        name="subProducts"
  +        element-class-ref="org.apache.ojb.odmg.CircularTest$Product"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <inverse-foreignkey field-ref="subProductFK"/>
  +    </collection-descriptor>
  +
  +</class-descriptor>
  +
  +<class-descriptor
  +    class="org.apache.ojb.odmg.CircularTest$ShopDetail"
  +    table="CT_DETAIL"
  +    >
  +    <field-descriptor
  +        name="id"
  +        column="OBJ_ID"
  +        jdbc-type="INTEGER"
  +        primarykey="true"
  +        autoincrement="true"
  +        />
  +
  +    <field-descriptor
  +        name="name"
  +        column="NAME"
  +        jdbc-type="VARCHAR"
  +        />
  +
  +    <field-descriptor
  +        name="shopFk"
  +        column="SHOP_FK"
  +        jdbc-type="INTEGER"
  +        access="anonymous"
  +        />
  +
  +    <reference-descriptor name="shop"
  +        class-ref="org.apache.ojb.odmg.CircularTest$Shop"
  +        proxy="false"
  +        auto-retrieve="true"
  +        auto-update="none"
  +        auto-delete="none"
  +        >
  +        <foreignkey field-ref="shopFk"/>
  +    </reference-descriptor>
  +
  +</class-descriptor>
  +
   <!-- Mapping of classes used in junit tests and tutorials ends here -->
  
  
  

---------------------------------------------------------------------
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