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/01/19 12:49:43 UTC
cvs commit: jakarta-ojb/src/test/org/apache/ojb/broker QueryTest.java
brj 2003/01/19 03:49:43
Modified: src/test/org/apache/ojb/broker QueryTest.java
Log:
testcases for extent aware path expressions
Revision Changes Path
1.19 +26 -11 jakarta-ojb/src/test/org/apache/ojb/broker/QueryTest.java
Index: QueryTest.java
===================================================================
RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/broker/QueryTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- QueryTest.java 14 Jan 2003 11:16:20 -0000 1.18
+++ QueryTest.java 19 Jan 2003 11:49:43 -0000 1.19
@@ -336,8 +336,6 @@
*/
public void testInversePathExpression()
{
-
-
QueryByCriteria query;
Criteria crit;
CdArticle cd;
@@ -687,7 +685,7 @@
/**
* Test pathExpression and Extents
*/
- public void testPathExpressionForExtents()
+ public void testPathExpressionForExtents1()
{
ArrayList list = new java.util.ArrayList();
@@ -702,16 +700,33 @@
list.add(iter.next());
}
- // BRJ : should return 1 product group
- // returns 3 because of implementation of extent aware path expression
- //
- // SQL: SELECT DISTINCT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM Kategorien A0 INNER JOIN Artikel A1 ON A0.Kategorie_Nr=A1.Kategorie_Nr WHERE A1.Kategorie_Nr = ?
- // SQL: SELECT DISTINCT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM Kategorien A0 INNER JOIN BOOKS A1 ON A0.Kategorie_Nr=A1.Kategorie_Nr WHERE A1.Kategorie_Nr = ?
- // SQL: SELECT DISTINCT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM Kategorien A0 INNER JOIN CDS A1 ON A0.Kategorie_Nr=A1.Kategorie_Nr WHERE A1.Kategorie_Nr = ?
-
- assertEquals("check size", list.size(), 3);
+ // ProductGroup 5
+ assertEquals("check size", list.size(), 1);
}
+
+ /**
+ * Test pathExpression and Extents
+ */
+ public void testPathExpressionForExtents2()
+ {
+ ArrayList list = new java.util.ArrayList();
+
+ Criteria crit = new Criteria();
+ crit.addLike("allArticlesInGroup.articleName", "F%");
+
+ Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
+
+ Iterator iter = broker.getIteratorByQuery(q);
+ while (iter.hasNext())
+ {
+ list.add(iter.next());
+ }
+
+ // ProductGroups 4 and 5
+ assertEquals("check size", list.size(), 2);
+
+ }
/**
* Run a query range test that includes one record less than the