Search in sources :

Example 6 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartFiveWithTwoSpecs.

/**
     * @throws Exception If failed.
     */
public void testStartFiveWithTwoSpecs() throws Exception {
    joinedLatch = new CountDownLatch(5);
    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);
    assert res.size() == 5;
    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;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 7 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodeById.

/**
     * @throws Exception If failed.
     */
public void testStopNodeById() 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(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;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 8 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartOneNode.

/**
     * @throws Exception If failed.
     */
public void testStartOneNode() throws Exception {
    joinedLatch = new CountDownLatch(1);
    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);
    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;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 9 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodesByIds.

/**
     * @throws Exception If failed.
     */
public void testStopNodesByIds() 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();
    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;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult) UUID(java.util.UUID) HashSet(java.util.HashSet)

Example 10 with ClusterStartNodeResult

use of org.apache.ignite.cluster.ClusterStartNodeResult in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartThreeNodesAndDoEmptyCall.

/**
     * @throws Exception If failed.
     */
public void testStartThreeNodesAndDoEmptyCall() 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;
    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.isEmpty();
    assert joinedCnt.get() == 3;
    assert leftCnt.get() == 0;
    assert ignite.cluster().nodes().size() == 3;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Aggregations

ClusterStartNodeResult (org.apache.ignite.cluster.ClusterStartNodeResult)20 CountDownLatch (java.util.concurrent.CountDownLatch)18 IgniteException (org.apache.ignite.IgniteException)18 ClusterNode (org.apache.ignite.cluster.ClusterNode)7 UUID (java.util.UUID)3 StartNodeCallable (org.apache.ignite.internal.util.nodestart.StartNodeCallable)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 ClusterGroupEmptyException (org.apache.ignite.cluster.ClusterGroupEmptyException)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 GridCompoundFuture (org.apache.ignite.internal.util.future.GridCompoundFuture)1 IgniteRemoteStartSpecification (org.apache.ignite.internal.util.nodestart.IgniteRemoteStartSpecification)1 IgniteSshHelper (org.apache.ignite.internal.util.nodestart.IgniteSshHelper)1