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 2543219111 for ; Wed, 20 Apr 2016 16:29:53 +0000 (UTC) Received: (qmail 93695 invoked by uid 500); 20 Apr 2016 16:29:50 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 93631 invoked by uid 500); 20 Apr 2016 16:29:50 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 93561 invoked by uid 99); 20 Apr 2016 16:29:50 -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; Wed, 20 Apr 2016 16:29:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2A92EDFC70; Wed, 20 Apr 2016 16:29:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ntikhonov@apache.org To: commits@ignite.apache.org Date: Wed, 20 Apr 2016 16:29:50 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/4] ignite git commit: Moved tests from GridGetOrStartSelfTest to GridFactorySelfTest and removed the first suite. Repository: ignite Updated Branches: refs/heads/ignite-2004 c614679c0 -> e434ee4d5 Moved tests from GridGetOrStartSelfTest to GridFactorySelfTest and removed the first suite. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/57d85a41 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57d85a41 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57d85a41 Branch: refs/heads/ignite-2004 Commit: 57d85a413b15d7c7733753cfb9d74dab9b0eb4fc Parents: e833eb2 Author: Denis Magda Authored: Wed Apr 20 17:03:57 2016 +0300 Committer: Denis Magda Committed: Wed Apr 20 17:03:57 2016 +0300 ---------------------------------------------------------------------- .../ignite/internal/GridGetOrStartSelfTest.java | 132 ------------------- .../ignite/testsuites/IgniteBasicTestSuite.java | 3 - .../ignite/internal/GridFactorySelfTest.java | 85 ++++++++++++ 3 files changed, 85 insertions(+), 135 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/57d85a41/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java deleted file mode 100644 index 211d413..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridGetOrStartSelfTest.java +++ /dev/null @@ -1,132 +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 java.util.concurrent.atomic.AtomicReference; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteException; -import org.apache.ignite.Ignition; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.testframework.junits.common.GridCommonTest; - -/** - * The GridGetOrStartSelfTest tests get or start semantics. - */ - -@GridCommonTest(group = "Kernal Self") -public class GridGetOrStartSelfTest extends GridCommonAbstractTest { - /** Concurrency. */ - public static final int CONCURRENCY = 10; - - /** - * Default constructor. - */ - public GridGetOrStartSelfTest() { - super(false); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * Tests default grid - */ - public void testDefaultGridGetOrStart() throws Exception { - IgniteConfiguration cfg = getConfiguration(null); - - try (Ignite ignite = Ignition.getOrStart(cfg)) { - try { - Ignition.start(cfg); - - fail("Expected exception after grid started"); - } - catch (IgniteException ignored) { - } - - Ignite ignite2 = Ignition.getOrStart(cfg); - - assertEquals("Must return same instance", ignite, ignite2); - } - - assertTrue(G.allGrids().isEmpty()); - } - - /** - * Tests named grid - */ - public void testNamedGridGetOrStart() throws Exception { - IgniteConfiguration cfg = getConfiguration("test"); - try (Ignite ignite = Ignition.getOrStart(cfg)) { - try { - Ignition.start(cfg); - - fail("Expected exception after grid started"); - } - catch (IgniteException ignored) { - // No-op. - } - - Ignite ignite2 = Ignition.getOrStart(cfg); - - assertEquals("Must return same instance", ignite, ignite2); - } - - assertTrue(G.allGrids().isEmpty()); - } - - /** - * Tests concurrent grid initialization - */ - public void testConcurrentGridGetOrStartCon() throws Exception { - final IgniteConfiguration cfg = getConfiguration(null); - - final AtomicReference ref = new AtomicReference<>(); - - try { - GridTestUtils.runMultiThreaded(new Runnable() { - @Override public void run() { - // must return same instance in each thread - - try { - Ignite ignite = Ignition.getOrStart(cfg); - - boolean set = ref.compareAndSet(null, ignite); - - if (!set) - assertEquals(ref.get(), ignite); - } - catch (IgniteException e) { - throw new RuntimeException("Ignite error", e); - } - } - }, CONCURRENCY, "GridCreatorThread"); - } - catch (Exception ignored) { - fail("Exception is not expected"); - } - - G.stopAll(true); - - assertTrue(G.allGrids().isEmpty()); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/57d85a41/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 a4be2de..9e2324c 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 @@ -23,7 +23,6 @@ import org.apache.ignite.GridSuppressedExceptionSelfTest; import org.apache.ignite.internal.ClusterGroupHostsSelfTest; import org.apache.ignite.internal.ClusterGroupSelfTest; import org.apache.ignite.internal.GridFailFastNodeFailureDetectionSelfTest; -import org.apache.ignite.internal.GridGetOrStartSelfTest; import org.apache.ignite.internal.GridLifecycleAwareSelfTest; import org.apache.ignite.internal.GridLifecycleBeanSelfTest; import org.apache.ignite.internal.GridNodeMetricsLogSelfTest; @@ -130,8 +129,6 @@ public class IgniteBasicTestSuite extends TestSuite { suite.addTestSuite(VariationsIteratorTest.class); suite.addTestSuite(ConfigVariationsTestSuiteBuilderTest.class); - GridTestUtils.addTestIfNeeded(suite, GridGetOrStartSelfTest.class, ignoredTests); - return suite; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/57d85a41/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java b/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java index cca3e8b..0868dff 100644 --- a/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java +++ b/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java @@ -91,6 +91,9 @@ public class GridFactorySelfTest extends GridCommonAbstractTest { /** */ private static final AtomicInteger cnt = new AtomicInteger(); + /** Concurrency. */ + private static final int CONCURRENCY = 10; + /** */ private static final String CUSTOM_CFG_PATH = "modules/core/src/test/config/factory/custom-grid-name-spring-test.xml"; @@ -206,6 +209,88 @@ public class GridFactorySelfTest extends GridCommonAbstractTest { } /** + * Tests default grid + */ + public void testDefaultGridGetOrStart() throws Exception { + IgniteConfiguration cfg = getConfiguration(null); + + try (Ignite ignite = Ignition.getOrStart(cfg)) { + try { + Ignition.start(cfg); + + fail("Expected exception after grid started"); + } + catch (IgniteException ignored) { + } + + Ignite ignite2 = Ignition.getOrStart(cfg); + + assertEquals("Must return same instance", ignite, ignite2); + } + + assertTrue(G.allGrids().isEmpty()); + } + + /** + * Tests named grid + */ + public void testNamedGridGetOrStart() throws Exception { + IgniteConfiguration cfg = getConfiguration("test"); + try (Ignite ignite = Ignition.getOrStart(cfg)) { + try { + Ignition.start(cfg); + + fail("Expected exception after grid started"); + } + catch (IgniteException ignored) { + // No-op. + } + + Ignite ignite2 = Ignition.getOrStart(cfg); + + assertEquals("Must return same instance", ignite, ignite2); + } + + assertTrue(G.allGrids().isEmpty()); + } + + /** + * Tests concurrent grid initialization + */ + public void testConcurrentGridGetOrStartCon() throws Exception { + final IgniteConfiguration cfg = getConfiguration(null); + + final AtomicReference ref = new AtomicReference<>(); + + try { + GridTestUtils.runMultiThreaded(new Runnable() { + @Override public void run() { + // must return same instance in each thread + + try { + Ignite ignite = Ignition.getOrStart(cfg); + + boolean set = ref.compareAndSet(null, ignite); + + if (!set) + assertEquals(ref.get(), ignite); + } + catch (IgniteException e) { + throw new RuntimeException("Ignite error", e); + } + } + }, CONCURRENCY, "GridCreatorThread"); + } + catch (Exception ignored) { + fail("Exception is not expected"); + } + + G.stopAll(true); + + assertTrue(G.allGrids().isEmpty()); + } + + /** * @throws Exception If failed. */ public void testLifecycleBeansNullGridName() throws Exception {