use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testCustomScript.
/**
* @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.getIgniteHome()).relativize(U.resolveIgnitePath(script).toPath()).toString();
Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), 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<ClusterStartNodeResult>() {
@Override
public void apply(ClusterStartNodeResult t) {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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));
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testRestartNodesByIdsC.
/**
* @throws Exception If failed.
*/
public void testRestartNodesByIdsC() throws Exception {
joinedLatch = new CountDownLatch(3);
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);
assert res.size() == 3;
F.forEach(res, new CI1<ClusterStartNodeResult>() {
@Override
public void apply(ClusterStartNodeResult t) {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testStopNodes.
/**
* @throws Exception If failed.
*/
public void testStopNodes() throws Exception {
joinedLatch = new CountDownLatch(3);
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);
assert res.size() == 3;
F.forEach(res, new CI1<ClusterStartNodeResult>() {
@Override
public void apply(ClusterStartNodeResult t) {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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();
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testStopNodesByIdsC.
/**
* @throws Exception If failed.
*/
public void testStopNodesByIdsC() throws Exception {
joinedLatch = new CountDownLatch(3);
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);
assert res.size() == 3;
F.forEach(res, new CI1<ClusterStartNodeResult>() {
@Override
public void apply(ClusterStartNodeResult t) {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testRestartNodeById.
/**
* @throws Exception If failed.
*/
public void testRestartNodeById() throws Exception {
joinedLatch = new CountDownLatch(3);
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);
assert res.size() == 3;
F.forEach(res, new CI1<ClusterStartNodeResult>() {
@Override
public void apply(ClusterStartNodeResult t) {
assert t.getHostName().equals(HOST);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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;
}
Aggregations