You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/04/19 14:59:01 UTC
[44/50] [abbrv] ignite git commit: ignite-db - rnd test
ignite-db - rnd test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ef9b0419
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ef9b0419
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ef9b0419
Branch: refs/heads/ignite-db-x-10884
Commit: ef9b04199b8cd4b93043e084ada531ee8b920e77
Parents: 26314b8
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Apr 18 04:32:46 2016 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Apr 18 04:32:46 2016 +0300
----------------------------------------------------------------------
.../IgniteDbSingleNodePutGetSelfTest.java | 41 ++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9b0419/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 cbb12e7..a25a47d 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
@@ -478,6 +478,47 @@ public class IgniteDbSingleNodePutGetSelfTest extends GridCommonAbstractTest {
}
}
+ public void testRandomPutGetRemove() {
+ IgniteEx ig = grid(0);
+
+ final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+
+ int cnt = 100_000;
+
+ Map<Integer, DbValue> map = new HashMap<>(cnt);
+
+ Random rnd = new GridRandom();
+
+ for (int i = 0 ; i < 500_000; i++) {
+ if (i % 5000 == 0)
+ X.println(" --> " + i);
+
+ int key = rnd.nextInt(cnt);
+
+ DbValue v0 = new DbValue(key, "test-value-" + rnd.nextInt(200), rnd.nextInt(500));
+
+ switch (rnd.nextInt(3)) {
+ case 0:
+ assertEquals(map.put(key, v0), cache.getAndPut(key, v0));
+
+ case 1:
+ assertEquals(map.get(key), cache.get(key));
+
+ break;
+
+ case 2:
+ assertEquals(map.remove(key), cache.getAndRemove(key));
+
+ assertNull(cache.get(key));
+ }
+ }
+
+// assertEquals(map.size(), cache.size(CachePeekMode.ALL));
+
+ for (Integer key : map.keySet())
+ assertEquals(map.get(key), cache.get(key));
+ }
+
public void testPutGetRemoveMultipleBackward() throws Exception {
IgniteEx ig = grid(0);