use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testStartThreeNodesAndRestart.
/**
* @throws Exception If failed.
*/
public void testStartThreeNodesAndRestart() 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 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.getIgniteHome(), CFG_NO_ATTR, null), 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);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testRestartNodesFiltered.
/**
* @throws Exception If failed.
*/
public void testRestartNodesFiltered() throws Exception {
joinedLatch = new CountDownLatch(2);
Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), 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<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);
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);
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 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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testStopNodesFiltered.
/**
* @throws Exception If failed.
*/
public void testStopNodesFiltered() throws Exception {
joinedLatch = new CountDownLatch(2);
Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), 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<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);
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);
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 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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testRestartNodes.
/**
* @throws Exception If failed.
*/
public void testRestartNodes() 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(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;
}
use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.
the class IgniteProjectionStartStopRestartSelfTest method testStartFiveNodesInTwoCalls.
/**
* @throws Exception If failed.
*/
public void testStartFiveNodesInTwoCalls() 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 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.getIgniteHome(), CFG_NO_ATTR, null), 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);
if (!t.isSuccess())
throw new IgniteException(t.getError());
}
});
assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
assert joinedCnt.get() == 5;
assert leftCnt.get() == 0;
assert ignite.cluster().nodes().size() == 5;
}
Aggregations