You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/09/13 12:49:37 UTC
[43/50] [abbrv] ignite git commit: IGNITE-9545 Fixed misleading
javadocs, required conditions are not described,
inconvenient to configure locally in IgniteProjectionStartStopRestartSelfTest
- Fixes #4729.
IGNITE-9545 Fixed misleading javadocs, required conditions are not described, inconvenient to configure locally in IgniteProjectionStartStopRestartSelfTest - Fixes #4729.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c1b2c6b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c1b2c6b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c1b2c6b5
Branch: refs/heads/ignite-9349
Commit: c1b2c6b55e82b2bbc0701552540f3ba24f42b397
Parents: f5b5ecd
Author: Oleg Ignatenko <oi...@gridgain.com>
Authored: Wed Sep 12 17:41:33 2018 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Wed Sep 12 17:41:33 2018 +0300
----------------------------------------------------------------------
...gniteProjectionStartStopRestartSelfTest.java | 392 ++++++++-----------
1 file changed, 168 insertions(+), 224 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1b2c6b5/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
index 4314a98..a91488c 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
@@ -36,13 +36,13 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterStartNodeResult;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils;
-import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.testframework.config.GridTestProperties;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
@@ -63,20 +63,24 @@ import static org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.UNA
* 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).
+ * Environment (obtained via {@link System#getenv(String)}) or, alternatively, {@code tests.properties} file must
+ * specify either username and password or private key path in the environment properties (@code test.ssh.username},
+ * {@code test.ssh.password}, {@code ssh.key} or in test file entries {@code ssh.username} {@code ssh.password},
+ * {@code ssh.key}respectively.</p>
+ * <p>
+ * Configured target host must run ssh server and accept ssh connections at configured port from user with specified
+ * credentials.</p>
*/
@SuppressWarnings("ConstantConditions")
public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstractTest {
/** */
- private static final String SSH_UNAME = System.getenv("test.ssh.username");
+ private static final String SSH_UNAME = getProperty("test.ssh.username", "ssh.username");
/** */
- private static final String SSH_PWD = System.getenv("test.ssh.password");
+ private static final String SSH_PWD = getProperty("test.ssh.password", "ssh.password");
/** */
- private static final String SSH_KEY = System.getenv("ssh.key");
+ private static final String SSH_KEY = getProperty("ssh.key", "ssh.key");
/** */
private static final String CUSTOM_SCRIPT_WIN = "modules/core/src/test/bin/start-nodes-custom.bat";
@@ -124,7 +128,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
private volatile CountDownLatch leftLatch;
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
+ @Override protected void beforeTest() {
if (SSH_KEY != null) {
key = new File(SSH_KEY);
@@ -144,25 +148,23 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
G.setDaemon(false);
- ignite.events().localListen(new IgnitePredicate<Event>() {
- @Override public boolean apply(Event evt) {
- info("Received event: " + evt.shortDisplay());
-
- if (evt.type() == EVT_NODE_JOINED) {
- joinedCnt.incrementAndGet();
+ ignite.events().localListen((IgnitePredicate<Event>)evt -> {
+ info("Received event: " + evt.shortDisplay());
- if (joinedLatch != null)
- joinedLatch.countDown();
- }
- else if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED) {
- leftCnt.incrementAndGet();
+ if (evt.type() == EVT_NODE_JOINED) {
+ joinedCnt.incrementAndGet();
- if (leftLatch != null)
- leftLatch.countDown();
- }
+ if (joinedLatch != null)
+ joinedLatch.countDown();
+ }
+ else if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED) {
+ leftCnt.incrementAndGet();
- return true;
+ if (leftLatch != null)
+ leftLatch.countDown();
}
+
+ return true;
}, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED);
}
@@ -209,18 +211,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -239,18 +239,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, DFLT_TIMEOUT, 1);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, DFLT_TIMEOUT, 1);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -269,18 +267,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -291,8 +287,8 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert ignite.cluster().nodes().size() == 3;
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.isEmpty();
@@ -310,18 +306,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -332,8 +326,8 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert ignite.cluster().nodes().size() == 3;
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.isEmpty();
@@ -351,18 +345,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -375,18 +367,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
joinedLatch = new CountDownLatch(2);
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 5, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 5, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 2;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -405,19 +395,17 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- 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);
+ F.asList(map(pwd, key, 2, U.getIgniteHome()),
+ map(pwd, key, 3, U.getIgniteHome())),
+ false, 0, 16);
assert res.size() == 5;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -436,18 +424,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -461,18 +447,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
leftLatch = new CountDownLatch(3);
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, true, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ true, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -496,18 +480,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), null, script),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 1, U.getIgniteHome(), null, script),
+ false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -528,18 +510,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3, U.getIgniteHome(), CFG_NO_ATTR,
- null), null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, null, 3, U.getIgniteHome(), CFG_NO_ATTR,
+ null), false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -563,18 +543,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
+ false, 0, 16);
assert res.size() == 2;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -582,18 +560,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
joinedLatch = new CountDownLatch(1);
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -603,11 +579,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
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();
- }
- });
+ (IgniteClosure<ClusterNode, UUID>)ClusterNode::id);
ignite.cluster().forAttribute(CUSTOM_CFG_ATTR_KEY, CUSTOM_CFG_ATTR_VAL).nodes();
@@ -626,18 +598,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -661,18 +631,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
+ res.forEach(t -> {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
- }
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -703,18 +671,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -740,18 +706,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
+ false, 0, 16);
assert res.size() == 2;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -759,18 +723,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
joinedLatch = new CountDownLatch(1);
res = startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -783,11 +745,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
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();
- }
- }
+ (IgniteClosure<ClusterNode, UUID>)ClusterNode::id
);
ignite.cluster().restartNodes(ids);
@@ -806,18 +764,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -843,18 +799,16 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
- maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
- null, false, 0, 16);
+ maps(Collections.singleton(HOST), pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
+ false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<ClusterStartNodeResult>() {
- @Override public void apply(ClusterStartNodeResult t) {
- assert t.getHostName().equals(HOST);
+ res.forEach(t -> {
+ assert t.getHostName().equals(HOST);
- if (!t.isSuccess())
- throw new IgniteException(t.getError());
- }
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
@@ -875,44 +829,35 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
}
/**
- * @param host Hostname.
- * @param uname Username.
* @param passwd Password.
* @param key Private key file.
* @param nodes Number of nodes.
* @param igniteHome Ignite 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;
+ @Nullable String igniteHome) {
+ assert IgniteProjectionStartStopRestartSelfTest.HOST != null;
Map<String, Object> params = new HashMap<>();
- params.put(IgniteNodeStartUtils.HOST, host);
- params.put(UNAME, uname);
+ params.put(IgniteNodeStartUtils.HOST, IgniteProjectionStartStopRestartSelfTest.HOST);
+ params.put(UNAME, IgniteProjectionStartStopRestartSelfTest.SSH_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);
+ params.put(CFG, IgniteProjectionStartStopRestartSelfTest.CFG_NO_ATTR);
+ params.put(SCRIPT, null);
return params;
}
/**
* @param hosts Hostnames.
- * @param uname Username.
* @param passwd Password.
* @param key Private key file.
* @param nodes Number of nodes.
@@ -923,7 +868,6 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
*/
private Collection<Map<String, Object>> maps(
Collection<String> hosts,
- @Nullable String uname,
@Nullable String passwd,
@Nullable File key,
@Nullable Integer nodes,
@@ -938,7 +882,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
Map<String, Object> params = new HashMap<>();
params.put(IgniteNodeStartUtils.HOST, host);
- params.put(UNAME, uname);
+ params.put(UNAME, IgniteProjectionStartStopRestartSelfTest.SSH_UNAME);
params.put(PASSWD, passwd);
params.put(KEY, key);
params.put(NODES, nodes);
@@ -953,17 +897,8 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
}
/**
- * @param name Filename.
- * @return Whether name belongs to log file.
- */
- private boolean isSshNodeLogName(String name) {
- 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.
@@ -971,10 +906,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
*/
private Collection<ClusterStartNodeResult> startNodes(IgniteCluster cluster,
Collection<Map<String, Object>> hosts,
- @Nullable Map<String, Object> dflts,
boolean restart,
int timeout,
int maxConn) {
- return cluster.startNodesAsync(hosts, dflts, restart, timeout, maxConn).get(WAIT_TIMEOUT);
+ return cluster.startNodesAsync(hosts, null, restart, timeout, maxConn).get(WAIT_TIMEOUT);
+ }
+
+ /** */
+ private static String getProperty(String envName, String gridTestName) {
+ String candidate = System.getenv(envName);
+
+ if (candidate != null)
+ return candidate;
+
+ return GridTestProperties.getProperty(gridTestName);
}
-}
\ No newline at end of file
+}