ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [26/50] [abbrv] incubator-ignite git commit: IGNITE-96 - Fixing tests.
Date Thu, 12 Feb 2015 09:44:51 GMT
IGNITE-96 - Fixing tests.


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

Branch: refs/heads/sprint-1
Commit: 7096bf2d152d326b05cbb876a322c05edcc1366e
Parents: b15cf5e
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Tue Feb 10 19:02:10 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Tue Feb 10 19:02:10 2015 -0800

----------------------------------------------------------------------
 .../GridCacheGroupLockAbstractSelfTest.java     |  8 +--
 .../GridCacheClientModesAbstractSelfTest.java   | 71 ++++++++++----------
 ...CacheReplicatedPreloadLifecycleSelfTest.java |  8 +--
 .../GridCacheReplicatedPreloadSelfTest.java     | 19 +++---
 4 files changed, 51 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7096bf2d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
index 9534e4a..890137e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
@@ -1041,7 +1041,7 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
 
             fail("Exception should be thrown.");
         }
-        catch (IgniteException ignored) {
+        catch (CacheException ignored) {
             // Expected exception.
         }
 
@@ -1305,15 +1305,15 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
         }
 
         /** {@inheritDoc} */
-        @Override public void writeAll(Collection<javax.cache.Cache.Entry<?, ?>>
entries) {
-            for (javax.cache.Cache.Entry<?, ?> e : entries)
+        @Override public void writeAll(Collection<Cache.Entry<?, ?>> entries)
{
+            for (Cache.Entry<?, ?> e : entries)
                 storeMap.put(e.getKey(), e.getValue());
 
             putCnt.incrementAndGet();
         }
 
         /** {@inheritDoc} */
-        @Override public void write(javax.cache.Cache.Entry<?, ?> e) {
+        @Override public void write(Cache.Entry<?, ?> e) {
             storeMap.put(e.getKey(), e.getValue());
 
             putCnt.incrementAndGet();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7096bf2d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
index 0da8b11..d0b86c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
@@ -148,42 +148,41 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
      * @throws Exception If failed.
      */
     public void testNearOnlyAffinity() throws Exception {
-        assert false;
-//        for (int i = 0; i < gridCount(); i++) {
-//            Ignite g = grid(i);
-//
-//            if (F.eq(g.name(), nearOnlyGridName)) {
-//                for (int k = 0; k < 10000; k++) {
-//                    GridCache<Object, Object> cache = g.cache(null);
-//
-//                    String key = "key" + k;
-//
-//                    if (cacheMode() == PARTITIONED)
-//                        assertFalse(cache.entry(key).primary() || cache.entry(key).backup());
-//
-//                    assertFalse(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()));
-//                }
-//            }
-//            else {
-//                boolean foundEntry = false;
-//                boolean foundAffinityNode = false;
-//
-//                for (int k = 0; k < 10000; k++) {
-//                    GridCache<Object, Object> cache = g.cache(null);
-//
-//                    String key = "key" + k;
-//
-//                    if (cache.entry(key).primary() || cache.entry(key).backup())
-//                        foundEntry = true;
-//
-//                    if (cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
-//                        foundAffinityNode = true;
-//                }
-//
-//                assertTrue("Did not found primary or backup entry for grid: " + i, foundEntry);
-//                assertTrue("Did not found affinity node for grid: " + i, foundAffinityNode);
-//            }
-//        }
+        for (int i = 0; i < gridCount(); i++) {
+            Ignite g = grid(i);
+
+            if (F.eq(g.name(), nearOnlyGridName)) {
+                for (int k = 0; k < 10000; k++) {
+                    GridCache<Object, Object> cache = g.cache(null);
+
+                    String key = "key" + k;
+
+                    if (cacheMode() == PARTITIONED)
+                        assertFalse(cache.affinity().isPrimaryOrBackup(g.cluster().localNode(),
key));
+
+                    assertFalse(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()));
+                }
+            }
+            else {
+                boolean foundEntry = false;
+                boolean foundAffinityNode = false;
+
+                for (int k = 0; k < 10000; k++) {
+                    GridCache<Object, Object> cache = g.cache(null);
+
+                    String key = "key" + k;
+
+                    if (cache.affinity().isPrimaryOrBackup(g.cluster().localNode(), key))
+                        foundEntry = true;
+
+                    if (cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
+                        foundAffinityNode = true;
+                }
+
+                assertTrue("Did not found primary or backup entry for grid: " + i, foundEntry);
+                assertTrue("Did not found affinity node for grid: " + i, foundAffinityNode);
+            }
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7096bf2d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
index 52eb6b2..a30658b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java
@@ -150,11 +150,11 @@ public class GridCacheReplicatedPreloadLifecycleSelfTest extends GridCachePreloa
                 IgniteCache<String, MyValue> c1 = grid(j).jcache("one");
                 IgniteCache<String, MyValue> c2 = grid(j).jcache("two");
 
-                int size1 = c1.size();
-                int size2 = c2.size();
+                int size1 = c1.localSize();
+                int size2 = c2.localSize();
 
-                assert size1 == keys.length : " Invalid cache1 size [i=" + i + ", j=" + j
+ ", size=" + size1 + ']';
-                assert size2 == keys.length / 2 : " Invalid cache2 size [i=" + i + ", j="
+ j + ", size=" + size2 + ']';
+                assertEquals(" Invalid cache1 size [i=" + i + ", j=" + j + ", size=" + size1
+ ']', keys.length, size1);
+                assertEquals(" Invalid cache2 size [i=" + i + ", j=" + j + ", size=" + size2
+ ']', keys.length / 2, size2);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7096bf2d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 51c0ed5..969692e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -34,7 +34,6 @@ import org.apache.ignite.spi.eventstorage.memory.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.junits.common.*;
 
-import javax.cache.*;
 import java.io.*;
 import java.util.*;
 
@@ -161,7 +160,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
             cache1.put(1, "val1");
             cache1.put(2, "val2");
 
-            Cache.Entry<Integer, String> e1 = cache1.entry(1);
+            GridCacheEntryEx<Integer, String> e1 = cache1.peekEx(1);
 
             assert e1 != null;
 
@@ -194,16 +193,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
             assertEquals("val1", cache2.peek(1));
             assertEquals("val2", cache2.peek(2));
 
-            Cache.Entry<Integer, String> e2 = cache2.entry(1);
+            GridCacheEntryEx<Integer, String> e2 = cache2.peekEx(1);
 
             assert e2 != null;
             assert e2 != e1;
 
-            assert false : "ignite-96";
+            assert e2.version() != null;
 
-//            assert e2.version() != null;
-//
-//            assertEquals(e1.version(), e2.version());
+            assertEquals(e1.version(), e2.version());
         }
         finally {
             stopAllGrids();
@@ -282,7 +279,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
 
             IgniteCache<Integer, String> cache2 = startGrid(2).jcache(null);
 
-            assertEquals(keyCnt, cache2.size());
+            assertEquals(keyCnt, cache2.localSize());
         }
         finally {
             stopAllGrids();
@@ -360,7 +357,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
 
             IgniteCache<Integer, String> cache2 = startGrid(2).jcache(null);
 
-            assertEquals(cnt, cache2.size());
+            assertEquals(cnt, cache2.localSize());
         }
         finally {
             stopAllGrids();
@@ -384,7 +381,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
 
             IgniteCache<Integer, String> cache2 = startGrid(2).jcache(null);
 
-            assertEquals(cnt, cache2.size());
+            assertEquals(cnt, cache2.localSize());
         }
         finally {
             stopAllGrids();
@@ -408,7 +405,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
 
             IgniteCache<Integer, String> cache2 = startGrid(2).jcache(null);
 
-            assertEquals(cnt, cache2.size());
+            assertEquals(cnt, cache2.localSize());
         }
         finally {
             stopGrid(1);


Mime
View raw message