ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: debug
Date Thu, 10 Dec 2015 13:09:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 97fbc4b33 -> 575c6ef68


debug


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/575c6ef6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/575c6ef6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/575c6ef6

Branch: refs/heads/ignite-1537
Commit: 575c6ef6870f1a447f2f95ba16e66e39e46cfc0a
Parents: 97fbc4b
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 10 16:07:13 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 10 16:07:13 2015 +0300

----------------------------------------------------------------------
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 67 ++++++++++++++++++++
 .../IgniteCacheFailoverTestSuite3.java          |  2 +
 2 files changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/575c6ef6/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 862e780..dff37a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.DiscoverySpi;
@@ -77,6 +78,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessag
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.jetbrains.annotations.Nullable;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
@@ -1728,6 +1730,40 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testDiscoveryEventsDiscard() throws Exception {
+        try {
+            TestEventDiscardSpi spi = new TestEventDiscardSpi();
+
+            nodeSpi.set(spi);
+
+            Ignite ignite0 = startGrid(0);
+
+            startGrid(1);
+
+            ignite0.createCache(new CacheConfiguration<>()); // Send custom message.
+
+            ignite0.destroyCache(null); // Send custom message.
+
+            stopGrid(1);
+
+            log.info("Start new node.");
+
+            spi.checkDuplicates = true;
+
+            startGrid(1);
+
+            spi.checkDuplicates = false;
+
+            assertFalse(spi.failed);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
      * @param nodeName Node name.
      * @throws Exception If failed.
      */
@@ -1782,6 +1818,37 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
         }
     }
 
+
+    /**
+     *
+     */
+    private static class TestEventDiscardSpi extends TcpDiscoverySpi {
+        /** */
+        private ConcurrentHashSet<IgniteUuid> msgIds = new ConcurrentHashSet<>();
+
+        /** */
+        private volatile boolean checkDuplicates;
+
+        /** */
+        private volatile boolean failed;
+
+        /** {@inheritDoc} */
+        @Override protected void writeToSocket(Socket sock,
+            TcpDiscoveryAbstractMessage msg,
+            GridByteArrayOutputStream bout,
+            long timeout) throws IOException, IgniteCheckedException {
+            boolean add = msgIds.add(msg.id());
+
+            if (checkDuplicates && !add) {
+                log.error("Send duplicated message: " + msg);
+
+                failed = true;
+            }
+
+            super.writeToSocket(sock, msg, bout, timeout);
+        }
+    }
+
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/575c6ef6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
index 4ab2891..4b04c05 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
@@ -33,6 +33,8 @@ public class IgniteCacheFailoverTestSuite3 extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Cache Failover Test Suite3");
 
+        suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
+        suite.addTestSuite(IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest.class);
         suite.addTestSuite(IgniteCachePutRetryTransactionalSelfTest.class);
 
         return suite;


Mime
View raw message