ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #ignite-460: change test CacheMapEntrySelfTest.
Date Thu, 07 May 2015 14:02:28 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-460 693bdbcc2 -> 7f1146f1f


#ignite-460: change test CacheMapEntrySelfTest.


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

Branch: refs/heads/ignite-460
Commit: 7f1146f1fd7d93127af553f4d5fe3aeda627b99e
Parents: 693bdbc
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu May 7 17:02:12 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu May 7 17:02:12 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheMapEntrySelfTest.java | 41 ++++++++++----------
 .../ignite/testsuites/IgniteBasicTestSuite.java |  1 -
 .../ignite/testsuites/IgniteCacheTestSuite.java |  2 +
 3 files changed, 23 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f1146f1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMapEntrySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMapEntrySelfTest.java
index 4cbfd22..7729be0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMapEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMapEntrySelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
@@ -29,14 +30,8 @@ import org.apache.ignite.internal.processors.cache.local.*;
  * Cache map entry self test.
  */
 public class CacheMapEntrySelfTest extends GridCacheAbstractSelfTest {
-    /** Cache mode. */
-    private CacheMode cacheMode;
-
-    /** Atomicity mode. */
-    private CacheAtomicityMode atomicityMode;
-
-    /** Memory mode. */
-    private CacheMemoryMode memoryMode;
+    /** Cache id. */
+    private int cacheId = 0;
 
     /** {@inheritDoc} */
     @Override protected int gridCount() {
@@ -55,7 +50,7 @@ public class CacheMapEntrySelfTest extends GridCacheAbstractSelfTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        // No-op.
+        startGrids(1);
     }
 
     /** {@inheritDoc} */
@@ -63,14 +58,23 @@ public class CacheMapEntrySelfTest extends GridCacheAbstractSelfTest {
         // No-op.
     }
 
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception
{
+    /**
+     * @param gridName Grid name.
+     * @param memoryMode Memory mode.
+     * @param atomicityMode Atomicity mode.
+     * @param cacheMode Cache mode.
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     * @throws Exception If failed.
+     */
+    private CacheConfiguration cacheConfiguration(String gridName, CacheMemoryMode memoryMode,
+        CacheAtomicityMode atomicityMode, CacheMode cacheMode, String cacheName) throws Exception
{
         CacheConfiguration cfg = super.cacheConfiguration(gridName);
 
         cfg.setCacheMode(cacheMode);
         cfg.setAtomicityMode(atomicityMode);
         cfg.setMemoryMode(memoryMode);
-        cfg.setBackups(1);
+        cfg.setName(cacheName);
 
         return cfg;
     }
@@ -126,15 +130,14 @@ public class CacheMapEntrySelfTest extends GridCacheAbstractSelfTest
{
      */
     private void checkCacheMapEntry(CacheMemoryMode memoryMode, CacheAtomicityMode atomicityMode,
CacheMode cacheMode,
         Class<?> entryClass) throws Exception {
-        this.cacheMode = cacheMode;
-        this.atomicityMode = atomicityMode;
-        this.memoryMode = memoryMode;
+        CacheConfiguration cfg = cacheConfiguration(grid(0).name(), memoryMode, atomicityMode,
cacheMode,
+            "Cache" + cacheId++);
 
-        IgniteKernal ignite = (IgniteKernal)startGrid(2);
+        IgniteCache jcache = grid(0).getOrCreateCache(cfg);
 
-        GridCacheAdapter<Integer, String> cache = ignite.internalCache(null);
+        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(0)).internalCache(jcache.getName());
 
-        Integer key = primaryKey(ignite.cache(null));
+        Integer key = primaryKey(grid(0).cache(null));
 
         cache.put(key, "val");
 
@@ -145,7 +148,5 @@ public class CacheMapEntrySelfTest extends GridCacheAbstractSelfTest {
         assertNotNull(entry);
 
         assertEquals(entry.getClass(), entryClass);
-
-        stopAllGrids();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f1146f1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index bd6e81a..2b33d7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -72,7 +72,6 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTestSuite(GridLifecycleAwareSelfTest.class);
         suite.addTestSuite(GridMessageListenSelfTest.class);
         suite.addTestSuite(GridFailFastNodeFailureDetectionSelfTest.class);
-        suite.addTestSuite(CacheMapEntrySelfTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f1146f1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 28b10d9..39b8d0a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -446,6 +446,8 @@ public class IgniteCacheTestSuite extends TestSuite {
 
         suite.addTestSuite(CacheNoValueClassOnServerNodeTest.class);
 
+        suite.addTestSuite(CacheMapEntrySelfTest.class);
+
         return suite;
     }
 }


Mime
View raw message