ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/17] incubator-ignite git commit: # ignite-217 : move GridStartupWithUndefinedIgniteHomeSelfTest at Ignite proj
Date Fri, 27 Feb 2015 07:33:25 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-51 7d31dde89 -> 3cdc1fa51


# ignite-217 : move GridStartupWithUndefinedIgniteHomeSelfTest at Ignite proj


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

Branch: refs/heads/ignite-51
Commit: 8c526b9619dbe33a86d7c308765bd620805783b1
Parents: eb2b178
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Wed Feb 18 17:08:47 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Wed Feb 18 17:08:47 2015 +0300

----------------------------------------------------------------------
 ...dStartupWithUndefinedIgniteHomeSelfTest.java | 103 +++++++++++++++++++
 .../testsuites/IgniteKernalSelfTestSuite.java   |   1 +
 2 files changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8c526b96/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
new file mode 100644
index 0000000..ed39280
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.util;
+
+import junit.framework.*;
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.logger.java.*;
+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 static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.internal.util.IgniteUtils.*;
+
+/**
+ * Checks that node can be started without operations with undefined IGNITE_HOME.
+ * <p>
+ * Notes:
+ * 1. The test intentionally extends JUnit {@link TestCase} class to make the test
+ * independent from {@link GridCommonAbstractTest} stuff.
+ * 2. Do not replace native Java asserts with JUnit ones - test won't fall on TeamCity.
+ */
+public class GridStartupWithUndefinedIgniteHomeSelfTest extends TestCase {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int GRID_COUNT = 2;
+
+    /** {@inheritDoc} */
+    @Override protected void tearDown() throws Exception {
+        // Next grid in the same VM shouldn't use cached values produced by these tests.
+        nullifyHomeDirectory();
+
+        U.getIgniteHome();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStartStopWithUndefinedIgniteHome() throws Exception {
+        IgniteUtils.nullifyHomeDirectory();
+
+        // We can't use U.getIgniteHome() here because
+        // it will initialize cached value which is forbidden to override.
+        String igniteHome = IgniteSystemProperties.getString(IGNITE_HOME);
+
+        assert igniteHome != null;
+
+        U.setIgniteHome(null);
+
+        String igniteHome0 = U.getIgniteHome();
+
+        assert igniteHome0 == null;
+
+        IgniteLogger log = new JavaLogger();
+
+        log.info(">>> Test started: " + getName());
+        log.info("Grid start-stop test count: " + GRID_COUNT);
+
+        for (int i = 0; i < GRID_COUNT; i++) {
+            TcpDiscoverySpi disc = new TcpDiscoverySpi();
+
+            disc.setIpFinder(IP_FINDER);
+
+            IgniteConfiguration cfg = new IgniteConfiguration();
+
+            // Default console logger is used
+            cfg.setGridLogger(log);
+            cfg.setDiscoverySpi(disc);
+            cfg.setConnectorConfiguration(null);
+
+            try (Ignite ignite = G.start(cfg)) {
+                assert ignite != null;
+
+                igniteHome0 = U.getIgniteHome();
+
+                assert igniteHome0 == null;
+
+                X.println("Stopping grid " + ignite.cluster().localNode().id());
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8c526b96/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index 74a6d1a..dd0e4be 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -60,6 +60,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridPortProcessorSelfTest.class);
         suite.addTestSuite(GridHomePathSelfTest.class);
         suite.addTestSuite(GridStartupWithSpecifiedWorkDirectorySelfTest.class);
+        suite.addTestSuite(GridStartupWithUndefinedIgniteHomeSelfTest.class);
         suite.addTestSuite(GridVersionSelfTest.class);
         suite.addTestSuite(GridListenActorSelfTest.class);
         suite.addTestSuite(GridNodeLocalSelfTest.class);


Mime
View raw message