Repository: incubator-ignite
Updated Branches:
  refs/heads/master 52f2b4002 -> c67dcde9f


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
new file mode 100644
index 0000000..fb1c29f
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -0,0 +1,713 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.communication.tcp;
+
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.*;
+import org.eclipse.jetty.util.*;
+import org.gridgain.grid.*;
+import org.gridgain.grid.util.direct.*;
+import org.gridgain.grid.util.lang.*;
+import org.gridgain.grid.util.nio.*;
+import org.gridgain.grid.util.typedef.internal.*;
+import org.gridgain.testframework.*;
+import org.gridgain.testframework.junits.*;
+import org.gridgain.testframework.junits.spi.*;
+
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ *
+ */
+@GridSpiTest(spi = TcpCommunicationSpi.class, group = "Communication SPI")
+public class GridTcpCommunicationSpiRecoverySelfTest<T extends 
CommunicationSpi> extends GridSpiAbstractTest<T> {
+    /** */
+    private static final Collection<GridTestResources> spiRsrcs = new 
ArrayList<>();
+
+    /** */
+    protected static final List<TcpCommunicationSpi> spis = new ArrayList<>();
+
+    /** */
+    protected static final List<ClusterNode> nodes = new ArrayList<>();
+
+    /** */
+    private static final int SPI_CNT = 2;
+
+    /** */
+    private static final int ITERS = 10;
+
+    /** */
+    private static int port = 30_000;
+
+    /**
+     *
+     */
+    static {
+        GridTcpCommunicationMessageFactory.registerCustom(new 
GridTcpCommunicationMessageProducer() {
+            @Override public GridTcpCommunicationMessageAdapter create(byte 
type) {
+                return new GridTestMessage();
+            }
+        }, GridTestMessage.DIRECT_TYPE);
+    }
+
+    /**
+     * Disable SPI auto-start.
+     */
+    public GridTcpCommunicationSpiRecoverySelfTest() {
+        super(false);
+    }
+
+    /** */
+    @SuppressWarnings({"deprecation"})
+    private class TestListener implements 
CommunicationListener<GridTcpCommunicationMessageAdapter> {
+        /** */
+        private boolean block;
+
+        /** */
+        private CountDownLatch blockLatch;
+
+        /** */
+        private ConcurrentHashSet<Long> msgIds = new ConcurrentHashSet<>();
+
+        /** */
+        private AtomicInteger rcvCnt = new AtomicInteger();
+
+        /** {@inheritDoc} */
+        @Override public void onMessage(UUID nodeId, 
GridTcpCommunicationMessageAdapter msg, IgniteRunnable msgC) {
+            // info("Test listener received message: " + msg);
+
+            assertTrue("Unexpected message: " + msg, msg instanceof 
GridTestMessage);
+
+            GridTestMessage msg0 = (GridTestMessage)msg;
+
+            assertTrue("Duplicated message received: " + msg0, 
msgIds.add(msg0.getMsgId()));
+
+            rcvCnt.incrementAndGet();
+
+            msgC.run();
+
+            try {
+                synchronized (this) {
+                    while (block) {
+                        info("Test listener blocks.");
+
+                        assert blockLatch != null;
+
+                        blockLatch.countDown();
+
+                        wait();
+
+                        if (block)
+                            continue;
+
+                        info("Test listener throws exception.");
+
+                        throw new RuntimeException("Test exception.");
+                    }
+                }
+            }
+            catch (InterruptedException e) {
+                fail("Unexpected error: " + e);
+            }
+        }
+
+        /**
+         *
+         */
+        void block() {
+            synchronized (this) {
+                block = true;
+
+                blockLatch = new CountDownLatch(1);
+            }
+        }
+
+        /**
+         *
+         */
+        void unblock() {
+            synchronized (this) {
+                block = false;
+
+                notifyAll();
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void onDisconnected(UUID nodeId) {
+            // No-op.
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBlockListener() throws Exception {
+        // Test listener throws exception and stops selector thread, so must 
restart SPI.
+        for (int i = 0; i < ITERS; i++) {
+            log.info("Creating SPIs: " + i);
+
+            createSpis();
+
+            try {
+                checkBlockListener();
+            }
+            finally {
+                stopSpis();
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("BusyWait")
+    private void checkBlockListener() throws Exception {
+        TcpCommunicationSpi spi0 = spis.get(0);
+        TcpCommunicationSpi spi1 = spis.get(1);
+
+        final TestListener lsnr0 = (TestListener)spi0.getListener();
+        final TestListener lsnr1 = (TestListener)spi1.getListener();
+
+        ClusterNode node0 = nodes.get(0);
+        ClusterNode node1 = nodes.get(1);
+
+        lsnr1.block();
+
+        int msgId = 0;
+
+        for (int j = 0; j < 10; j++) {
+            spi0.sendMessage(node1, new GridTestMessage(node0.id(), ++msgId, 
0));
+
+            spi1.sendMessage(node0, new GridTestMessage(node1.id(), ++msgId, 
0));
+        }
+
+        lsnr1.blockLatch.await();
+
+        lsnr1.unblock();
+
+        Thread.sleep(500);
+
+        int errCnt = 0;
+
+        int msgs = 0;
+
+        while (true) {
+            try {
+                int id = msgId + 1;
+
+                spi0.sendMessage(node1, new GridTestMessage(node0.id(), id, 
0));
+
+                msgId++;
+
+                msgs++;
+
+                if (msgs == 10)
+                    break;
+            }
+            catch (IgniteSpiException e) {
+                errCnt++;
+
+                if (errCnt > 10)
+                    fail("Failed to send message: " + e);
+            }
+        }
+
+        for (int j = 0; j < 10; j++)
+            spi1.sendMessage(node0, new GridTestMessage(node1.id(), ++msgId, 
0));
+
+        final int expMsgs = 20;
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return lsnr0.rcvCnt.get() >= expMsgs && lsnr1.rcvCnt.get() >= 
expMsgs;
+            }
+        }, 5000);
+
+        assertEquals(expMsgs, lsnr0.rcvCnt.get());
+        assertEquals(expMsgs, lsnr1.rcvCnt.get());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBlockRead1() throws Exception {
+        createSpis();
+
+        try {
+            final TcpCommunicationSpi spi0 = spis.get(0);
+            final TcpCommunicationSpi spi1 = spis.get(1);
+
+            final TestListener lsnr1 = (TestListener)spi1.getListener();
+
+            final ClusterNode node0 = nodes.get(0);
+            final ClusterNode node1 = nodes.get(1);
+
+            final AtomicInteger msgId = new AtomicInteger();
+
+            // Send message to establish connection.
+            spi0.sendMessage(node1, new GridTestMessage(node0.id(), 
msgId.incrementAndGet(), 0));
+
+            final AtomicInteger sentCnt = new AtomicInteger(1);
+
+            int errCnt = 0;
+
+            for (int i = 0; i < ITERS; i++) {
+                log.info("Iteration: " + i);
+
+                try {
+                    final GridNioSession ses0 = communicationSession(spi0);
+                    final GridNioSession ses1 = communicationSession(spi1);
+
+                    ses1.pauseReads().get();
+
+                    IgniteFuture<?> sndFut = GridTestUtils.runAsync(new 
Callable<Void>() {
+                        @Override public Void call() throws Exception {
+                            for (int i = 0; i < 5000; i++) {
+                                spi0.sendMessage(node1, new 
GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+
+                                sentCnt.incrementAndGet();
+                            }
+
+                            return null;
+                        }
+                    });
+
+                    // Wait when session is closed because of write timeout.
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return ses0.closeTime() != 0;
+                        }
+                    }, 5000);
+
+                    assertTrue("Failed to wait for session close", 
ses0.closeTime() != 0);
+
+                    ses1.resumeReads().get();
+
+                    for (int j = 0; j < 100; j++) {
+                        spi0.sendMessage(node1, new 
GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+
+                        sentCnt.incrementAndGet();
+                    }
+
+                    sndFut.get();
+
+                    final int expMsgs = sentCnt.get();
+
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return lsnr1.rcvCnt.get() >= expMsgs;
+                        }
+                    }, 60_000);
+
+                    assertEquals(expMsgs, lsnr1.rcvCnt.get());
+                }
+                catch (GridException e) {
+                    if (e.hasCause(BindException.class)) {
+                        errCnt++;
+
+                        if (errCnt > 3) {
+                            log.warning("Got exception > 3 times, test 
fails.");
+
+                            throw e;
+                        }
+
+                        if (i < ITERS - 1) {
+                            info("Got exception caused by BindException, will 
retry after delay: " + e);
+
+                            U.sleep(10_000);
+                        }
+                        else
+                            info("Got exception caused by BindException, will 
ignore: " + e);
+                    }
+                    else {
+                        log.warning("Unexpected exception: " + e, e);
+
+                        throw e;
+                    }
+                }
+            }
+        }
+        finally {
+            stopSpis();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBlockRead2() throws Exception {
+        createSpis();
+
+        try {
+            final TcpCommunicationSpi spi0 = spis.get(0);
+            final TcpCommunicationSpi spi1 = spis.get(1);
+
+            final TestListener lsnr0 = (TestListener)spi0.getListener();
+            final TestListener lsnr1 = (TestListener)spi1.getListener();
+
+            final ClusterNode node0 = nodes.get(0);
+            final ClusterNode node1 = nodes.get(1);
+
+            final AtomicInteger msgId = new AtomicInteger();
+
+            final AtomicInteger expCnt0 = new AtomicInteger();
+
+            final AtomicInteger expCnt1 = new AtomicInteger();
+
+            // Send message to establish connection.
+            spi0.sendMessage(node1, new GridTestMessage(node0.id(), 
msgId.incrementAndGet(), 0));
+
+            expCnt1.incrementAndGet();
+
+            int errCnt = 0;
+
+            for (int i = 0; i < ITERS; i++) {
+                log.info("Iteration: " + i);
+
+                try {
+                    final GridNioSession ses0 = communicationSession(spi0);
+                    final GridNioSession ses1 = communicationSession(spi1);
+
+                    ses1.pauseReads().get();
+
+                    IgniteFuture<?> sndFut = GridTestUtils.runAsync(new 
Callable<Void>() {
+                        @Override public Void call() throws Exception {
+                            for (int i = 0; i < 5000; i++) {
+                                spi0.sendMessage(node1, new 
GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+
+                                expCnt1.incrementAndGet();
+                            }
+
+                            return null;
+                        }
+                    });
+
+                    // Wait when session is closed because of write timeout.
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return ses0.closeTime() != 0;
+                        }
+                    }, 5000);
+
+                    assertTrue("Failed to wait for session close", 
ses0.closeTime() != 0);
+
+                    ses1.resumeReads().get();
+
+                    // Wait when session is closed, then try to open new 
connection from node1.
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override
+                        public boolean apply() {
+                            return ses1.closeTime() != 0;
+                        }
+                    }, 5000);
+
+                    assertTrue("Failed to wait for session close", 
ses1.closeTime() != 0);
+
+                    for (int j = 0; j < 100; j++) {
+                        spi1.sendMessage(node0, new 
GridTestMessage(node1.id(), msgId.incrementAndGet(), 0));
+
+                        expCnt0.incrementAndGet();
+                    }
+
+                    sndFut.get();
+
+                    final int expMsgs0 = expCnt0.get();
+                    final int expMsgs1 = expCnt1.get();
+
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return lsnr0.rcvCnt.get() >= expMsgs0 && 
lsnr1.rcvCnt.get() >= expMsgs1;
+                        }
+                    }, 60_000);
+
+                    assertEquals(expMsgs0, lsnr0.rcvCnt.get());
+                    assertEquals(expMsgs1, lsnr1.rcvCnt.get());
+                }
+                catch (GridException e) {
+                    if (e.hasCause(BindException.class)) {
+                        errCnt++;
+
+                        if (errCnt > 3) {
+                            log.warning("Got exception > 3 times, test 
fails.");
+
+                            throw e;
+                        }
+
+                        if (i < ITERS - 1) {
+                            info("Got exception caused by BindException, will 
retry after delay: " + e);
+
+                            U.sleep(10_000);
+                        }
+                        else
+                            info("Got exception caused by BindException, will 
ignore: " + e);
+                    }
+                    else {
+                        log.warning("Unexpected exception: " + e, e);
+
+                        throw e;
+                    }
+                }
+            }
+        }
+        finally {
+            stopSpis();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBlockRead3() throws Exception {
+        createSpis();
+
+        try {
+            final TcpCommunicationSpi spi0 = spis.get(0);
+            final TcpCommunicationSpi spi1 = spis.get(1);
+
+            final TestListener lsnr1 = (TestListener)spi1.getListener();
+
+            final ClusterNode node0 = nodes.get(0);
+            final ClusterNode node1 = nodes.get(1);
+
+            final AtomicInteger msgId = new AtomicInteger();
+
+            // Send message to establish connection.
+            spi0.sendMessage(node1, new GridTestMessage(node0.id(), 
msgId.incrementAndGet(), 0));
+
+            final AtomicInteger sentCnt = new AtomicInteger(1);
+
+            int errCnt = 0;
+
+            for (int i = 0; i < ITERS; i++) {
+                log.info("Iteration: " + i);
+
+                try {
+                    final GridNioSession ses0 = communicationSession(spi0);
+                    final GridNioSession ses1 = communicationSession(spi1);
+
+                    ses1.pauseReads().get();
+
+                    IgniteFuture<?> sndFut = GridTestUtils.runAsync(new 
Callable<Void>() {
+                        @Override public Void call() throws Exception {
+                            for (int i = 0; i < 5000; i++) {
+                                spi0.sendMessage(node1, new 
GridTestMessage(node0.id(), msgId.incrementAndGet(), 0));
+
+                                sentCnt.incrementAndGet();
+                            }
+
+                            return null;
+                        }
+                    });
+
+                    // Wait when session is closed because of write timeout.
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return ses0.closeTime() != 0;
+                        }
+                    }, 5000);
+
+                    assertTrue("Failed to wait for session close", 
ses0.closeTime() != 0);
+
+                    ses1.resumeReads().get();
+
+                    sndFut.get();
+
+                    final int expMsgs = sentCnt.get();
+
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return lsnr1.rcvCnt.get() >= expMsgs;
+                        }
+                    }, 60_000);
+
+                    assertEquals(expMsgs, lsnr1.rcvCnt.get());
+                }
+                catch (GridException e) {
+                    if (e.hasCause(BindException.class)) {
+                        errCnt++;
+
+                        if (errCnt > 3) {
+                            log.warning("Got exception > 3 times, test 
fails.");
+
+                            throw e;
+                        }
+
+                        if (i < ITERS - 1) {
+                            info("Got exception caused by BindException, will 
retry after delay: " + e);
+
+                            U.sleep(10_000);
+                        }
+                        else
+                            info("Got exception caused by BindException, will 
ignore: " + e);
+                    }
+                    else {
+                        log.warning("Unexpected exception: " + e, e);
+
+                        throw e;
+                    }
+                }
+            }
+        }
+        finally {
+            stopSpis();
+        }
+    }
+
+    /**
+     * @param spi SPI.
+     * @return Session.
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("unchecked")
+    private GridNioSession communicationSession(TcpCommunicationSpi spi) 
throws Exception {
+        final GridNioServer srv = U.field(spi, "nioSrvr");
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                Collection<? extends GridNioSession> sessions = 
GridTestUtils.getFieldValue(srv, "sessions");
+
+                return !sessions.isEmpty();
+            }
+        }, 5000);
+
+        Collection<? extends GridNioSession> sessions = 
GridTestUtils.getFieldValue(srv, "sessions");
+
+        assertEquals(1, sessions.size());
+
+        return sessions.iterator().next();
+    }
+
+    /**
+     * @param idx SPI index.
+     * @return SPI instance.
+     */
+    protected TcpCommunicationSpi getSpi(int idx) {
+        TcpCommunicationSpi spi = new TcpCommunicationSpi();
+
+        spi.setSharedMemoryPort(-1);
+        spi.setLocalPort(port++);
+        spi.setIdleConnectionTimeout(10_000);
+        spi.setConnectTimeout(10_000);
+        spi.setAckSendThreshold(5);
+        spi.setSocketWriteTimeout(1000);
+        spi.setSocketSendBuffer(512);
+        spi.setSocketReceiveBuffer(512);
+
+        return spi;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void startSpis() throws Exception {
+        spis.clear();
+        nodes.clear();
+        spiRsrcs.clear();
+
+        Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
+
+        for (int i = 0; i < SPI_CNT; i++) {
+            TcpCommunicationSpi spi = getSpi(i);
+
+            GridTestUtils.setFieldValue(spi, "gridName", "grid-" + i);
+
+            GridTestResources rsrcs = new GridTestResources();
+
+            GridTestNode node = new GridTestNode(rsrcs.getNodeId());
+
+            node.order(i);
+
+            GridSpiTestContext ctx = initSpiContext();
+
+            ctx.setLocalNode(node);
+
+            spiRsrcs.add(rsrcs);
+
+            rsrcs.inject(spi);
+
+            spi.setListener(new TestListener());
+
+            node.setAttributes(spi.getNodeAttributes());
+
+            nodes.add(node);
+
+            spi.spiStart(getTestGridName() + (i + 1));
+
+            spis.add(spi);
+
+            spi.onContextInitialized(ctx);
+
+            ctxs.put(node, ctx);
+        }
+
+        // For each context set remote nodes.
+        for (Map.Entry<ClusterNode, GridSpiTestContext> e : ctxs.entrySet()) {
+            for (ClusterNode n : nodes) {
+                if (!n.equals(e.getKey()))
+                    e.getValue().remoteNodes().add(n);
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void createSpis() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            try {
+                startSpis();
+
+                break;
+            }
+            catch (GridException e) {
+                if (e.hasCause(BindException.class)) {
+                    if (i < 2) {
+                        info("Failed to start SPIs because of BindException, 
will retry after delay.");
+
+                        stopSpis();
+
+                        U.sleep(10_000);
+                    }
+                    else
+                        throw e;
+                }
+                else
+                    throw e;
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void stopSpis() throws Exception {
+        for (CommunicationSpi<GridTcpCommunicationMessageAdapter> spi : spis) {
+            spi.onContextDestroyed();
+
+            spi.setListener(null);
+
+            spi.spiStop();
+        }
+
+        for (GridTestResources rsrcs : spiRsrcs) {
+            rsrcs.stopThreads();
+        }
+
+        spis.clear();
+        nodes.clear();
+        spiRsrcs.clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiShmemSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiShmemSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiShmemSelfTest.java
index ff093ce..85ae027 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiShmemSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiShmemSelfTest.java
@@ -18,6 +18,6 @@ import org.gridgain.testframework.junits.spi.*;
 public class GridTcpCommunicationSpiShmemSelfTest extends 
GridTcpCommunicationSpiAbstractTest {
     /** */
     public GridTcpCommunicationSpiShmemSelfTest() {
-        super(true);
+        super(false);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpNoDelayOffSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpNoDelayOffSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpNoDelayOffSelfTest.java
new file mode 100644
index 0000000..e18ca96
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiTcpNoDelayOffSelfTest.java
@@ -0,0 +1,20 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.spi.communication.tcp;
+
+/**
+ *
+ */
+public class GridTcpCommunicationSpiTcpNoDelayOffSelfTest extends 
GridTcpCommunicationSpiTcpSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean tcpNoDelay() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/gridgain/grid/kernal/managers/GridManagerStopSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/managers/GridManagerStopSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/managers/GridManagerStopSelfTest.java
index 28863d5..15e4d39 100644
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/managers/GridManagerStopSelfTest.java
+++ 
b/modules/core/src/test/java/org/gridgain/grid/kernal/managers/GridManagerStopSelfTest.java
@@ -120,6 +120,8 @@ public class GridManagerStopSelfTest extends 
GridCommonAbstractTest {
 
         GridIoManager mgr = new GridIoManager(ctx);
 
+        mgr.onKernalStop(true);
+
         mgr.stop(false);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/gridgain/grid/spi/GridSpiStartStopAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/spi/GridSpiStartStopAbstractTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/spi/GridSpiStartStopAbstractTest.java
index 1c11d91..ebbfe16 100644
--- 
a/modules/core/src/test/java/org/gridgain/grid/spi/GridSpiStartStopAbstractTest.java
+++ 
b/modules/core/src/test/java/org/gridgain/grid/spi/GridSpiStartStopAbstractTest.java
@@ -65,6 +65,8 @@ public abstract class GridSpiStartStopAbstractTest<T extends 
IgniteSpi> extends
 
         getTestResources().inject(spi);
 
+        spi.onContextDestroyed();
+
         spi.spiStop();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/gridgain/grid/util/nio/impl/GridNioFilterChainSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/util/nio/impl/GridNioFilterChainSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/util/nio/impl/GridNioFilterChainSelfTest.java
index 47d5492..b62507e 100644
--- 
a/modules/core/src/test/java/org/gridgain/grid/util/nio/impl/GridNioFilterChainSelfTest.java
+++ 
b/modules/core/src/test/java/org/gridgain/grid/util/nio/impl/GridNioFilterChainSelfTest.java
@@ -368,5 +368,15 @@ public class GridNioFilterChainSelfTest extends 
GridCommonAbstractTest {
         @Override public boolean readsPaused() {
             return false;
         }
+
+        /** {@inheritDoc} */
+        @Override public void recoveryDescriptor(GridNioRecoveryDescriptor 
recoveryDesc) {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public GridNioRecoveryDescriptor 
recoveryDescriptor() {
+            return null;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/gridgain/testframework/GridTestNode.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/testframework/GridTestNode.java 
b/modules/core/src/test/java/org/gridgain/testframework/GridTestNode.java
index da867c7..01ed47e 100644
--- a/modules/core/src/test/java/org/gridgain/testframework/GridTestNode.java
+++ b/modules/core/src/test/java/org/gridgain/testframework/GridTestNode.java
@@ -48,6 +48,9 @@ public class GridTestNode extends GridMetadataAwareAdapter 
implements ClusterNod
     private ClusterNodeMetrics metrics;
 
     /** */
+    private long order;
+
+    /** */
     public GridTestNode() {
         // No-op.
 
@@ -177,7 +180,14 @@ public class GridTestNode extends GridMetadataAwareAdapter 
implements ClusterNod
 
     /** {@inheritDoc} */
     @Override public long order() {
-        return metrics == null ? -1 : metrics.getStartTime();
+        return order != 0 ? order : (metrics == null ? -1 : 
metrics.getStartTime());
+    }
+
+    /**
+     * @param order Order.
+     */
+    public void order(long order) {
+        this.order = order;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dae4b942/modules/core/src/test/java/org/gridgain/testsuites/GridSpiCommunicationSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/testsuites/GridSpiCommunicationSelfTestSuite.java
 
b/modules/core/src/test/java/org/gridgain/testsuites/GridSpiCommunicationSelfTestSuite.java
index e7c0c0d..548f660 100644
--- 
a/modules/core/src/test/java/org/gridgain/testsuites/GridSpiCommunicationSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/gridgain/testsuites/GridSpiCommunicationSelfTestSuite.java
@@ -21,9 +21,15 @@ public class GridSpiCommunicationSelfTestSuite extends 
TestSuite {
      * @throws Exception If failed.
      */
     public static TestSuite suite() throws Exception {
-        TestSuite suite = new TestSuite("Gridgain Communication SPI Test 
Suite");
+        TestSuite suite = new TestSuite("Communication SPI Test Suite");
+
+        suite.addTest(new 
TestSuite(GridTcpCommunicationSpiRecoveryAckSelfTest.class));
+        suite.addTest(new 
TestSuite(GridTcpCommunicationSpiRecoverySelfTest.class));
+
+        suite.addTest(new 
TestSuite(GridTcpCommunicationSpiConcurrentConnectSelfTest.class));
 
         suite.addTest(new TestSuite(GridTcpCommunicationSpiTcpSelfTest.class));
+        suite.addTest(new 
TestSuite(GridTcpCommunicationSpiTcpNoDelayOffSelfTest.class));
         suite.addTest(new 
TestSuite(GridTcpCommunicationSpiShmemSelfTest.class));
 
         suite.addTest(new 
TestSuite(GridTcpCommunicationSpiStartStopSelfTest.class));

Reply via email to