You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by br...@apache.org on 2003/11/17 21:30:43 UTC

cvs commit: db-ojb/src/test/org/apache/ojb/broker PersistenceBrokerTest.java QueryTest.java

brj         2003/11/17 12:30:42

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
               src/test/org/apache/ojb/broker PersistenceBrokerTest.java
                        QueryTest.java
  Log:
  startAt, endAt didn't retrieve last row
  
  Revision  Changes    Path
  1.53      +2 -2      db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- PersistenceBrokerImpl.java	14 Nov 2003 18:16:45 -0000	1.52
  +++ PersistenceBrokerImpl.java	17 Nov 2003 20:30:42 -0000	1.53
  @@ -1491,7 +1491,7 @@
                   endAt = iter.size() + 1;
               }
   
  -            int numberOfObjectsToFetch = endAt - startAt;
  +            int numberOfObjectsToFetch = endAt - startAt + 1; // BRJ: don't forget last row
               int retrievedCount = 0;
               /**
                * keep retrieving objects while retrievedCount is less than the retrievalCount, or the
  
  
  
  1.32      +1 -1      db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
  
  Index: PersistenceBrokerTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PersistenceBrokerTest.java	23 Oct 2003 19:50:03 -0000	1.31
  +++ PersistenceBrokerTest.java	17 Nov 2003 20:30:42 -0000	1.32
  @@ -716,7 +716,7 @@
   
           // 4. check if all items are found
           col = broker.getCollectionByQuery(query);
  -        assertEquals("size of collection should be three", 3, col.size());
  +        assertEquals("size of collection should be three", 4, col.size());
           iter = col.iterator();
           int itemNumberCheck = 5002;
           while (iter.hasNext())
  
  
  
  1.41      +674 -651  db-ojb/src/test/org/apache/ojb/broker/QueryTest.java
  
  Index: QueryTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/QueryTest.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- QueryTest.java	5 Nov 2003 21:07:11 -0000	1.40
  +++ QueryTest.java	17 Nov 2003 20:30:42 -0000	1.41
  @@ -1,158 +1,168 @@
  -
   package org.apache.ojb.broker;
   
  +import java.util.ArrayList;
  +import java.util.Arrays;
  +import java.util.Collection;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.Set;
  +import java.util.Vector;
  +
   import junit.framework.TestCase;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  -import org.apache.ojb.broker.query.*;
  +import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.broker.query.QueryFactory;
  +import org.apache.ojb.broker.query.ReportQueryByCriteria;
   import org.apache.ojb.broker.util.BrokerHelper;
   
  -import java.util.*;
  -
   /**
    * Testing the query API
    */
   public class QueryTest extends TestCase
   {
   
  -	PersistenceBroker broker;
  +    PersistenceBroker broker;
   
  -	private static Class CLASS = QueryTest.class;
  +    private static Class CLASS = QueryTest.class;
   
  -	/**
  +    /**
   	 * BrokerTests constructor comment.
  -	 * @param name java.lang.String
  +	 * 
  +	 * @param name
  +	 *            java.lang.String
  +	 */
  +    public QueryTest(String name)
  +    {
  +        super(name);
  +    }
  +
  +    /**
  +	 * Insert the method's description here. Creation date: (23.12.2000
  +	 * 18:30:38)
  +	 * 
  +	 * @param args
  +	 *            java.lang.String[]
  +	 */
  +    public static void main(String[] args)
  +    {
  +        String[] arr = { CLASS.getName()};
  +        junit.textui.TestRunner.main(arr);
  +    }
  +
  +    /**
  +	 * Insert the method's description here. Creation date: (06.12.2000
  +	 * 21:58:53)
   	 */
  -	public QueryTest(String name)
  -	{
  -		super(name);
  -	}
  -
  -	/**
  -	 * Insert the method's description here.
  -	 * Creation date: (23.12.2000 18:30:38)
  -	 * @param args java.lang.String[]
  -	 */
  -	public static void main(String[] args)
  -	{
  -		String[] arr = {CLASS.getName()};
  -		junit.textui.TestRunner.main(arr);
  -	}
  -
  -	/**
  -	 * Insert the method's description here.
  -	 * Creation date: (06.12.2000 21:58:53)
  -	 */
  -	public void setUp()
  -	{
  -		try
  -		{
  -			broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  -		}
  -		catch (PBFactoryException e)
  -		{
  -		}
  -	}
  -
  -	/**
  -	 * Insert the method's description here.
  -	 * Creation date: (06.12.2000 21:59:14)
  -	 */
  -	public void tearDown()
  -	{
  -		broker.close();
  -	}
  +    public void setUp()
  +    {
  +        try
  +        {
  +            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        }
  +        catch (PBFactoryException e)
  +        {
  +        }
  +    }
   
  -	/**
  +    /**
  +	 * Insert the method's description here. Creation date: (06.12.2000
  +	 * 21:59:14)
  +	 */
  +    public void tearDown()
  +    {
  +        broker.close();
  +    }
  +
  +    /**
   	 * test EqualTo Criteria
   	 */
  -	public void testEqualCriteria()
  -	{
  +    public void testEqualCriteria()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("firstname", "tom");
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  -
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  -
  -	}
  -
  -	/**
  -	 * test Subquery
  -	 * get all product groups without articles
  -	 *
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("firstname", "tom");
  +        Query q = QueryFactory.newQuery(Person.class, crit);
  +
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
  +
  +    }
  +
  +    /**
  +	 * test Subquery get all product groups without articles
  +	 * 
   	 * test may fail if db does not support sub queries
   	 */
  -	public void testSubQuery2()
  -	{
  -		Collection results = null;
  -        String stamp = ""+System.currentTimeMillis();
  +    public void testSubQuery2()
  +    {
  +        Collection results = null;
  +        String stamp = "" + System.currentTimeMillis();
           int loops = 10;
           // create ProductGroups without article
           broker.beginTransaction();
  -        for (int i=0; i<loops;i++)
  +        for (int i = 0; i < loops; i++)
           {
               ProductGroup pg = new ProductGroup();
  -            pg.setGroupName("test group "+stamp);
  +            pg.setGroupName("test group " + stamp);
               pg.setDescription("build by QueryTest#testSubQuery2");
               broker.store(pg);
           }
           broker.commitTransaction();
   
           ReportQueryByCriteria subQuery;
  -		Criteria subCrit = new Criteria();
  -		Criteria crit = new Criteria();
  +        Criteria subCrit = new Criteria();
  +        Criteria crit = new Criteria();
   
  -		subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  -		subQuery.setColumns(new String[]{"productGroupId"});
  -		subQuery.setDistinct(true);
  -
  -		crit.addEqualTo("groupName", "test group "+stamp);
  -		crit.addNotIn("groupId", subQuery);
  -		Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  -
  -		results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		System.out.println("*** Found " + results.size() + " empty ProductGroups ***");
  +        subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  +        subQuery.setColumns(new String[] { "productGroupId" });
  +        subQuery.setDistinct(true);
  +
  +        crit.addEqualTo("groupName", "test group " + stamp);
  +        crit.addNotIn("groupId", subQuery);
  +        Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  +
  +        results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        System.out.println("*** Found " + results.size() + " empty ProductGroups ***");
           assertEquals("Result of the query with sub-query does not match", loops, results.size());
   
  -	}
  +    }
   
  -	/**
  -	 * test Subquery
  -	 * get all articles with price > avg(price)
  -	 * PROBLEM: avg(price) is NOT extent aware !!
  -	 *
  +    /**
  +	 * test Subquery get all articles with price > avg(price) PROBLEM:
  +	 * avg(price) is NOT extent aware !!
  +	 * 
   	 * test may fail if db does not support sub queries
   	 */
  -	public void testSubQuery1()
  -	{
  +    public void testSubQuery1()
  +    {
   
  -		ReportQueryByCriteria subQuery;
  -		Criteria subCrit = new Criteria();
  -		Criteria crit = new Criteria();
  +        ReportQueryByCriteria subQuery;
  +        Criteria subCrit = new Criteria();
  +        Criteria crit = new Criteria();
   
  -        subCrit.addLike("articleName","A%");
  -		subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  -		subQuery.setColumns(new String[]{"avg(price)"});
  +        subCrit.addLike("articleName", "A%");
  +        subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  +        subQuery.setColumns(new String[] { "avg(price)" });
   
  -		crit.addGreaterOrEqualThan("price", subQuery);
  -		Query q = QueryFactory.newQuery(Article.class, crit);
  +        crit.addGreaterOrEqualThan("price", subQuery);
  +        Query q = QueryFactory.newQuery(Article.class, crit);
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
   
  -	}
  +    }
   
       /**
  -     * test Subquery
  -     * get all product groups with more than 10 articles, uses attribute as value !
  -     * see testSubQuery4 for a better way
  -     *
  -     * test may fail if db does not support sub queries
  -     */
  +	 * test Subquery get all product groups with more than 10 articles, uses
  +	 * attribute as value ! see testSubQuery4 for a better way
  +	 * 
  +	 * test may fail if db does not support sub queries
  +	 */
       public void testSubQuery3()
       {
   
  @@ -160,12 +170,13 @@
           Criteria subCrit = new Criteria();
           Criteria crit = new Criteria();
   
  -        subCrit.addEqualToField("productGroupId",Criteria.PARENT_QUERY_PREFIX + "groupId");
  +        subCrit.addEqualToField("productGroupId", Criteria.PARENT_QUERY_PREFIX + "groupId");
           subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  -        subQuery.setColumns(new String[]{"count(productGroupId)"});
  +        subQuery.setColumns(new String[] { "count(productGroupId)" });
   
  -        crit.addLessThan("10", subQuery);    // MORE than 10 articles, uses attribute as value !
  -        crit.addLessThan("groupId",new Integer(987654));
  +        crit.addLessThan("10", subQuery); // MORE than 10 articles, uses
  +										  // attribute as value !
  +        crit.addLessThan("groupId", new Integer(987654));
           Query q = QueryFactory.newQuery(ProductGroup.class, crit);
   
           Collection results = broker.getCollectionByQuery(q);
  @@ -174,11 +185,10 @@
       }
   
       /**
  -     * test Subquery
  -     * get all product groups with more than 10 articles
  -     *
  -     * test may fail if db does not support sub queries
  -     */
  +	 * test Subquery get all product groups with more than 10 articles
  +	 * 
  +	 * test may fail if db does not support sub queries
  +	 */
       public void testSubQuery4()
       {
   
  @@ -186,12 +196,12 @@
           Criteria subCrit = new Criteria();
           Criteria crit = new Criteria();
   
  -        subCrit.addEqualToField("productGroupId",Criteria.PARENT_QUERY_PREFIX + "groupId");
  +        subCrit.addEqualToField("productGroupId", Criteria.PARENT_QUERY_PREFIX + "groupId");
           subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
  -        subQuery.setColumns(new String[]{"count(productGroupId)"});
  +        subQuery.setColumns(new String[] { "count(productGroupId)" });
   
  -        crit.addGreaterThan(subQuery,"10");    // MORE than 10 articles
  -        crit.addLessThan("groupId",new Integer(987654));
  +        crit.addGreaterThan(subQuery, "10"); // MORE than 10 articles
  +        crit.addLessThan("groupId", new Integer(987654));
           Query q = QueryFactory.newQuery(ProductGroup.class, crit);
   
           Collection results = broker.getCollectionByQuery(q);
  @@ -199,127 +209,126 @@
           assertTrue(results.size() == 4);
       }
   
  -	/**
  +    /**
   	 * test Like Criteria
   	 */
  -	public void testLikeCriteria()
  -	{
  +    public void testLikeCriteria()
  +    {
  +
  +        Criteria crit = new Criteria();
  +        crit.addLike("firstname", "%o%");
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -		Criteria crit = new Criteria();
  -		crit.addLike("firstname", "%o%");
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  -
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  -	}
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
  +    }
   
  -	/**
  +    /**
   	 * test Null Criteria
   	 */
  -	public void testNullCriteria()
  -	{
  +    public void testNullCriteria()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addIsNull("firstname");
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  +        Criteria crit = new Criteria();
  +        crit.addIsNull("firstname");
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() == 0);
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() == 0);
   
  -	}
  +    }
   
  -	/**
  +    /**
   	 * test Between Criteria
   	 */
  -	public void testBetweenCriteria()
  -	{
  +    public void testBetweenCriteria()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addBetween("id", new Integer(1), new Integer(5));
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  +        Criteria crit = new Criteria();
  +        crit.addBetween("id", new Integer(1), new Integer(5));
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() == 5);
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() == 5);
   
  -	}
  +    }
   
  -	/**
  +    /**
   	 * test In Criteria
   	 */
  -	public void testInCriteria()
  -	{
  -
  -		Criteria crit = new Criteria();
  -		Collection ids = new Vector();
  -		ids.add(new Integer(1));
  -		ids.add(new Integer(3));
  -		ids.add(new Integer(5));
  +    public void testInCriteria()
  +    {
   
  -		crit.addIn("id", ids);
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  +        Criteria crit = new Criteria();
  +        Collection ids = new Vector();
  +        ids.add(new Integer(1));
  +        ids.add(new Integer(3));
  +        ids.add(new Integer(5));
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() == 3);
  +        crit.addIn("id", ids);
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -	}
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() == 3);
  +    }
   
  -	/**
  +    /**
   	 * Single Path Expression
   	 */
  -	public void testPathExpressions()
  -	{
  +    public void testPathExpressions()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("productGroup.groupName", "Liquors");
  -		Query q = QueryFactory.newQuery(Article.class, crit);
  -		//System.out.println(q.toString());
  -
  -		Collection results = broker.getCollectionByQuery(q);
  -		//System.out.println(results.toString());
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("productGroup.groupName", "Liquors");
  +        Query q = QueryFactory.newQuery(Article.class, crit);
  +        //System.out.println(q.toString());
   
  -	}
  +        Collection results = broker.getCollectionByQuery(q);
  +        //System.out.println(results.toString());
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
  +
  +    }
   
  -	/**
  +    /**
   	 * Multi Path Expression over decomposed m:n
   	 */
  -	public void testPathExpressionsMtoNDecomposed()
  -	{
  +    public void testPathExpressionsMtoNDecomposed()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("roles.project.title", "HSQLDB");
  -		// use decomposed m:n
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("roles.project.title", "HSQLDB");
  +        // use decomposed m:n
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
   
  -	}
  +    }
   
  -	/**
  +    /**
   	 * Multi Path Expression over nondecomposed m:n
   	 */
  -	public void testPathExpressionsMtoN()
  -	{
  +    public void testPathExpressionsMtoN()
  +    {
   
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("projects.title", "HSQLDB"); // direct m:n
  -		Query q = QueryFactory.newQuery(Person.class, crit);
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("projects.title", "HSQLDB"); // direct m:n
  +        Query q = QueryFactory.newQuery(Person.class, crit);
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
   
  -	}
  +    }
   
       /**
  -     * Multi Path Expression over nondecomposed m:n
  -     * new test case for the 'not unique alias' problem with m:n relationship
  -     */
  +	 * Multi Path Expression over nondecomposed m:n new test case for the 'not
  +	 * unique alias' problem with m:n relationship
  +	 */
       public void testPathExpressionsMtoN2()
       {
           Criteria crit = new Criteria();
  @@ -332,32 +341,60 @@
           assertTrue(results.size() > 0);
       }
   
  -	/**
  +    /**
  +	 * Simple ReportQuery returning rows with 2 columns of Person
  +	 */
  +    public void testReportQuery()
  +    {
  +
  +        Criteria crit = new Criteria();
  +        Collection results = new Vector();
  +        crit.addLike("firstname", "%o%");
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Person.class, crit);
  +        q.setColumns(new String[] { "id", "firstname", "count(*)" });
  +        q.addGroupBy(new String[] { "id", "firstname" });
  +
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +
  +        assertNotNull(iter);
  +        while (iter.hasNext())
  +        {
  +            results.add(iter.next());
  +        }
  +        assertTrue(results.size() > 0);
  +
  +    }
  +
  +    /**
   	 * Simple ReportQuery returning rows with 2 columns of Person
  +     * needs SQL paging
   	 */
  -	public void testReportQuery()
  -	{
  +    public void _testReportQueryWithStartAndEnd()
  +    {
   
  -		Criteria crit = new Criteria();
  -		Collection results = new Vector();
  -		crit.addLike("firstname", "%o%");
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(Person.class, crit);
  -		q.setColumns(new String[]{"id", "firstname", "count(*)"});
  -        q.addGroupBy(new String[]{"id", "firstname"});
  -
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		assertNotNull(iter);
  -		while (iter.hasNext())
  -		{
  -			results.add(iter.next());
  -		}
  -		assertTrue(results.size() > 0);
  +        Criteria crit = new Criteria();
  +        Collection results = new Vector();
  +        crit.addLike("firstname", "%o%");
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Person.class, crit);
  +        q.setColumns(new String[] { "id", "firstname", "count(*)" });
  +        q.addGroupBy(new String[] { "id", "firstname" });
   
  -	}
  +        q.setStartAtIndex(3);
  +        q.setEndAtIndex(5);
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +
  +        assertNotNull(iter);
  +        while (iter.hasNext())
  +        {
  +            results.add(iter.next());
  +        }
  +        assertTrue(results.size() == 4);
  +
  +    }
   
       /**
  -     * Simple ReportQuery returning rows with 2 columns of Person
  -     */
  +	 * Simple ReportQuery returning rows with 2 columns of Person
  +	 */
       public void testReportQueryExtent()
       {
   
  @@ -365,9 +402,10 @@
           Collection results = new Vector();
           crit.addLike("articleName", "%o%");
           ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
  -        q.setColumns(new String[]{"articleId", "articleName", "price"});
  +        q.setColumns(new String[] { "articleId", "articleName", "price" });
   
           Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +
           assertNotNull(iter);
           while (iter.hasNext())
           {
  @@ -377,123 +415,122 @@
   
       }
   
  -	/**
  +    /**
   	 * ReportQuery returning rows with some "Liquor" data ordered by price
   	 */
  -	public void testReportQueryOrderBy()
  -	{
  +    public void testReportQueryOrderBy()
  +    {
   
  -		Criteria crit = new Criteria();
  -		Collection results = new Vector();
  -		crit.addEqualTo("productGroup.groupName", "Liquors");
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
  -		q.setColumns(new String[]{"articleId", "articleName", "price"});
  -		q.addOrderByAscending("price");
  -
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		assertNotNull(iter);
  -		while (iter.hasNext())
  -		{
  -			results.add(iter.next());
  -		}
  -		assertTrue(results.size() > 0);
  +        Criteria crit = new Criteria();
  +        Collection results = new Vector();
  +        crit.addEqualTo("productGroup.groupName", "Liquors");
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
  +        q.setColumns(new String[] { "articleId", "articleName", "price" });
  +        q.addOrderByAscending("price");
   
  -	}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        assertNotNull(iter);
  +        while (iter.hasNext())
  +        {
  +            results.add(iter.next());
  +        }
  +        assertTrue(results.size() > 0);
  +
  +    }
   
  -	/**
  +    /**
   	 * ReportQuery returning rows with summed stock and price per article group
   	 */
  -	public void testReportQueryGroupBy()
  -	{
  +    public void testReportQueryGroupBy()
  +    {
   
  -		Criteria crit = new Criteria();
  -		Collection results = new Vector();
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit);
  -		q.setColumns(
  -				new String[]{"groupName", "sum(allArticlesInGroup.stock)", "sum(allArticlesInGroup.price)"});
  -		q.addGroupBy("groupName");
  -
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		assertNotNull(iter);
  -		while (iter.hasNext())
  -		{
  -			results.add(iter.next());
  -		}
  -		assertTrue(results.size() > 0);
  +        Criteria crit = new Criteria();
  +        Collection results = new Vector();
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit);
  +        q.setColumns(new String[] { "groupName", "sum(allArticlesInGroup.stock)", "sum(allArticlesInGroup.price)" });
  +        q.addGroupBy("groupName");
   
  -	}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        assertNotNull(iter);
  +        while (iter.hasNext())
  +        {
  +            results.add(iter.next());
  +        }
  +        assertTrue(results.size() > 0);
   
  -	/**
  +    }
  +
  +    /**
   	 * Read a CD and then read the ProductGroup for the CD
   	 */
  -	public void testInversePathExpression()
  -	{
  -		QueryByCriteria query;
  -		Criteria crit;
  -		CdArticle cd;
  -		ProductGroupProxy pg, cdPg;
  -
  -		crit = new Criteria();
  -		crit.addEqualTo("articleId", new Integer(200));
  -		query = new QueryByCriteria(CdArticle.class, crit);
  -		cd = (CdArticle) broker.getObjectByQuery(query);
  -		cdPg = (ProductGroupProxy) cd.getProductGroup();
  -
  -		crit = new Criteria();
  -		crit.addEqualTo("allArticlesInGroup.articleId", new Integer(cd.getArticleId()));
  -		query = new QueryByCriteria(ProductGroup.class, crit);
  -		query.setPathClass("allArticlesInGroup", CdArticle.class);
  -		pg = (ProductGroupProxy) broker.getObjectByQuery(query);
  -
  -		// this test can only succeed in singlevm mode:
  -		if (!BrokerHelper.isRunningInServerMode())
  -		{
  -			assertNotNull(pg);
  -			assertNotNull(cdPg);
  -            assertEquals("ProductGroups should be identical", pg.getRealSubject().toString(),cdPg.getRealSubject().toString());
  -		}
  -
  -	}
  -
  -	/**
  -	 * prefetch Articles for ProductGroupsWithArray,
  -	 * Does not yet work with Arrays
  -	 */
  -	public void testPrefetchedArraySingleKey()
  -	{
  -		ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  -		Class articleProxy = cldArticle.getProxyClass();
  -
  -		//
  -		// use ProductGroup and Articles with disabled Proxy
  -		//
  -		broker.clearCache();
  -		cldArticle.setProxyClassName(null);
  -
  -		Criteria crit = new Criteria();
  -		crit.addLessOrEqualThan("groupId", new Integer(5));
  -		QueryByCriteria q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
  +    public void testInversePathExpression()
  +    {
  +        QueryByCriteria query;
  +        Criteria crit;
  +        CdArticle cd;
  +        ProductGroupProxy pg, cdPg;
  +
  +        crit = new Criteria();
  +        crit.addEqualTo("articleId", new Integer(200));
  +        query = new QueryByCriteria(CdArticle.class, crit);
  +        cd = (CdArticle) broker.getObjectByQuery(query);
  +        cdPg = (ProductGroupProxy) cd.getProductGroup();
  +
  +        crit = new Criteria();
  +        crit.addEqualTo("allArticlesInGroup.articleId", new Integer(cd.getArticleId()));
  +        query = new QueryByCriteria(ProductGroup.class, crit);
  +        query.setPathClass("allArticlesInGroup", CdArticle.class);
  +        pg = (ProductGroupProxy) broker.getObjectByQuery(query);
  +
  +        // this test can only succeed in singlevm mode:
  +        if (!BrokerHelper.isRunningInServerMode())
  +        {
  +            assertNotNull(pg);
  +            assertNotNull(cdPg);
  +            assertEquals("ProductGroups should be identical", pg.getRealSubject().toString(), cdPg.getRealSubject().toString());
  +        }
  +
  +    }
  +
  +    /**
  +	 * prefetch Articles for ProductGroupsWithArray, Does not yet work with
  +	 * Arrays
  +	 */
  +    public void testPrefetchedArraySingleKey()
  +    {
  +        ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  +        Class articleProxy = cldArticle.getProxyClass();
  +
  +        //
  +        // use ProductGroup and Articles with disabled Proxy
  +        //
  +        broker.clearCache();
  +        cldArticle.setProxyClassName(null);
  +
  +        Criteria crit = new Criteria();
  +        crit.addLessOrEqualThan("groupId", new Integer(5));
  +        QueryByCriteria q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
           q.addOrderByDescending("groupId");
           q.addPrefetchedRelationship("allArticlesInGroup");
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  -		ProductGroupWithArray pg = (ProductGroupWithArray) results.toArray()[0];
  -		int articleSize = pg.getAllArticles().length;
  -		String articleString = Arrays.asList(pg.getAllArticles()).toString();
  -
  -		//
  -		// use ProductGroupWithArray and Articles with original Proxy settings
  -		//
  -		broker.clearCache();
  -		cldArticle.setProxyClassName(articleProxy.getName());
  -
  -		crit = new Criteria();
  -		crit.addEqualTo("groupId", new Integer(5));
  -		q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
  -		results = broker.getCollectionByQuery(q);
  -		ProductGroupWithArray pg2 = (ProductGroupWithArray) results.toArray()[0];
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
  +        ProductGroupWithArray pg = (ProductGroupWithArray) results.toArray()[0];
  +        int articleSize = pg.getAllArticles().length;
  +        String articleString = Arrays.asList(pg.getAllArticles()).toString();
  +
  +        //
  +        // use ProductGroupWithArray and Articles with original Proxy settings
  +        //
  +        broker.clearCache();
  +        cldArticle.setProxyClassName(articleProxy.getName());
  +
  +        crit = new Criteria();
  +        crit.addEqualTo("groupId", new Integer(5));
  +        q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
  +        results = broker.getCollectionByQuery(q);
  +        ProductGroupWithArray pg2 = (ProductGroupWithArray) results.toArray()[0];
           InterfaceArticle[] articles = pg2.getAllArticles();
   
           // force materialization
  @@ -501,265 +538,261 @@
           {
               articles[i].getArticleName();
           }
  -		int articleSize2 = articles.length;
  -		String articleString2 = Arrays.asList(articles).toString();
  +        int articleSize2 = articles.length;
  +        String articleString2 = Arrays.asList(articles).toString();
   
  -		//
  -		// compare prefetched and 'normal' data
  -		//
  -		assertEquals("Check size", articleSize, articleSize2);
  -		assertEquals("Check content", articleString, articleString2);
  +        //
  +        // compare prefetched and 'normal' data
  +        //
  +        assertEquals("Check size", articleSize, articleSize2);
  +        assertEquals("Check content", articleString, articleString2);
   
  -	}
  +    }
   
  -	/**
  +    /**
   	 * prefetch Articles for ProductGroups
   	 */
  -	public void testPrefetchedCollectionSingleKey()
  -	{
  -		ClassDescriptor cldProductGroup = broker.getClassDescriptor(ProductGroup.class);
  -		ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  -		Class productGroupProxy = cldProductGroup.getProxyClass();
  -		Class articleProxy = cldArticle.getProxyClass();
  -
  -		//
  -		// use ProductGroup and Articles with disabled Proxy
  -		//
  -		broker.clearCache();
  -		cldProductGroup.setProxyClass(null);
  -		cldProductGroup.setProxyClassName(null);
  -		cldArticle.setProxyClass(null);
  -		cldArticle.setProxyClassName(null);
  -		broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  -		broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  -
  -		Criteria crit = new Criteria();
  -		crit.addLessOrEqualThan("groupId", new Integer(5));
  -		QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit);
  +    public void testPrefetchedCollectionSingleKey()
  +    {
  +        ClassDescriptor cldProductGroup = broker.getClassDescriptor(ProductGroup.class);
  +        ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  +        Class productGroupProxy = cldProductGroup.getProxyClass();
  +        Class articleProxy = cldArticle.getProxyClass();
  +
  +        //
  +        // use ProductGroup and Articles with disabled Proxy
  +        //
  +        broker.clearCache();
  +        cldProductGroup.setProxyClass(null);
  +        cldProductGroup.setProxyClassName(null);
  +        cldArticle.setProxyClass(null);
  +        cldArticle.setProxyClassName(null);
  +        broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  +        broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  +
  +        Criteria crit = new Criteria();
  +        crit.addLessOrEqualThan("groupId", new Integer(5));
  +        QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit);
           q.addOrderByDescending("groupId");
           q.addPrefetchedRelationship("allArticlesInGroup");
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		assertNotNull(results);
  -		assertTrue(results.size() > 0);
  -		InterfaceProductGroup pg = (InterfaceProductGroup) results.toArray()[0];
  +        Collection results = broker.getCollectionByQuery(q);
  +        assertNotNull(results);
  +        assertTrue(results.size() > 0);
  +        InterfaceProductGroup pg = (InterfaceProductGroup) results.toArray()[0];
           assertNotNull(pg.getAllArticles());
  -		int articleSize = pg.getAllArticles().size();
  -		String articleString = pg.getAllArticles().toString();
  +        int articleSize = pg.getAllArticles().size();
  +        String articleString = pg.getAllArticles().toString();
   
  -		//
  -		// use ProductGroup and Articles with original Proxy settings
  -		//
  -		broker.clearCache();
  -		cldProductGroup.setProxyClass(productGroupProxy);
  -		cldProductGroup.setProxyClassName(productGroupProxy.getName());
  -		cldArticle.setProxyClass(articleProxy);
  -		cldArticle.setProxyClassName(articleProxy.getName());
  -		broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  -		broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  -
  -
  -		crit = new Criteria();
  -		crit.addEqualTo("groupId", new Integer(5));
  -		q = QueryFactory.newQuery(ProductGroup.class, crit);
  -		results = broker.getCollectionByQuery(q);
  -		InterfaceProductGroup pg2 = (InterfaceProductGroup) results.toArray()[0];
  +        //
  +        // use ProductGroup and Articles with original Proxy settings
  +        //
  +        broker.clearCache();
  +        cldProductGroup.setProxyClass(productGroupProxy);
  +        cldProductGroup.setProxyClassName(productGroupProxy.getName());
  +        cldArticle.setProxyClass(articleProxy);
  +        cldArticle.setProxyClassName(articleProxy.getName());
  +        broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  +        broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  +
  +        crit = new Criteria();
  +        crit.addEqualTo("groupId", new Integer(5));
  +        q = QueryFactory.newQuery(ProductGroup.class, crit);
  +        results = broker.getCollectionByQuery(q);
  +        InterfaceProductGroup pg2 = (InterfaceProductGroup) results.toArray()[0];
           // force materialization
  -        for (Iterator it = pg2.getAllArticles().iterator(); it.hasNext(); )
  +        for (Iterator it = pg2.getAllArticles().iterator(); it.hasNext();)
           {
               ((InterfaceArticle) it.next()).getArticleName();
           }
  -		int articleSize2 = pg2.getAllArticles().size();
  -		String articleString2 = pg2.getAllArticles().toString();
  +        int articleSize2 = pg2.getAllArticles().size();
  +        String articleString2 = pg2.getAllArticles().toString();
   
  -		//
  -		// compare prefetched and 'normal' data
  -		//
  +        //
  +        // compare prefetched and 'normal' data
  +        //
           assertEquals("Check size", articleSize, articleSize2);
           assertEquals("Check content", articleString, articleString2);
  -	}
  +    }
   
  -	/**
  +    /**
   	 * Test nested joins using pathExpressions
   	 */
  -	public void testNestedJoins()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  +    public void testNestedJoins()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(Person.class, crit, true);
  +        Criteria crit = new Criteria();
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Person.class, crit, true);
   
  -		q.setColumns(new String[]{"roles.roleName", "roles.project.title", "firstname", });
  +        q.setColumns(new String[] { "roles.roleName", "roles.project.title", "firstname", });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		assertTrue(list.size() > 0);
  -	}
  +        assertTrue(list.size() > 0);
  +    }
   
  -	/**
  +    /**
   	 * Test multiple non nested joins using pathExpressions
   	 */
  -	public void testMultipleJoins()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  +    public void testMultipleJoins()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(Role.class, crit, true);
  +        Criteria crit = new Criteria();
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Role.class, crit, true);
   
  -		q.setColumns(new String[]{"roleName", "project.title", "person.firstname", });
  +        q.setColumns(new String[] { "roleName", "project.title", "person.firstname", });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		assertTrue(list.size() > 0);
  +        assertTrue(list.size() > 0);
   
  -	}
  +    }
   
  -	/**
  -	 * Test nested joins using pathExpressions
  -	 * *** Fails under hsqldb because of join using multiple keys ***
  +    /**
  +	 * Test nested joins using pathExpressions *** Fails under hsqldb because
  +	 * of join using multiple keys ***
   	 */
  -	public void tesXNestedJoins2()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  +    public void tesXNestedJoins2()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(Task.class, crit);
  +        Criteria crit = new Criteria();
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(Task.class, crit);
   
  -		q.setColumns(new String[]{"role.roleName", "role.project.title", "role.person.firstname", });
  +        q.setColumns(new String[] { "role.roleName", "role.project.title", "role.person.firstname", });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		assertTrue(list.size() > 0);
  +        assertTrue(list.size() > 0);
   
  -	}
  +    }
   
  -	/**
  +    /**
   	 * prefetch ProductGroups for Articles
   	 */
  -	public void testPrefetchedReferencesSingleKey()
  -	{
  -		ClassDescriptor cldProductGroup = broker.getClassDescriptor(ProductGroup.class);
  -		ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  -		Class productGroupProxy = cldProductGroup.getProxyClass();
  -		Class articleProxy = cldArticle.getProxyClass();
  -
  -		//
  -		// use ProductGroup and Articles with disabled Proxy
  -		//
  -		broker.clearCache();
  -		cldProductGroup.setProxyClass(null);
  -		cldProductGroup.setProxyClassName(null);
  -		cldArticle.setProxyClass(null);
  -		cldArticle.setProxyClassName(null);
  -		broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  -		broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  -
  -		Criteria crit = new Criteria();
  -		crit.addNotNull("productGroupId");
  -		crit.addLessOrEqualThan("productGroupId", new Integer(5));
  -		QueryByCriteria q = QueryFactory.newQuery(Article.class, crit);
  +    public void testPrefetchedReferencesSingleKey()
  +    {
  +        ClassDescriptor cldProductGroup = broker.getClassDescriptor(ProductGroup.class);
  +        ClassDescriptor cldArticle = broker.getClassDescriptor(Article.class);
  +        Class productGroupProxy = cldProductGroup.getProxyClass();
  +        Class articleProxy = cldArticle.getProxyClass();
  +
  +        //
  +        // use ProductGroup and Articles with disabled Proxy
  +        //
  +        broker.clearCache();
  +        cldProductGroup.setProxyClass(null);
  +        cldProductGroup.setProxyClassName(null);
  +        cldArticle.setProxyClass(null);
  +        cldArticle.setProxyClassName(null);
  +        broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  +        broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  +
  +        Criteria crit = new Criteria();
  +        crit.addNotNull("productGroupId");
  +        crit.addLessOrEqualThan("productGroupId", new Integer(5));
  +        QueryByCriteria q = QueryFactory.newQuery(Article.class, crit);
           q.addOrderByDescending("productGroupId");
           q.addPrefetchedRelationship("productGroup");
   
  -		Collection results = broker.getCollectionByQuery(q);
  -		Set pgs = new HashSet();
  -		Iterator iter = results.iterator();
  -		while (iter.hasNext())
  -		{
  -			InterfaceArticle a = (InterfaceArticle) iter.next();
  -			pgs.add(a.getProductGroup().getName());
  -		}
  -
  -		assertTrue(pgs.size() > 0);
  -		String pgsString = pgs.toString();
  -
  -		//
  -		// use ProductGroup and Articles with original Proxy settings
  -		//
  -		broker.clearCache();
  -		cldProductGroup.setProxyClass(productGroupProxy);
  -		cldProductGroup.setProxyClassName(productGroupProxy.getName());
  -		cldArticle.setProxyClass(articleProxy);
  -		cldArticle.setProxyClassName(articleProxy.getName());
  -		broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  -		broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  -
  -
  -		crit = new Criteria();
  -		crit.addNotNull("productGroupId");
  -		crit.addLessOrEqualThan("productGroupId", new Integer(5));
  -		q = QueryFactory.newQuery(Article.class, crit);
  +        Collection results = broker.getCollectionByQuery(q);
  +        Set pgs = new HashSet();
  +        Iterator iter = results.iterator();
  +        while (iter.hasNext())
  +        {
  +            InterfaceArticle a = (InterfaceArticle) iter.next();
  +            pgs.add(a.getProductGroup().getName());
  +        }
  +
  +        assertTrue(pgs.size() > 0);
  +        String pgsString = pgs.toString();
  +
  +        //
  +        // use ProductGroup and Articles with original Proxy settings
  +        //
  +        broker.clearCache();
  +        cldProductGroup.setProxyClass(productGroupProxy);
  +        cldProductGroup.setProxyClassName(productGroupProxy.getName());
  +        cldArticle.setProxyClass(articleProxy);
  +        cldArticle.setProxyClassName(articleProxy.getName());
  +        broker.getDescriptorRepository().setClassDescriptor(cldProductGroup);
  +        broker.getDescriptorRepository().setClassDescriptor(cldArticle);
  +
  +        crit = new Criteria();
  +        crit.addNotNull("productGroupId");
  +        crit.addLessOrEqualThan("productGroupId", new Integer(5));
  +        q = QueryFactory.newQuery(Article.class, crit);
           q.addOrderByDescending("productGroupId");
   
  -		results = broker.getCollectionByQuery(q);
  -		Set pgs2 = new HashSet();
  -		iter = results.iterator();
  -		while (iter.hasNext())
  -		{
  -			InterfaceArticle a = (InterfaceArticle) iter.next();
  -			pgs2.add(a.getProductGroup().getName());
  -		}
  -
  -		assertTrue(pgs2.size() > 0);
  -		String pgsString2 = pgs2.toString();
  -
  -		//
  -		// compare prefetched and 'normal' data
  -		//
  -		assertEquals("Check size", pgs.size(), pgs2.size());
  -		assertEquals("Check content", pgsString, pgsString2);
  +        results = broker.getCollectionByQuery(q);
  +        Set pgs2 = new HashSet();
  +        iter = results.iterator();
  +        while (iter.hasNext())
  +        {
  +            InterfaceArticle a = (InterfaceArticle) iter.next();
  +            pgs2.add(a.getProductGroup().getName());
  +        }
   
  -	}
  +        assertTrue(pgs2.size() > 0);
  +        String pgsString2 = pgs2.toString();
  +
  +        //
  +        // compare prefetched and 'normal' data
  +        //
  +        assertEquals("Check size", pgs.size(), pgs2.size());
  +        assertEquals("Check content", pgsString, pgsString2);
  +
  +    }
   
  -	/**
  +    /**
   	 * test PathExpression pointing to abstract class (InterfaceArticle)
   	 */
  -	public void tesXReportPathExpressionAbstractExtent()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  -
  +    public void tesXReportPathExpressionAbstractExtent()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("groupId", new Integer(5));
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("groupId", new Integer(5));
   
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroupWithAbstractArticles.class, crit, true);
  -		q.setColumns(new String[]{"groupId", "groupName", "allArticlesInGroup.articleId", "allArticlesInGroup.articleName"});
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroupWithAbstractArticles.class, crit, true);
  +        q.setColumns(new String[] { "groupId", "groupName", "allArticlesInGroup.articleId", "allArticlesInGroup.articleName" });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		// 7 Articles, 2 Books, 3 Cds
  -		//	assertEquals("check size", list.size(), 12);
  -		//
  -		//  BRJ: path expression is not yet extent aware
  +        // 7 Articles, 2 Books, 3 Cds
  +        //	assertEquals("check size", list.size(), 12);
  +        //
  +        //  BRJ: path expression is not yet extent aware
   
  -		assertEquals("check size", list.size(), 7);
  +        assertEquals("check size", list.size(), 7);
   
  -	}
  +    }
   
       /**
  -     * test PathExpression pointing to abstract class (InterfaceArticle)
  -     */
  +	 * test PathExpression pointing to abstract class (InterfaceArticle)
  +	 */
       public void testPathExpressionForAbstractExtent()
       {
           ArrayList list = new java.util.ArrayList();
   
  -
           Criteria crit = new Criteria();
           crit.addLike("allArticlesInGroup.articleName", "Chef%");
           Criteria crit1 = new Criteria();
  @@ -768,93 +801,92 @@
   
           QueryByCriteria q = QueryFactory.newQuery(ProductGroupWithAbstractArticles.class, crit, true);
           q.addOrderByAscending("groupId");
  -        
  +
           Iterator iter = broker.getIteratorByQuery(q);
           while (iter.hasNext())
           {
               list.add(iter.next());
           }
   
  -        // Groups 2, 5   
  +        // Groups 2, 5
           assertEquals("check size", list.size(), 2);
   
  -        assertEquals("Group 2",((InterfaceProductGroup)list.get(0)).getId(), 2);
  -        assertEquals("Group 5",((InterfaceProductGroup)list.get(1)).getId(), 5);
  +        assertEquals("Group 2", ((InterfaceProductGroup) list.get(0)).getId(), 2);
  +        assertEquals("Group 5", ((InterfaceProductGroup) list.get(1)).getId(), 5);
       }
   
  -	/**
  +    /**
   	 * Test pathExpression and Extents
   	 */
  -	public void testReportPathExpressionForExtents1()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  -
  +    public void testReportPathExpressionForExtents1()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		crit.addGreaterOrEqualThan("allArticlesInGroup.articleId", new Integer(75));
  +        Criteria crit = new Criteria();
  +        crit.addGreaterOrEqualThan("allArticlesInGroup.articleId", new Integer(75));
   
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit,true);
  -		q.setColumns(new String[]{"groupId", "groupName"});
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit, true);
  +        q.setColumns(new String[] { "groupId", "groupName" });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		// Groups: 1, 2, 5
  -		assertEquals("check size", list.size(), 3);
  -	}
  +        // Groups: 1, 2, 5
  +        assertEquals("check size", list.size(), 3);
  +    }
   
       /**
  -     * Test pathExpression and Extents
  -     */
  -	public void testReportPathExpressionForExtents2()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  +	 * Test pathExpression and Extents
  +	 */
  +    public void testReportPathExpressionForExtents2()
  +    {
  +        ArrayList list = new java.util.ArrayList();
   
  -		Criteria crit = new Criteria();
  -		crit.addLike("groupName", "%o%");
  -		crit.addLike("allArticlesInGroup.articleName", "%�%");
  +        Criteria crit = new Criteria();
  +        crit.addLike("groupName", "%o%");
  +        crit.addLike("allArticlesInGroup.articleName", "%�%");
   
  -		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit, true);
  -		q.setColumns(new String[] { "groupId", "groupName" });
  +        ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit, true);
  +        q.setColumns(new String[] { "groupId", "groupName" });
   
  -		Iterator iter = broker.getReportQueryIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +        Iterator iter = broker.getReportQueryIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
  -		// Groups: 3 Books , 1 Dairy Product
  -		assertEquals("check size", list.size(), 2);
  -	}
  +        // Groups: 3 Books , 1 Dairy Product
  +        assertEquals("check size", list.size(), 2);
  +    }
   
  -	/**
  +    /**
   	 * Test pathExpression and Extents
   	 */
  -	public void testPathExpressionForExtents1()
  -	{
  -		ArrayList list = new java.util.ArrayList();
  -
  -		Criteria crit = new Criteria();
  -		crit.addEqualTo("allArticlesInGroup.productGroupId", new Integer(5));
  -
  -		Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
  -
  -		Iterator iter = broker.getIteratorByQuery(q);
  -		while (iter.hasNext())
  -		{
  -			list.add(iter.next());
  -		}
  +    public void testPathExpressionForExtents1()
  +    {
  +        ArrayList list = new java.util.ArrayList();
  +
  +        Criteria crit = new Criteria();
  +        crit.addEqualTo("allArticlesInGroup.productGroupId", new Integer(5));
  +
  +        Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
  +
  +        Iterator iter = broker.getIteratorByQuery(q);
  +        while (iter.hasNext())
  +        {
  +            list.add(iter.next());
  +        }
   
           // ProductGroup 5
  -		assertEquals("check size", list.size(), 1);
  -	}
  +        assertEquals("check size", list.size(), 1);
  +    }
   
       /**
  -     * Test pathExpression and Extents
  -     */
  +	 * Test pathExpression and Extents
  +	 */
       public void testPathExpressionForExtents2()
       {
           ArrayList list = new java.util.ArrayList();
  @@ -876,9 +908,8 @@
       }
   
       /**
  -     * Test pathExpression and Extents
  -     * musicians is only defined in CD
  -     */
  +	 * Test pathExpression and Extents musicians is only defined in CD
  +	 */
       public void testPathExpressionForExtents3()
       {
           ArrayList list = new java.util.ArrayList();
  @@ -887,7 +918,7 @@
           crit.addLike("allArticlesInGroup.musicians", "%");
   
           QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit, true);
  -        q.setPathClass("allArticlesInGroup",CdArticle.class);
  +        q.setPathClass("allArticlesInGroup", CdArticle.class);
   
           Iterator iter = broker.getIteratorByQuery(q);
           while (iter.hasNext())
  @@ -900,8 +931,8 @@
       }
   
       /**
  -     * Test pathExpression and Extents Abstract Base
  -     */
  +	 * Test pathExpression and Extents Abstract Base
  +	 */
       public void testPathExpressionForExtents4()
       {
           ArrayList list = new java.util.ArrayList();
  @@ -922,8 +953,8 @@
       }
   
       /**
  -     * Test pathExpression and Extents using Alias
  -     */
  +	 * Test pathExpression and Extents using Alias
  +	 */
       public void testPathExpressionForExtentsAlias()
       {
           ArrayList list = new java.util.ArrayList();
  @@ -948,76 +979,68 @@
           assertEquals("check size", list.size(), 1);
       }
   
  -
       /**
  -     * Run a query range test that includes one record less than the
  -     * total number of records that exist.
  -     */
  -    public void testQueryRangeOneLessThanTotal() {
  +	 * Run a query range test that includes one record less than the total
  +	 * number of records that exist.
  +	 */
  +    public void testQueryRangeOneLessThanTotal()
  +    {
           this.runQueryRangeTest(-1);
       }
   
       /**
  -     * Run a query range test that includes all of the records that exist.
  -     */
  -    public void testQueryRangeAllRecords() {
  +	 * Run a query range test that includes all of the records that exist.
  +	 */
  +    public void testQueryRangeAllRecords()
  +    {
           this.runQueryRangeTest(0);
       }
   
       /**
  -     * Run a query range test that includes one record more than the
  -     * total number of records that exist.
  -     */
  -    public void testQueryRangeOneMoreThanTotal() {
  +	 * Run a query range test that includes one record more than the total
  +	 * number of records that exist.
  +	 */
  +    public void testQueryRangeOneMoreThanTotal()
  +    {
           this.runQueryRangeTest(+1);
       }
   
       /**
  -     * Run a query range test.
  -     *
  -     * @param delta the amount to add to the existing record count when
  -     *      setting the start/end index for the query that we'll use.
  -     */
  -    private void runQueryRangeTest(int delta) {
  +	 * Run a query range test.
  +	 * 
  +	 * @param delta
  +	 *            the amount to add to the existing record count when setting
  +	 *            the start/end index for the query that we'll use.
  +	 */
  +    private void runQueryRangeTest(int delta)
  +    {
   
           // How many records are there in the table?
  -        Query countQuery =
  -            QueryFactory.newQuery(ProductGroup.class,
  -                                  null,
  -                                  false);
  +        Query countQuery = QueryFactory.newQuery(ProductGroup.class, null, false);
   
           // Get the existing record count
  -        int recordCount =
  -            broker.getCollectionByQuery(countQuery)
  -                  .toArray()
  -                  .length;
  +        int recordCount = broker.getCollectionByQuery(countQuery).toArray().length;
   
           // Build a query that will get the range we're looking for.
  -        Query listQuery =
  -            QueryFactory.newQuery(ProductGroup.class,
  -                                  null,
  -                                  false);
  -        listQuery.setStartAtIndex(0);
  +        Query listQuery = QueryFactory.newQuery(ProductGroup.class, null, false);
  +        listQuery.setStartAtIndex(1);
           listQuery.setEndAtIndex(recordCount + delta);
   
           // Get the list.
  -        Object[] theObjects =
  -            broker.getCollectionByQuery(listQuery)
  -                  .toArray();
  +        Object[] theObjects = broker.getCollectionByQuery(listQuery).toArray();
   
           // Verify the record count
  -        if (delta <= 0) {
  -            assertEquals("record count",
  -                              (recordCount + delta),
  -                              theObjects.length);
  -        } else {
  -            assertEquals("record count",
  -                              recordCount,
  -                              theObjects.length);
  +        if (delta <= 0)
  +        {
  +            assertEquals("record count", (recordCount + delta), theObjects.length);
  +        }
  +        else
  +        {
  +            assertEquals("record count", recordCount, theObjects.length);
           }
   
           // Verify the query size
  -        assertEquals("Query size",recordCount,listQuery.fullSize());
  +        assertEquals("Query size", recordCount, listQuery.fullSize());
       }
   
       public void testQueryMN_Alias1() throws Exception
  @@ -1026,17 +1049,17 @@
           Criteria crit2 = new Criteria();
           QueryByCriteria q;
           Collection result;
  -        
  +
           broker.clearCache();
   
           // get persons working for projects OJB and SODA
  -        crit1.addLike("projects.title","OJB%");   
  -        crit1.setAlias("alias1");    
  -        crit2.addLike("projects.title","SODA%");       
  +        crit1.addLike("projects.title", "OJB%");
  +        crit1.setAlias("alias1");
  +        crit2.addLike("projects.title", "SODA%");
           crit2.setAlias("alias2");
           crit1.addAndCriteria(crit2);
  -            
  -        q = QueryFactory.newQuery(Person.class, crit1,true);
  +
  +        q = QueryFactory.newQuery(Person.class, crit1, true);
           result = broker.getCollectionByQuery(q);
           assertNotNull(result);
           assertTrue(result.size() == 2); // bob, tom
  @@ -1049,25 +1072,25 @@
           QueryByCriteria q;
           Collection result1;
           Collection result2;
  -        
  +
           broker.clearCache();
   
           // get persons working for projects OJB (alias should have no effect)
  -        crit1.setAlias("myAlias");    
  +        crit1.setAlias("myAlias");
           crit1.addLike("firstname", "%o%");
  -        crit1.addLike("projects.title","OJB%");       
  -            
  -        q = QueryFactory.newQuery(Person.class, crit1,true);
  +        crit1.addLike("projects.title", "OJB%");
  +
  +        q = QueryFactory.newQuery(Person.class, crit1, true);
           result1 = broker.getCollectionByQuery(q);
           assertNotNull(result1);
           assertTrue(result1.size() == 2); // bob, tom
   
           // WITHOUT ALIAS
  -        // get persons working for projects OJB 
  +        // get persons working for projects OJB
           crit2.addLike("firstname", "%o%");
  -        crit2.addLike("projects.title","OJB%");       
  -            
  -        q = QueryFactory.newQuery(Person.class, crit2,true);
  +        crit2.addLike("projects.title", "OJB%");
  +
  +        q = QueryFactory.newQuery(Person.class, crit2, true);
           result2 = broker.getCollectionByQuery(q);
           assertNotNull(result2);
           assertTrue(result2.size() == 2); // bob, tom
  @@ -1080,15 +1103,15 @@
           Criteria crit2 = new Criteria();
           QueryByCriteria q;
           Collection result;
  -        
  +
           broker.clearCache();
   
           // get persons working for projects OJB _or_ SODA
  -        crit1.addLike("projects.title","OJB%");   
  -        crit2.addLike("projects.title","SODA%");       
  +        crit1.addLike("projects.title", "OJB%");
  +        crit2.addLike("projects.title", "SODA%");
           crit1.addOrCriteria(crit2);
  -            
  -        q = QueryFactory.newQuery(Person.class, crit1,true);
  +
  +        q = QueryFactory.newQuery(Person.class, crit1, true);
           result = broker.getCollectionByQuery(q);
           assertNotNull(result);
           assertTrue(result.size() == 5); // bob, tom, cindy, albert ,betrand
  
  
  

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