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/20 20:47:47 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/broker PersistenceBrokerTest.java
brj 2003/11/20 11:47:47
Modified: src/test/org/apache/ojb/broker PersistenceBrokerTest.java
Log:
testcase paging with startAt == endAt
Revision Changes Path
1.33 +14 -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.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- PersistenceBrokerTest.java 17 Nov 2003 20:30:42 -0000 1.32
+++ PersistenceBrokerTest.java 20 Nov 2003 19:47:47 -0000 1.33
@@ -9,6 +9,7 @@
import junit.framework.TestCase;
import org.apache.commons.lang.SerializationUtils;
+import org.apache.ojb.broker.accesslayer.OJBIterator;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.query.Criteria;
import org.apache.ojb.broker.query.Query;
@@ -716,7 +717,7 @@
// 4. check if all items are found
col = broker.getCollectionByQuery(query);
- assertEquals("size of collection should be three", 4, col.size());
+ assertEquals("size of collection should be four", 4, col.size());
iter = col.iterator();
int itemNumberCheck = 5002;
while (iter.hasNext())
@@ -726,6 +727,18 @@
assertEquals("should be same value - id number", itemNumberCheck, testIa.getArticleId());
itemNumberCheck++;
}
+
+ // read one item only
+ // 1. set query start equals end
+ query.setStartAtIndex(4);
+ query.setEndAtIndex(4);
+
+ // 2. check if only one item is found
+ OJBIterator ojbIter = (OJBIterator)broker.getIteratorByQuery(query);
+ assertEquals("size of iterator should be one", 1, ojbIter.size());
+ InterfaceArticle test4 = (InterfaceArticle) ojbIter.next();
+ assertEquals("should be same value - id number", 5004, test4.getArticleId());
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org