Merge remote-tracking branch 'remotes/origin/sprint-1' into ignite-164v2
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeStartUtils.java
modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteRemoteStartSpecification.java
modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.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/bf143cdb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bf143cdb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bf143cdb
Branch: refs/heads/ignite-164v2stable
Commit: bf143cdbab14cb1c72f6b6e19adc018e6dc0d263
Parents: 9ee52f9 e4365c3
Author: ivasilinets <[email protected]>
Authored: Fri Feb 6 14:48:09 2015 +0300
Committer: ivasilinets <[email protected]>
Committed: Fri Feb 6 14:48:09 2015 +0300
----------------------------------------------------------------------
bin/include/ggservice.exe | Bin 5632 -> 0 bytes
bin/include/igniteservice.exe | Bin 0 -> 6144 bytes
.../IgniteAtomicReferenceExample.java | 2 +-
.../IgniteAtomicStampedExample.java | 2 +-
.../MessagingPingPongListenActorExample.java | 4 +-
.../streaming/StreamingCheckInExample.java | 2 +-
.../StreamingPopularNumbersExample.java | 2 +-
.../streaming/StreamingPriceBarsExample.java | 2 +-
.../apache/ignite/examples/ComputeExample.java | 6 +-
.../examples/ScalarCacheAffinityExample1.scala | 3 +-
.../java/org/apache/ignite/IgniteCache.java | 22 -
.../java/org/apache/ignite/IgniteCluster.java | 6 +-
.../java/org/apache/ignite/IgniteCompute.java | 18 +-
.../java/org/apache/ignite/IgniteQueue.java | 4 +-
.../main/java/org/apache/ignite/IgniteSet.java | 2 +-
.../ignite/cache/eviction/EvictableEntry.java | 2 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 1567 ++++++++++++++++++
.../cache/store/jdbc/CacheJdbcPojoStore.java | 205 +++
.../ignite/cache/store/jdbc/JdbcCacheStore.java | 1560 -----------------
.../cache/store/jdbc/JdbcPojoCacheStore.java | 205 ---
.../ignite/internal/IgniteComputeImpl.java | 21 +-
.../apache/ignite/internal/IgniteKernal.java | 16 +-
.../processors/cache/IgniteCacheProxy.java | 6 -
.../GridDistributedCacheAdapter.java | 46 +-
.../ignite/internal/util/IgniteUtils.java | 2 +-
.../internal/util/lang/GridAbsClosure.java | 4 +-
.../util/nodestart/GridNodeCallable.java | 29 -
.../util/nodestart/GridNodeStartUtils.java | 390 -----
.../nodestart/GridRemoteStartSpecification.java | 279 ----
.../util/nodestart/IgniteNodeCallable.java | 30 +
.../util/nodestart/IgniteNodeStartUtils.java | 391 +++++
.../IgniteRemoteStartSpecification.java | 279 ++++
.../util/nodestart/IgniteSshProcessor.java | 2 +-
.../apache/ignite/internal/util/typedef/CA.java | 3 +-
.../ignite/internal/util/typedef/CAX.java | 2 +-
.../org/apache/ignite/lang/IgniteRunnable.java | 2 +-
.../IgniteOptimizedObjectInputStream.java | 2 +
.../ignite/messaging/MessagingListenActor.java | 18 +-
.../core/src/test/bin/start-nodes-custom.bat | 2 +-
modules/core/src/test/config/start-nodes.ini | 6 +-
.../core/src/test/config/store/jdbc/Ignite.xml | 50 +
...ractJdbcCacheStoreMultithreadedSelfTest.java | 196 ---
.../CacheJdbcPojoStoreMultitreadedSelfTest.java | 35 +
.../store/jdbc/CacheJdbcPojoStoreTest.java | 759 +++++++++
...eJdbcStoreAbstractMultithreadedSelfTest.java | 275 +++
.../PojoJdbcCacheStoreMultitreadedSelfTest.java | 34 -
.../store/jdbc/PojoJdbcCacheStoreTest.java | 702 --------
.../store/jdbc/model/PersonComplexKey.java | 146 ++
.../GridJobMasterLeaveAwareSelfTest.java | 4 +-
.../internal/GridListenActorSelfTest.java | 11 +-
.../internal/GridManagementJobSelfTest.java | 7 +-
.../internal/GridProjectionAbstractTest.java | 18 +-
.../GridTaskExecutionContextSelfTest.java | 4 +-
.../IgniteComputeEmptyClusterGroupTest.java | 4 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 8 +-
...eAbstractDataStructuresFailoverSelfTest.java | 2 +-
...GridCacheQueueMultiNodeAbstractSelfTest.java | 2 +-
.../GridCacheSetAbstractSelfTest.java | 3 +-
...xOriginatingNodeFailureAbstractSelfTest.java | 3 +-
...cOriginatingNodeFailureAbstractSelfTest.java | 4 +-
.../near/GridCacheNearEvictionSelfTest.java | 5 +-
.../GridCachePartitionedAffinitySelfTest.java | 2 +-
.../GridCachePartitionedEntryLockSelfTest.java | 3 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 2 +-
.../closure/GridClosureProcessorSelfTest.java | 14 +-
.../loadtests/colocation/GridTestMain.java | 2 +-
.../marshaller/GridMarshallerAbstractTest.java | 2 +-
.../spi/GridTcpSpiForwardingSelfTest.java | 3 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../GridHibernateAccessStrategyAdapter.java | 3 +-
.../ignite/scalar/ScalarConversions.scala | 8 +-
.../ignite/scalar/lang/ScalarOutClosure.scala | 4 +-
.../scalar/lang/ScalarOutClosureFunction.scala | 4 +-
.../ignite/schema/model/PojoDescriptor.java | 8 +-
.../org/apache/ignite/schema/ui/Controls.java | 4 +-
.../apache/ignite/schema/ui/SchemaLoadApp.java | 137 +-
.../schema/load/AbstractSchemaLoaderTest.java | 4 +-
.../util/nodestart/GridNodeCallableImpl.java | 344 ----
.../util/nodestart/IgniteNodeCallableImpl.java | 344 ++++
.../util/nodestart/IgniteSshProcessorImpl.java | 4 +-
.../internal/GridNodeStartUtilsSelfTest.java | 89 -
.../GridProjectionStartStopRestartSelfTest.java | 1032 ------------
.../internal/IgniteNodeStartUtilsSelfTest.java | 88 +
...gniteProjectionStartStopRestartSelfTest.java | 1032 ++++++++++++
.../IgniteStartStopRestartTestSuite.java | 4 +-
.../commands/start/VisorStartCommand.scala | 4 +-
.../commands/open/VisorOpenCommandSpec.scala | 6 +-
modules/winservice/IgniteService.sln | 22 +
.../winservice/IgniteService/IgniteService.cs | 170 ++
.../IgniteService/IgniteService.csproj | 90 +
modules/winservice/README.md | 3 +
.../yardstick/config/benchmark-store.properties | 35 +-
.../yardstick/config/ignite-store-config.xml | 11 +-
.../jdbc/IgniteJdbcStoreAbstractBenchmark.java | 95 +-
.../store/jdbc/IgniteJdbcStoreGetBenchmark.java | 10 +-
.../jdbc/IgniteJdbcStoreGetTxBenchmark.java | 47 +
.../store/jdbc/IgniteJdbcStorePutBenchmark.java | 5 +
.../jdbc/IgniteJdbcStorePutGetBenchmark.java | 5 +
.../jdbc/IgniteJdbcStorePutGetTxBenchmark.java | 52 +
.../jdbc/IgniteJdbcStorePutTxBenchmark.java | 47 +
.../yardstick/compute/IgniteRunBenchmark.java | 5 +-
.../yardstick/compute/model/NoopCallable.java | 5 +-
102 files changed, 6028 insertions(+), 5139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
index 45ada5f,0350487..800693d
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
@@@ -232,10 -232,10 +232,10 @@@ public interface IgniteCluster extends
* </td>
* </tr>
* <tr>
- * <td><b>ggHome</b></td>
+ * <td><b>igniteHome</b></td>
* <td>String</td>
* <td>
- * Path to GridGain installation folder. If not defined,
IGNITE_HOME
+ * Path to Ignite installation folder. If not defined,
IGNITE_HOME
* environment variable must be set on remote hosts.
* </td>
* </tr>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectInputStream.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/scalar/src/main/scala/org/apache/ignite/scalar/ScalarConversions.scala
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteNodeStartUtilsSelfTest.java
----------------------------------------------------------------------
diff --cc
modules/ssh/src/test/java/org/apache/ignite/internal/IgniteNodeStartUtilsSelfTest.java
index 0000000,46a64c5..c21f0b1
mode 000000,100644..100644
---
a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteNodeStartUtilsSelfTest.java
+++
b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteNodeStartUtilsSelfTest.java
@@@ -1,0 -1,88 +1,88 @@@
+ /*
+ * 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.internal.util.typedef.internal.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.testframework.junits.common.*;
+
+ import java.io.*;
+ import java.util.*;
+
+ import static
org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.*;
+
+ /**
+ * Tests for {@link
org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils}.
+ */
+ public class IgniteNodeStartUtilsSelfTest extends GridCommonAbstractTest {
+ /**
+ * @throws Exception If failed.
+ */
+ public void testParseFile() throws Exception {
- File file =
U.resolveGridGainPath("modules/core/src/test/config/start-nodes.ini");
++ File file =
U.resolveIgnitePath("modules/core/src/test/config/start-nodes.ini");
+
+ IgniteBiTuple<Collection<Map<String, Object>>, Map<String, Object>> t
= parseFile(file);
+
+ assert t != null;
+
+ Collection<Map<String, Object>> hosts = t.get1();
+
+ assert hosts != null;
+ assert hosts.size() == 2;
+
+ for (Map<String, Object> host : hosts) {
+ assert host != null;
+
+ assert "192.168.1.1".equals(host.get(HOST)) ||
"192.168.1.2".equals(host.get(HOST));
+
+ if ("192.168.1.1".equals(host.get(HOST))) {
+ assert (Integer)host.get(PORT) == 1;
+ assert "uname1".equals(host.get(UNAME));
+ assert "passwd1".equals(host.get(PASSWD));
+ assert new File("key1").equals(host.get(KEY));
+ assert (Integer)host.get(NODES) == 1;
+ assert "ggHome1".equals(host.get(IGNITE_HOME));
+ assert "cfg1".equals(host.get(CFG));
+ assert "script1".equals(host.get(SCRIPT));
+ }
+ else if ("192.168.1.2".equals(host.get(HOST))) {
+ assert (Integer)host.get(PORT) == 2;
+ assert "uname2".equals(host.get(UNAME));
+ assert "passwd2".equals(host.get(PASSWD));
+ assert new File("key2").equals(host.get(KEY));
+ assert (Integer)host.get(NODES) == 2;
+ assert "ggHome2".equals(host.get(IGNITE_HOME));
+ assert "cfg2".equals(host.get(CFG));
+ assert "script2".equals(host.get(SCRIPT));
+ }
+ }
+
+ Map<String, Object> dflts = t.get2();
+
+ assert dflts != null;
+
+ assert (Integer)dflts.get(PORT) == 3;
+ assert "uname3".equals(dflts.get(UNAME));
+ assert "passwd3".equals(dflts.get(PASSWD));
+ assert new File("key3").equals(dflts.get(KEY));
+ assert (Integer)dflts.get(NODES) == 3;
+ assert "ggHome3".equals(dflts.get(IGNITE_HOME));
+ assert "cfg3".equals(dflts.get(CFG));
+ assert "script3".equals(dflts.get(SCRIPT));
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
----------------------------------------------------------------------
diff --cc
modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
index 0000000,0e9ee8a..68f68a9
mode 000000,100644..100644
---
a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
+++
b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
@@@ -1,0 -1,1032 +1,1032 @@@
+ /*
+ * 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.events.*;
+ import org.apache.ignite.internal.util.lang.*;
+ import org.apache.ignite.internal.util.nodestart.*;
+ 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.junits.common.*;
+ import org.jetbrains.annotations.*;
+
+ import java.io.*;
+ import java.nio.file.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+ import java.util.concurrent.atomic.*;
+
+ import static java.util.concurrent.TimeUnit.*;
+ import static org.apache.ignite.events.IgniteEventType.*;
+ import static
org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.*;
+
+ /**
+ * Tests for {@code startNodes(..)}, {@code stopNodes(..)}
+ * and {@code restartNodes(..)} methods.
+ * <p>
+ * {@code tests.properties} file must specify username ({@code ssh.username}
property)
+ * and one (and only one) of password ({@code ssh.password} property) or
+ * private key path ({@code ssh.key} property).
+ */
+ @SuppressWarnings("ConstantConditions")
+ public class IgniteProjectionStartStopRestartSelfTest extends
GridCommonAbstractTest {
+ /** */
+ private static final String SSH_UNAME =
System.getenv("test.ssh.username");
+
+ /** */
+ private static final String SSH_PWD = System.getenv("test.ssh.password");
+
+ /** */
+ private static final String SSH_KEY = System.getenv("ssh.key");
+
+ /** */
+ private static final String CUSTOM_SCRIPT_WIN =
"modules/core/src/test/bin/start-nodes-custom.bat";
+
+ /** */
+ private static final String CUSTOM_SCRIPT_LINUX =
"modules/core/src/test/bin/start-nodes-custom.sh";
+
+ /** */
+ private static final String CFG_NO_ATTR =
"modules/core/src/test/config/spring-start-nodes.xml";
+
+ /** */
+ private static final String CFG_ATTR =
"modules/core/src/test/config/spring-start-nodes-attr.xml";
+
+ /** */
+ private static final String CUSTOM_CFG_ATTR_KEY = "grid.node.ssh.started";
+
+ /** */
+ private static final String CUSTOM_CFG_ATTR_VAL = "true";
+
+ /** */
+ private static final long WAIT_TIMEOUT = 40 * 1000;
+
+ /** */
+ private String pwd;
+
+ /** */
+ private File key;
+
+ /** */
+ private Ignite ignite;
+
+ /** */
+ private static final String HOST = "127.0.0.1";
+
+ /** */
+ private final AtomicInteger joinedCnt = new AtomicInteger();
+
+ /** */
+ private final AtomicInteger leftCnt = new AtomicInteger();
+
+ /** */
+ private volatile CountDownLatch joinedLatch;
+
+ /** */
+ private volatile CountDownLatch leftLatch;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ if (SSH_KEY != null) {
+ key = new File(SSH_KEY);
+
+ assert key.exists() : "Private key doesn't exist: " +
key.getAbsolutePath();
+ assert key.isFile() : "Private key is not a file: " +
key.getAbsolutePath();
+ }
+ else
+ pwd = SSH_PWD;
+
+ log.info("Username: " + SSH_UNAME);
+ log.info("Password: " + pwd);
+ log.info("Key path: " + key);
+
+ G.setDaemon(true);
+
+ ignite = G.start(CFG_NO_ATTR);
+
+ G.setDaemon(false);
+
+ ignite.events().localListen(new IgnitePredicate<IgniteEvent>() {
+ @Override public boolean apply(IgniteEvent evt) {
+ info("Received event: " + evt.shortDisplay());
+
+ if (evt.type() == EVT_NODE_JOINED) {
+ joinedCnt.incrementAndGet();
+
+ if (joinedLatch != null)
+ joinedLatch.countDown();
+ } else if (evt.type() == EVT_NODE_LEFT) {
+ leftCnt.incrementAndGet();
+
+ if (leftLatch != null)
+ leftLatch.countDown();
+ }
+
+ return true;
+ }
+ }, EVT_NODE_JOINED, EVT_NODE_LEFT);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ if (!ignite.cluster().nodes().isEmpty()) {
+ leftLatch = new CountDownLatch(ignite.cluster().nodes().size());
+
+ ignite.cluster().stopNodes();
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ }
+
+ boolean wasEmpty = ignite.cluster().nodes().isEmpty();
+
+ G.stop(true);
+
+ joinedCnt.set(0);
+ leftCnt.set(0);
+
+ joinedLatch = null;
+ leftLatch = null;
+
+ assert wasEmpty : "grid.isEmpty() returned false after all nodes were
stopped [nodes=" + ignite.cluster().nodes() + ']';
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 90 * 1000;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartOneNode() throws Exception {
+ joinedLatch = new CountDownLatch(1);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 1;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 1;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 1;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartThreeNodes() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, DFLT_TIMEOUT, 1);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartThreeNodesAndDoEmptyCall() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.isEmpty();
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartThreeNodesAndTryToStartOneNode() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.isEmpty();
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartFiveNodesInTwoCalls() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(2);
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 5,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 5,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 2;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 5;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 5;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartFiveWithTwoSpecs() throws Exception {
+ joinedLatch = new CountDownLatch(5);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- F.asList(map(HOST, SSH_UNAME, pwd, key, 2,
U.getGridGainHome(), CFG_NO_ATTR, null),
- map(HOST, SSH_UNAME, pwd, key, 3, U.getGridGainHome(),
CFG_NO_ATTR, null)),
++ F.asList(map(HOST, SSH_UNAME, pwd, key, 2, U.getIgniteHome(),
CFG_NO_ATTR, null),
++ map(HOST, SSH_UNAME, pwd, key, 3, U.getIgniteHome(),
CFG_NO_ATTR, null)),
+ null, false, 0, 16);
+
+ assert res.size() == 5;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 5;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 5;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartThreeNodesAndRestart() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 3;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(3);
+ leftLatch = new CountDownLatch(3);
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, true, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 6;
+ assert leftCnt.get() == 3;
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCustomScript() throws Exception {
+ joinedLatch = new CountDownLatch(1);
+
+ String script = U.isWindows() ? CUSTOM_SCRIPT_WIN :
CUSTOM_SCRIPT_LINUX;
+
- script =
Paths.get(U.getGridGainHome()).relativize(U.resolveGridGainPath(script).toPath()).toString();
++ script =
Paths.get(U.getIgniteHome()).relativize(U.resolveIgnitePath(script).toPath()).toString();
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getGridGainHome(), null, script),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1,
U.getIgniteHome(), null, script),
+ null, false, 0, 16);
+
+ assert res.size() == 1;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert joinedCnt.get() == 1;
+ assert leftCnt.get() == 0;
+
+ assert ignite.cluster().nodes().size() == 1;
+
+ assert
CUSTOM_CFG_ATTR_VAL.equals(F.first(ignite.cluster().nodes()).<String>attribute(CUSTOM_CFG_ATTR_KEY));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopNodes() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3,
U.getGridGainHome(), CFG_NO_ATTR,
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3,
U.getIgniteHome(), CFG_NO_ATTR,
+ null), null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ leftLatch = new CountDownLatch(3);
+
+ ignite.cluster().stopNodes();
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().isEmpty();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopNodesFiltered() throws Exception {
+ joinedLatch = new CountDownLatch(2);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2,
U.getGridGainHome(), CFG_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2,
U.getIgniteHome(), CFG_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 2;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ joinedLatch = new CountDownLatch(1);
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 1;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ leftLatch = new CountDownLatch(2);
+
+ Collection<UUID> ids =
F.transform(ignite.cluster().forAttribute(CUSTOM_CFG_ATTR_KEY,
CUSTOM_CFG_ATTR_VAL).nodes(),
+ new IgniteClosure<ClusterNode, UUID>() {
+ @Override public UUID apply(ClusterNode node) {
+ return node.id();
+ }
+ });
+
+ ignite.cluster().forAttribute(CUSTOM_CFG_ATTR_KEY,
CUSTOM_CFG_ATTR_VAL).nodes();
+
+ ignite.cluster().stopNodes(ids);
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 1;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopNodeById() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ leftLatch = new CountDownLatch(1);
+
+
ignite.cluster().stopNodes(Collections.singleton(F.first(ignite.cluster().forRemotes().nodes()).id()));
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 2;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopNodesByIds() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ leftLatch = new CountDownLatch(2);
+
+ Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
+
+ Collection<UUID> ids = new HashSet<>();
+
+ ids.add(it.next().id());
+ ids.add(it.next().id());
+
+ ignite.cluster().stopNodes(ids);
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 1;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStopNodesByIdsC() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ leftLatch = new CountDownLatch(2);
+
+ Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
+
+ ignite.cluster().stopNodes(F.asList(it.next().id(), it.next().id()));
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 1;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartNodes() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(3);
+ leftLatch = new CountDownLatch(3);
+
+ ignite.cluster().restartNodes();
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartNodesFiltered() throws Exception {
+ joinedLatch = new CountDownLatch(2);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2,
U.getGridGainHome(), CFG_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2,
U.getIgniteHome(), CFG_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 2;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ joinedLatch = new CountDownLatch(1);
+
+ res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 1;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(2);
+ leftLatch = new CountDownLatch(2);
+
+ X.println("Restarting nodes with " + CUSTOM_CFG_ATTR_KEY);
+
+ Collection<UUID> ids =
F.transform(ignite.cluster().forAttribute(CUSTOM_CFG_ATTR_KEY,
CUSTOM_CFG_ATTR_VAL).nodes(),
+ new IgniteClosure<ClusterNode, UUID>() {
+ @Override public UUID apply(ClusterNode node) {
+ return node.id();
+ }
+ }
+ );
+
+ ignite.cluster().restartNodes(ids);
+
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartNodeById() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(1);
+ leftLatch = new CountDownLatch(1);
+
+
ignite.cluster().restartNodes(Collections.singleton(F.first(ignite.cluster().forRemotes().nodes()).id()));
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartNodesByIds() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(2);
+ leftLatch = new CountDownLatch(2);
+
+ Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
+
+ ignite.cluster().restartNodes(F.asList(it.next().id(),
it.next().id()));
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartNodesByIdsC() throws Exception {
+ joinedLatch = new CountDownLatch(3);
+
+ Collection<GridTuple3<String, Boolean, String>> res =
+ startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getGridGainHome(), CFG_NO_ATTR, null),
++ maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3,
U.getIgniteHome(), CFG_NO_ATTR, null),
+ null, false, 0, 16);
+
+ assert res.size() == 3;
+
+ F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
+ @Override public void apply(GridTuple3<String, Boolean, String>
t) {
+ assert t.get1().equals(HOST);
+
+ if (!t.get2())
+ throw new IgniteException(t.get3());
+ }
+ });
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+
+ joinedLatch = new CountDownLatch(2);
+ leftLatch = new CountDownLatch(2);
+
+ Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
+
+ ignite.cluster().restartNodes(F.asList(it.next().id(),
it.next().id()));
+
+ assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+ assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
+
+ assert ignite.cluster().nodes().size() == 3;
+ }
+
+ /**
+ * @param host Hostname.
+ * @param uname Username.
+ * @param passwd Password.
+ * @param key Private key file.
+ * @param nodes Number of nodes.
+ * @param igniteHome GridGain home.
+ * @param cfg Configuration file path.
+ * @param script Startup script path.
+ * @return Parameters map.
+ */
+ private Map<String, Object> map(
+ String host,
+ @Nullable String uname,
+ @Nullable String passwd,
+ @Nullable File key,
+ @Nullable Integer nodes,
+ @Nullable String igniteHome,
+ @Nullable String cfg,
+ @Nullable String script) {
+ assert host != null;
+
+ Map<String, Object> params = new HashMap<>();
+
+ params.put(IgniteNodeStartUtils.HOST, host);
+ params.put(UNAME, uname);
+ params.put(PASSWD, passwd);
+ params.put(KEY, key);
+ params.put(NODES, nodes);
+ params.put(IGNITE_HOME, igniteHome);
+ params.put(CFG, cfg);
+ params.put(SCRIPT, script);
+
+ return params;
+ }
+
+ /**
+ * @param hosts Hostnames.
+ * @param uname Username.
+ * @param passwd Password.
+ * @param key Private key file.
+ * @param nodes Number of nodes.
+ * @param igniteHome GridGain home.
+ * @param cfg Configuration file path.
+ * @param script Startup script path.
+ * @return Parameters map.
+ */
+ private Collection<Map<String, Object>> maps(
+ Collection<String> hosts,
+ @Nullable String uname,
+ @Nullable String passwd,
+ @Nullable File key,
+ @Nullable Integer nodes,
+ @Nullable String igniteHome,
+ @Nullable String cfg,
+ @Nullable String script) {
+ assert HOST != null;
+
+ Collection<Map<String, Object>> maps = new ArrayList<>(hosts.size());
+
+ for (String host : hosts) {
+ Map<String, Object> params = new HashMap<>();
+
+ params.put(IgniteNodeStartUtils.HOST, host);
+ params.put(UNAME, uname);
+ params.put(PASSWD, passwd);
+ params.put(KEY, key);
+ params.put(NODES, nodes);
+ params.put(IGNITE_HOME, igniteHome);
+ params.put(CFG, cfg);
+ params.put(SCRIPT, script);
+
+ maps.add(params);
+ }
+
+ return maps;
+ }
+
+ /**
+ * @param name Filename.
+ * @return Whether name belongs to log file.
+ */
+ private boolean isSshNodeLogName(String name) {
- return name.matches("gridgain.[0-9a-z-]+.log");
++ return name.matches("ignite.[0-9a-z-]+.log");
+ }
+
+ /**
+ * @param cluster Cluster.
+ * @param hosts Hosts.
+ * @param dflts Default.
+ * @param restart Restart flag.
+ * @param timeout Timeout.
+ * @param maxConn Maximum connections.
+ * @return Results collection.
+ * @throws IgniteCheckedException If failed.
+ */
+ private Collection<GridTuple3<String, Boolean, String>>
startNodes(IgniteCluster cluster,
+ Collection<Map<String, Object>> hosts,
+ @Nullable Map<String, Object> dflts,
+ boolean restart,
+ int timeout,
+ int maxConn) throws IgniteCheckedException {
+ cluster = cluster.withAsync();
+
+ assertNull(cluster.startNodes(hosts, dflts, restart, timeout,
maxConn));
+
+ return cluster.<Collection<GridTuple3<String, Boolean,
String>>>future().get(WAIT_TIMEOUT);
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf143cdb/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
----------------------------------------------------------------------