summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-04-14 14:09:45 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-04-14 14:09:45 +0000
commitb68490c5042ec1c4c701a79b5bec42c3b9b53266 (patch)
tree05302e22f43dd3e34d3226cde0958d3df01762e0 /src/test
parent718538484ac934f2d41f387baed8e145de8034c7 (diff)
Added "after" method and removed fetchAfter slice method.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/amazon/carbonado/TestStorables.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/TestStorables.java b/src/test/java/com/amazon/carbonado/TestStorables.java
index 5073ef8..f1e1dec 100644
--- a/src/test/java/com/amazon/carbonado/TestStorables.java
+++ b/src/test/java/com/amazon/carbonado/TestStorables.java
@@ -2404,6 +2404,50 @@ public class TestStorables extends TestCase {
assertEquals(total, actual);
+ // Try using "after" method and additional filtering.
+
+ orderBy = new String[] {"a", "b", "c", "d", "e", "f"};
+ query = storage.query().orderBy(orderBy);
+ {
+ ManyKeys2 obj = storage.prepare();
+ obj.setA(0);
+ obj.setB(1);
+ obj.setC(2);
+ query = query.after(obj);
+ }
+ query = query.and("d = ?").with(3);
+
+ cursor = query.fetch();
+
+ actual = 0;
+ last = null;
+ while (cursor.hasNext()) {
+ actual++;
+ ManyKeys2 obj = cursor.next();
+ if (last != null) {
+ assertTrue(comparator.compare(last, obj) < 0);
+ }
+ last = obj;
+ }
+
+ assertEquals(928, actual);
+
+ // Try not after.
+
+ orderBy = new String[] {"a", "b", "c", "d", "e", "f"};
+ query = storage.query().orderBy(orderBy);
+ {
+ ManyKeys2 obj = storage.prepare();
+ obj.setA(0);
+ obj.setB(1);
+ obj.setC(2);
+ query = query.after(obj);
+ }
+ long count = query.count();
+ long ncount = query.not().count();
+
+ assertEquals(total, count + ncount);
+
// Try again with funny mix of orderings. This will likely cause sort
// operations to be performed, thus making it very slow.