Search in sources :

Example 1 with KEY

use of org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.KEY in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() {
    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((IgnitePredicate<Event>) 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 || evt.type() == EVT_NODE_FAILED) {
            leftCnt.incrementAndGet();
            if (leftLatch != null)
                leftLatch.countDown();
        }
        return true;
    }, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED);
}
Also used : EVT_NODE_LEFT(org.apache.ignite.events.EventType.EVT_NODE_LEFT) U(org.apache.ignite.internal.util.typedef.internal.U) UNAME(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.UNAME) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterNode(org.apache.ignite.cluster.ClusterNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteClosure(org.apache.ignite.lang.IgniteClosure) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) IgniteCluster(org.apache.ignite.IgniteCluster) Map(java.util.Map) X(org.apache.ignite.internal.util.typedef.X) IGNITE_HOME(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.IGNITE_HOME) NODES(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.NODES) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult) G(org.apache.ignite.internal.util.typedef.G) F(org.apache.ignite.internal.util.typedef.F) EVT_NODE_JOINED(org.apache.ignite.events.EventType.EVT_NODE_JOINED) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) CFG(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.CFG) DFLT_TIMEOUT(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.DFLT_TIMEOUT) Iterator(java.util.Iterator) EventType(org.apache.ignite.events.EventType) GridTestProperties(org.apache.ignite.testframework.config.GridTestProperties) PASSWD(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.PASSWD) Collection(java.util.Collection) IgniteException(org.apache.ignite.IgniteException) Event(org.apache.ignite.events.Event) IgniteNodeStartUtils(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils) KEY(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.KEY) Test(org.junit.Test) UUID(java.util.UUID) Ignite(org.apache.ignite.Ignite) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) File(java.io.File) CountDownLatch(java.util.concurrent.CountDownLatch) Nullable(org.jetbrains.annotations.Nullable) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) EVT_NODE_FAILED(org.apache.ignite.events.EventType.EVT_NODE_FAILED) Paths(java.nio.file.Paths) Collections(java.util.Collections) SCRIPT(org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.SCRIPT) Event(org.apache.ignite.events.Event) File(java.io.File)

Aggregations

File (java.io.File)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 UUID (java.util.UUID)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 MILLISECONDS (java.util.concurrent.TimeUnit.MILLISECONDS)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Ignite (org.apache.ignite.Ignite)1 IgniteCluster (org.apache.ignite.IgniteCluster)1 IgniteException (org.apache.ignite.IgniteException)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 ClusterStartNodeResult (org.apache.ignite.cluster.ClusterStartNodeResult)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 Event (org.apache.ignite.events.Event)1