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 Wed, 05 Nov 2003 19:50:11 GMT
brj         2003/11/05 11:50:11

  Modified:    src/test/org/apache/ojb/broker QueryTest.java
  Log:
  added testPathExpressionForAbstractExtent
  
  Revision  Changes    Path
  1.39      +32 -3     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.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- QueryTest.java	26 Oct 2003 00:03:21 -0000	1.38
  +++ QueryTest.java	5 Nov 2003 19:50:11 -0000	1.39
  @@ -724,10 +724,9 @@
   	}
   
   	/**
  -	 * test PathExpression pointing to abstract class
  -	 * BRJ: throws a NullPointerException
  +	 * test PathExpression pointing to abstract class (InterfaceArticle)
   	 */
  -	public void tesXPathExpressionAbstract()
  +	public void tesXReportPathExpressionAbstractExtent()
   	{
   		ArrayList list = new java.util.ArrayList();
   
  @@ -752,6 +751,36 @@
   		assertEquals("check size", list.size(), 7);
   
   	}
  +
  +    /**
  +     * 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();
  +        crit1.addEqualTo("allArticlesInGroup.articleName", "Faust");
  +        crit.addOrCriteria(crit1);
  +
  +        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   
  +        assertEquals("check size", list.size(), 2);
  +
  +        assertEquals("Group 2",((InterfaceProductGroup)list.get(0)).getId(), 2);
  +        assertEquals("Group 5",((InterfaceProductGroup)list.get(1)).getId(), 5);
  +    }
   
   	/**
   	 * Test pathExpression and Extents
  
  
  

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