ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [6/7] incubator-ignite git commit: ignite-648: uncomment commented staff
Date Tue, 28 Apr 2015 08:40:37 GMT
ignite-648: uncomment commented staff


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

Branch: refs/heads/ignite-648
Commit: b1f7d063289a7489c2d6c4d6cb666f1dabc2e03a
Parents: d77eb82
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Mon Apr 27 20:18:18 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Mon Apr 27 20:18:18 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java | 46 +++++++++++++-------
 .../GridCacheMultiNodeAbstractTest.java         |  4 --
 ...CachePartitionedMultiJvmFullApiSelfTest.java | 13 ++----
 .../cache/multijvm/IgniteCacheProcessProxy.java | 32 ++++++++++----
 .../cache/multijvm/IgniteExProcessProxy.java    | 23 +++++++---
 .../testframework/junits/GridAbstractTest.java  |  6 +--
 6 files changed, 76 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 4b042d1..445e9a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -193,8 +193,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             cacheCfgMap = null;
         }
 
-//        for (int i = 0; i < gridCount(); i++)
-//            info("Grid " + i + ": " + grid(i).localNode().id());
+        for (int i = 0; i < gridCount(); i++)
+            info("Grid " + i + ": " + grid(i).localNode().id());
     }
 
     /**
@@ -244,29 +244,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         return IgniteExProcessProxy.get(name);
     }
 
+    /**
+     * @param idx Index of grid.
+     * @return Default cache.
+     */
+    @SuppressWarnings({"unchecked"})
+    @Override protected IgniteCache<String, Integer> jcache(int idx) {
+        if (!isMultiJvm() || idx == 0)
+            return super.jcache(idx);
+
+        String name = getTestGridName(idx);
+
+        return IgniteExProcessProxy.get(name).cache(null);
+    }
+
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-//        IgniteCache<String, Integer> cache = jcache();
-//
-//        assertEquals(0, cache.localSize());
-//        assertEquals(0, cache.size());
-//
-//        super.beforeTest();
-//
-//        assertEquals(0, cache.localSize());
-//        assertEquals(0, cache.size());
+        IgniteCache<String, Integer> cache = jcache();
+
+        assertEquals(0, cache.localSize());
+        assertEquals(0, cache.size());
+
+        super.beforeTest();
+
+        assertEquals(0, cache.localSize());
+        assertEquals(0, cache.size());
 
         dfltIgnite = grid(0);
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-//        super.afterTest();
+        super.afterTest();
+
+        IgniteCache<String, Integer> cache = jcache();
 
-//        IgniteCache<String, Integer> cache = jcache();
-//
-//        assertEquals(0, cache.localSize());
-//        assertEquals(0, cache.size());
+        assertEquals(0, cache.localSize());
+        assertEquals(0, cache.size());
 
         dfltIgnite = null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/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 3b691f8..ecf2f00 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
@@ -121,10 +121,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         removeListeners(ignite3);
 
         lsnrs.clear();
-        
-        cache1.clear();
-        cache2.clear();
-        cache3.clear();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
index 2a3d07d..bf77880 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCachePartitionedMultiJvmFullApiSelfTest.java
@@ -29,12 +29,9 @@ import java.util.*;
 import java.util.concurrent.*;
 
 /**
- * TODO: Add class description.
+ * Multy Jvm tests.
  */
 public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartitionedMultiNodeFullApiSelfTest
{
-    /** Local ignite. */
-    private Ignite locIgnite;
-
     /** */
     private CountDownLatch allNodesJoinLatch;
 
@@ -60,8 +57,6 @@ public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartit
     @Override protected void afterTestsStopped() throws Exception {
         IgniteExProcessProxy.killAll();
 
-        locIgnite = null;
-
         super.afterTestsStopped();
     }
 
@@ -72,9 +67,9 @@ public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartit
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        IgniteExProcessProxy.killAll(); // TODO: remove processes killing from here.
-
         super.afterTest();
+        
+        IgniteExProcessProxy.killAll(); // TODO: remove processes killing from here.
     }
 
     /** {@inheritDoc} */
