ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [15/50] [abbrv] incubator-ignite git commit: # IGNITE-56 Fix some tests.
Date Thu, 12 Feb 2015 09:44:40 GMT
# IGNITE-56 Fix some 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/c06b9a19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c06b9a19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c06b9a19

Branch: refs/heads/sprint-1
Commit: c06b9a1935f3d68d6dc707b3814d3d0148e4ee57
Parents: 1845895
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Tue Feb 10 20:12:49 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Tue Feb 10 20:12:49 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAbstractSelfTest.java    |  8 ++++----
 .../processors/cache/GridCacheSwapPreloadSelfTest.java |  3 ++-
 .../cache/IgniteTxStoreExceptionAbstractSelfTest.java  |  6 +++---
 .../org/apache/ignite/testframework/GridTestUtils.java |  9 +++++++--
 .../junits/common/GridCommonAbstractTest.java          | 13 +++++++++++++
 5 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c06b9a19/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index adddc36..f832d53 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -89,13 +89,13 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        assert grid(0).transactions().tx() == null;
+        assert jcache().unwrap(Ignite.class).transactions().tx() == null;
         assert jcache().localSize() == 0;
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        IgniteTx tx = grid(0).transactions().tx();
+        IgniteTx tx = jcache().unwrap(Ignite.class).transactions().tx();
 
         if (tx != null) {
             tx.close();
@@ -184,8 +184,8 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
             }
         }
 
-        assert grid(0).transactions().tx() == null;
-        assertEquals("Cache is not empty", 0, jcache().size());
+        assert jcache().unwrap(Ignite.class).transactions().tx() == null;
+        assertEquals("Cache is not empty", 0, jcache().localSize());
 
         resetStore();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c06b9a19/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
index 5d1c960..56aeb58 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
@@ -118,7 +118,8 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest
{
             for (int i = 0; i < ENTRY_CNT; i++)
                 assertNull(cache.peek(i));
 
-            assert cache.isEmpty();
+            assert cache.localSize(CachePeekMode.PRIMARY, CachePeekMode.BACKUP, CachePeekMode.NEAR,
+                CachePeekMode.ONHEAP) == 0;
 
             startGrid(1);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c06b9a19/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
index dd78536..3c0d641 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
@@ -411,7 +411,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
                 return null;
             }
-        }, IgniteTxRollbackCheckedException.class, null);
+        }, IgniteTxRollbackException.class, null);
 
         checkValue(key, putBefore);
     }
@@ -499,7 +499,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
                 return null;
             }
-        }, IgniteTxRollbackCheckedException.class, null);
+        }, IgniteTxRollbackException.class, null);
 
         for (Integer key : m.keySet())
             checkValue(key, putBefore);
@@ -533,7 +533,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
                 return null;
             }
-        }, IgniteTxRollbackCheckedException.class, null);
+        }, IgniteTxRollbackException.class, null);
 
         checkValue(key, putBefore);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c06b9a19/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 5e936d0..fe7811e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -36,6 +36,7 @@ import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.config.*;
 import org.jetbrains.annotations.*;
 
+import javax.cache.*;
 import javax.net.ssl.*;
 import java.io.*;
 import java.lang.annotation.*;
@@ -126,9 +127,13 @@ public final class GridTestUtils {
         }
         catch (Throwable e) {
             if (cls != e.getClass()) {
-                U.error(log, "Unexpected exception.", e);
+                if (e.getClass() == CacheException.class && e.getCause() != null
&& e.getCause().getClass() == cls)
+                    e = e.getCause();
+                else {
+                    U.error(log, "Unexpected exception.", e);
 
-                fail("Exception class is not as expected [expected=" + cls + ", actual="
+ e.getClass() + ']', e);
+                    fail("Exception class is not as expected [expected=" + cls + ", actual="
+ e.getClass() + ']', e);
+                }
             }
 
             if (msg != null && (e.getMessage() == null || !e.getMessage().startsWith(msg)))
{

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c06b9a19/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 0918e87..858c0b9 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
@@ -662,6 +662,19 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
+     * @param e Exception.
+     * @param exCls Ex class.
+     */
+    protected <T extends IgniteException> void assertCacheExceptionWithCause(RuntimeException
e, Class<T> exCls) {
+        if (exCls.isAssignableFrom(e.getClass()))
+            return;
+
+        if (e.getClass() != CacheException.class
+            || e.getCause() == null || !exCls.isAssignableFrom(e.getCause().getClass()))
+            throw e;
+    }
+
+    /**
      * @param ignite Grid.
      * @return {@link org.apache.ignite.IgniteCompute} for given grid's local node.
      */


Mime
View raw message