ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [49/50] [abbrv] incubator-ignite git commit: IGNITE-96 - Fixing tests.
Date Wed, 11 Feb 2015 03:03:15 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/b15cf5e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b15cf5e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b15cf5e2

Branch: refs/heads/ignite-96
Commit: b15cf5e282aff9820fff9da53a1733085cd45210
Parents: 167f67e
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Tue Feb 10 17:38:08 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Tue Feb 10 17:38:08 2015 -0800

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  4 +---
 .../processors/cache/IgniteTxAbstractTest.java  | 21 ++++++--------------
 .../GridCacheMultiNodeAbstractTest.java         | 12 +++++------
 .../dht/GridCacheDhtEntrySelfTest.java          | 16 +++++++--------
 .../dht/GridCacheDhtPreloadUnloadSelfTest.java  |  4 ++--
 .../GridCacheReplicatedEvictionSelfTest.java    |  2 +-
 .../local/GridCacheLocalTxTimeoutSelfTest.java  |  9 ++++++---
 .../junits/common/GridCommonAbstractTest.java   |  2 +-
 8 files changed, 31 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index b10e4ce..f5b4e07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -5472,11 +5472,9 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
      * @return Peek modes flags.
      */
     private static PeekModes parsePeekModes(CachePeekMode[] peekModes) {
-        assert peekModes != null;
-
         PeekModes modes = new PeekModes();
 
-        if (peekModes.length == 0) {
+        if (F.isEmpty(peekModes)) {
             modes.near = true;
             modes.primary = true;
             modes.backup = true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
index da32afc..c0a9e5c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
@@ -30,7 +29,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 
-import javax.cache.*;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
@@ -400,35 +398,28 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
         for (int i = 1; i <= maxKeyValue(); i++) {
             for (int k = 0; k < 3; k++) {
                 try {
-                    Cache.Entry<Integer, String> e1 = null;
-
                     String v1 = null;
 
                     for (int j = 0; j < gridCount(); j++) {
-                        GridCache<Integer, String> cache = internalCache(j);
+                        IgniteCache<Integer, String> cache = jcache(j);
 
                         IgniteTx tx = ignite(j).transactions().tx();
 
                         assertNull("Transaction is not completed: " + tx, tx);
 
                         if (j == 0) {
-                            e1 = cache.entry(i);
-
-                            v1 = e1.getValue();
+                            v1 = cache.get(i);
                         }
                         else {
-                            Cache.Entry<Integer, String> e2 = cache.entry(i);
-
-                            String v2 = e2.getValue();
+                            String v2 = cache.get(i);
 
                             if (!F.eq(v2, v1)) {
-                                v1 = e1.getValue();
-                                v2 = e2.getValue();
+                                v1 = this.<Integer, String>jcache(0).get(i);
+                                v2 = cache.get(i);
                             }
 
                             assert F.eq(v2, v1) :
-                                "Invalid cached value [key=" + i + ", v1=" + v1 + ", v2="
+ v2 + ", e1=" + e1 +
-                                    ", e2=" + e2 + ", grid=" + j + ']';
+                                "Invalid cached value [key=" + i + ", v1=" + v1 + ", v2="
+ v2 + ", grid=" + j + ']';
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
index 8634de7..ad54f69 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
@@ -340,15 +340,15 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         cache2.put(2, "val2");
         cache3.put(3, "val3");
 
-        assert cache1.size() == 3;
-        assert cache2.size() == 3;
-        assert cache3.size() == 3;
+        assertEquals(3, cache1.localSize());
+        assertEquals(3, cache2.localSize());
+        assertEquals(3, cache3.localSize());
 
         cache1.clear();
 
-        assert cache1.localSize() == 0;
-        assert cache2.localSize() == 0;
-        assert cache3.localSize() == 0;
+        assertEquals(0, cache1.localSize());
+        assertEquals(0, cache2.localSize());
+        assertEquals(0, cache3.localSize());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
index 7973e9c..b32c7d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
@@ -271,19 +271,19 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest
{
 
         assert !e0.evictInternal(false, dht0.context().versions().next(), null);
 
-        assertEquals(1, near0.size());
-        assertEquals(1, dht0.size());
+        assertEquals(1, near0.localSize());
+        assertEquals(1, dht0.localSize(null));
 
-        assertEquals(1, near1.size());
-        assertEquals(0, dht1.size());
+        assertEquals(1, near1.localSize());
+        assertEquals(0, dht1.localSize(null));
 
         assert !e0.evictInternal(true, dht0.context().versions().next(), null);
 
-        assertEquals(1, near0.size());
-        assertEquals(1, dht0.size());
+        assertEquals(1, near0.localSize());
+        assertEquals(1, dht0.localSize(null));
 
-        assertEquals(1, near1.size());
-        assertEquals(0, dht1.size());
+        assertEquals(1, near1.localSize());
+        assertEquals(0, dht1.localSize(null));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
index 9bf5376..480d01c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
@@ -173,7 +173,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest
{
                 IgniteCache<Integer, String> c = grid(i).jcache(null);
 
                 // Nothing should be unloaded since nodes are backing up each other.
-                assert c.size() == cnt;
+                assertEquals(cnt, c.localSize());
             }
         }
         finally {
@@ -299,8 +299,8 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest
{
     /**
      * @param c Cache.
      * @param cnt Key count.
-     * @throws IgniteCheckedException If failed.
      */
+    @SuppressWarnings("TypeMayBeWeakened")
     private void populate(IgniteCache<Integer, String> c, int cnt) {
         for (int i = 0; i < cnt; i++)
             c.put(i, value(1024));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java
index 1bff158..a1103b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedEvictionSelfTest.java
@@ -86,7 +86,7 @@ public class GridCacheReplicatedEvictionSelfTest extends GridCacheAbstractSelfTe
 
         for (int g = 0; g < gridCount(); g++) {
             for (int i = 0; i < KEYS; i++) {
-                if (grid(i).affinity(null).isPrimary(grid(i).localNode(), String.valueOf(i)))
+                if (grid(g).affinity(null).isPrimary(grid(g).localNode(), String.valueOf(i)))
                     assertTrue(cache(g).evict(String.valueOf(i)));
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
index b50b4c8..6548781 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
@@ -18,14 +18,15 @@
 package org.apache.ignite.internal.processors.cache.local;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.transactions.*;
+import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 
+import javax.cache.*;
+
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
 import static org.apache.ignite.transactions.IgniteTxIsolation.*;
@@ -145,7 +146,9 @@ public class GridCacheLocalTxTimeoutSelfTest extends GridCommonAbstractTest
{
 
             tx.commit();
         }
-        catch (IgniteException e) {
+        catch (CacheException e) {
+            assertTrue(X.hasCause(e, IgniteTxTimeoutException.class));
+
             info("Received expected optimistic exception: " + e.getMessage());
 
             wasEx = true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b15cf5e2/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 40bb49f..58da239 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -458,7 +458,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @return Set
      */
     protected <K, V> Set<Cache.Entry<K, V>> entrySet(Iterable<Cache.Entry<K,
V>> iterable){
-        Set<Cache.Entry<K, V>> set = new TreeSet<>();
+        Set<Cache.Entry<K, V>> set = new HashSet<>();
 
         for (Cache.Entry<K, V> entry : iterable)
             set.add(entry);


Mime
View raw message