Added test.

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/823fabd9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/823fabd9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/823fabd9

Branch: refs/heads/ignite-db-x-10884
Commit: 823fabd94052fd04e748faffa42e7417c3024663
Parents: bb79688
Author: Alexey Goncharuk <[email protected]>
Authored: Mon Apr 25 16:37:47 2016 -0700
Committer: Alexey Goncharuk <[email protected]>
Committed: Mon Apr 25 16:37:47 2016 -0700

----------------------------------------------------------------------
 .../IgniteDbSingleNodePutGetSelfTest.java       | 58 +++++++++++++++++++-
 1 file changed, 56 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/823fabd9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
index 7b7d791..1bb95fa 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
@@ -274,6 +274,62 @@ public class IgniteDbSingleNodePutGetSelfTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception if failed.
      */
+    public void testBounds() throws Exception {
+        IgniteEx ig = grid(0);
+
+        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+
+        X.println("Put start");
+
+        int cnt = 1000;
+
+        try (IgniteDataStreamer<Integer, DbValue> st = ig.dataStreamer(null)) {
+            st.allowOverwrite(true);
+
+            for (int i = 0; i < cnt; i++) {
+                int k = 2 * i;
+
+                DbValue v0 = new DbValue(k, "test-value", k);
+
+                st.addData(k, v0);
+            }
+        }
+
+        X.println("Get start");
+
+        for (int i = 0; i < cnt; i++) {
+            int k = 2 * i;
+
+            DbValue v0 = new DbValue(k, "test-value", k);
+
+            assertEquals(v0, cache.get(k));
+        }
+
+        awaitPartitionMapExchange();
+
+        X.println("Query start");
+
+        // Make sure to cover multiple pages.
+        int limit = 500;
+
+        for (int i = 0; i < limit; i++) {
+            List<List<?>> res = cache.query(new SqlFieldsQuery("select ival, 
_val from dbvalue where ival < ? order by ival")
+                .setArgs(i)).getAll();
+
+            // 0 => 0, 1 => 1, 2=>1,...
+            assertEquals((i + 1) / 2, res.size());
+
+            res = cache.query(new SqlFieldsQuery("select ival, _val from 
dbvalue where ival <= ? order by ival")
+                .setArgs(i)).getAll();
+
+            // 0 => 1, 1 => 1, 2=>2,...
+            assertEquals(i / 2 + 1, res.size());
+        }
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
     public void testMultithreadedPut() throws Exception {
         IgniteEx ig = grid(0);
 
@@ -331,8 +387,6 @@ public class IgniteDbSingleNodePutGetSelfTest extends 
GridCommonAbstractTest {
             "explain select lval from dbvalue where ival >= 5000 and ival < 
7000")).getAll().get(0).get(0).toString();
 
         assertTrue(plan, plan.contains("iVal_idx"));
-
-        cache.clear();
     }
 
     /**

Reply via email to