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 Tue, 13 Dec 2005 18:18:30 GMT
arminw      2005/12/13 10:18:30

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        FieldConversionTest.java MtoNTest.java
               src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        CircularTest.java InheritanceMultipleTableTest.java
                        ObjectImageTest.java PersonWithArrayTest.java
               src/test/org/apache/ojb Tag: OJB_1_0_RELEASE
                        repository_junit_odmg.xml
  Log:
  update tests to support "new Identiity handling"
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.2.4.1   +3 -1      db-ojb/src/test/org/apache/ojb/broker/FieldConversionTest.java
  
  Index: FieldConversionTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/FieldConversionTest.java,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- FieldConversionTest.java	5 Mar 2003 14:38:17 -0000	1.2
  +++ FieldConversionTest.java	13 Dec 2005 18:18:25 -0000	1.2.4.1
  @@ -93,6 +93,7 @@
       {
           public Object javaToSql(Object source) throws ConversionException
           {
  +            if(source == null) return null;
               if (!(source instanceof Long))
               {
                   throw new ConversionException(
  @@ -104,6 +105,7 @@
   
           public Object sqlToJava(Object source) throws ConversionException
           {
  +            if(source == null) return null;
               if (!(source instanceof Integer))
               {
                   throw new ConversionException(
  
  
  
  1.15.2.5  +2 -2      db-ojb/src/test/org/apache/ojb/broker/MtoNTest.java
  
  Index: MtoNTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/MtoNTest.java,v
  retrieving revision 1.15.2.4
  retrieving revision 1.15.2.5
  diff -u -r1.15.2.4 -r1.15.2.5
  --- MtoNTest.java	9 May 2005 14:26:55 -0000	1.15.2.4
  +++ MtoNTest.java	13 Dec 2005 18:18:25 -0000	1.15.2.5
  @@ -126,9 +126,9 @@
               qual.setName("qual " + now);
               paper.setQualifiers(Arrays.asList(new Qualifier[] { qual }));
               broker.beginTransaction();
  -            broker.store(paper);        // store Paper and intermediary table only
               broker.store(qual);         // store Qualifier
  -            Identity paperId = new Identity(paper, broker);
  +            broker.store(paper);        // store Paper and intermediary table only
  +            Identity paperId = broker.serviceIdentity().buildIdentity(paper);
               broker.commitTransaction();
   
               broker.clearCache();
  
  
  
  No                   revision
  No                   revision
  1.1.2.9   +10 -1     db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java
  
  Index: CircularTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- CircularTest.java	4 Dec 2005 02:15:49 -0000	1.1.2.8
  +++ CircularTest.java	13 Dec 2005 18:18:25 -0000	1.1.2.9
  @@ -1648,6 +1648,10 @@
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           database.makePersistent(s);
  +        // before establishing the circular references write
  +        // all objects to DB
  +        tx.flush();
  +        // now close the circular references
           tx.commit();
   
           tx.begin();
  @@ -1787,6 +1791,11 @@
           TransactionExt tx = (TransactionExt) odmg.newTransaction();
           tx.begin();
           database.makePersistent(s);
  +        // shop and shopDetail have a bidirectional 1:1 reference
  +        // on flush() OJB will insert both objects and set one FK
  +        tx.flush();
  +        // on commit() OJB will be aware of the bidirectional reference
  +        // and set the second FK
           tx.commit();
   
           tx.begin();
  
  
  
  1.1.2.8   +1 -11     db-ojb/src/test/org/apache/ojb/odmg/InheritanceMultipleTableTest.java
  
  Index: InheritanceMultipleTableTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/InheritanceMultipleTableTest.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- InheritanceMultipleTableTest.java	4 Jun 2005 14:48:05 -0000	1.1.2.7
  +++ InheritanceMultipleTableTest.java	13 Dec 2005 18:18:25 -0000	1.1.2.8
  @@ -146,11 +146,6 @@
   
       public void testQuery_3() throws Exception
       {
  -        if(ojbSkipKnownIssueProblem("References of classes (1:1, 1:n) mapped to multiple
joined tables only" +
  -                " return base class type instances, same thing with queries against a base
type"))
  -        {
  -            return;
  -        }
           long timestamp = System.currentTimeMillis();
           Long id_2 = new Long(timestamp);
           String name = "testInsert" + timestamp;
  @@ -186,11 +181,6 @@
   
       public void testQuery_2() throws Exception
       {
  -        if(ojbSkipKnownIssueProblem("References of classes (1:1, 1:n) mapped to multiple
joined tables only" +
  -                " return base class type instances, same thing with queries against a base
type"))
  -        {
  -            return;
  -        }
           long timestamp = System.currentTimeMillis();
           Long id_2 = new Long(timestamp);
           String name = "testInsert" + timestamp;
  
  
  
  1.1.2.8   +9 -2      db-ojb/src/test/org/apache/ojb/odmg/ObjectImageTest.java
  
  Index: ObjectImageTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/ObjectImageTest.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- ObjectImageTest.java	5 Dec 2005 15:06:53 -0000	1.1.2.7
  +++ ObjectImageTest.java	13 Dec 2005 18:18:25 -0000	1.1.2.8
  @@ -821,6 +821,7 @@
           assertEquals(1, result.size());
           b = (Book) result.iterator().next();
           Publisher newP = b.getPublisher();
  +        assertNotNull(newP);
           assertEquals(name+"_new", newP.getName());
       }
   
  @@ -1985,7 +1986,13 @@
               if(obj instanceof Review)
               {
                   Review other = (Review) obj;
  -                result = new EqualsBuilder().append(id, other.id).append(version, other.version).isEquals();
  +                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;
           }
  
  
  
  1.6.2.6   +11 -4     db-ojb/src/test/org/apache/ojb/odmg/PersonWithArrayTest.java
  
  Index: PersonWithArrayTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/PersonWithArrayTest.java,v
  retrieving revision 1.6.2.5
  retrieving revision 1.6.2.6
  diff -u -r1.6.2.5 -r1.6.2.6
  --- PersonWithArrayTest.java	18 Mar 2005 19:22:30 -0000	1.6.2.5
  +++ PersonWithArrayTest.java	13 Dec 2005 18:18:25 -0000	1.6.2.6
  @@ -8,10 +8,13 @@
   import java.util.ArrayList;
   import java.util.Arrays;
   import java.util.Collection;
  +import java.util.List;
   
   import org.apache.ojb.junit.ODMGTestCase;
   import org.apache.ojb.odmg.shared.Person;
   import org.apache.ojb.odmg.shared.PersonImpl;
  +import org.apache.commons.lang.ArrayUtils;
  +import org.apache.commons.collections.ListUtils;
   import org.odmg.OQLQuery;
   import org.odmg.Transaction;
   
  @@ -262,10 +265,14 @@
           assertNotNull(lookupFather);
           assertEquals(returnedFather.getFirstname(), lookupFather.getFirstname());
           // unfortunately, PersonImpl does not have a suitable equals method.
  -        assertEquals(
  -                "children's names are equal",
  -                Arrays.asList(getFirstNames(returnedChildren)),
  -                Arrays.asList(getFirstNames(children)));
  +// comment out, because of child object order problem (it's not a bug, it's bad test writing)
  +//        assertEquals(
  +//                "children's names are equal",
  +//                Arrays.asList(getFirstNames(returnedChildren)),
  +//                Arrays.asList(getFirstNames(children)));
  +        // we expect the same names in both array, thus intersection result have to be
'2'
  +        List list = ListUtils.intersection(Arrays.asList(getFirstNames(returnedChildren)),
Arrays.asList(getFirstNames(children)));
  +        assertEquals(2, list.size());
           // System.out.println(Arrays.asList(getFirstNames(returnedChildren)));
           tx.commit();
   
  
  
  
  No                   revision
  No                   revision
  1.13.2.21 +2 -1      db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml
  
  Index: repository_junit_odmg.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/repository_junit_odmg.xml,v
  retrieving revision 1.13.2.20
  retrieving revision 1.13.2.21
  diff -u -r1.13.2.20 -r1.13.2.21
  --- repository_junit_odmg.xml	9 Dec 2005 01:52:08 -0000	1.13.2.20
  +++ repository_junit_odmg.xml	13 Dec 2005 18:18:29 -0000	1.13.2.21
  @@ -193,6 +193,7 @@
           auto-delete="none"
           >
           <inverse-foreignkey field-ref="fatherId"/>
  +        <orderby name="id" sort="ASC"/>
       </collection-descriptor>
   </class-descriptor>
   
  
  
  

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