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:58:08 UTC
[01/27] incubator-ignite git commit: #IGNITE-GG-10440 If cache plugin
manager doesn't provide CacheConflictResolutionManager than Plugin provider
create defaule conflict resolution.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-648-failover 8361e087a -> cb4e55708
#IGNITE-GG-10440 If cache plugin manager doesn't provide CacheConflictResolutionManager than Plugin provider create defaule conflict resolution.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/987d91e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/987d91e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/987d91e2
Branch: refs/heads/ignite-648-failover
Commit: 987d91e2804cace7acb846a7d61b0f5bdc1c3442
Parents: d006389
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jun 19 18:23:38 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jun 19 18:23:38 2015 +0300
----------------------------------------------------------------------
.../internal/processors/plugin/CachePluginManager.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/987d91e2/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
index 640271a..ae69eb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/CachePluginManager.java
@@ -105,8 +105,14 @@ public class CachePluginManager extends GridCacheManagerAdapter {
if (cls.equals(GridCacheDrManager.class))
return (T)new GridOsCacheDrManager();
- else if (cls.equals(CacheConflictResolutionManager.class))
- return (T)new CacheOsConflictResolutionManager<>();
+ else if (cls.equals(CacheConflictResolutionManager.class)) {
+ T cmp = (T)ctx.createComponent(CacheConflictResolutionManager.class);
+
+ if (cmp != null)
+ return cmp;
+ else
+ return (T)new CacheOsConflictResolutionManager<>();
+ }
else if (cls.equals(CacheStoreManager.class))
return (T)new CacheOsStoreManager(ctx, cfg);
[08/27] incubator-ignite git commit: # ignite-917
Posted by sb...@apache.org.
# ignite-917
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2ad4fe12
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2ad4fe12
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2ad4fe12
Branch: refs/heads/ignite-648-failover
Commit: 2ad4fe121184ce3bb38e899df826208da83c5b0d
Parents: b29ff1c
Author: Atri <at...@gmail.com>
Authored: Wed Jun 10 15:47:00 2015 +0530
Committer: ashutak <as...@gridgain.com>
Committed: Wed Jun 24 16:15:58 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/cluster/ClusterGroup.java | 9 +++++
.../internal/cluster/ClusterGroupAdapter.java | 42 ++++++++++++++++++++
.../cluster/IgniteClusterAsyncImpl.java | 5 +++
.../ignite/internal/GridProjectionSelfTest.java | 19 +++++++++
4 files changed, 75 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
index 06854d4..2f43fc6 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
@@ -193,6 +193,15 @@ public interface ClusterGroup {
public ClusterGroup forHost(ClusterNode node);
/**
+ * Gets cluster group consisting from the nodes running on the hosts specified.
+ *
+ * @param host Host name to get nodes to put in cluster
+ * @param hosts Host names to get nodes to put in cluster.
+ * @return Cluster group for nodes residing on the hosts specified.
+ */
+ public ClusterGroup forHost(String host, String... hosts);
+
+ /**
* Gets a cluster group consisting from the daemon nodes.
* <p>
* Daemon nodes are the usual grid nodes that participate in topology but not
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index bb82c3b..1831321 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -577,6 +577,11 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
}
/** {@inheritDoc} */
+ @Override public final ClusterGroup forHost(String host, String... hosts) {
+ return forPredicate(new HostsFilter(host, hosts));
+ }
+
+ /** {@inheritDoc} */
@Override public final ClusterGroup forDaemons() {
return forPredicate(new DaemonFilter());
}
@@ -762,6 +767,43 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
/**
*/
+ private static class HostsFilter implements IgnitePredicate<ClusterNode> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Hosts Names. */
+ private final HashSet hashInputHostNames;
+
+ /**
+ * @param name First host name.
+ * @param names Host names
+ */
+ private HostsFilter(String name, String[] names) {
+ hashInputHostNames = new HashSet();
+
+ if (name != null)
+ hashInputHostNames.add(name);
+
+ if (names != null && (names.length > 0)) {
+ for (String currentInputHostName : names)
+ hashInputHostNames.add(currentInputHostName);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode n) {
+ for (String currentHostName : n.hostNames()) {
+ if (hashInputHostNames.contains(currentHostName)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ /**
+ */
private static class DaemonFilter implements IgnitePredicate<ClusterNode> {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index 7f67b4f..ca6cf32 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -232,6 +232,11 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
}
/** {@inheritDoc} */
+ @Override public ClusterGroup forHost(String host, String... hosts) {
+ return cluster.forHost(host, hosts);
+ }
+
+ /** {@inheritDoc} */
@Override public ClusterGroup forDaemons() {
return cluster.forDaemons();
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad4fe12/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
index 9fbad80..bd625d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
@@ -248,4 +248,23 @@ public class GridProjectionSelfTest extends GridProjectionAbstractTest {
return even ? cnt - 1 : cnt - 2;
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForHost() throws Exception {
+ Collection<ClusterNode> allNodes = ignite.cluster().nodes();
+ ClusterNode localNode = ignite.cluster().localNode();
+ ArrayList<String> inputHostNames = new ArrayList<String> ();
+
+ for (ClusterNode currentNode : allNodes)
+ Collections.addAll(inputHostNames, currentNode.hostNames().toArray(new String[0]));
+
+ String[] inputHostNamesArray = inputHostNames.toArray(new String[] {});
+ ClusterGroup resultGroup = ignite.cluster().forHost(inputHostNamesArray[0], inputHostNamesArray);
+ ClusterGroup nullTestGroup = ignite.cluster().forHost(null, null);
+
+ assert((resultGroup.node(localNode.id())) != null);
+ assert((nullTestGroup.node(localNode.id())) == null);
+ }
}
[12/27] incubator-ignite git commit: Merge branch 'ignite-gg-10440'
into ignite-sprint-7
Posted by sb...@apache.org.
Merge branch 'ignite-gg-10440' into ignite-sprint-7
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7fc5595a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7fc5595a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7fc5595a
Branch: refs/heads/ignite-648-failover
Commit: 7fc5595ac58bdd628a42cf870e59fc31e89e99af
Parents: b29ff1c c528705
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:41:55 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:41:55 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridKernalContextImpl.java | 3 +++
.../internal/processors/plugin/CachePluginManager.java | 10 ++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[26/27] incubator-ignite git commit: Merge branch 'ignite-sprint-7'
into ignite-648
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-648
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/15c2821f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/15c2821f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/15c2821f
Branch: refs/heads/ignite-648-failover
Commit: 15c2821fa611a69c633b3a20005576c7a3cd8430
Parents: 8361e08 6e23608
Author: ashutak <as...@gridgain.com>
Authored: Fri Jun 26 16:50:28 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jun 26 16:50:28 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterGroup.java | 9 +
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../ignite/compute/ComputeTaskSplitAdapter.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +
.../internal/cluster/ClusterGroupAdapter.java | 38 +
.../cluster/IgniteClusterAsyncImpl.java | 5 +
.../GridCachePartitionExchangeManager.java | 6 +-
.../processors/plugin/CachePluginManager.java | 10 +-
.../internal/util/GridConfigurationFinder.java | 55 +-
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 151 ++--
.../ignite/spi/discovery/tcp/ServerImpl.java | 103 ++-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++
.../internal/ClusterGroupAbstractTest.java | 777 ++++++++++++++++++
.../ignite/internal/ClusterGroupSelfTest.java | 251 ++++++
.../internal/GridDiscoveryEventSelfTest.java | 12 +-
.../internal/GridProjectionAbstractTest.java | 784 -------------------
.../ignite/internal/GridProjectionSelfTest.java | 251 ------
.../apache/ignite/internal/GridSelfTest.java | 2 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 37 +
...achePartitionedMultiNodeFullApiSelfTest.java | 4 +-
.../internal/util/IgniteUtilsSelfTest.java | 22 +
.../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++++++-
.../ignite/testsuites/IgniteBasicTestSuite.java | 6 +-
.../p2p/GridP2PContinuousDeploymentTask1.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 7 +-
scripts/git-patch-prop.sh | 2 +-
29 files changed, 1766 insertions(+), 1166 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15c2821f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
[07/27] incubator-ignite git commit: # ignite-sprint-7 added test
Posted by sb...@apache.org.
# ignite-sprint-7 added test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b29ff1cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b29ff1cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b29ff1cb
Branch: refs/heads/ignite-648-failover
Commit: b29ff1cb24ff344fb624a803cf210cae9f9001d2
Parents: c270bd8
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 15:40:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 15:40:56 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteDynamicCacheStartSelfTest.java | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b29ff1cb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 7905565..9c483ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -1105,4 +1105,41 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
fut.get();
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartStopSameCacheMultinode() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-993");
+
+ final AtomicInteger idx = new AtomicInteger();
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int node = idx.getAndIncrement();
+
+ Ignite ignite = ignite(node);
+
+ Thread.currentThread().setName("start-stop-" + ignite.name());
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName("testStartStop");
+
+ for (int i = 0; i < 1000; i++) {
+ log.info("Start cache: " + i);
+
+ try (IgniteCache<Object, Object> cache = ignite.getOrCreateCache(ccfg)) {
+ // No-op.
+ }
+
+ log.info("Stopped cache: " + i);
+ }
+
+ return null;
+ }
+ }, nodeCount(), "start-stop-cache");
+
+ fut.get();
+ }
}
[27/27] incubator-ignite git commit: # ignite-648: remove grod count
Posted by sb...@apache.org.
# ignite-648: remove grod count
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cb4e5570
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cb4e5570
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cb4e5570
Branch: refs/heads/ignite-648-failover
Commit: cb4e557082a3288c3a4c2975c849ef0a93f438c4
Parents: 15c2821
Author: ashutak <as...@gridgain.com>
Authored: Fri Jun 26 16:53:27 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Fri Jun 26 16:53:27 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractSelfTest.java | 5 +++++
.../testframework/junits/GridAbstractTest.java | 17 -----------------
2 files changed, 5 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4e5570/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 bb207fc..f75f77d 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
@@ -59,6 +59,11 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
/** VM ip finder for TCP discovery. */
protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+ /**
+ * @return Grids count to start.
+ */
+ protected abstract int gridCount();
+
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
return TEST_TIMEOUT;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb4e5570/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 2f52224..3ecbe19 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
@@ -487,17 +487,7 @@ public abstract class GridAbstractTest extends TestCase {
}
try {
- if (isMultiJvm()) {
- if (gridCount() < 2)
- throw new IllegalStateException("Grid count have to be more 1 in milti jvm mode.");
-
- allNodesJoinLatch = new CountDownLatch(gridCount() - 1);
- }
-
beforeTestsStarted();
-
- if (isMultiJvm())
- assert allNodesJoinLatch.await(20, TimeUnit.SECONDS);
}
catch (Exception | Error t) {
t.printStackTrace();
@@ -1368,13 +1358,6 @@ public abstract class GridAbstractTest extends TestCase {
}
/**
- * @return Grids count to start.
- */
- protected int gridCount() {
- return 0;
- }
-
- /**
* Gets flag whether nodes will run in one jvm or in separate jvms.
*
* @return <code>True</code> to run nodes in separate jvms.
[09/27] incubator-ignite git commit: # ignite-917: review
(ignite-1033 fixed).
Posted by sb...@apache.org.
# ignite-917: review (ignite-1033 fixed).
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/532a98f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/532a98f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/532a98f1
Branch: refs/heads/ignite-648-failover
Commit: 532a98f13933ce34168b64854a735f4f9ee4b8bd
Parents: 2ad4fe1
Author: ashutak <as...@gridgain.com>
Authored: Wed Jun 24 16:19:27 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Wed Jun 24 16:19:27 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../internal/cluster/ClusterGroupAdapter.java | 30 +++--
.../cluster/IgniteClusterAsyncImpl.java | 2 +-
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++++++++++++++++++
.../ignite/internal/GridProjectionSelfTest.java | 19 ----
.../internal/util/IgniteUtilsSelfTest.java | 22 ++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
9 files changed, 157 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
index 5aec7e5..a2e7c38 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
@@ -20,9 +20,9 @@ package org.apache.ignite.internal.client.integration;
import org.apache.ignite.*;
import org.apache.ignite.internal.client.*;
import org.apache.ignite.internal.util.*;
-import org.apache.ignite.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.testframework.*;
import org.apache.ignite.testframework.junits.common.*;
import org.jetbrains.annotations.*;
@@ -146,7 +146,7 @@ public abstract class ClientAbstractConnectivitySelfTest extends GridCommonAbstr
startRestNode("grid1", LOOPBACK_IP, defaultRestPort());
checkConnectivityByIp(LOOPBACK_IP, F.t((Collection<String>)Collections.singleton(LOOPBACK_IP),
- (Collection<String>)Collections.singleton("")));
+ (Collection<String>)Collections.<String>emptySet()));
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index 85fd08a..bb792d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -188,6 +188,8 @@ public interface ClusterNode {
* <p>
* If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used,
* and this method returns host names of all addresses of that node.
+ * <p/
+ * Note: the loopback address will skipped from the results.
*
* @return Collection of host names.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 1831321..b940017 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -578,7 +578,9 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
/** {@inheritDoc} */
@Override public final ClusterGroup forHost(String host, String... hosts) {
- return forPredicate(new HostsFilter(host, hosts));
+ A.notNull(host, "host");
+
+ return forPredicate(new HostsFilter(host, hosts));
}
/** {@inheritDoc} */
@@ -772,30 +774,24 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
private static final long serialVersionUID = 0L;
/** Hosts Names. */
- private final HashSet hashInputHostNames;
+ private final Collection<String> validHostNames = new HashSet<>();
/**
- * @param name First host name.
- * @param names Host names
+ * @param name First host name.
+ * @param names Host names
*/
- private HostsFilter(String name, String[] names) {
- hashInputHostNames = new HashSet();
-
- if (name != null)
- hashInputHostNames.add(name);
+ private HostsFilter(String name, String... names) {
+ validHostNames.add(name);
- if (names != null && (names.length > 0)) {
- for (String currentInputHostName : names)
- hashInputHostNames.add(currentInputHostName);
- }
+ if (names != null && (names.length > 0))
+ Collections.addAll(validHostNames, names);
}
/** {@inheritDoc} */
@Override public boolean apply(ClusterNode n) {
- for (String currentHostName : n.hostNames()) {
- if (hashInputHostNames.contains(currentHostName)) {
- return true;
- }
+ for (String hostName : n.hostNames()) {
+ if (validHostNames.contains(hostName))
+ return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index ca6cf32..6e68527 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -233,7 +233,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
/** {@inheritDoc} */
@Override public ClusterGroup forHost(String host, String... hosts) {
- return cluster.forHost(host, hosts);
+ return cluster.forHost(host, hosts);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 6623e85..f457d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -1658,10 +1658,10 @@ public abstract class IgniteUtils {
String ipAddr = addr.getHostAddress();
- hostName = F.isEmpty(hostName) || hostName.equals(ipAddr) || addr.isLoopbackAddress() ? "" : hostName;
-
addrs.add(ipAddr);
- hostNames.add(hostName);
+
+ if (!F.isEmpty(hostName) && !addr.isLoopbackAddress())
+ hostNames.add(hostName);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
new file mode 100644
index 0000000..59c3db9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterForHostsSelfTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Test for {@link ClusterGroup#forHost(String, String...)}.
+ *
+ * @see GridProjectionSelfTest
+ */
+@GridCommonTest(group = "Kernal Self")
+public class ClusterForHostsSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ Collection<String> hostNames = null;
+
+ if ("forHostTest".equals(gridName))
+ hostNames = Arrays.asList("h_1", "h_2", "h_3");
+
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (hostNames != null) {
+ TcpDiscoverySpi disco = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+
+ cfg.setDiscoverySpi(new CustomHostsTcpDiscoverySpi(hostNames).setIpFinder(disco.getIpFinder()));
+ }
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForHosts() throws Exception {
+ Ignite ignite = startGrid("forHostTest");
+
+ assertEquals(1, ignite.cluster().forHost("h_1").nodes().size());
+ assertEquals(1, ignite.cluster().forHost("h_1", "h_3").nodes().size());
+ assertEquals(1, ignite.cluster().forHost("unknown_host", "h_2").nodes().size());
+ assertEquals(1, ignite.cluster().forHost("h_1", "h_3", "unknown_host", "h_2").nodes().size());
+
+ assertEquals(0, ignite.cluster().forHost("unknown_host").nodes().size());
+
+ boolean gotNpe = false;
+
+ try {
+ assertEquals(0, ignite.cluster().forHost(null, null, null).nodes().size());
+ }
+ catch (NullPointerException e) {
+ gotNpe = true;
+ }
+
+ assertTrue(gotNpe);
+ }
+
+ /**
+ * Tcp discovery spi that allow to customise hostNames of created local node.
+ */
+ private static class CustomHostsTcpDiscoverySpi extends TcpDiscoverySpi {
+ /** Hosts. */
+ private final Collection<String> hosts;
+
+ /**
+ * @param hosts Host names which will be retuned by {@link ClusterNode#hostNames()} of created local node.
+ */
+ CustomHostsTcpDiscoverySpi(Collection<String> hosts) {
+ this.hosts = hosts;
+ }
+
+ /**
+ * @param srvPort Server port.
+ */
+ @Override protected void initLocalNode(int srvPort, boolean addExtAddrAttr) {
+ super.initLocalNode(srvPort, addExtAddrAttr);
+
+ try {
+ Field hostNamesField = locNode.getClass().getDeclaredField("hostNames");
+
+ hostNamesField.setAccessible(true);
+
+ hostNamesField.set(locNode, hosts);
+ }
+ catch (IllegalAccessException | NoSuchFieldException e) {
+ U.error(log, "Looks like implementation of " + locNode.getClass()
+ + " class was changed. Need to update test.", e);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
index bd625d9..9fbad80 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
@@ -248,23 +248,4 @@ public class GridProjectionSelfTest extends GridProjectionAbstractTest {
return even ? cnt - 1 : cnt - 2;
}
-
- /**
- * @throws Exception If failed.
- */
- public void testForHost() throws Exception {
- Collection<ClusterNode> allNodes = ignite.cluster().nodes();
- ClusterNode localNode = ignite.cluster().localNode();
- ArrayList<String> inputHostNames = new ArrayList<String> ();
-
- for (ClusterNode currentNode : allNodes)
- Collections.addAll(inputHostNames, currentNode.hostNames().toArray(new String[0]));
-
- String[] inputHostNamesArray = inputHostNames.toArray(new String[] {});
- ClusterGroup resultGroup = ignite.cluster().forHost(inputHostNamesArray[0], inputHostNamesArray);
- ClusterGroup nullTestGroup = ignite.cluster().forHost(null, null);
-
- assert((resultGroup.node(localNode.id())) != null);
- assert((nullTestGroup.node(localNode.id())) == null);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
index 6e3e0e2..4762001 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/IgniteUtilsSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.compute.*;
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.testframework.*;
import org.apache.ignite.testframework.http.*;
import org.apache.ignite.testframework.junits.*;
@@ -698,6 +699,27 @@ public class IgniteUtilsSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testResolveLocalAddresses() throws Exception {
+ InetAddress inetAddress = InetAddress.getByName("0.0.0.0");
+
+ IgniteBiTuple<Collection<String>, Collection<String>> addrs = U.resolveLocalAddresses(inetAddress);
+
+ Collection<String> hostNames = addrs.get2();
+
+ assertFalse(hostNames.contains(null));
+ assertFalse(hostNames.contains(""));
+ assertFalse(hostNames.contains("127.0.0.1"));
+
+ assertFalse(F.exist(hostNames, new IgnitePredicate<String>() {
+ @Override public boolean apply(String hostName) {
+ return hostName.contains("localhost") || hostName.contains("0:0:0:0:0:0:0:1");
+ }
+ }));
+ }
+
+ /**
* Test enum.
*/
private enum TestEnum {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/532a98f1/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 2d14728..8be9f31 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
@@ -66,6 +66,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridSelfTest.class));
GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+ suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);
[13/27] incubator-ignite git commit: # minor
Posted by sb...@apache.org.
# minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8d8d2916
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8d8d2916
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8d8d2916
Branch: refs/heads/ignite-648-failover
Commit: 8d8d29160599e454d53244873ee67b61850fbbf2
Parents: b29ff1c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 12:59:24 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 12:59:24 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java | 2 +-
.../apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d8d2916/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
index 7b3b0d6..bc4b3c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSplitAdapter.java
@@ -73,7 +73,7 @@ public abstract class ComputeTaskSplitAdapter<T, R> extends ComputeTaskAdapter<T
/** Load balancer. */
@LoadBalancerResource
- private ComputeLoadBalancer balancer;
+ private transient ComputeLoadBalancer balancer;
/**
* This is a simplified version of {@link ComputeTask#map(List, Object)} method.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d8d2916/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
index 725274b..e5c423c 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
@@ -33,7 +33,7 @@ public class GridP2PContinuousDeploymentTask1 extends ComputeTaskSplitAdapter<Ob
@Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
return Collections.singleton(new ComputeJobAdapter() {
@IgniteInstanceResource
- private Ignite ignite;
+ private transient Ignite ignite;
@Override public Object execute() {
X.println(">>> Executing GridP2PContinuousDeploymentTask1 job.");
[19/27] incubator-ignite git commit: Merge branches 'ignite-1037' and
'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-1037
Posted by sb...@apache.org.
Merge branches 'ignite-1037' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1037
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/20a45375
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/20a45375
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/20a45375
Branch: refs/heads/ignite-648-failover
Commit: 20a45375d115a38bbaa96206b689131551a15bb5
Parents: 65964e2 646c361
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 22:26:32 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 22:26:32 2015 +0700
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterGroup.java | 9 +
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../ignite/compute/ComputeTaskSplitAdapter.java | 2 +-
.../configuration/IgniteReflectionFactory.java | 81 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +
.../internal/cluster/ClusterGroupAdapter.java | 38 +
.../cluster/IgniteClusterAsyncImpl.java | 5 +
.../processors/cache/GridCacheContext.java | 2 +-
.../distributed/dht/GridDhtLocalPartition.java | 3 +-
.../distributed/dht/GridDhtLockFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 9 +-
.../GridDhtPartitionsExchangeFuture.java | 46 +-
.../datastructures/DataStructuresProcessor.java | 64 +-
.../processors/hadoop/HadoopJobInfo.java | 4 +-
.../hadoop/counter/HadoopCounterWriter.java | 5 +-
.../processors/plugin/CachePluginManager.java | 10 +-
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++
.../internal/ClusterGroupAbstractTest.java | 777 ++++++++++++++++++
.../ignite/internal/ClusterGroupSelfTest.java | 251 ++++++
.../internal/GridProjectionAbstractTest.java | 784 -------------------
.../ignite/internal/GridProjectionSelfTest.java | 251 ------
.../apache/ignite/internal/GridSelfTest.java | 2 +-
.../CacheReadThroughAtomicRestartSelfTest.java | 32 +
...heReadThroughLocalAtomicRestartSelfTest.java | 32 +
.../CacheReadThroughLocalRestartSelfTest.java | 32 +
...dThroughReplicatedAtomicRestartSelfTest.java | 32 +
...cheReadThroughReplicatedRestartSelfTest.java | 32 +
.../cache/CacheReadThroughRestartSelfTest.java | 133 ++++
.../cache/GridCacheAbstractSelfTest.java | 2 +-
...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 37 +
...GridCacheQueueMultiNodeAbstractSelfTest.java | 4 +-
.../GridCacheSetAbstractSelfTest.java | 22 +-
.../IgniteDataStructureWithJobTest.java | 111 +++
.../distributed/IgniteCache150ClientsTest.java | 189 +++++
...teCacheClientNodePartitionsExchangeTest.java | 1 +
.../distributed/IgniteCacheManyClientsTest.java | 1 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 -
...achePartitionedMultiNodeFullApiSelfTest.java | 49 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 +
.../IgniteCacheTxStoreSessionTest.java | 4 +
.../internal/util/IgniteUtilsSelfTest.java | 22 +
.../testframework/junits/GridAbstractTest.java | 2 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 6 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite4.java | 8 +
.../testsuites/IgniteClientTestSuite.java | 38 +
.../p2p/GridP2PContinuousDeploymentTask1.java | 2 +-
modules/hadoop/pom.xml | 78 --
.../fs/IgniteHadoopFileSystemCounterWriter.java | 9 +-
.../processors/hadoop/HadoopClassLoader.java | 29 +
.../processors/hadoop/HadoopDefaultJobInfo.java | 27 +-
.../internal/processors/hadoop/HadoopUtils.java | 237 ------
.../hadoop/SecondaryFileSystemProvider.java | 3 +-
.../hadoop/fs/HadoopFileSystemCacheUtils.java | 241 ++++++
.../hadoop/fs/HadoopFileSystemsUtils.java | 11 +
.../hadoop/fs/HadoopLazyConcurrentMap.java | 5 +
.../hadoop/jobtracker/HadoopJobTracker.java | 25 +-
.../child/HadoopChildProcessRunner.java | 3 +-
.../processors/hadoop/v2/HadoopV2Job.java | 84 +-
.../hadoop/v2/HadoopV2JobResourceManager.java | 22 +-
.../hadoop/v2/HadoopV2TaskContext.java | 37 +-
.../apache/ignite/igfs/IgfsEventsTestSuite.java | 5 +-
.../processors/hadoop/HadoopMapReduceTest.java | 2 +-
.../processors/hadoop/HadoopTasksV1Test.java | 7 +-
.../processors/hadoop/HadoopTasksV2Test.java | 7 +-
.../processors/hadoop/HadoopV2JobSelfTest.java | 6 +-
.../collections/HadoopAbstractMapTest.java | 3 +-
.../testsuites/IgniteHadoopTestSuite.java | 2 +-
.../IgniteIgfsLinuxAndMacOSTestSuite.java | 3 +-
72 files changed, 3069 insertions(+), 1518 deletions(-)
----------------------------------------------------------------------
[06/27] incubator-ignite git commit: # ignite-733 Changed node print
in cache command.
Posted by sb...@apache.org.
# ignite-733 Changed node print in cache command.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/38f5e415
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/38f5e415
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/38f5e415
Branch: refs/heads/ignite-648-failover
Commit: 38f5e415362e8b7bbd520bdf6a19aebf3da61e75
Parents: 359b431
Author: Andrey <an...@gridgain.com>
Authored: Wed Jun 24 13:14:15 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed Jun 24 13:14:15 2015 +0700
----------------------------------------------------------------------
.../ignite/visor/commands/cache/VisorCacheCommand.scala | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38f5e415/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 144779c..4c005af 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -328,7 +328,7 @@ class VisorCacheCommand {
sumT += (
mkCacheName(ad.name()),
ad.mode(),
- ad.nodes.map(nid8),
+ ad.nodes.size(),
(
"min: " + ad.minimumSize,
"avg: " + formatDouble(ad.averageSize),
@@ -619,9 +619,9 @@ class VisorCacheCommand {
val sumT = VisorTextTable()
- sumT #= ("#", "Name(@)", "Mode", "Nodes", "Size")
+ sumT #= ("#", "Name(@)", "Mode", "Size")
- (0 until sortedAggrData.size) foreach (i => {
+ sortedAggrData.indices.foreach(i => {
val ad = sortedAggrData(i)
// Add cache host as visor variable.
@@ -631,7 +631,6 @@ class VisorCacheCommand {
i,
mkCacheName(ad.name()),
ad.mode(),
- ad.nodes,
(
"min: " + ad.minimumSize,
"avg: " + formatDouble(ad.averageSize),
[10/27] incubator-ignite git commit: Merge branch 'ignite-sprint-7'
into ignite-gg-10440
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b2e8fea0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b2e8fea0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b2e8fea0
Branch: refs/heads/ignite-648-failover
Commit: b2e8fea0e9d3154f8cdde8ac4fed7d6ede1e7ace
Parents: 5b306e1 b29ff1c
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:13:10 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:13:10 2015 +0300
----------------------------------------------------------------------
.../configuration/IgniteReflectionFactory.java | 81 +++-
.../processors/cache/GridCacheContext.java | 2 +-
.../distributed/dht/GridDhtLocalPartition.java | 3 +-
.../distributed/dht/GridDhtLockFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicCache.java | 9 +-
.../GridDhtPartitionsExchangeFuture.java | 95 +++-
.../datastructures/DataStructuresProcessor.java | 64 +--
.../processors/hadoop/HadoopJobInfo.java | 4 +-
.../hadoop/counter/HadoopCounterWriter.java | 5 +-
.../communication/tcp/TcpCommunicationSpi.java | 12 +
.../CacheReadThroughAtomicRestartSelfTest.java | 32 ++
...heReadThroughLocalAtomicRestartSelfTest.java | 32 ++
.../CacheReadThroughLocalRestartSelfTest.java | 32 ++
...dThroughReplicatedAtomicRestartSelfTest.java | 32 ++
...cheReadThroughReplicatedRestartSelfTest.java | 32 ++
.../cache/CacheReadThroughRestartSelfTest.java | 133 ++++++
.../cache/GridCacheAbstractSelfTest.java | 2 +-
...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 37 ++
...GridCacheQueueMultiNodeAbstractSelfTest.java | 4 +-
.../GridCacheSetAbstractSelfTest.java | 22 +-
.../IgniteDataStructureWithJobTest.java | 111 +++++
.../distributed/IgniteCache150ClientsTest.java | 189 ++++++++
...teCacheClientNodePartitionsExchangeTest.java | 1 +
.../distributed/IgniteCacheManyClientsTest.java | 1 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 -
...achePartitionedMultiNodeFullApiSelfTest.java | 49 +-
.../GridCacheReplicatedFailoverSelfTest.java | 5 +
.../IgniteCacheTxStoreSessionTest.java | 4 +
.../GridTcpCommunicationSpiConfigSelfTest.java | 1 -
.../testframework/junits/GridAbstractTest.java | 2 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite4.java | 8 +
.../testsuites/IgniteClientTestSuite.java | 38 ++
modules/hadoop/pom.xml | 78 ----
.../fs/IgniteHadoopFileSystemCounterWriter.java | 9 +-
.../processors/hadoop/HadoopClassLoader.java | 29 ++
.../processors/hadoop/HadoopDefaultJobInfo.java | 27 +-
.../internal/processors/hadoop/HadoopUtils.java | 237 ----------
.../hadoop/SecondaryFileSystemProvider.java | 3 +-
.../hadoop/fs/HadoopFileSystemCacheUtils.java | 241 ++++++++++
.../hadoop/fs/HadoopFileSystemsUtils.java | 11 +
.../hadoop/fs/HadoopLazyConcurrentMap.java | 5 +
.../hadoop/jobtracker/HadoopJobTracker.java | 25 +-
.../child/HadoopChildProcessRunner.java | 3 +-
.../processors/hadoop/v2/HadoopV2Job.java | 84 +++-
.../hadoop/v2/HadoopV2JobResourceManager.java | 22 +-
.../hadoop/v2/HadoopV2TaskContext.java | 37 +-
.../apache/ignite/igfs/IgfsEventsTestSuite.java | 5 +-
.../processors/hadoop/HadoopMapReduceTest.java | 2 +-
.../processors/hadoop/HadoopTasksV1Test.java | 7 +-
.../processors/hadoop/HadoopTasksV2Test.java | 7 +-
.../processors/hadoop/HadoopV2JobSelfTest.java | 6 +-
.../collections/HadoopAbstractMapTest.java | 3 +-
.../testsuites/IgniteHadoopTestSuite.java | 2 +-
.../IgniteIgfsLinuxAndMacOSTestSuite.java | 3 +-
56 files changed, 1878 insertions(+), 484 deletions(-)
----------------------------------------------------------------------
[02/27] incubator-ignite git commit: Merge branch 'ignite-sprint-7'
into ignite-gg-10440
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/09062925
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/09062925
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/09062925
Branch: refs/heads/ignite-648-failover
Commit: 090629255360603de4b2b3828812913d16243686
Parents: 987d91e cd06e1d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 16:23:45 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 16:23:45 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../ignite/internal/MarshallerContextImpl.java | 12 +-
.../internal/managers/GridManagerAdapter.java | 8 +-
.../discovery/GridDiscoveryManager.java | 30 ++-
.../processors/cache/GridCacheIoManager.java | 64 ++++--
.../GridCachePartitionExchangeManager.java | 71 ++++---
.../processors/cache/GridCacheSwapManager.java | 12 +-
.../continuous/CacheContinuousQueryHandler.java | 8 +
.../offheap/GridOffHeapProcessor.java | 19 +-
.../apache/ignite/internal/util/GridDebug.java | 37 ++--
.../ignite/internal/util/nio/GridNioServer.java | 64 +++++-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 7 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 9 +-
.../communication/tcp/TcpCommunicationSpi.java | 92 ++++++++-
.../tcp/TcpCommunicationSpiMBean.java | 19 ++
.../ignite/spi/discovery/DiscoverySpi.java | 3 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 80 +++++---
.../ignite/spi/discovery/tcp/ServerImpl.java | 17 +-
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 3 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 6 +-
.../messages/TcpDiscoveryNodeFailedMessage.java | 18 ++
...ridFailFastNodeFailureDetectionSelfTest.java | 17 +-
.../IgniteSlowClientDetectionSelfTest.java | 187 ++++++++++++++++++
.../GridCacheAbstractFailoverSelfTest.java | 6 +-
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 +++++++++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 44 ++++-
.../testframework/GridSpiTestContext.java | 7 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 1 +
.../processors/query/h2/IgniteH2Indexing.java | 2 +
.../query/h2/twostep/GridMapQueryExecutor.java | 23 ++-
.../cache/IgniteCacheOffheapEvictQueryTest.java | 196 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 3 +-
.../cache/jta/GridCacheXAResource.java | 18 +-
.../processors/cache/GridCacheJtaSelfTest.java | 2 +-
35 files changed, 1036 insertions(+), 172 deletions(-)
----------------------------------------------------------------------
[14/27] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-7' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fc17f07b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fc17f07b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fc17f07b
Branch: refs/heads/ignite-648-failover
Commit: fc17f07be91fb7851bda8cf847b5a8c4194acffe
Parents: 8d8d291 7fc5595
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 12:59:42 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 12:59:42 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridKernalContextImpl.java | 3 +++
.../internal/processors/plugin/CachePluginManager.java | 10 ++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[03/27] incubator-ignite git commit: Merge branch 'ignite-sprint-7'
into ignite-gg-10440
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-gg-10440
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/76f53772
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/76f53772
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/76f53772
Branch: refs/heads/ignite-648-failover
Commit: 76f53772fb5b99c5dd126814764ae468d3b31be0
Parents: 0906292 5d8e404
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 17:07:28 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 17:07:28 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[21/27] incubator-ignite git commit: # ignite-sprint-7: update sprint
version at git-patch-prop.sh
Posted by sb...@apache.org.
# ignite-sprint-7: update sprint version at git-patch-prop.sh
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3e8ddb47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3e8ddb47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3e8ddb47
Branch: refs/heads/ignite-648-failover
Commit: 3e8ddb47dcef245596e9b7028a3f37a43e568185
Parents: e1c49b7
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 21:04:11 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 21:04:11 2015 +0300
----------------------------------------------------------------------
scripts/git-patch-prop.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3e8ddb47/scripts/git-patch-prop.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-prop.sh b/scripts/git-patch-prop.sh
index c856fb4..16f907e 100644
--- a/scripts/git-patch-prop.sh
+++ b/scripts/git-patch-prop.sh
@@ -19,6 +19,6 @@
#
# Git patch-file maker/applier properties.
#
-IGNITE_DEFAULT_BRANCH='ignite-sprint-5'
+IGNITE_DEFAULT_BRANCH='ignite-sprint-7'
PATCHES_HOME=${IGNITE_HOME}
[20/27] incubator-ignite git commit: Merge branches 'ignite-733' and
'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-733
Posted by sb...@apache.org.
Merge branches 'ignite-733' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-733
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1c49b75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1c49b75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1c49b75
Branch: refs/heads/ignite-648-failover
Commit: e1c49b75fdfe86f34d2e44aa59aaa1851b03d778
Parents: 38f5e41 20a4537
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 22:29:06 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 22:29:06 2015 +0700
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterGroup.java | 9 +
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../ignite/compute/ComputeTaskSplitAdapter.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +
.../internal/cluster/ClusterGroupAdapter.java | 38 +
.../cluster/IgniteClusterAsyncImpl.java | 5 +
.../processors/cache/GridCacheContext.java | 2 +-
.../distributed/dht/GridDhtLockFuture.java | 2 +-
.../GridDhtPartitionsExchangeFuture.java | 46 +-
.../datastructures/DataStructuresProcessor.java | 64 +-
.../processors/plugin/CachePluginManager.java | 10 +-
.../internal/util/GridConfigurationFinder.java | 55 +-
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++
.../internal/ClusterGroupAbstractTest.java | 777 ++++++++++++++++++
.../ignite/internal/ClusterGroupSelfTest.java | 251 ++++++
.../internal/GridProjectionAbstractTest.java | 784 -------------------
.../ignite/internal/GridProjectionSelfTest.java | 251 ------
.../apache/ignite/internal/GridSelfTest.java | 2 +-
.../CacheReadThroughAtomicRestartSelfTest.java | 32 +
...heReadThroughLocalAtomicRestartSelfTest.java | 32 +
.../CacheReadThroughLocalRestartSelfTest.java | 32 +
...dThroughReplicatedAtomicRestartSelfTest.java | 32 +
...cheReadThroughReplicatedRestartSelfTest.java | 32 +
.../cache/CacheReadThroughRestartSelfTest.java | 133 ++++
.../cache/GridCacheAbstractSelfTest.java | 2 +-
...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 37 +
...GridCacheQueueMultiNodeAbstractSelfTest.java | 4 +-
.../GridCacheSetAbstractSelfTest.java | 22 +-
.../IgniteDataStructureWithJobTest.java | 111 +++
.../distributed/IgniteCache150ClientsTest.java | 189 +++++
...teCacheClientNodePartitionsExchangeTest.java | 1 +
.../distributed/IgniteCacheManyClientsTest.java | 1 +
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 -
...achePartitionedMultiNodeFullApiSelfTest.java | 49 +-
.../IgniteCacheTxStoreSessionTest.java | 4 +
.../internal/util/IgniteUtilsSelfTest.java | 22 +
.../ignite/testsuites/IgniteBasicTestSuite.java | 6 +-
.../IgniteCacheDataStructuresSelfTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite4.java | 8 +
.../testsuites/IgniteClientTestSuite.java | 38 +
.../p2p/GridP2PContinuousDeploymentTask1.java | 2 +-
44 files changed, 2532 insertions(+), 1155 deletions(-)
----------------------------------------------------------------------
[18/27] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-7' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7
Conflicts:
modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/646c3613
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/646c3613
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/646c3613
Branch: refs/heads/ignite-648-failover
Commit: 646c361323de82e0bc94a6912e838f39061fc204
Parents: 6c3d97f 9f74335
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 17:20:12 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 17:20:12 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterGroup.java | 9 ++
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../internal/cluster/ClusterGroupAdapter.java | 38 +++++++
.../cluster/IgniteClusterAsyncImpl.java | 5 +
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++++++++++++++++++
.../internal/util/IgniteUtilsSelfTest.java | 22 ++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 4 +-
9 files changed, 197 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/646c3613/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 3da198c,9b7f392..6ff83e2
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@@ -65,9 -65,11 +65,11 @@@ public class IgniteBasicTestSuite exten
suite.addTest(IgniteStreamSelfTestSuite.suite());
suite.addTest(new TestSuite(GridSelfTest.class));
+ suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
+ suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
-
- GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
++
+ GridTestUtils.addTestIfNeeded(suite, ClusterGroupSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
- suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);
if (U.isLinux() || U.isMacOs())
[23/27] incubator-ignite git commit: # ignite-sprint-7 enabled test
Posted by sb...@apache.org.
# ignite-sprint-7 enabled test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/01d842a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/01d842a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/01d842a5
Branch: refs/heads/ignite-648-failover
Commit: 01d842a5110587cf6df4a17217a0674e9bed391f
Parents: 3e8ddb4
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 12:29:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 12:29:17 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridDiscoveryEventSelfTest.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01d842a5/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
index 3981b7f..d820dba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
@@ -98,7 +98,7 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
private AtomicInteger cnt = new AtomicInteger();
@Override public boolean apply(Event evt) {
- assert evt.type() == EVT_NODE_JOINED;
+ assert evt.type() == EVT_NODE_JOINED : evt;
evts.put(cnt.getAndIncrement(), ((DiscoveryEvent)evt).topologyNodes());
@@ -147,8 +147,6 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLeaveSequenceEvents() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-932");
-
try {
Ignite g0 = startGrid(0);
@@ -165,6 +163,8 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
private AtomicInteger cnt = new AtomicInteger();
@Override public boolean apply(Event evt) {
+ assert evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED : evt;
+
evts.put(cnt.getAndIncrement(), ((DiscoveryEvent) evt).topologyNodes());
latch.countDown();
@@ -215,8 +215,6 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testMixedSequenceEvents() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-932");
-
try {
Ignite g0 = startGrid(0);
@@ -231,7 +229,7 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
@Override public boolean apply(Event evt) {
assert evt.type() == EVT_NODE_JOINED
- || evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED;
+ || evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED : evt;
evts.put(cnt.getAndIncrement(), ((DiscoveryEvent) evt).topologyNodes());
@@ -347,7 +345,7 @@ public class GridDiscoveryEventSelfTest extends GridCommonAbstractTest {
private AtomicInteger cnt = new AtomicInteger();
@Override public boolean apply(Event evt) {
- assert evt.type() == EVT_NODE_JOINED;
+ assert evt.type() == EVT_NODE_JOINED : evt;
X.println(">>>>>>> Joined " + F.viewReadOnly(((DiscoveryEvent) evt).topologyNodes(),
NODE_2ID));
[22/27] incubator-ignite git commit: # ignite-883 issues with client
connect/reconnect
Posted by sb...@apache.org.
# ignite-883 issues with client connect/reconnect
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/efa92c54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/efa92c54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/efa92c54
Branch: refs/heads/ignite-648-failover
Commit: efa92c54ab07d7f72b9c83aa3a09e03627d72e4a
Parents: 3e8ddb4
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 11:06:41 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 11:06:41 2015 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 6 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 151 ++++++-----
.../ignite/spi/discovery/tcp/ServerImpl.java | 103 +++++--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++++++++++++++++++-
5 files changed, 448 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa92c54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index edd0ad7..af87685 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -826,7 +826,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
updated |= top.update(null, entry.getValue()) != null;
}
- if (updated)
+ if (!cctx.kernalContext().clientNode() && updated)
refreshPartitions();
}
else
@@ -985,7 +985,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
// If not first preloading and no more topology events present,
// then we periodically refresh partition map.
- if (futQ.isEmpty() && preloadFinished) {
+ if (!cctx.kernalContext().clientNode() && futQ.isEmpty() && preloadFinished) {
refreshPartitions(timeout);
timeout = cctx.gridConfig().getNetworkTimeout();
@@ -1051,7 +1051,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
startEvtFired = true;
- if (changed && futQ.isEmpty())
+ if (!cctx.kernalContext().clientNode() && changed && futQ.isEmpty())
refreshPartitions();
}
else {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa92c54/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 0c2c059..04276d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -1123,7 +1123,7 @@ class ClientImpl extends TcpDiscoveryImpl {
if (joinLatch.getCount() > 0) {
joinError(new IgniteSpiException("Join process timed out, did not receive response for " +
"join request (consider increasing 'joinTimeout' configuration property) " +
- "[joinTimeout=" + spi.joinTimeout + ", sock=" + sock +']'));
+ "[joinTimeout=" + spi.joinTimeout + ", sock=" + sock + ']'));
break;
}
@@ -1282,17 +1282,21 @@ class ClientImpl extends TcpDiscoveryImpl {
"[msg=" + msg + ", locNode=" + locNode + ']');
}
else {
- boolean topChanged = rmtNodes.putIfAbsent(newNodeId, node) == null;
+ if (nodeAdded()) {
+ boolean topChanged = rmtNodes.putIfAbsent(newNodeId, node) == null;
- if (topChanged) {
- if (log.isDebugEnabled())
- log.debug("Added new node to topology: " + node);
+ if (topChanged) {
+ if (log.isDebugEnabled())
+ log.debug("Added new node to topology: " + node);
- Map<Integer, byte[]> data = msg.newNodeDiscoveryData();
+ Map<Integer, byte[]> data = msg.newNodeDiscoveryData();
- if (data != null)
- spi.onExchange(newNodeId, newNodeId, data, null);
+ if (data != null)
+ spi.onExchange(newNodeId, newNodeId, data, null);
+ }
}
+ else if (log.isDebugEnabled())
+ log.debug("Ignore topology message, local node not added to topology: " + msg);
}
}
@@ -1332,54 +1336,58 @@ class ClientImpl extends TcpDiscoveryImpl {
"[msg=" + msg + ", locNode=" + locNode + ']');
}
else {
- TcpDiscoveryNode node = rmtNodes.get(msg.nodeId());
+ if (nodeAdded()) {
+ TcpDiscoveryNode node = rmtNodes.get(msg.nodeId());
- if (node == null) {
- if (log.isDebugEnabled())
- log.debug("Discarding node add finished message since node is not found [msg=" + msg + ']');
+ if (node == null) {
+ if (log.isDebugEnabled())
+ log.debug("Discarding node add finished message since node is not found [msg=" + msg + ']');
- return;
- }
+ return;
+ }
- boolean evt = false;
+ boolean evt = false;
- long topVer = msg.topologyVersion();
+ long topVer = msg.topologyVersion();
- assert topVer > 0 : msg;
+ assert topVer > 0 : msg;
- if (!node.visible()) {
- node.order(topVer);
- node.visible(true);
+ if (!node.visible()) {
+ node.order(topVer);
+ node.visible(true);
- if (spi.locNodeVer.equals(node.version()))
- node.version(spi.locNodeVer);
+ if (spi.locNodeVer.equals(node.version()))
+ node.version(spi.locNodeVer);
- evt = true;
- }
- else {
- if (log.isDebugEnabled())
- log.debug("Skip node join event, node already joined [msg=" + msg + ", node=" + node + ']');
+ evt = true;
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Skip node join event, node already joined [msg=" + msg + ", node=" + node + ']');
- assert node.order() == topVer : node;
- }
+ assert node.order() == topVer : node;
+ }
- Collection<ClusterNode> top = updateTopologyHistory(topVer, msg);
+ Collection<ClusterNode> top = updateTopologyHistory(topVer, msg);
- assert top != null && top.contains(node) : "Topology does not contain node [msg=" + msg +
- ", node=" + node + ", top=" + top + ']';
+ assert top != null && top.contains(node) : "Topology does not contain node [msg=" + msg +
+ ", node=" + node + ", top=" + top + ']';
- if (!pending && joinLatch.getCount() > 0) {
- if (log.isDebugEnabled())
- log.debug("Discarding node add finished message (join process is not finished): " + msg);
+ if (!pending && joinLatch.getCount() > 0) {
+ if (log.isDebugEnabled())
+ log.debug("Discarding node add finished message (join process is not finished): " + msg);
- return;
- }
+ return;
+ }
- if (evt) {
- notifyDiscovery(EVT_NODE_JOINED, topVer, node, top);
+ if (evt) {
+ notifyDiscovery(EVT_NODE_JOINED, topVer, node, top);
- spi.stats.onNodeJoined();
+ spi.stats.onNodeJoined();
+ }
}
+ else if (log.isDebugEnabled())
+ log.debug("Ignore topology message, local node not added to topology: " + msg);
}
}
@@ -1397,31 +1405,42 @@ class ClientImpl extends TcpDiscoveryImpl {
if (spi.getSpiContext().isStopping())
return;
- TcpDiscoveryNode node = rmtNodes.remove(msg.creatorNodeId());
+ if (nodeAdded()) {
+ TcpDiscoveryNode node = rmtNodes.remove(msg.creatorNodeId());
- if (node == null) {
- if (log.isDebugEnabled())
- log.debug("Discarding node left message since node is not found [msg=" + msg + ']');
+ if (node == null) {
+ if (log.isDebugEnabled())
+ log.debug("Discarding node left message since node is not found [msg=" + msg + ']');
- return;
- }
+ return;
+ }
- Collection<ClusterNode> top = updateTopologyHistory(msg.topologyVersion(), msg);
+ Collection<ClusterNode> top = updateTopologyHistory(msg.topologyVersion(), msg);
- if (!pending && joinLatch.getCount() > 0) {
- if (log.isDebugEnabled())
- log.debug("Discarding node left message (join process is not finished): " + msg);
+ if (!pending && joinLatch.getCount() > 0) {
+ if (log.isDebugEnabled())
+ log.debug("Discarding node left message (join process is not finished): " + msg);
- return;
- }
+ return;
+ }
- notifyDiscovery(EVT_NODE_LEFT, msg.topologyVersion(), node, top);
+ notifyDiscovery(EVT_NODE_LEFT, msg.topologyVersion(), node, top);
- spi.stats.onNodeLeft();
+ spi.stats.onNodeLeft();
+ }
+ else if (log.isDebugEnabled())
+ log.debug("Ignore topology message, local node not added to topology: " + msg);
}
}
/**
+ * @return {@code True} if received node added message for local node.
+ */
+ private boolean nodeAdded() {
+ return !topHist.isEmpty();
+ }
+
+ /**
* @param msg Message.
*/
private void processNodeFailedMessage(TcpDiscoveryNodeFailedMessage msg) {
@@ -1514,9 +1533,9 @@ class ClientImpl extends TcpDiscoveryImpl {
return;
if (getLocalNodeId().equals(msg.creatorNodeId())) {
- assert msg.success() : msg;
-
if (reconnector != null) {
+ assert msg.success() : msg;
+
currSock = reconnector.sock;
sockWriter.setSocket(currSock);
@@ -1529,7 +1548,7 @@ class ClientImpl extends TcpDiscoveryImpl {
try {
for (TcpDiscoveryAbstractMessage pendingMsg : msg.pendingMessages()) {
if (log.isDebugEnabled())
- log.debug("Process message on reconnect [msg=" + pendingMsg + ']');
+ log.debug("Process pending message on reconnect [msg=" + pendingMsg + ']');
processDiscoveryMessage(pendingMsg);
}
@@ -1538,8 +1557,22 @@ class ClientImpl extends TcpDiscoveryImpl {
pending = false;
}
}
- else if (log.isDebugEnabled())
- log.debug("Discarding reconnect message, reconnect is completed: " + msg);
+ else {
+ if (joinLatch.getCount() > 0) {
+ if (msg.success()) {
+ for (TcpDiscoveryAbstractMessage pendingMsg : msg.pendingMessages()) {
+ if (log.isDebugEnabled())
+ log.debug("Process pending message on connect [msg=" + pendingMsg + ']');
+
+ processDiscoveryMessage(pendingMsg);
+ }
+
+ assert joinLatch.getCount() == 0 : msg;
+ }
+ }
+ else if (log.isDebugEnabled())
+ log.debug("Discarding reconnect message, reconnect is completed: " + msg);
+ }
}
else if (log.isDebugEnabled())
log.debug("Discarding reconnect message for another client: " + msg);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa92c54/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 2458f85..fa3e564 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -2452,7 +2452,40 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
- if (log.isDebugEnabled())
+ if (msg.client()) {
+ TcpDiscoveryClientReconnectMessage reconMsg = new TcpDiscoveryClientReconnectMessage(node.id(),
+ node.clientRouterNodeId(),
+ null);
+
+ reconMsg.verify(getLocalNodeId());
+
+ Collection<TcpDiscoveryAbstractMessage> msgs = msgHist.messages(null, node);
+
+ if (msgs != null) {
+ reconMsg.pendingMessages(msgs);
+
+ reconMsg.success(true);
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Send reconnect message to already joined client " +
+ "[clientNode=" + existingNode + ", msg=" + reconMsg + ']');
+
+ if (getLocalNodeId().equals(node.clientRouterNodeId())) {
+ ClientMessageWorker wrk = clientMsgWorkers.get(node.id());
+
+ if (wrk != null)
+ wrk.addMessage(reconMsg);
+ else if (log.isDebugEnabled())
+ log.debug("Failed to find client message worker " +
+ "[clientNode=" + existingNode + ", msg=" + reconMsg + ']');
+ }
+ else {
+ if (ring.hasRemoteNodes())
+ sendMessageAcrossRing(reconMsg);
+ }
+ }
+ else if (log.isDebugEnabled())
log.debug("Ignoring join request message since node is already in topology: " + msg);
return;
@@ -4104,15 +4137,44 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (req.client()) {
+ ClientMessageWorker clientMsgWrk0 = new ClientMessageWorker(sock, nodeId);
+
+ while (true) {
+ ClientMessageWorker old = clientMsgWorkers.putIfAbsent(nodeId, clientMsgWrk0);
+
+ if (old == null)
+ break;
+
+ if (old.isInterrupted()) {
+ clientMsgWorkers.remove(nodeId, old);
+
+ continue;
+ }
+
+ old.join(500);
+
+ old = clientMsgWorkers.putIfAbsent(nodeId, clientMsgWrk0);
+
+ if (old == null)
+ break;
+
+ if (log.isDebugEnabled())
+ log.debug("Already have client message worker, closing connection " +
+ "[locNodeId=" + locNodeId +
+ ", rmtNodeId=" + nodeId +
+ ", workerSock=" + old.sock +
+ ", sock=" + sock + ']');
+
+ return;
+ }
+
if (log.isDebugEnabled())
log.debug("Created client message worker [locNodeId=" + locNodeId +
", rmtNodeId=" + nodeId + ", sock=" + sock + ']');
- clientMsgWrk = new ClientMessageWorker(sock, nodeId);
-
- clientMsgWrk.start();
+ assert clientMsgWrk0 == clientMsgWorkers.get(nodeId);
- clientMsgWorkers.put(nodeId, clientMsgWrk);
+ clientMsgWrk = clientMsgWrk0;
}
if (log.isDebugEnabled())
@@ -4188,7 +4250,7 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoveryJoinRequestMessage req = (TcpDiscoveryJoinRequestMessage)msg;
if (!req.responded()) {
- boolean ok = processJoinRequestMessage(req);
+ boolean ok = processJoinRequestMessage(req, clientMsgWrk);
if (clientMsgWrk != null && ok)
continue;
@@ -4202,14 +4264,17 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoverySpiState state = spiStateCopy();
if (state == CONNECTED) {
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
+
+ if (clientMsgWrk != null && clientMsgWrk.getState() == State.NEW)
+ clientMsgWrk.start();
msgWorker.addMessage(msg);
continue;
}
else {
- spi.writeToSocket(sock, RES_CONTINUE_JOIN);
+ spi.writeToSocket(msg, sock, RES_CONTINUE_JOIN);
break;
}
@@ -4217,7 +4282,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryDuplicateIdMessage) {
// Send receipt back.
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
boolean ignored = false;
@@ -4246,7 +4311,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryAuthFailedMessage) {
// Send receipt back.
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
boolean ignored = false;
@@ -4275,7 +4340,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryCheckFailedMessage) {
// Send receipt back.
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
boolean ignored = false;
@@ -4304,7 +4369,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryLoopbackProblemMessage) {
// Send receipt back.
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
boolean ignored = false;
@@ -4346,7 +4411,7 @@ class ServerImpl extends TcpDiscoveryImpl {
// Send receipt back.
if (clientMsgWrk == null)
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
}
catch (IgniteCheckedException e) {
if (log.isDebugEnabled())
@@ -4435,24 +4500,29 @@ class ServerImpl extends TcpDiscoveryImpl {
/**
* @param msg Join request message.
+ * @param clientMsgWrk Client message worker to start.
* @return Whether connection was successful.
* @throws IOException If IO failed.
*/
@SuppressWarnings({"IfMayBeConditional"})
- private boolean processJoinRequestMessage(TcpDiscoveryJoinRequestMessage msg) throws IOException {
+ private boolean processJoinRequestMessage(TcpDiscoveryJoinRequestMessage msg,
+ @Nullable ClientMessageWorker clientMsgWrk) throws IOException {
assert msg != null;
assert !msg.responded();
TcpDiscoverySpiState state = spiStateCopy();
if (state == CONNECTED) {
- spi.writeToSocket(sock, RES_OK);
+ spi.writeToSocket(msg, sock, RES_OK);
if (log.isDebugEnabled())
log.debug("Responded to join request message [msg=" + msg + ", res=" + RES_OK + ']');
msg.responded(true);
+ if (clientMsgWrk != null && clientMsgWrk.getState() == State.NEW)
+ clientMsgWrk.start();
+
msgWorker.addMessage(msg);
return true;
@@ -4477,7 +4547,7 @@ class ServerImpl extends TcpDiscoveryImpl {
// Local node is stopping. Remote node should try next one.
res = RES_CONTINUE_JOIN;
- spi.writeToSocket(sock, res);
+ spi.writeToSocket(msg, sock, res);
if (log.isDebugEnabled())
log.debug("Responded to join request message [msg=" + msg + ", res=" + res + ']');
@@ -4632,6 +4702,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * @return Ping result.
* @throws InterruptedException If interrupted.
*/
public boolean ping() throws InterruptedException {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa92c54/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 1d1916a..7663fe6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1227,12 +1227,13 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
/**
* Writes response to the socket.
*
+ * @param msg Received message.
* @param sock Socket.
* @param res Integer response.
* @throws IOException If IO failed or write timed out.
*/
@SuppressWarnings("ThrowFromFinallyBlock")
- protected void writeToSocket(Socket sock, int res) throws IOException {
+ protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res) throws IOException {
assert sock != null;
SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + sockTimeout);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efa92c54/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index 8147958..ec6a526 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -24,7 +24,9 @@ import org.apache.ignite.events.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.io.*;
+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.resources.*;
import org.apache.ignite.spi.*;
@@ -106,11 +108,14 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
/** */
private int maxMissedClientHbs = TcpDiscoverySpi.DFLT_MAX_MISSED_CLIENT_HEARTBEATS;
+ /** */
+ private IgniteInClosure2X<TcpDiscoveryAbstractMessage, Socket> afterWrite;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- TcpDiscoverySpi disco = new TestTcpDiscoverySpi();
+ TestTcpDiscoverySpi disco = new TestTcpDiscoverySpi();
disco.setMaxMissedClientHeartbeats(maxMissedClientHbs);
@@ -154,6 +159,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
disco.setJoinTimeout(joinTimeout);
disco.setNetworkTimeout(netTimeout);
+ disco.afterWrite(afterWrite);
+
cfg.setDiscoverySpi(disco);
if (nodeId != null)
@@ -1016,6 +1023,189 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testJoinError3() throws Exception {
+ startServerNodes(1);
+
+ Ignite ignite = G.ignite("server-0");
+
+ TestTcpDiscoverySpi srvSpi = ((TestTcpDiscoverySpi)ignite.configuration().getDiscoverySpi());
+
+ srvSpi.failNodeAddFinishedMessage();
+
+ startClientNodes(1);
+
+ checkNodes(1, 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinErrorMissedAddFinishedMessage1() throws Exception {
+ missedAddFinishedMessage(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinErrorMissedAddFinishedMessage2() throws Exception {
+ missedAddFinishedMessage(false);
+ }
+
+ /**
+ * @param singleSrv If {@code true} starts one server node two otherwise.
+ * @throws Exception If failed.
+ */
+ private void missedAddFinishedMessage(boolean singleSrv) throws Exception {
+ int srvs = singleSrv ? 1 : 2;
+
+ startServerNodes(srvs);
+
+ afterWrite = new CIX2<TcpDiscoveryAbstractMessage, Socket>() {
+ private boolean first = true;
+
+ @Override public void applyx(TcpDiscoveryAbstractMessage msg, Socket sock) throws IgniteCheckedException {
+ if (first && (msg instanceof TcpDiscoveryJoinRequestMessage)) {
+ first = false;
+
+ log.info("Close socket after message write [msg=" + msg + "]");
+
+ try {
+ sock.close();
+ }
+ catch (IOException e) {
+ throw new IgniteCheckedException(e);
+ }
+
+ log.info("Delay after message write [msg=" + msg + "]");
+
+ U.sleep(5000); // Wait when server process join request.
+ }
+ }
+ };
+
+ Ignite srv = singleSrv ? G.ignite("server-0") : G.ignite("server-1");
+
+ TcpDiscoveryNode srvNode = (TcpDiscoveryNode)srv.cluster().localNode();
+
+ assertEquals(singleSrv ? 1 : 2, srvNode.order());
+
+ clientIpFinder = new TcpDiscoveryVmIpFinder();
+
+ clientIpFinder.setAddresses(Collections.singleton("localhost:" + srvNode.discoveryPort()));
+
+ startClientNodes(1);
+
+ TcpDiscoveryNode clientNode = (TcpDiscoveryNode)G.ignite("client-0").cluster().localNode();
+
+ assertEquals(srvNode.id(), clientNode.clientRouterNodeId());
+
+ checkNodes(srvs, 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientMessageWorkerStartSingleServer() throws Exception {
+ clientMessageWorkerStart(1, 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientMessageWorkerStartTwoServers1() throws Exception {
+ clientMessageWorkerStart(2, 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientMessageWorkerStartTwoServers2() throws Exception {
+ clientMessageWorkerStart(2, 2);
+ }
+
+ /**
+ * @param srvs Number of server nodes.
+ * @param connectTo What server connect to.
+ * @throws Exception If failed.
+ */
+ private void clientMessageWorkerStart(int srvs, int connectTo) throws Exception {
+ startServerNodes(srvs);
+
+ Ignite srv = G.ignite("server-" + (connectTo - 1));
+
+ final TcpDiscoveryNode srvNode = (TcpDiscoveryNode)srv.cluster().localNode();
+
+ assertEquals((long)connectTo, srvNode.order());
+
+ TestTcpDiscoverySpi srvSpi = ((TestTcpDiscoverySpi)srv.configuration().getDiscoverySpi());
+
+ final String client0 = "client-" + clientIdx.getAndIncrement();
+
+ srvSpi.delayJoinAckFor = client0;
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ clientIpFinder = new TcpDiscoveryVmIpFinder();
+
+ clientIpFinder.setAddresses(Collections.singleton("localhost:" + srvNode.discoveryPort()));
+
+ Ignite client = startGrid(client0);
+
+ clientIpFinder = null;
+
+ clientNodeIds.add(client.cluster().localNode().id());
+
+ TestTcpDiscoverySpi clientSpi = ((TestTcpDiscoverySpi)client.configuration().getDiscoverySpi());
+
+ assertFalse(clientSpi.invalidResponse());
+
+ TcpDiscoveryNode clientNode = (TcpDiscoveryNode)client.cluster().localNode();
+
+ assertEquals(srvNode.id(), clientNode.clientRouterNodeId());
+
+ return null;
+ }
+ });
+
+ final String client1 = "client-" + clientIdx.getAndIncrement();
+
+ while (!fut.isDone()) {
+ startGrid(client1);
+
+ stopGrid(client1);
+ }
+
+ fut.get();
+
+ checkNodes(srvs, 1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinMutlithreaded() throws Exception {
+ startServerNodes(1);
+
+ final int CLIENTS = 30;
+
+ clientsPerSrv = CLIENTS;
+
+ GridTestUtils.runMultiThreaded(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Ignite g = startGrid("client-" + clientIdx.getAndIncrement());
+
+ clientNodeIds.add(g.cluster().localNode().id());
+
+ return null;
+ }
+ }, CLIENTS, "start-client");
+
+ checkNodes(1, CLIENTS);
+ }
+
+ /**
* @param clientIdx Client index.
* @param srvIdx Server index.
* @throws Exception In case of error.
@@ -1267,8 +1457,20 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
private AtomicInteger failNodeAdded = new AtomicInteger();
/** */
+ private AtomicInteger failNodeAddFinished = new AtomicInteger();
+
+ /** */
private AtomicInteger failClientReconnect = new AtomicInteger();
+ /** */
+ private IgniteInClosure2X<TcpDiscoveryAbstractMessage, Socket> afterWrite;
+
+ /** */
+ private volatile boolean invalidRes;
+
+ /** */
+ private volatile String delayJoinAckFor;
+
/**
* @param lock Lock.
*/
@@ -1287,6 +1489,20 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
}
/**
+ * @param afterWrite After write callback.
+ */
+ void afterWrite(IgniteInClosure2X<TcpDiscoveryAbstractMessage, Socket> afterWrite) {
+ this.afterWrite = afterWrite;
+ }
+
+ /**
+ * @return {@code True} if received unexpected ack.
+ */
+ boolean invalidResponse() {
+ return invalidRes;
+ }
+
+ /**
*
*/
void failNodeAddedMessage() {
@@ -1296,6 +1512,13 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
/**
*
*/
+ void failNodeAddFinishedMessage() {
+ failNodeAddFinished.set(1);
+ }
+
+ /**
+ *
+ */
void failClientReconnectMessage() {
failClientReconnect.set(1);
}
@@ -1322,6 +1545,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
if (msg instanceof TcpDiscoveryNodeAddedMessage)
fail = failNodeAdded.getAndDecrement() > 0;
+ else if (msg instanceof TcpDiscoveryNodeAddFinishedMessage)
+ fail = failNodeAddFinished.getAndDecrement() > 0;
else if (msg instanceof TcpDiscoveryClientReconnectMessage)
fail = failClientReconnect.getAndDecrement() > 0;
@@ -1332,6 +1557,9 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
}
super.writeToSocket(sock, msg, bout);
+
+ if (afterWrite != null)
+ afterWrite.apply(msg, sock);
}
/** {@inheritDoc} */
@@ -1365,5 +1593,40 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
impl.workerThread().resume();
}
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res) throws IOException {
+ if (delayJoinAckFor != null && msg instanceof TcpDiscoveryJoinRequestMessage) {
+ TcpDiscoveryJoinRequestMessage msg0 = (TcpDiscoveryJoinRequestMessage)msg;
+
+ if (delayJoinAckFor.equals(msg0.node().attribute(IgniteNodeAttributes.ATTR_GRID_NAME))) {
+ log.info("Delay response [sock=" + sock + ", msg=" + msg0 + ", res=" + res + ']');
+
+ delayJoinAckFor = null;
+
+ try {
+ Thread.sleep(2000);
+ }
+ catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ super.writeToSocket(msg, sock, res);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected int readReceipt(Socket sock, long timeout) throws IOException {
+ int res = super.readReceipt(sock, timeout);
+
+ if (res != TcpDiscoveryImpl.RES_OK) {
+ invalidRes = true;
+
+ log.info("Received unexpected response: " + res);
+ }
+
+ return res;
+ }
}
}
[05/27] incubator-ignite git commit: # ignite-1037
Posted by sb...@apache.org.
# ignite-1037
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/65964e26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/65964e26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/65964e26
Branch: refs/heads/ignite-648-failover
Commit: 65964e26a7519e77f55a0320b37782f83bef229b
Parents: 1c66078
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 23 10:14:38 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 23 10:14:38 2015 +0700
----------------------------------------------------------------------
.../internal/util/GridConfigurationFinder.java | 55 +++++++++++---------
1 file changed, 29 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65964e26/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
index bc9a13f..37d8756 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridConfigurationFinder.java
@@ -106,45 +106,48 @@ public final class GridConfigurationFinder {
LinkedList<GridTuple3<String, Long, File>> paths = new LinkedList<>();
- for (String name : dir.list()) {
- File file = new File(dir, name);
+ String[] configs = dir.list();
- if (file.isDirectory())
- paths.addAll(listFiles(file));
- else if (file.getName().endsWith(".xml")) {
- try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
- boolean springCfg = false;
- boolean ggCfg = false;
+ if (configs != null)
+ for (String name : configs) {
+ File file = new File(dir, name);
- String line;
+ if (file.isDirectory())
+ paths.addAll(listFiles(file));
+ else if (file.getName().endsWith(".xml")) {
+ try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+ boolean springCfg = false;
+ boolean ggCfg = false;
- while ((line = reader.readLine()) != null) {
- if (line.contains("http://www.springframework.org/schema/beans"))
- springCfg = true;
+ String line;
- if (line.contains("class=\"org.apache.ignite.configuration.IgniteConfiguration\""))
- ggCfg = true;
+ while ((line = reader.readLine()) != null) {
+ if (line.contains("http://www.springframework.org/schema/beans"))
+ springCfg = true;
- if (springCfg && ggCfg)
- break;
- }
+ if (line.contains("class=\"org.apache.ignite.configuration.IgniteConfiguration\""))
+ ggCfg = true;
+
+ if (springCfg && ggCfg)
+ break;
+ }
- if (springCfg) {
- String path = file.getAbsolutePath().substring(U.getIgniteHome().length());
+ if (springCfg) {
+ String path = file.getAbsolutePath().substring(U.getIgniteHome().length());
- if (path.startsWith(File.separator))
- path = path.substring(File.separator.length());
+ if (path.startsWith(File.separator))
+ path = path.substring(File.separator.length());
- if (!path.equals(DFLT_CFG)) {
- if (!ggCfg)
- path = Q_PREFIX + ' ' + path;
+ if (!path.equals(DFLT_CFG)) {
+ if (!ggCfg)
+ path = Q_PREFIX + ' ' + path;
- paths.add(F.t(path, file.lastModified(), file));
+ paths.add(F.t(path, file.lastModified(), file));
+ }
}
}
}
}
- }
return paths;
}
[25/27] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-883' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-883' into ignite-sprint-7
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6e23608f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6e23608f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6e23608f
Branch: refs/heads/ignite-648-failover
Commit: 6e23608fd0845fb30c470fbb2f0143c7d5d67f82
Parents: 847ddf5 efa92c5
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 16:21:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 16:21:22 2015 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 6 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 151 ++++++-----
.../ignite/spi/discovery/tcp/ServerImpl.java | 103 +++++--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++++++++++++++++++-
5 files changed, 448 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
[15/27] incubator-ignite git commit: # ignite-917: review 2.
Posted by sb...@apache.org.
# ignite-917: review 2.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/401aa122
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/401aa122
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/401aa122
Branch: refs/heads/ignite-648-failover
Commit: 401aa1223f99838bd8c841045f7c8614f4113c52
Parents: 532a98f
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 13:09:45 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 13:09:45 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/cluster/ClusterNode.java | 4 ++--
.../java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/401aa122/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index bb792d5..62c1deb 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -188,8 +188,8 @@ public interface ClusterNode {
* <p>
* If {@link IgniteConfiguration#getLocalHost()} value is {@code null} then local wildcard address will be used,
* and this method returns host names of all addresses of that node.
- * <p/
- * Note: the loopback address will skipped from the results.
+ * <p>
+ * Note: the loopback address will be omitted in results.
*
* @return Collection of host names.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/401aa122/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 8be9f31..9b7f392 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
@@ -65,10 +65,11 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTest(IgniteStreamSelfTestSuite.suite());
suite.addTest(new TestSuite(GridSelfTest.class));
- GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
suite.addTest(new TestSuite(ClusterForHostsSelfTest.class));
- GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
+
+ GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);
if (U.isLinux() || U.isMacOs())
[16/27] incubator-ignite git commit: Merge branch 'ignite-917' into
ignite-sprint-7
Posted by sb...@apache.org.
Merge branch 'ignite-917' into ignite-sprint-7
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9f74335e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9f74335e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9f74335e
Branch: refs/heads/ignite-648-failover
Commit: 9f74335e0793b35bdf3e171ed98a2d5734d493a3
Parents: fc17f07 401aa12
Author: ashutak <as...@gridgain.com>
Authored: Thu Jun 25 13:13:18 2015 +0300
Committer: ashutak <as...@gridgain.com>
Committed: Thu Jun 25 13:13:18 2015 +0300
----------------------------------------------------------------------
.../ClientAbstractConnectivitySelfTest.java | 4 +-
.../org/apache/ignite/cluster/ClusterGroup.java | 9 ++
.../org/apache/ignite/cluster/ClusterNode.java | 2 +
.../internal/cluster/ClusterGroupAdapter.java | 38 +++++++
.../cluster/IgniteClusterAsyncImpl.java | 5 +
.../ignite/internal/util/IgniteUtils.java | 6 +-
.../internal/ClusterForHostsSelfTest.java | 113 +++++++++++++++++++
.../internal/util/IgniteUtilsSelfTest.java | 22 ++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 4 +-
9 files changed, 197 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[04/27] incubator-ignite git commit: #IGNITE-GG-10440 Changed tests.
Posted by sb...@apache.org.
#IGNITE-GG-10440 Changed 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/5b306e1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5b306e1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5b306e1a
Branch: refs/heads/ignite-648-failover
Commit: 5b306e1a035c94be6dcb357635d07ce7eaba84c0
Parents: 76f5377
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 22 17:17:44 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 22 17:17:44 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/GridKernalContextImpl.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5b306e1a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 7b07593..737dbee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -790,6 +790,8 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
if (cls.equals(IgniteCacheObjectProcessor.class))
return (T)new IgniteCacheObjectProcessorImpl(this);
+ if (cls.equals(CacheConflictResolutionManager.class))
+ return null;
throw new IgniteException("Unsupported component type: " + cls);
}
[24/27] incubator-ignite git commit: # ignite-sprint-7 fixed test
Posted by sb...@apache.org.
# ignite-sprint-7 fixed test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/847ddf54
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/847ddf54
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/847ddf54
Branch: refs/heads/ignite-648-failover
Commit: 847ddf543d635144d8c33f4afc33e76d0de92143
Parents: 01d842a
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 16:02:50 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 16:02:50 2015 +0300
----------------------------------------------------------------------
.../near/GridCachePartitionedMultiNodeFullApiSelfTest.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/847ddf54/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..30c9e8a 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
@@ -358,7 +358,9 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
assertEquals(0, cache1.localSize(NEAR));
assertEquals(5, cache1.localSize(CachePeekMode.ALL) - cache1.localSize(NEAR));
- assertEquals(nearEnabled() ? 2 : 0, cache2.localSize(NEAR));
+ boolean nearEnabled = cache2.getConfiguration(CacheConfiguration.class).getNearConfiguration() != null;
+
+ assertEquals(nearEnabled ? 2 : 0, cache2.localSize(NEAR));
assertEquals(0, cache2.localSize(CachePeekMode.ALL) - cache2.localSize(NEAR));
}
[11/27] incubator-ignite git commit: #IGNITE-GG-10440 Fixed review
notes.
Posted by sb...@apache.org.
#IGNITE-GG-10440 Fixed review notes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c5287050
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c5287050
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c5287050
Branch: refs/heads/ignite-648-failover
Commit: c5287050d47e97a8ae817879d7d7f2797f164348
Parents: b2e8fea
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Jun 25 10:39:01 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jun 25 10:39:01 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/GridKernalContextImpl.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5287050/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 737dbee..65107a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -790,6 +790,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
if (cls.equals(IgniteCacheObjectProcessor.class))
return (T)new IgniteCacheObjectProcessorImpl(this);
+
if (cls.equals(CacheConflictResolutionManager.class))
return null;
[17/27] incubator-ignite git commit: # minor (renaming)
Posted by sb...@apache.org.
# minor (renaming)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6c3d97f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6c3d97f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6c3d97f8
Branch: refs/heads/ignite-648-failover
Commit: 6c3d97f8069c2aec66195e03b7f1062ceb91e172
Parents: fc17f07
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jun 25 17:18:33 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jun 25 17:18:33 2015 +0300
----------------------------------------------------------------------
.../internal/ClusterGroupAbstractTest.java | 777 ++++++++++++++++++
.../ignite/internal/ClusterGroupSelfTest.java | 251 ++++++
.../internal/GridProjectionAbstractTest.java | 784 -------------------
.../ignite/internal/GridProjectionSelfTest.java | 251 ------
.../apache/ignite/internal/GridSelfTest.java | 2 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +-
6 files changed, 1030 insertions(+), 1037 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
new file mode 100644
index 0000000..0514ad9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupAbstractTest.java
@@ -0,0 +1,777 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.events.EventType.*;
+
+/**
+ * Abstract test for {@link org.apache.ignite.cluster.ClusterGroup}
+ */
+@SuppressWarnings("deprecation")
+public abstract class ClusterGroupAbstractTest extends GridCommonAbstractTest implements Externalizable {
+ /** VM ip finder for TCP discovery. */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Waiting timeout. */
+ private static final int WAIT_TIMEOUT = 30000;
+
+ /** Utility static variable. */
+ private static final AtomicInteger cnt = new AtomicInteger(0);
+
+ /** Mutex. */
+ private static final Object mux = new Object();
+
+ /** Projection. */
+ private ClusterGroup prj;
+
+ /** Runnable job. */
+ private IgniteRunnable runJob = new TestRunnable();
+
+ /** Callable job. */
+ private IgniteCallable<String> calJob = new TestCallable<>();
+
+ /** Closure job. */
+ private IgniteClosure<String, String> clrJob = new IgniteClosure<String, String>() {
+ @Override public String apply(String s) {
+ return s;
+ }
+
+ @Override public String toString() {
+ return "clrJob";
+ }
+ };
+
+ /** Reducer. */
+ private IgniteReducer<String, Object> rdc = new IgniteReducer<String, Object>() {
+ @Override public boolean collect(String e) {
+ return true;
+ }
+
+ @Nullable @Override public Object reduce() {
+ return null;
+ }
+
+ @Override public String toString() {
+ return "rdc";
+ }
+ };
+
+ /** */
+ protected ClusterGroupAbstractTest() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ prj = projection();
+
+ cnt.set(0);
+ }
+
+ /**
+ * @return Projection.
+ */
+ protected abstract ClusterGroup projection();
+
+ /**
+ * @return Local node ID.
+ */
+ @Nullable protected abstract UUID localNodeId();
+
+ /**
+ * @return Remote nodes IDs.
+ */
+ protected Collection<UUID> remoteNodeIds() {
+ return F.nodeIds(projection().forRemotes().nodes());
+ }
+
+ /**
+ * @return Projection size.
+ */
+ private int projectionSize() {
+ int size = localNodeId() != null ? 1 : 0;
+
+ size += remoteNodeIds().size();
+
+ assert size > 0;
+
+ return size;
+ }
+
+ /**
+ * @return Collection of projection node IDs.
+ */
+ private Collection<UUID> projectionNodeIds() {
+ Collection<UUID> ids = new LinkedList<>();
+
+ UUID id = localNodeId();
+
+ if (id != null)
+ ids.add(id);
+
+ ids.addAll(remoteNodeIds());
+
+ assert !ids.isEmpty();
+
+ return ids;
+ }
+
+ /**
+ * Test for projection on not existing node IDs.
+ */
+ public void testInvalidProjection() {
+ Collection<UUID> ids = new HashSet<>();
+
+ ids.add(UUID.randomUUID());
+ ids.add(UUID.randomUUID());
+
+ ClusterGroup invalidPrj = prj.forNodeIds(ids);
+
+ assertEquals(0, invalidPrj.nodes().size());
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testProjection() throws Exception {
+ assert prj != null;
+
+ assert prj.ignite() != null;
+ assert prj.predicate() != null;
+
+ int size = projectionSize();
+
+ assert prj.nodes().size() == size;
+
+ Collection<UUID> nodeIds = projectionNodeIds();
+
+ for (ClusterNode node : prj.nodes())
+ assert nodeIds.contains(node.id());
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testRemoteNodes() throws Exception {
+ Collection<UUID> remoteNodeIds = remoteNodeIds();
+
+ UUID locNodeId = localNodeId();
+
+ int size = remoteNodeIds.size();
+
+ String name = "oneMoreGrid";
+
+ try {
+ Ignite g = startGrid(name);
+
+ UUID excludedId = g.cluster().localNode().id();
+
+ assertEquals(size, prj.forRemotes().nodes().size());
+
+ for (ClusterNode node : prj.forRemotes().nodes()) {
+ UUID id = node.id();
+
+ assert !id.equals(locNodeId) && remoteNodeIds.contains(id) && !excludedId.equals(id);
+ }
+ }
+ finally {
+ stopGrid(name);
+ }
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testRemoteProjection() throws Exception {
+ Collection<UUID> remoteNodeIds = remoteNodeIds();
+
+ ClusterGroup remotePrj = projection().forRemotes();
+
+ Collection<UUID> prjNodeIds = F.nodeIds(remotePrj.nodes());
+
+ assert prjNodeIds.size() == remoteNodeIds.size();
+
+ assert prjNodeIds.containsAll(remoteNodeIds());
+
+ assert !prjNodeIds.contains(localNodeId());
+
+ String name = "oneMoreGrid";
+
+ try {
+ Ignite g = startGrid(name);
+
+ UUID excludedId = g.cluster().localNode().id();
+
+ assert !F.nodeIds(remotePrj.nodes()).contains(excludedId);
+ }
+ finally {
+ stopGrid(name);
+ }
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testExecution() throws Exception {
+ String name = "oneMoreGrid";
+
+ Collection<IgniteBiTuple<Ignite, IgnitePredicate<Event>>> lsnrs = new LinkedList<>();
+
+ try {
+ final AtomicInteger cnt = new AtomicInteger();
+
+ Ignite g = startGrid(name);
+
+ IgnitePredicate<Event> lsnr;
+
+ if (!IgniteCluster.class.isAssignableFrom(projection().getClass())) {
+ g.events().localListen(lsnr = new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ assert evt.type() == EVT_JOB_STARTED;
+
+ assert false;
+
+ return true;
+ }
+ }, EVT_JOB_STARTED);
+
+ lsnrs.add(F.t(g, lsnr));
+ }
+
+ for (ClusterNode node : prj.nodes()) {
+ g = G.ignite(node.id());
+
+ g.events().localListen(lsnr = new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ assert evt.type() == EVT_JOB_STARTED;
+
+ synchronized (mux) {
+ cnt.incrementAndGet();
+
+ mux.notifyAll();
+ }
+
+ return true;
+ }
+ }, EVT_JOB_STARTED);
+
+ lsnrs.add(F.t(g, lsnr));
+ }
+
+ run1(cnt);
+ run2(cnt);
+
+ call1(cnt);
+ call2(cnt);
+ call3(cnt);
+ call4(cnt);
+ call5(cnt);
+
+ forkjoin1(cnt);
+ forkjoin2(cnt);
+
+ exec1(cnt);
+ exec2(cnt);
+
+ executorService(cnt);
+
+ checkActiveFutures();
+ }
+ finally {
+ for (IgniteBiTuple<Ignite, IgnitePredicate<Event>> t : lsnrs)
+ t.get1().events().stopLocalListen(t.get2(), EVT_JOB_STARTED);
+
+ stopGrid(name);
+ }
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void run1(AtomicInteger cnt) throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.broadcast(runJob);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).broadcast(runJob);
+
+ waitForValue(cnt, projectionSize());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void run2(AtomicInteger cnt) throws Exception {
+ Collection<IgniteRunnable> jobs = F.asList(runJob);
+
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.run(jobs);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).run(jobs);
+
+ waitForValue(cnt, jobs.size());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void call1(AtomicInteger cnt) throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.broadcast(calJob);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).broadcast(calJob);
+
+ waitForValue(cnt, projectionSize());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void call2(AtomicInteger cnt) throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ Collection<IgniteCallable<String>> jobs = F.asList(calJob);
+
+ comp.call(jobs);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).call(jobs);
+
+ waitForValue(cnt, jobs.size());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void call3(AtomicInteger cnt) throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.apply(clrJob, (String) null);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).apply(clrJob, (String) null);
+
+ waitForValue(cnt, 1);
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void call4(AtomicInteger cnt) throws Exception {
+ Collection<String> args = F.asList("a", "b", "c");
+
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.apply(clrJob, args);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).apply(clrJob, args);
+
+ waitForValue(cnt, args.size());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void call5(AtomicInteger cnt) throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.broadcast(new TestClosure(), "arg");
+
+ ComputeTaskFuture<Collection<String>> fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ Collection<String> res = compute(prj).broadcast(new TestClosure(), "arg");
+
+ assertEquals(projectionSize(), res.size());
+
+ waitForValue(cnt, projectionSize());
+
+ for (String resStr : res)
+ assertEquals("arg", resStr);
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void forkjoin1(AtomicInteger cnt) throws Exception {
+ Collection<String> args = F.asList("a", "b", "c");
+
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.apply(clrJob, args, rdc);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).apply(clrJob, args, rdc);
+
+ waitForValue(cnt, args.size());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void forkjoin2(AtomicInteger cnt) throws Exception {
+ Collection<IgniteCallable<String>> jobs = F.asList(calJob);
+
+ IgniteCompute comp = compute(prj).withAsync();
+
+ comp.call(jobs, rdc);
+
+ ComputeTaskFuture fut = comp.future();
+
+ waitForExecution(fut);
+
+ cnt.set(0);
+
+ compute(prj).call(jobs, rdc);
+
+ waitForValue(cnt, jobs.size());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void exec1(AtomicInteger cnt) throws Exception {
+ cnt.set(0);
+
+ compute(prj).execute(TestTask.class.getName(), null);
+
+ waitForValue(cnt, projectionSize());
+
+ cnt.set(0);
+
+ compute(prj).execute(new TestTask(), null);
+
+ waitForValue(cnt, projectionSize());
+
+ cnt.set(0);
+
+ compute(prj).execute(TestTask.class, null);
+
+ waitForValue(cnt, projectionSize());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void exec2(AtomicInteger cnt) throws Exception {
+ cnt.set(0);
+
+ compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class.getName(), null);
+
+ waitForValue(cnt, projectionSize());
+
+ cnt.set(0);
+
+ compute(prj).withTimeout(WAIT_TIMEOUT).execute(new TestTask(), null);
+
+ waitForValue(cnt, projectionSize());
+
+ cnt.set(0);
+
+ compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class, null);
+
+ waitForValue(cnt, projectionSize());
+ }
+
+ /**
+ * @param cnt Counter.
+ * @throws Exception If failed.
+ */
+ private void executorService(AtomicInteger cnt) throws Exception {
+ cnt.set(0);
+
+ ExecutorService execSrvc = prj.ignite().executorService(prj);
+
+ Future<String> fut = execSrvc.submit(new TestCallable<String>() {
+ @Override public String call() throws Exception {
+ return "submit1";
+ }
+ });
+
+ waitForValue(cnt, 1);
+
+ assertEquals("submit1", fut.get());
+
+ cnt.set(0);
+
+ fut = execSrvc.submit(new TestRunnable(), "submit2");
+
+ waitForValue(cnt, 1);
+
+ assertEquals("submit2", fut.get());
+
+ cnt.set(0);
+
+ Future<?> runFut = execSrvc.submit(new TestRunnable());
+
+ waitForValue(cnt, 1);
+
+ runFut.get();
+ }
+
+ /**
+ * @param fut Execution future.
+ * @throws InterruptedException Thrown if wait was interrupted.
+ */
+ @SuppressWarnings({"UnconditionalWait"})
+ private void waitForExecution(IgniteFuture fut) throws InterruptedException {
+ long sleep = 250;
+
+ long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
+
+ do synchronized (mux) {
+ mux.wait(sleep);
+ }
+ while (fut != null && !fut.isDone() && !fut.isCancelled() && threshold > System.currentTimeMillis());
+
+ assert fut == null || fut.isDone();
+ }
+
+ /**
+ * @param cnt Counter to check.
+ * @param val Value to check.
+ * @throws InterruptedException Thrown if wait was interrupted.
+ */
+ private void waitForValue(AtomicInteger cnt, int val) throws InterruptedException {
+ assert cnt != null;
+ assert val > 0;
+
+ long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
+
+ long time;
+
+ while (threshold > (time = System.currentTimeMillis()))
+ synchronized (mux) {
+ if (cnt.get() == val)
+ break;
+
+ mux.wait(threshold - time);
+ }
+
+ assert cnt.get() == val;
+ }
+
+ /**
+ * @throws Exception If test failed.
+ */
+ private void checkActiveFutures() throws Exception {
+ IgniteCompute comp = compute(prj).withAsync();
+
+ assertEquals(0, comp.activeTaskFutures().size());
+
+ cnt.set(0);
+
+ Collection<ComputeTaskFuture<Object>> futsList = new ArrayList<>();
+
+ for (int i = 0; i < 10; i++) {
+ comp.call(new TestWaitCallable<>());
+
+ ComputeTaskFuture<Object> fut = comp.future();
+
+ assertFalse(fut.isDone());
+
+ Map<IgniteUuid, ComputeTaskFuture<Object>> futs = comp.activeTaskFutures();
+
+ assertEquals(i + 1, futs.size());
+
+ assertTrue(futs.containsKey(fut.getTaskSession().getId()));
+
+ futsList.add(fut);
+ }
+
+ synchronized (mux) {
+ cnt.incrementAndGet();
+
+ mux.notifyAll();
+ }
+
+ for (ComputeTaskFuture<Object> fut : futsList)
+ fut.get();
+
+ assertEquals(0, comp.activeTaskFutures().size());
+ }
+
+ /**
+ * Test closure.
+ */
+ private static class TestClosure implements IgniteClosure<String, String> {
+ /** {@inheritDoc} */
+ @Override public String apply(String s) {
+ return s;
+ }
+ }
+
+ /**
+ * Test runnable.
+ */
+ private static class TestRunnable implements IgniteRunnable {
+ /** {@inheritDoc} */
+ @Override public void run() {
+ // No-op.
+ }
+ }
+
+ /**
+ * Test callable.
+ */
+ private static class TestCallable<T> implements IgniteCallable<T> {
+ /** {@inheritDoc} */
+ @Nullable @Override public T call() throws Exception {
+ return null;
+ }
+ }
+
+ /**
+ * Test callable.
+ */
+ private static class TestWaitCallable<T> implements IgniteCallable<T> {
+ /** {@inheritDoc} */
+ @Nullable @Override public T call() throws Exception {
+ synchronized (mux) {
+ while (cnt.get() == 0)
+ mux.wait();
+ }
+
+ return null;
+ }
+ }
+
+ /**
+ * Test task.
+ */
+ @SuppressWarnings({"PublicInnerClass"})
+ public static class TestTask extends ComputeTaskSplitAdapter<String, Void> {
+ /** {@inheritDoc} */
+ @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
+ Collection<ComputeJob> jobs = new HashSet<>();
+
+ for (int i = 0; i < gridSize; i++)
+ jobs.add(new TestJob());
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+ }
+
+ /**
+ * Test job.
+ */
+ @SuppressWarnings({"PublicInnerClass"})
+ public static class TestJob extends ComputeJobAdapter {
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ return null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
new file mode 100644
index 0000000..ceb9bef
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
@@ -0,0 +1,251 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+
+/**
+ * Test for {@link ClusterGroup}.
+ */
+@GridCommonTest(group = "Kernal Self")
+public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
+ /** Nodes count. */
+ private static final int NODES_CNT = 4;
+
+ /** Projection node IDs. */
+ private static Collection<UUID> ids;
+
+ /** */
+ private static Ignite ignite;
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"ConstantConditions"})
+ @Override protected void beforeTestsStarted() throws Exception {
+ assert NODES_CNT > 2;
+
+ ids = new LinkedList<>();
+
+ try {
+ for (int i = 0; i < NODES_CNT; i++) {
+ Ignition.setClientMode(i > 1);
+
+ Ignite g = startGrid(i);
+
+ ids.add(g.cluster().localNode().id());
+
+ if (i == 0)
+ ignite = g;
+ }
+ }
+ finally {
+ Ignition.setClientMode(false);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ for (int i = 0; i < NODES_CNT; i++)
+ stopGrid(i);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected ClusterGroup projection() {
+ return grid(0).cluster().forPredicate(F.nodeForNodeIds(ids));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected UUID localNodeId() {
+ return grid(0).localNode().id();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRandom() throws Exception {
+ assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node()));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOldest() throws Exception {
+ ClusterGroup oldest = ignite.cluster().forOldest();
+
+ ClusterNode node = null;
+
+ long minOrder = Long.MAX_VALUE;
+
+ for (ClusterNode n : ignite.cluster().nodes()) {
+ if (n.order() < minOrder) {
+ node = n;
+
+ minOrder = n.order();
+ }
+ }
+
+ assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testYoungest() throws Exception {
+ ClusterGroup youngest = ignite.cluster().forYoungest();
+
+ ClusterNode node = null;
+
+ long maxOrder = Long.MIN_VALUE;
+
+ for (ClusterNode n : ignite.cluster().nodes()) {
+ if (n.order() > maxOrder) {
+ node = n;
+
+ maxOrder = n.order();
+ }
+ }
+
+ assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNewNodes() throws Exception {
+ ClusterGroup youngest = ignite.cluster().forYoungest();
+ ClusterGroup oldest = ignite.cluster().forOldest();
+
+ ClusterNode old = oldest.node();
+ ClusterNode last = youngest.node();
+
+ assertNotNull(last);
+
+ try (Ignite g = startGrid(NODES_CNT)) {
+ ClusterNode n = g.cluster().localNode();
+
+ ClusterNode latest = youngest.node();
+
+ assertNotNull(latest);
+ assertEquals(latest.id(), n.id());
+ assertEquals(oldest.node(), old);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForPredicate() throws Exception {
+ IgnitePredicate<ClusterNode> evenP = new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return node.order() % 2 == 0;
+ }
+ };
+
+ IgnitePredicate<ClusterNode> oddP = new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return node.order() % 2 == 1;
+ }
+ };
+
+ ClusterGroup remotes = ignite.cluster().forRemotes();
+
+ ClusterGroup evenYoungest = remotes.forPredicate(evenP).forYoungest();
+ ClusterGroup evenOldest = remotes.forPredicate(evenP).forOldest();
+
+ ClusterGroup oddYoungest = remotes.forPredicate(oddP).forYoungest();
+ ClusterGroup oddOldest = remotes.forPredicate(oddP).forOldest();
+
+ int clusterSize = ignite.cluster().nodes().size();
+
+ assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
+ assertEquals(grid(1).localNode().id(), evenOldest.node().id());
+
+ assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
+ assertEquals(grid(2).localNode().id(), oddOldest.node().id());
+
+ try (Ignite g4 = startGrid(NODES_CNT);
+ Ignite g5 = startGrid(NODES_CNT + 1))
+ {
+ clusterSize = g4.cluster().nodes().size();
+
+ assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
+ assertEquals(grid(1).localNode().id(), evenOldest.node().id());
+
+ assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
+ assertEquals(grid(2).localNode().id(), oddOldest.node().id());
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAgeClusterGroupSerialization() throws Exception {
+ Marshaller marshaller = getConfiguration().getMarshaller();
+
+ ClusterGroup grp = ignite.cluster().forYoungest();
+ ClusterNode node = grp.node();
+
+ byte[] arr = marshaller.marshal(grp);
+
+ ClusterGroup obj = marshaller.unmarshal(arr, null);
+
+ assertEquals(node.id(), obj.node().id());
+
+ try (Ignite ignore = startGrid()) {
+ obj = marshaller.unmarshal(arr, null);
+
+ assertEquals(grp.node().id(), obj.node().id());
+ assertFalse(node.id().equals(obj.node().id()));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientServer() throws Exception {
+ ClusterGroup srv = ignite.cluster().forServers();
+
+ assertEquals(2, srv.nodes().size());
+ assertTrue(srv.nodes().contains(ignite(0).cluster().localNode()));
+ assertTrue(srv.nodes().contains(ignite(1).cluster().localNode()));
+
+ ClusterGroup cli = ignite.cluster().forClients();
+
+ assertEquals(2, srv.nodes().size());
+ assertTrue(cli.nodes().contains(ignite(2).cluster().localNode()));
+ assertTrue(cli.nodes().contains(ignite(3).cluster().localNode()));
+ }
+
+ /**
+ * @param cnt Count.
+ * @param even Even.
+ */
+ private static int gridMaxOrder(int cnt, boolean even) {
+ assert cnt > 2;
+
+ cnt = cnt - (cnt % 2);
+
+ return even ? cnt - 1 : cnt - 2;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
deleted file mode 100644
index cb1341c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
+++ /dev/null
@@ -1,784 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.events.EventType.*;
-
-/**
- * Abstract test for {@link org.apache.ignite.cluster.ClusterGroup}
- */
-@SuppressWarnings("deprecation")
-public abstract class GridProjectionAbstractTest extends GridCommonAbstractTest implements Externalizable {
- /** VM ip finder for TCP discovery. */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** Waiting timeout. */
- private static final int WAIT_TIMEOUT = 30000;
-
- /** Utility static variable. */
- private static final AtomicInteger cnt = new AtomicInteger(0);
-
- /** Mutex. */
- private static final Object mux = new Object();
-
- /** Projection. */
- private ClusterGroup prj;
-
- /** Runnable job. */
- private IgniteRunnable runJob = new TestRunnable();
-
- /** Callable job. */
- private IgniteCallable<String> calJob = new TestCallable<>();
-
- /** Closure job. */
- private IgniteClosure<String, String> clrJob = new IgniteClosure<String, String>() {
- @Override public String apply(String s) {
- return s;
- }
-
- @Override public String toString() {
- return "clrJob";
- }
- };
-
- /** Reducer. */
- private IgniteReducer<String, Object> rdc = new IgniteReducer<String, Object>() {
- @Override public boolean collect(String e) {
- return true;
- }
-
- @Nullable @Override public Object reduce() {
- return null;
- }
-
- @Override public String toString() {
- return "rdc";
- }
- };
-
- /** */
- protected GridProjectionAbstractTest() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
-
- return cfg;
- }
-
- /**
- * @param startGrid Start grid flag.
- */
- protected GridProjectionAbstractTest(boolean startGrid) {
- super(startGrid);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- prj = projection();
-
- cnt.set(0);
- }
-
- /**
- * @return Projection.
- */
- protected abstract ClusterGroup projection();
-
- /**
- * @return Local node ID.
- */
- @Nullable protected abstract UUID localNodeId();
-
- /**
- * @return Remote nodes IDs.
- */
- protected Collection<UUID> remoteNodeIds() {
- return F.nodeIds(projection().forRemotes().nodes());
- }
-
- /**
- * @return Projection size.
- */
- private int projectionSize() {
- int size = localNodeId() != null ? 1 : 0;
-
- size += remoteNodeIds().size();
-
- assert size > 0;
-
- return size;
- }
-
- /**
- * @return Collection of projection node IDs.
- */
- private Collection<UUID> projectionNodeIds() {
- Collection<UUID> ids = new LinkedList<>();
-
- UUID id = localNodeId();
-
- if (id != null)
- ids.add(id);
-
- ids.addAll(remoteNodeIds());
-
- assert !ids.isEmpty();
-
- return ids;
- }
-
- /**
- * Test for projection on not existing node IDs.
- */
- public void testInvalidProjection() {
- Collection<UUID> ids = new HashSet<>();
-
- ids.add(UUID.randomUUID());
- ids.add(UUID.randomUUID());
-
- ClusterGroup invalidPrj = prj.forNodeIds(ids);
-
- assertEquals(0, invalidPrj.nodes().size());
- }
-
- /**
- * @throws Exception If test failed.
- */
- public void testProjection() throws Exception {
- assert prj != null;
-
- assert prj.ignite() != null;
- assert prj.predicate() != null;
-
- int size = projectionSize();
-
- assert prj.nodes().size() == size;
-
- Collection<UUID> nodeIds = projectionNodeIds();
-
- for (ClusterNode node : prj.nodes())
- assert nodeIds.contains(node.id());
- }
-
- /**
- * @throws Exception If test failed.
- */
- public void testRemoteNodes() throws Exception {
- Collection<UUID> remoteNodeIds = remoteNodeIds();
-
- UUID locNodeId = localNodeId();
-
- int size = remoteNodeIds.size();
-
- String name = "oneMoreGrid";
-
- try {
- Ignite g = startGrid(name);
-
- UUID excludedId = g.cluster().localNode().id();
-
- assertEquals(size, prj.forRemotes().nodes().size());
-
- for (ClusterNode node : prj.forRemotes().nodes()) {
- UUID id = node.id();
-
- assert !id.equals(locNodeId) && remoteNodeIds.contains(id) && !excludedId.equals(id);
- }
- }
- finally {
- stopGrid(name);
- }
- }
-
- /**
- * @throws Exception If test failed.
- */
- public void testRemoteProjection() throws Exception {
- Collection<UUID> remoteNodeIds = remoteNodeIds();
-
- ClusterGroup remotePrj = projection().forRemotes();
-
- Collection<UUID> prjNodeIds = F.nodeIds(remotePrj.nodes());
-
- assert prjNodeIds.size() == remoteNodeIds.size();
-
- assert prjNodeIds.containsAll(remoteNodeIds());
-
- assert !prjNodeIds.contains(localNodeId());
-
- String name = "oneMoreGrid";
-
- try {
- Ignite g = startGrid(name);
-
- UUID excludedId = g.cluster().localNode().id();
-
- assert !F.nodeIds(remotePrj.nodes()).contains(excludedId);
- }
- finally {
- stopGrid(name);
- }
- }
-
- /**
- * @throws Exception If test failed.
- */
- public void testExecution() throws Exception {
- String name = "oneMoreGrid";
-
- Collection<IgniteBiTuple<Ignite, IgnitePredicate<Event>>> lsnrs = new LinkedList<>();
-
- try {
- final AtomicInteger cnt = new AtomicInteger();
-
- Ignite g = startGrid(name);
-
- IgnitePredicate<Event> lsnr;
-
- if (!IgniteCluster.class.isAssignableFrom(projection().getClass())) {
- g.events().localListen(lsnr = new IgnitePredicate<Event>() {
- @Override public boolean apply(Event evt) {
- assert evt.type() == EVT_JOB_STARTED;
-
- assert false;
-
- return true;
- }
- }, EVT_JOB_STARTED);
-
- lsnrs.add(F.t(g, lsnr));
- }
-
- for (ClusterNode node : prj.nodes()) {
- g = G.ignite(node.id());
-
- g.events().localListen(lsnr = new IgnitePredicate<Event>() {
- @Override public boolean apply(Event evt) {
- assert evt.type() == EVT_JOB_STARTED;
-
- synchronized (mux) {
- cnt.incrementAndGet();
-
- mux.notifyAll();
- }
-
- return true;
- }
- }, EVT_JOB_STARTED);
-
- lsnrs.add(F.t(g, lsnr));
- }
-
- run1(cnt);
- run2(cnt);
-
- call1(cnt);
- call2(cnt);
- call3(cnt);
- call4(cnt);
- call5(cnt);
-
- forkjoin1(cnt);
- forkjoin2(cnt);
-
- exec1(cnt);
- exec2(cnt);
-
- executorService(cnt);
-
- checkActiveFutures();
- }
- finally {
- for (IgniteBiTuple<Ignite, IgnitePredicate<Event>> t : lsnrs)
- t.get1().events().stopLocalListen(t.get2(), EVT_JOB_STARTED);
-
- stopGrid(name);
- }
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void run1(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(runJob);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).broadcast(runJob);
-
- waitForValue(cnt, projectionSize());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void run2(AtomicInteger cnt) throws Exception {
- Collection<IgniteRunnable> jobs = F.asList(runJob);
-
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.run(jobs);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).run(jobs);
-
- waitForValue(cnt, jobs.size());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void call1(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(calJob);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).broadcast(calJob);
-
- waitForValue(cnt, projectionSize());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void call2(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- Collection<IgniteCallable<String>> jobs = F.asList(calJob);
-
- comp.call(jobs);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).call(jobs);
-
- waitForValue(cnt, jobs.size());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void call3(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, (String) null);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).apply(clrJob, (String) null);
-
- waitForValue(cnt, 1);
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void call4(AtomicInteger cnt) throws Exception {
- Collection<String> args = F.asList("a", "b", "c");
-
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, args);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).apply(clrJob, args);
-
- waitForValue(cnt, args.size());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void call5(AtomicInteger cnt) throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.broadcast(new TestClosure(), "arg");
-
- ComputeTaskFuture<Collection<String>> fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- Collection<String> res = compute(prj).broadcast(new TestClosure(), "arg");
-
- assertEquals(projectionSize(), res.size());
-
- waitForValue(cnt, projectionSize());
-
- for (String resStr : res)
- assertEquals("arg", resStr);
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void forkjoin1(AtomicInteger cnt) throws Exception {
- Collection<String> args = F.asList("a", "b", "c");
-
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.apply(clrJob, args, rdc);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).apply(clrJob, args, rdc);
-
- waitForValue(cnt, args.size());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void forkjoin2(AtomicInteger cnt) throws Exception {
- Collection<IgniteCallable<String>> jobs = F.asList(calJob);
-
- IgniteCompute comp = compute(prj).withAsync();
-
- comp.call(jobs, rdc);
-
- ComputeTaskFuture fut = comp.future();
-
- waitForExecution(fut);
-
- cnt.set(0);
-
- compute(prj).call(jobs, rdc);
-
- waitForValue(cnt, jobs.size());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void exec1(AtomicInteger cnt) throws Exception {
- cnt.set(0);
-
- compute(prj).execute(TestTask.class.getName(), null);
-
- waitForValue(cnt, projectionSize());
-
- cnt.set(0);
-
- compute(prj).execute(new TestTask(), null);
-
- waitForValue(cnt, projectionSize());
-
- cnt.set(0);
-
- compute(prj).execute(TestTask.class, null);
-
- waitForValue(cnt, projectionSize());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void exec2(AtomicInteger cnt) throws Exception {
- cnt.set(0);
-
- compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class.getName(), null);
-
- waitForValue(cnt, projectionSize());
-
- cnt.set(0);
-
- compute(prj).withTimeout(WAIT_TIMEOUT).execute(new TestTask(), null);
-
- waitForValue(cnt, projectionSize());
-
- cnt.set(0);
-
- compute(prj).withTimeout(WAIT_TIMEOUT).execute(TestTask.class, null);
-
- waitForValue(cnt, projectionSize());
- }
-
- /**
- * @param cnt Counter.
- * @throws Exception If failed.
- */
- private void executorService(AtomicInteger cnt) throws Exception {
- cnt.set(0);
-
- ExecutorService execSrvc = prj.ignite().executorService(prj);
-
- Future<String> fut = execSrvc.submit(new TestCallable<String>() {
- @Override public String call() throws Exception {
- return "submit1";
- }
- });
-
- waitForValue(cnt, 1);
-
- assertEquals("submit1", fut.get());
-
- cnt.set(0);
-
- fut = execSrvc.submit(new TestRunnable(), "submit2");
-
- waitForValue(cnt, 1);
-
- assertEquals("submit2", fut.get());
-
- cnt.set(0);
-
- Future<?> runFut = execSrvc.submit(new TestRunnable());
-
- waitForValue(cnt, 1);
-
- runFut.get();
- }
-
- /**
- * @param fut Execution future.
- * @throws InterruptedException Thrown if wait was interrupted.
- */
- @SuppressWarnings({"UnconditionalWait"})
- private void waitForExecution(IgniteFuture fut) throws InterruptedException {
- long sleep = 250;
-
- long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
-
- do synchronized (mux) {
- mux.wait(sleep);
- }
- while (fut != null && !fut.isDone() && !fut.isCancelled() && threshold > System.currentTimeMillis());
-
- assert fut == null || fut.isDone();
- }
-
- /**
- * @param cnt Counter to check.
- * @param val Value to check.
- * @throws InterruptedException Thrown if wait was interrupted.
- */
- private void waitForValue(AtomicInteger cnt, int val) throws InterruptedException {
- assert cnt != null;
- assert val > 0;
-
- long threshold = System.currentTimeMillis() + WAIT_TIMEOUT;
-
- long time;
-
- while (threshold > (time = System.currentTimeMillis()))
- synchronized (mux) {
- if (cnt.get() == val)
- break;
-
- mux.wait(threshold - time);
- }
-
- assert cnt.get() == val;
- }
-
- /**
- * @throws Exception If test failed.
- */
- private void checkActiveFutures() throws Exception {
- IgniteCompute comp = compute(prj).withAsync();
-
- assertEquals(0, comp.activeTaskFutures().size());
-
- cnt.set(0);
-
- Collection<ComputeTaskFuture<Object>> futsList = new ArrayList<>();
-
- for (int i = 0; i < 10; i++) {
- comp.call(new TestWaitCallable<>());
-
- ComputeTaskFuture<Object> fut = comp.future();
-
- assertFalse(fut.isDone());
-
- Map<IgniteUuid, ComputeTaskFuture<Object>> futs = comp.activeTaskFutures();
-
- assertEquals(i + 1, futs.size());
-
- assertTrue(futs.containsKey(fut.getTaskSession().getId()));
-
- futsList.add(fut);
- }
-
- synchronized (mux) {
- cnt.incrementAndGet();
-
- mux.notifyAll();
- }
-
- for (ComputeTaskFuture<Object> fut : futsList)
- fut.get();
-
- assertEquals(0, comp.activeTaskFutures().size());
- }
-
- /**
- * Test closure.
- */
- private static class TestClosure implements IgniteClosure<String, String> {
- /** {@inheritDoc} */
- @Override public String apply(String s) {
- return s;
- }
- }
-
- /**
- * Test runnable.
- */
- private static class TestRunnable implements IgniteRunnable {
- /** {@inheritDoc} */
- @Override public void run() {
- // No-op.
- }
- }
-
- /**
- * Test callable.
- */
- private static class TestCallable<T> implements IgniteCallable<T> {
- /** {@inheritDoc} */
- @Nullable @Override public T call() throws Exception {
- return null;
- }
- }
-
- /**
- * Test callable.
- */
- private static class TestWaitCallable<T> implements IgniteCallable<T> {
- /** {@inheritDoc} */
- @Nullable @Override public T call() throws Exception {
- synchronized (mux) {
- while (cnt.get() == 0)
- mux.wait();
- }
-
- return null;
- }
- }
-
- /**
- * Test task.
- */
- @SuppressWarnings({"PublicInnerClass"})
- public static class TestTask extends ComputeTaskSplitAdapter<String, Void> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
- Collection<ComputeJob> jobs = new HashSet<>();
-
- for (int i = 0; i < gridSize; i++)
- jobs.add(new TestJob());
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
- return null;
- }
- }
-
- /**
- * Test job.
- */
- @SuppressWarnings({"PublicInnerClass"})
- public static class TestJob extends ComputeJobAdapter {
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- return null;
- }
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
deleted file mode 100644
index 9fbad80..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionSelfTest.java
+++ /dev/null
@@ -1,251 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test for {@link ClusterGroup}.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridProjectionSelfTest extends GridProjectionAbstractTest {
- /** Nodes count. */
- private static final int NODES_CNT = 4;
-
- /** Projection node IDs. */
- private static Collection<UUID> ids;
-
- /** */
- private static Ignite ignite;
-
- /** {@inheritDoc} */
- @SuppressWarnings({"ConstantConditions"})
- @Override protected void beforeTestsStarted() throws Exception {
- assert NODES_CNT > 2;
-
- ids = new LinkedList<>();
-
- try {
- for (int i = 0; i < NODES_CNT; i++) {
- Ignition.setClientMode(i > 1);
-
- Ignite g = startGrid(i);
-
- ids.add(g.cluster().localNode().id());
-
- if (i == 0)
- ignite = g;
- }
- }
- finally {
- Ignition.setClientMode(false);
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- for (int i = 0; i < NODES_CNT; i++)
- stopGrid(i);
- }
-
- /** {@inheritDoc} */
- @Override protected ClusterGroup projection() {
- return grid(0).cluster().forPredicate(F.nodeForNodeIds(ids));
- }
-
- /** {@inheritDoc} */
- @Override protected UUID localNodeId() {
- return grid(0).localNode().id();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRandom() throws Exception {
- assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node()));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOldest() throws Exception {
- ClusterGroup oldest = ignite.cluster().forOldest();
-
- ClusterNode node = null;
-
- long minOrder = Long.MAX_VALUE;
-
- for (ClusterNode n : ignite.cluster().nodes()) {
- if (n.order() < minOrder) {
- node = n;
-
- minOrder = n.order();
- }
- }
-
- assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testYoungest() throws Exception {
- ClusterGroup youngest = ignite.cluster().forYoungest();
-
- ClusterNode node = null;
-
- long maxOrder = Long.MIN_VALUE;
-
- for (ClusterNode n : ignite.cluster().nodes()) {
- if (n.order() > maxOrder) {
- node = n;
-
- maxOrder = n.order();
- }
- }
-
- assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNewNodes() throws Exception {
- ClusterGroup youngest = ignite.cluster().forYoungest();
- ClusterGroup oldest = ignite.cluster().forOldest();
-
- ClusterNode old = oldest.node();
- ClusterNode last = youngest.node();
-
- assertNotNull(last);
-
- try (Ignite g = startGrid(NODES_CNT)) {
- ClusterNode n = g.cluster().localNode();
-
- ClusterNode latest = youngest.node();
-
- assertNotNull(latest);
- assertEquals(latest.id(), n.id());
- assertEquals(oldest.node(), old);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testForPredicate() throws Exception {
- IgnitePredicate<ClusterNode> evenP = new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.order() % 2 == 0;
- }
- };
-
- IgnitePredicate<ClusterNode> oddP = new IgnitePredicate<ClusterNode>() {
- @Override public boolean apply(ClusterNode node) {
- return node.order() % 2 == 1;
- }
- };
-
- ClusterGroup remotes = ignite.cluster().forRemotes();
-
- ClusterGroup evenYoungest = remotes.forPredicate(evenP).forYoungest();
- ClusterGroup evenOldest = remotes.forPredicate(evenP).forOldest();
-
- ClusterGroup oddYoungest = remotes.forPredicate(oddP).forYoungest();
- ClusterGroup oddOldest = remotes.forPredicate(oddP).forOldest();
-
- int clusterSize = ignite.cluster().nodes().size();
-
- assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
- assertEquals(grid(1).localNode().id(), evenOldest.node().id());
-
- assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
- assertEquals(grid(2).localNode().id(), oddOldest.node().id());
-
- try (Ignite g4 = startGrid(NODES_CNT);
- Ignite g5 = startGrid(NODES_CNT + 1))
- {
- clusterSize = g4.cluster().nodes().size();
-
- assertEquals(grid(gridMaxOrder(clusterSize, true)).localNode().id(), evenYoungest.node().id());
- assertEquals(grid(1).localNode().id(), evenOldest.node().id());
-
- assertEquals(grid(gridMaxOrder(clusterSize, false)).localNode().id(), oddYoungest.node().id());
- assertEquals(grid(2).localNode().id(), oddOldest.node().id());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testAgeClusterGroupSerialization() throws Exception {
- Marshaller marshaller = getConfiguration().getMarshaller();
-
- ClusterGroup grp = ignite.cluster().forYoungest();
- ClusterNode node = grp.node();
-
- byte[] arr = marshaller.marshal(grp);
-
- ClusterGroup obj = marshaller.unmarshal(arr, null);
-
- assertEquals(node.id(), obj.node().id());
-
- try (Ignite ignore = startGrid()) {
- obj = marshaller.unmarshal(arr, null);
-
- assertEquals(grp.node().id(), obj.node().id());
- assertFalse(node.id().equals(obj.node().id()));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientServer() throws Exception {
- ClusterGroup srv = ignite.cluster().forServers();
-
- assertEquals(2, srv.nodes().size());
- assertTrue(srv.nodes().contains(ignite(0).cluster().localNode()));
- assertTrue(srv.nodes().contains(ignite(1).cluster().localNode()));
-
- ClusterGroup cli = ignite.cluster().forClients();
-
- assertEquals(2, srv.nodes().size());
- assertTrue(cli.nodes().contains(ignite(2).cluster().localNode()));
- assertTrue(cli.nodes().contains(ignite(3).cluster().localNode()));
- }
-
- /**
- * @param cnt Count.
- * @param even Even.
- */
- private static int gridMaxOrder(int cnt, boolean even) {
- assert cnt > 2;
-
- cnt = cnt - (cnt % 2);
-
- return even ? cnt - 1 : cnt - 2;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
index 2de04b0..3ec3278 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.*;
* Test for {@link org.apache.ignite.IgniteCluster}.
*/
@GridCommonTest(group = "Kernal Self")
-public class GridSelfTest extends GridProjectionAbstractTest {
+public class GridSelfTest extends ClusterGroupAbstractTest {
/** Nodes count. */
private static final int NODES_CNT = 4;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6c3d97f8/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 2d14728..3da198c 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
@@ -65,7 +65,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTest(IgniteStreamSelfTestSuite.suite());
suite.addTest(new TestSuite(GridSelfTest.class));
- GridTestUtils.addTestIfNeeded(suite, GridProjectionSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, ClusterGroupSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
GridTestUtils.addTestIfNeeded(suite, GridMessagingNoPeerClassLoadingSelfTest.class, ignoredTests);