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/broker AbstractExtentClassTest.java
Date Fri, 13 Jun 2003 10:58:05 GMT
arminw      2003/06/13 03:58:05

  Modified:    src/test/org/apache/ojb/broker AbstractExtentClassTest.java
  Log:
  more tests
  
  Revision  Changes    Path
  1.2       +24 -6     db-ojb/src/test/org/apache/ojb/broker/AbstractExtentClassTest.java
  
  Index: AbstractExtentClassTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AbstractExtentClassTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractExtentClassTest.java	13 Jun 2003 10:11:54 -0000	1.1
  +++ AbstractExtentClassTest.java	13 Jun 2003 10:58:04 -0000	1.2
  @@ -5,7 +5,14 @@
   import java.util.Collection;
   import java.util.ArrayList;
   
  +import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryFactory;
  +import org.apache.commons.lang.builder.ToStringBuilder;
  +
   /**
  + *
  + *
    * @author <a href="mailto:om@ppi.de">Oliver Matz</a>
    * @version $Id$
    */
  @@ -41,13 +48,15 @@
           }
       }
   
  -    public void testStoreRetrieve()
  +    public void testStoreRetrieveQuery() throws Exception
       {
           broker.clearCache();
           broker.beginTransaction();
           // create new XContainer with ConcreteZ reference
           XContainer container = new XContainer();
           container.addX(new ConcreteZ());
  +        container.addX(new ConcreteZ());
  +        container.addX(new ConcreteZ());
   
           broker.store(container);
           broker.commitTransaction();
  @@ -58,6 +67,13 @@
           Object retContainer = broker.getObjectByIdentity(cont);
           // System.out.println("retrieved: " + retContainer);
           broker.commitTransaction();
  +
  +        broker.clearCache();
  +        // now test query
  +		Query q = QueryFactory.newQuery(AbstractX.class, (Criteria) null);
  +		Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 2);
       }
   
   
  @@ -120,8 +136,9 @@
   
           public String toString()
           {
  -            return "(#" + Integer.toHexString(System.identityHashCode(this)) +
  -                    ", " + id + ", " + someValue + ")";
  +            return (new ToStringBuilder(this)).
  +                    append("id", id).
  +                    append("someValue", someValue).toString();
           }
       }
   
  @@ -157,8 +174,9 @@
   
           public String toString()
           {
  -            return "(" + this.getClass().getName() + System.identityHashCode(this) +
  -                    ", " + myXReferences.toString() + ")";
  +            return (new ToStringBuilder(this)).
  +                    append("id", id).
  +                    append("myXReferences", myXReferences).toString();
           }
       }
   }
  
  
  

Mime
View raw message