You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/26 15:26:47 UTC
[1/4] incubator-ignite git commit: # ignite-648: tmp
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-648-failover [created] 8361e087a
# ignite-648: tmp
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/23109364
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/23109364
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/23109364
Branch: refs/heads/ignite-648-failover
Commit: 23109364f5989fae4c85fc55cfa941fe46a96e49
Parents: 03aea8c
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 12:26:20 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 12:26:20 2015 +0300
----------------------------------------------------------------------
.../GridCacheNearReloadAllMJSelfTest.java | 30 ++++++++++++++++++++
...IgniteCacheFullApiMultiJvmSelfTestSuite.java | 2 +-
2 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/23109364/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
new file mode 100644
index 0000000..9d10440
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+
+/**
+ * Multy Jvm tests.
+ */
+public class GridCacheNearReloadAllMJSelfTest extends GridCacheNearReloadAllSelfTest {
+ /** {@inheritDoc} */
+ protected boolean isMultiJvm() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/23109364/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
index 75d34c4..37851c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
@@ -69,7 +69,7 @@ public class IgniteCacheFullApiMultiJvmSelfTestSuite extends TestSuite {
suite.addTestSuite(GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.class);
suite.addTestSuite(GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.class);
-// suite.addTestSuite(GridCacheNearReloadAllSelfTest.class);
+ suite.addTestSuite(GridCacheNearReloadAllMJSelfTest.class);
// suite.addTestSuite(GridCacheColocatedReloadAllSelfTest.class);
// suite.addTestSuite(GridCacheAtomicReloadAllSelfTest.class);
// suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.class);
[4/4] incubator-ignite git commit: # ignite-648: revert
23109364f5989fae4c85fc55cfa941fe46a96e49 (tmp commit)
Posted by sb...@apache.org.
# ignite-648: revert 23109364f5989fae4c85fc55cfa941fe46a96e49 (tmp commit)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8361e087
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8361e087
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8361e087
Branch: refs/heads/ignite-648-failover
Commit: 8361e087a0886cdb9ada1129caf248e32fcdad38
Parents: 7cf3a66
Author: ashutak <as...@gridgain.com>
Authored: Fri Jun 26 12:39:53 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jun 26 12:39:53 2015 +0300
----------------------------------------------------------------------
.../GridCacheNearReloadAllMJSelfTest.java | 30 --------------------
...IgniteCacheFullApiMultiJvmSelfTestSuite.java | 2 +-
2 files changed, 1 insertion(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8361e087/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
deleted file mode 100644
index 9d10440..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/multijvm/GridCacheNearReloadAllMJSelfTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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;
-
-import org.apache.ignite.internal.processors.cache.distributed.near.*;
-
-/**
- * Multy Jvm tests.
- */
-public class GridCacheNearReloadAllMJSelfTest extends GridCacheNearReloadAllSelfTest {
- /** {@inheritDoc} */
- protected boolean isMultiJvm() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8361e087/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
index 37851c1..75d34c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiMultiJvmSelfTestSuite.java
@@ -69,7 +69,7 @@ public class IgniteCacheFullApiMultiJvmSelfTestSuite extends TestSuite {
suite.addTestSuite(GridCacheNearOnlyFairAffinityMultiJvmFullApiSelfTest.class);
suite.addTestSuite(GridCacheAtomicClientOnlyFairAffinityMultiJvmFullApiSelfTest.class);
- suite.addTestSuite(GridCacheNearReloadAllMJSelfTest.class);
+// suite.addTestSuite(GridCacheNearReloadAllSelfTest.class);
// suite.addTestSuite(GridCacheColocatedReloadAllSelfTest.class);
// suite.addTestSuite(GridCacheAtomicReloadAllSelfTest.class);
// suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderReloadAllSelfTest.class);
[2/4] incubator-ignite git commit: # ignite-648: fix testSize
Posted by sb...@apache.org.
# ignite-648: fix testSize
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ff4f2571
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ff4f2571
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ff4f2571
Branch: refs/heads/ignite-648-failover
Commit: ff4f2571dc3eec4cfba13f369451d30786b6d2db
Parents: 2310936
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 13:41:20 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 13:41:20 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 38 ++++++++++++++++----
1 file changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff4f2571/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 b73a209..606f64a 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
@@ -288,6 +288,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert jcache(i).localSize() != 0 || F.isEmpty(keysCol);
}
+ // TODO
for (int i = 0; i < gridCount(); i++) {
if (!isMultiJvmAndNodeIsRemote(i)) {
GridCacheContext<String, Integer> ctx = context(i);
@@ -3923,21 +3924,44 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @param keys Expected keys.
* @throws Exception If failed.
*/
- protected void checkKeySize(Collection<String> keys) throws Exception {
+ protected void checkKeySize(final Collection<String> keys) throws Exception {
if (nearEnabled())
assertEquals("Invalid key size: " + jcache().localSize(ALL),
keys.size(), jcache().localSize(ALL));
else {
for (int i = 0; i < gridCount(); i++) {
- GridCacheContext<String, Integer> ctx = context(i);
+ if (!isMultiJvmAndNodeIsRemote(i)) {
+ GridCacheContext<String, Integer> ctx = context(i);
- int size = 0;
+ int size = 0;
- for (String key : keys)
- if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
- size++;
+ for (String key : keys)
+ if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
+ size++;
+
+ assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize(ALL));
+ }
+ else {
+ final int finI = i;
+ final UUID id = grid(i).localNode().id();
+
+ ((IgniteProcessProxy)grid(i)).remoteCompute().run(new IgniteRunnable() {
+ @Override public void run() {
+ Ignite grid = Ignition.ignite(id);
+
+ GridCacheContext<String, Integer> ctx =
+ ((IgniteKernal)grid).<String, Integer>internalCache().context();
+
+ int size = 0;
+
+ for (String key : keys)
+ if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
+ size++;
- assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize(ALL));
+ assertEquals("Incorrect key size on cache #" + finI, size, grid.cache(null).localSize(ALL));
+ }
+ });
+ }
}
}
}
[3/4] incubator-ignite git commit: # ignite-648: fix testUnswapShort
and good refactoring
Posted by sb...@apache.org.
# ignite-648: fix testUnswapShort and good refactoring
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7cf3a66f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7cf3a66f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7cf3a66f
Branch: refs/heads/ignite-648-failover
Commit: 7cf3a66f8daef34de6a4450f407686d6461241fe
Parents: ff4f257
Author: ashutak <as...@gridgain.com>
Authored: Fri Jun 26 11:30:16 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jun 26 11:30:16 2015 +0300
----------------------------------------------------------------------
.../affinity/fair/FairAffinityFunction.java | 4 +--
.../cache/GridCacheAbstractFullApiSelfTest.java | 37 +++++++-------------
.../cache/GridCacheAbstractSelfTest.java | 16 ++++-----
...achePartitionedMultiNodeFullApiSelfTest.java | 12 ++++---
.../testframework/junits/GridAbstractTest.java | 31 +++++++++-------
.../junits/multijvm/IgniteNodeRunner.java | 20 ++++++++++-
.../junits/multijvm/IgniteProcessProxy.java | 2 +-
7 files changed, 66 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
index 0253e62..15c5a3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/fair/FairAffinityFunction.java
@@ -19,7 +19,7 @@ package org.apache.ignite.cache.affinity.fair;
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -31,7 +31,7 @@ import java.util.*;
* Fair affinity function which tries to ensure that all nodes get equal number of partitions with
* minimum amount of reassignments between existing nodes.
* <p>
- * Cache affinity can be configured for individual caches via {@link CacheConfiguration#getAffinity()} method.
+ * Cache affinity can be configured for individual caches via {@link CacheConfiguration#setAffinity(AffinityFunction)} method.
*/
@AffinityCentralizedFunction
public class FairAffinityFunction implements AffinityFunction {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/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 606f64a..2986e02 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
@@ -288,7 +288,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert jcache(i).localSize() != 0 || F.isEmpty(keysCol);
}
- // TODO
for (int i = 0; i < gridCount(); i++) {
if (!isMultiJvmAndNodeIsRemote(i)) {
GridCacheContext<String, Integer> ctx = context(i);
@@ -302,23 +301,20 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals("Incorrect key size on cache #" + i, sum, jcache(i).localSize(ALL));
}
else {
- final int finalI = i;
- final UUID id = grid(i).localNode().id();
+ final int iCopy = i;
((IgniteProcessProxy)grid(i)).remoteCompute().run(new IgniteRunnable() {
@Override public void run() {
- Ignite grid = Ignition.ignite(id);
-
- GridCacheContext<String, Integer> ctx =
- ((IgniteKernal)grid).<String, Integer>internalCache().context();
+ GridCacheContext<String, Integer> ctx = context(iCopy);
int sum = 0;
for (String key : map.keySet())
- if (ctx.affinity().localNode(key, new AffinityTopologyVersion(ctx.discovery().topologyVersion())))
+ if (ctx.affinity().localNode(key,
+ new AffinityTopologyVersion(ctx.discovery().topologyVersion())))
sum++;
- assertEquals("Incorrect key size on cache #" + finalI, sum, grid.cache(null).localSize(ALL));
+ assertEquals("Incorrect key size on cache #" + iCopy, sum, jcache(iCopy).localSize(ALL));
}
});
}
@@ -3885,15 +3881,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals("Incorrect size on cache #" + i, size, jcache(i).localSize(ALL));
}
else {
- final UUID id = grid(i).localNode().id();
+ final int iCopy = i;
- final int finalI = i;
((IgniteProcessProxy)grid(i)).remoteCompute().run(new IgniteRunnable() {
@Override public void run() {
- Ignite grid = Ignition.ignite(id);
-
- GridCacheContext<String, Integer> ctx =
- ((IgniteKernal)grid).<String, Integer>internalCache().context();
+ GridCacheContext<String, Integer> ctx = context(iCopy);
if (ctx.cache().configuration().getMemoryMode() == OFFHEAP_TIERED)
return;
@@ -3905,14 +3897,15 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
GridCacheEntryEx e =
ctx.isNear() ? ctx.near().dht().peekEx(key) : ctx.cache().peekEx(key);
- assert e != null : "Entry is null [idx=" + finalI + ", key=" + key + ", ctx=" + ctx + ']';
+ assert e != null : "Entry is null [idx=" + iCopy + ", key=" + key
+ + ", ctx=" + ctx + ']';
assert !e.deleted() : "Entry is deleted: " + e;
size++;
}
}
- assertEquals("Incorrect size on cache #" + finalI, size, grid.cache(null).localSize(ALL));
+ assertEquals("Incorrect size on cache #" + iCopy, size, jcache(iCopy).localSize(ALL));
}
});
}
@@ -3942,15 +3935,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assertEquals("Incorrect key size on cache #" + i, size, jcache(i).localSize(ALL));
}
else {
- final int finI = i;
- final UUID id = grid(i).localNode().id();
+ final int iCopy = i;
((IgniteProcessProxy)grid(i)).remoteCompute().run(new IgniteRunnable() {
@Override public void run() {
- Ignite grid = Ignition.ignite(id);
-
- GridCacheContext<String, Integer> ctx =
- ((IgniteKernal)grid).<String, Integer>internalCache().context();
+ GridCacheContext<String, Integer> ctx = context(iCopy);
int size = 0;
@@ -3958,7 +3947,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
size++;
- assertEquals("Incorrect key size on cache #" + finI, size, grid.cache(null).localSize(ALL));
+ assertEquals("Incorrect key size on cache #" + iCopy, size, jcache(iCopy).localSize(ALL));
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/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 2a84be9..bb207fc 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
@@ -32,7 +32,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.apache.ignite.testframework.*;
import org.apache.ignite.testframework.junits.common.*;
-import org.apache.ignite.testframework.junits.multijvm.*;
import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -357,11 +356,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
*/
@SuppressWarnings({"unchecked"})
@Override protected IgniteCache<String, Integer> jcache(int idx) {
- if (!isMultiJvmAndNodeIsRemote(idx))
- return ignite(idx).cache(null);
- else
- return IgniteProcessProxy.get(getTestGridName(idx)).cache(null);
-
+ return ignite(idx).cache(null);
}
/**
@@ -369,10 +364,11 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
* @return Cache context.
*/
protected GridCacheContext<String, Integer> context(final int idx) {
- if (!isMultiJvmAndNodeIsRemote(idx))
- return ((IgniteKernal)grid(idx)).<String, Integer>internalCache().context();
- else
- throw new UnsupportedOperationException("Operation cant be supported for multi jvm mode.");
+ if (isMultiJvmAndNodeIsRemote(idx) && !weAreOnRemoteJvm())
+ throw new UnsupportedOperationException("Operation can't be done automatically via proxy. " +
+ "Send task with this logic on remote jvm.");
+
+ return ((IgniteKernal)grid(idx)).<String, Integer>internalCache().context();
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index 9445f9c..6e694d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -28,7 +28,6 @@ import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lang.*;
import java.util.*;
-import java.util.concurrent.atomic.*;
import static org.apache.ignite.cache.CacheMode.*;
import static org.apache.ignite.cache.CachePeekMode.*;
@@ -179,21 +178,24 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
if (memoryMode() == CacheMemoryMode.OFFHEAP_TIERED)
return;
- final AtomicInteger swapEvts = new AtomicInteger(0);
- final AtomicInteger unswapEvts = new AtomicInteger(0);
+ final IgniteAtomicLong swapEvts = grid(0).atomicLong("swapEvts", 0, true);
+
+ final IgniteAtomicLong unswapEvts = grid(0).atomicLong("unswapEvts", 0, true);
for (int i = 0; i < gridCount(); i++) {
+ final int iCopy = i;
+
grid(i).events().localListen(new IgnitePredicate<Event>() {
@Override public boolean apply(Event evt) {
info("Received event: " + evt);
switch (evt.type()) {
case EVT_CACHE_OBJECT_SWAPPED:
- swapEvts.incrementAndGet();
+ grid(iCopy).atomicLong("swapEvts", 0, false).incrementAndGet();
break;
case EVT_CACHE_OBJECT_UNSWAPPED:
- unswapEvts.incrementAndGet();
+ grid(iCopy).atomicLong("unswapEvts", 0, false).incrementAndGet();
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/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 8802362..2f52224 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
@@ -223,6 +223,9 @@ public abstract class GridAbstractTest extends TestCase {
* @return logger.
*/
protected IgniteLogger log() {
+ if (weAreOnRemoteJvm())
+ return IgniteNodeRunner.startedInstance().log();
+
return log;
}
@@ -878,8 +881,12 @@ public abstract class GridAbstractTest extends TestCase {
protected IgniteEx grid(String name) {
if (!isMultiJvmAndNodeIsRemote(name))
return (IgniteEx)G.ignite(name);
- else
- return IgniteProcessProxy.get(name);
+ else {
+ if (weAreOnRemoteJvm())
+ return IgniteNodeRunner.startedInstance();
+ else
+ return IgniteProcessProxy.ignite(name);
+ }
}
/**
@@ -889,11 +896,7 @@ public abstract class GridAbstractTest extends TestCase {
* @return Grid instance.
*/
protected IgniteEx grid(int idx) {
- if (!isMultiJvmAndNodeIsRemote(idx))
- return (IgniteEx)G.ignite(getTestGridName(idx));
- else
- return IgniteProcessProxy.get(getTestGridName(idx));
-
+ return grid(getTestGridName(idx));
}
/**
@@ -901,12 +904,7 @@ public abstract class GridAbstractTest extends TestCase {
* @return Ignite instance.
*/
protected Ignite ignite(int idx) {
- String gridName = getTestGridName(idx);
-
- if (!isMultiJvmAndNodeIsRemote(idx))
- return G.ignite(gridName);
- else
- return IgniteProcessProxy.get(gridName);
+ return grid(idx);
}
/**
@@ -1402,6 +1400,13 @@ public abstract class GridAbstractTest extends TestCase {
}
/**
+ * @return <code>True</code> if current jvm contains remote started node.
+ */
+ protected boolean weAreOnRemoteJvm() {
+ return IgniteNodeRunner.hasStartedInstance();
+ }
+
+ /**
* @return Test counters.
*/
protected synchronized TestCounters getTestCounters() throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
index 0dec37b..e8b9be2 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
@@ -20,6 +20,7 @@ package org.apache.ignite.testframework.junits.multijvm;
import com.thoughtworks.xstream.*;
import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.typedef.*;
@@ -38,6 +39,9 @@ public class IgniteNodeRunner {
private static final String IGNITE_CONFIGURATION_FILE = System.getProperty("java.io.tmpdir") +
File.separator + "igniteConfiguration.tmp_";
+ /** */
+ private static volatile Ignite ignite;
+
/**
* Starts {@link Ignite} instance accorging to given arguments.
*
@@ -51,7 +55,21 @@ public class IgniteNodeRunner {
IgniteConfiguration cfg = readCfgFromFileAndDeleteFile(args[0]);
- Ignition.start(cfg);
+ ignite = Ignition.start(cfg);
+ }
+
+ /**
+ * @return Ignite instance started at main.
+ */
+ public static IgniteEx startedInstance(){
+ return (IgniteEx)ignite;
+ }
+
+ /**
+ * @return <code>True</code> if there is ignite node started via {@link IgniteNodeRunner} at this jvm.
+ */
+ public static boolean hasStartedInstance() {
+ return ignite != null;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7cf3a66f/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 51b910a..42436e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -120,7 +120,7 @@ public class IgniteProcessProxy implements IgniteEx {
* @param gridName Grid name.
* @return Instance by name or exception wiil be thrown.
*/
- public static IgniteProcessProxy get(String gridName) {
+ public static IgniteProcessProxy ignite(String gridName) {
IgniteProcessProxy res = gridProxies.get(gridName);
if (res == null)