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-565: Revert GridCommonAbstractTest.
Date Thu, 26 Mar 2015 09:25:55 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-565 d4400c48d -> 88e2d932f


#ignite-565: Revert GridCommonAbstractTest.


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

Branch: refs/heads/ignite-565
Commit: 88e2d932f02e25aecb0a5ec2cb08591c65b553b6
Parents: d4400c4
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Mar 26 12:25:50 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Mar 26 12:25:50 2015 +0300

----------------------------------------------------------------------
 .../junits/common/GridCommonAbstractTest.java   | 50 +++++++++-----------
 .../query/h2/GridH2IndexingGeoSelfTest.java     |  4 +-
 2 files changed, 24 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88e2d932/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 a823894..a309d72 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
@@ -145,19 +145,18 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @param cache Cache.
      * @return DHT cache.
      */
-    protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K,V>
cache) {
+    private static <K, V> GridDhtCacheAdapter<K, V> dht(GridCache<K,V>
cache) {
         return nearEnabled(cache) ? near(cache).dht() :
-            ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().dht();
+            ((IgniteKernal)cache.gridProjection().ignite()).<K, V>internalCache(cache.name()).context().dht();
     }
 
     /**
-     * @param ignite Ignite.
-     * @param cfg Cache configuration.
+     * @param cache Cache.
      * @return DHT cache.
      */
-    private static <K, V> GridDhtCacheAdapter<K, V> dht(Ignite ignite, CacheConfiguration
cfg) {
-        return nearEnabled(cfg) ? ((GridNearCacheAdapter)near(ignite, cfg.getName())).dht()
:
-            ((IgniteKernal)ignite).<K, V>internalCache(cfg.getName()).context().dht();
+    protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K,V>
cache) {
+        return nearEnabled(cache) ? near(cache).dht() :
+            ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().dht();
     }
 
     /**
@@ -194,9 +193,13 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
+     * @param cache Cache.
      * @return {@code True} if near cache is enabled.
      */
-    private static <K, V> boolean nearEnabled(CacheConfiguration cfg) {
+    private static <K, V> boolean nearEnabled(GridCache<K,V> cache) {
+        CacheConfiguration cfg = ((IgniteKernal)cache.gridProjection().ignite()).
+            <K, V>internalCache(cache.name()).context().config();
+
         return isNearEnabled(cfg);
     }
 
@@ -215,15 +218,16 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @param cache Cache.
      * @return Near cache.
      */
-    protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K,V>
cache) {
-        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().near();
+    private static <K, V> GridNearCacheAdapter<K, V> near(GridCache<K,V>
cache) {
+        return ((IgniteKernal)cache.gridProjection().ignite()).<K, V>internalCache(cache.name()).context().near();
     }
 
     /**
+     * @param cache Cache.
      * @return Near cache.
      */
-    private static <K, V> GridNearCacheAdapter<K, V> near(Ignite ignite, String
cacheName) {
-        return ((IgniteKernal)ignite).<K, V>internalCache(cacheName).context().near();
+    protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K,V>
cache) {
+        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().near();
     }
 
     /**
@@ -346,11 +350,14 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     @SuppressWarnings("BusyWait")
     protected void awaitPartitionMapExchange() throws InterruptedException {
         for (Ignite g : G.allGrids()) {
-            for (CacheConfiguration cfg : g.configuration().getCacheConfiguration()) {
+            for (GridCache<?, ?> c : ((IgniteEx)g).cachesx()) {
+
+                CacheConfiguration cfg = c.configuration();
+
                 if (cfg.getCacheMode() == PARTITIONED && cfg.getRebalanceMode() !=
NONE && g.cluster().nodes().size() > 1) {
                     AffinityFunction aff = cfg.getAffinity();
 
-                    GridDhtCacheAdapter<?, ?> dht = dht(g, cfg);
+                    GridDhtCacheAdapter<?, ?> dht = dht(c);
 
                     GridDhtPartitionTopology top = dht.topology();
 
@@ -359,7 +366,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
                         for (int i = 0; ; i++) {
                             // Must map on updated version of topology.
-                            Collection<ClusterNode> affNodes = g.affinity(cfg.getName()).mapPartitionToPrimaryAndBackups(p);
+                            Collection<ClusterNode> affNodes = c.affinity().mapPartitionToPrimaryAndBackups(p);
 
                             int exp = affNodes.size();
 
@@ -521,19 +528,6 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
-     * @param key Key.
-     * @param cacheName Cache name.
-     * @return Cache.
-     */
-    protected <K, V> IgniteCache<K, V> primaryCache(Object key, @Nullable String
cacheName) {
-        ClusterNode node = grid(0).affinity(cacheName).mapKeyToNode(key);
-
-        assertNotNull(node);
-
-        return grid((String)node.attribute(IgniteNodeAttributes.ATTR_GRID_NAME)).cache(cacheName);
-    }
-
-    /**
      * @param cache Cache.
      * @return Collection of keys for which given cache is primary.
      * @throws IgniteCheckedException If failed.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/88e2d932/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java
index 2dc660e..07abaf1 100644
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java
+++ b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexingGeoSelfTest.java
@@ -153,7 +153,7 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest
{
                 while (!stop.get()) {
                     int cacheIdx = rnd.nextInt(0, 3);
 
-                    GridCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1 :
cacheIdx == 1 ? cache2 : cache3;
+                    GridCacheAdapter<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1
: cacheIdx == 1 ? cache2 : cache3;
 
                     int idx = rnd.nextInt(CNT);
                     int x = rnd.nextInt(1, 100);
@@ -178,7 +178,7 @@ public class GridH2IndexingGeoSelfTest extends GridCacheAbstractSelfTest
{
                     try {
                         int cacheIdx = rnd.nextInt(0, 3);
 
-                        GridCache<Integer, EnemyCamp> cache = cacheIdx == 0 ? cache1
: cacheIdx == 1 ? cache2 : cache3;
+                        GridCacheAdapter<Integer, EnemyCamp> cache = cacheIdx == 0
? cache1 : cacheIdx == 1 ? cache2 : cache3;
 
                         CacheQuery<Map.Entry<Integer, EnemyCamp>> qry = cache.queries().createSqlQuery(
                             EnemyCamp.class, "coords && ?");


Mime
View raw message