You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sh...@apache.org on 2016/11/01 02:37:35 UTC

[16/50] [abbrv] ignite git commit: Moved tests from GridGetOrStartSelfTest to GridFactorySelfTest and removed the first suite.

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/9aab9e1b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9aab9e1b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9aab9e1b

Branch: refs/heads/ignite-2788
Commit: 9aab9e1b46ad21a20a0b422763976e1d060a804b
Parents: 0d07761
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Apr 20 17:03:57 2016 +0300
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Fri May 13 16:11:14 2016 +0900

----------------------------------------------------------------------
 .../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/9aab9e1b/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<Ignite> 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/9aab9e1b/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/9aab9e1b/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<Ignite> 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 {