Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5490F17EFC for ; Tue, 14 Apr 2015 15:21:05 +0000 (UTC) Received: (qmail 71587 invoked by uid 500); 14 Apr 2015 15:21:05 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 71524 invoked by uid 500); 14 Apr 2015 15:21:05 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 71508 invoked by uid 99); 14 Apr 2015 15:21:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Apr 2015 15:21:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 14 Apr 2015 15:21:03 +0000 Received: (qmail 70689 invoked by uid 99); 14 Apr 2015 15:20:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Apr 2015 15:20:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 53C03E0063; Tue, 14 Apr 2015 15:20:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 14 Apr 2015 15:20:49 -0000 Message-Id: <1785f5b59e6a49b99c86fbe95ca8f9a3@git.apache.org> In-Reply-To: <08c2afb022c6415584bace812bed8384@git.apache.org> References: <08c2afb022c6415584bace812bed8384@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/10] incubator-ignite git commit: IGNITE-714 - Fixes after review X-Virus-Checked: Checked by ClamAV on apache.org IGNITE-714 - Fixes after review Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ba7527fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ba7527fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ba7527fe Branch: refs/heads/ignite-sprint-3-p1 Commit: ba7527fecc6f000b8760e4c63566ee3abb1ec807 Parents: 877562d Author: Valentin Kulichenko Authored: Fri Apr 10 00:48:56 2015 -0700 Committer: Valentin Kulichenko Committed: Fri Apr 10 00:48:56 2015 -0700 ---------------------------------------------------------------------- ...ridFailFastNodeFailureDetectionSelfTest.java | 112 +++++++++++++++++++ .../ignite/internal/GridFailFastSelfTest.java | 112 ------------------- .../ignite/testsuites/IgniteBasicTestSuite.java | 2 +- 3 files changed, 113 insertions(+), 113 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7527fe/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java new file mode 100644 index 0000000..aa1bd68 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal; + +import org.apache.ignite.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.events.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.messaging.*; +import org.apache.ignite.spi.communication.*; +import org.apache.ignite.spi.discovery.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.util.*; +import java.util.concurrent.*; + +/** + * Fail fast test. + */ +public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstractTest { + /** */ + private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(IP_FINDER); + disco.setHeartbeatFrequency(10000); + + cfg.setDiscoverySpi(disco); + + return cfg; + } + + /** + * @throws Exception If failed. + */ + public void testFailFast() throws Exception { + startGridsMultiThreaded(5); + + final CountDownLatch failLatch = new CountDownLatch(4); + + for (int i = 0; i < 5; i++) { + ignite(i).events().localListen(new IgnitePredicate() { + @Override public boolean apply(Event evt) { + info(evt.shortDisplay()); + + failLatch.countDown(); + + return true; + } + }, EventType.EVT_NODE_FAILED); + } + + Ignite ignite1 = ignite(0); + Ignite ignite2 = ignite(1); + + ignite1.message().localListen(null, new MessagingListenActor() { + @Override protected void receive(UUID nodeId, Object rcvMsg) throws Throwable { + respond(rcvMsg); + } + }); + + ignite2.message().localListen(null, new MessagingListenActor() { + @Override protected void receive(UUID nodeId, Object rcvMsg) throws Throwable { + respond(rcvMsg); + } + }); + + ignite1.message(ignite1.cluster().forRemotes()).send(null, "Message"); + + failNode(ignite1); + + assert failLatch.await(500, TimeUnit.MILLISECONDS); + } + + /** + * @param ignite Ignite. + * @throws Exception In case of error. + */ + private void failNode(Ignite ignite) throws Exception { + DiscoverySpi disco = ignite.configuration().getDiscoverySpi(); + + U.invoke(disco.getClass(), disco, "simulateNodeFailure"); + + CommunicationSpi comm = ignite.configuration().getCommunicationSpi(); + + U.invoke(comm.getClass(), comm, "simulateNodeFailure"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7527fe/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastSelfTest.java deleted file mode 100644 index bc4de65..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastSelfTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal; - -import org.apache.ignite.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.events.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.messaging.*; -import org.apache.ignite.spi.communication.*; -import org.apache.ignite.spi.discovery.*; -import org.apache.ignite.spi.discovery.tcp.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.*; -import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; -import org.apache.ignite.testframework.junits.common.*; - -import java.util.*; -import java.util.concurrent.*; - -/** - * Fail fast test. - */ -public class GridFailFastSelfTest extends GridCommonAbstractTest { - /** */ - private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - TcpDiscoverySpi disco = new TcpDiscoverySpi(); - - disco.setIpFinder(IP_FINDER); - disco.setHeartbeatFrequency(10000); - - cfg.setDiscoverySpi(disco); - - return cfg; - } - - /** - * @throws Exception If failed. - */ - public void testFailFast() throws Exception { - startGridsMultiThreaded(5); - - final CountDownLatch failLatch = new CountDownLatch(4); - - for (int i = 0; i < 5; i++) { - ignite(i).events().localListen(new IgnitePredicate() { - @Override public boolean apply(Event evt) { - info(evt.shortDisplay()); - - failLatch.countDown(); - - return true; - } - }, EventType.EVT_NODE_FAILED); - } - - Ignite ignite1 = ignite(0); - Ignite ignite2 = ignite(1); - - ignite1.message().localListen(null, new MessagingListenActor() { - @Override protected void receive(UUID nodeId, Object rcvMsg) throws Throwable { - respond(rcvMsg); - } - }); - - ignite2.message().localListen(null, new MessagingListenActor() { - @Override protected void receive(UUID nodeId, Object rcvMsg) throws Throwable { - respond(rcvMsg); - } - }); - - ignite1.message(ignite1.cluster().forRemotes()).send(null, "Message"); - - failNode(ignite1); - - assert failLatch.await(500, TimeUnit.MILLISECONDS); - } - - /** - * @param ignite Ignite. - * @throws Exception In case of error. - */ - private void failNode(Ignite ignite) throws Exception { - DiscoverySpi disco = ignite.configuration().getDiscoverySpi(); - - U.invoke(disco.getClass(), disco, "simulateNodeFailure"); - - CommunicationSpi comm = ignite.configuration().getCommunicationSpi(); - - U.invoke(comm.getClass(), comm, "simulateNodeFailure"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7527fe/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java index 081de2f..5d53129 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java @@ -69,7 +69,7 @@ public class IgniteBasicTestSuite extends TestSuite { suite.addTestSuite(GridSuppressedExceptionSelfTest.class); suite.addTestSuite(GridLifecycleAwareSelfTest.class); suite.addTestSuite(GridMessageListenSelfTest.class); - suite.addTestSuite(GridFailFastSelfTest.class); + suite.addTestSuite(GridFailFastNodeFailureDetectionSelfTest.class); return suite; }