@@ -179,7 +174,7 @@ public class GridCachePartitionedMultiJvmFullApiSelfTest extends GridCachePartit
         assertEquals(val, c1.get(key));
         assertEquals(val, c0.get(key));
 
-        assertTrue(c1.remove(key));
+        assertTrue(c0.remove(key));
 
         U.sleep(1_000);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteCacheProcessProxy.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteCacheProcessProxy.java
index fd49042..ab4a4f7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteCacheProcessProxy.java
@@ -1,10 +1,18 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.ignite.internal.processors.cache.multijvm;
@@ -125,8 +133,16 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K,
V> {
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     @Override public Iterable<Entry<K, V>> localEntries(CachePeekMode... peekModes)
throws CacheException {
-        return null; // TODO: CODE: implement.
+        // TODO: implement.
+//        return F.first(compute.broadcast(new IgniteClosureX<CachePeekMode[], Iterable>()
{
+//            @Override public Iterable applyx(CachePeekMode... modes) {
+//                return Ignition.ignite(gridId).cache(cacheName).localEntries(modes);
+//            }
+//        }, peekModes));
+
+        return Collections.emptyList();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
index 286232b..469e425 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/IgniteExProcessProxy.java
@@ -26,6 +26,8 @@ import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.hadoop.*;
 import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.*;
@@ -39,23 +41,26 @@ import java.util.concurrent.*;
  */
 public class IgniteExProcessProxy implements IgniteEx {
     /** Grid proxies. */
-    private static final Map<String, IgniteExProcessProxy> gridProxies = new HashMap<>();
+    private transient static final Map<String, IgniteExProcessProxy> gridProxies =
new HashMap<>();
 
     /** Jvm process with ignite instance. */
-    private final GridJavaProcess proc;
+    private transient final GridJavaProcess proc;
 
     /** Configuration. */
-    private final IgniteConfiguration cfg;
+    private transient final IgniteConfiguration cfg;
 
     /** Local jvm grid. */
-    private final Ignite locJvmGrid;
+    private transient final Ignite locJvmGrid;
 
     /** Logger. */
-    private final IgniteLogger log;
+    private transient final IgniteLogger log;
 
     /** Grid id. */
     private final UUID id = UUID.randomUUID();
 
+    /** Compute. */
+    private transient final IgniteCompute compute;
+
     /**
      * @param cfg Configuration.
      * @param log Logger.
@@ -96,6 +101,8 @@ public class IgniteExProcessProxy implements IgniteEx {
         U.sleep(3_000);
 
         gridProxies.put(cfg.getGridName(), this);
+
+        compute = locJvmGrid.compute(locJvmGrid.cluster().forNodeId(id));
     }
 
     /**
@@ -215,7 +222,11 @@ public class IgniteExProcessProxy implements IgniteEx {
 
     /** {@inheritDoc} */
     @Override public ClusterNode localNode() {
-        return null; // TODO: CODE: implement.
+        return F.first(compute.broadcast(new IgniteClosureX<Object, ClusterNode>()
{
+            @Override public ClusterNode applyx(Object o) {
+                return ((IgniteEx)Ignition.ignite(id)).localNode();
+            }
+        }, null));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1f7d063/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index ca24226..cd10d60 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -23,7 +23,6 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.processors.resource.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -591,10 +590,7 @@ public abstract class GridAbstractTest extends TestCase {
             boolean topOk = true;
 
             for (int i = 0; i < cnt; i++) {
-                IgniteEx grid = grid(i);
-                IgniteClusterEx cluster = grid.cluster();
-                Collection<ClusterNode> nodes = cluster.nodes();
-                if (cnt != nodes.size()) {
+                if (cnt != grid(i).cluster().nodes().size()) {
                     U.warn(log, "Grid size is incorrect (will re-run check in 1000 ms) "
+
                         "[name=" + grid(i).name() + ", size=" + grid(i).cluster().nodes().size()
+ ']');
 


Mime
View raw message