db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker QueryTest.java
Date Sat, 15 Mar 2003 17:03:50 GMT
brj         2003/03/15 09:03:50

  Modified:    src/test/org/apache/ojb/broker QueryTest.java
  Log:
  Query refactoring
  
  Revision  Changes    Path
  1.23      +12 -12    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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- QueryTest.java	1 Mar 2003 20:53:39 -0000	1.22
  +++ QueryTest.java	15 Mar 2003 17:03:50 -0000	1.23
  @@ -296,7 +296,7 @@
   		crit.addEqualTo("productGroup.groupName", "Liquors");
   		ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
   		q.setColumns(new String[]{"articleId", "articleName", "price"});
  -		crit.addOrderByAscending("price");
  +		q.addOrderByAscending("price");
   
   		Iterator iter = broker.getReportQueryIteratorByQuery(q);
   		assertNotNull(iter);
  @@ -319,7 +319,7 @@
   		ReportQueryByCriteria q = QueryFactory.newReportQuery(ProductGroup.class, crit);
   		q.setColumns(
   				new String[]{"groupName", "sum(allArticlesInGroup.stock)", "sum(allArticlesInGroup.price)"});
  -		crit.addGroupBy("groupName");
  +		q.addGroupBy("groupName");
   
   		Iterator iter = broker.getReportQueryIteratorByQuery(q);
   		assertNotNull(iter);
  @@ -384,9 +384,9 @@
   
   		Criteria crit = new Criteria();
   		crit.addLessOrEqualThan("groupId", new Integer(5));
  -		crit.addOrderByDescending("groupId");
  -		crit.addPrefetchedRelationship("allArticlesInGroup");
  -		Query q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
  +		QueryByCriteria q = QueryFactory.newQuery(ProductGroupWithArray.class, crit);
  +        q.addOrderByDescending("groupId");
  +        q.addPrefetchedRelationship("allArticlesInGroup");
   
   		Collection results = broker.getCollectionByQuery(q);
   		assertNotNull(results);
  @@ -441,9 +441,9 @@
   
   		Criteria crit = new Criteria();
   		crit.addLessOrEqualThan("groupId", new Integer(5));
  -		crit.addOrderByDescending("groupId");
  -		crit.addPrefetchedRelationship("allArticlesInGroup");
  -		Query q = QueryFactory.newQuery(ProductGroup.class, crit);
  +		QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit);
  +        q.addOrderByDescending("groupId");
  +        q.addPrefetchedRelationship("allArticlesInGroup");
   
   		Collection results = broker.getCollectionByQuery(q);
   		assertNotNull(results);
  @@ -569,9 +569,9 @@
   		Criteria crit = new Criteria();
   		crit.addNotNull("productGroupId");
   		crit.addLessOrEqualThan("productGroupId", new Integer(5));
  -		crit.addOrderByDescending("productGroupId");
  -		crit.addPrefetchedRelationship("productGroup");
  -		Query q = QueryFactory.newQuery(Article.class, crit);
  +		QueryByCriteria q = QueryFactory.newQuery(Article.class, crit);
  +        q.addOrderByDescending("productGroupId");
  +        q.addPrefetchedRelationship("productGroup");
   
   		Collection results = broker.getCollectionByQuery(q);
   		Set pgs = new HashSet();
  @@ -600,8 +600,8 @@
   		crit = new Criteria();
   		crit.addNotNull("productGroupId");
   		crit.addLessOrEqualThan("productGroupId", new Integer(5));
  -		crit.addOrderByDescending("productGroupId");
   		q = QueryFactory.newQuery(Article.class, crit);
  +        q.addOrderByDescending("productGroupId");
   
   		results = broker.getCollectionByQuery(q);
   		Set pgs2 = new HashSet();
  
  
  

Mime
View raw message