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/02/19 19:20:08 UTC

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

brj         2003/02/19 10:20:08

  Modified:    src/test/org/apache/ojb/broker QueryTest.java
  Log:
  testcase for extent aware reports
  
  Revision  Changes    Path
  1.21      +25 -7     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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- QueryTest.java	1 Feb 2003 15:36:26 -0000	1.20
  +++ QueryTest.java	19 Feb 2003 18:20:08 -0000	1.21
  @@ -656,7 +656,7 @@
   	/**
   	 * Test pathExpression and Extents
   	 */
  -	public void testReportPathExpressionForExtents()
  +	public void testReportPathExpressionForExtents1()
   	{
   		ArrayList list = new java.util.ArrayList();
   
  @@ -674,12 +674,31 @@
   		}
   
   		// 7 Articles, 2 Books, 3 Cds
  -		//	assertEquals("check size", list.size(), 12);
  -		//
  -		//  BRJ: path expression is not yet extent aware for columns
  -
   		assertEquals("check size", list.size(), 7);
  +	}
  +
  +    /**
  +     * 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", "%�%");
   
  +		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.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());
  +		}
  +
  +		// 3 Books , 1 Dairy Product 
  +		assertEquals("check size", list.size(), 4);
   	}
   
   	/**
  @@ -702,7 +721,6 @@
   
           // ProductGroup 5
   		assertEquals("check size", list.size(), 1);
  -
   	}
   
       /**
  @@ -713,7 +731,7 @@
           ArrayList list = new java.util.ArrayList();
   
           Criteria crit = new Criteria();
  -        crit.addLike("allArticlesInGroup.articleName", "F%");
  +        crit.addLike("upper(allArticlesInGroup.articleName)", "F%");
   
           Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);