You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/24 08:47:17 UTC

[10/50] [abbrv] ignite git commit: IGNITE-6675 .NET: Fix ignored IgniteConfiguration.IgniteHome

IGNITE-6675 .NET: Fix ignored IgniteConfiguration.IgniteHome

This closes #2886


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

Branch: refs/heads/ignite-3478-tree
Commit: 8f23bca2e0599eec15d059f2ed7b14dd4fe93aa9
Parents: b8128e1
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Oct 19 18:42:12 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Oct 19 18:42:12 2017 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests/DeploymentTest.cs  | 33 ++------------------
 .../IgniteConfigurationTest.cs                  |  3 ++
 .../IgniteManagerTest.cs                        | 10 +++++-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  1 +
 4 files changed, 15 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
index cb97076..1d80c60 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests
     using System.IO;
     using System.Linq;
     using Apache.Ignite.Core.Compute;
+    using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Resource;
     using Apache.Ignite.Core.Tests.Process;
@@ -38,7 +39,7 @@ namespace Apache.Ignite.Core.Tests
         public void TestCustomDeployment()
         {
             // Create temp folder
-            var folder = GetTempFolder();
+            var folder = IgniteUtils.GetTempDirectoryName();
 
             // Copy jars
             var home = IgniteHome.Resolve(null);
@@ -139,36 +140,6 @@ namespace Apache.Ignite.Core.Tests
             }
         }
 
-        /// <summary>
-        /// Gets the temporary folder.
-        /// </summary>
-        private static string GetTempFolder()
-        {
-            const string prefix = "ig-test-";
-            var temp = Path.GetTempPath();
-
-            for (int i = 0; i < int.MaxValue; i++)
-            {
-                {
-                    try
-                    {
-                        var path = Path.Combine(temp, prefix + i);
-
-                        if (Directory.Exists(path))
-                            Directory.Delete(path, true);
-
-                        return Directory.CreateDirectory(path).FullName;
-                    }
-                    catch (Exception)
-                    {
-                        // Ignore
-                    }
-                }
-            }
-
-            throw new InvalidOperationException();
-        }
-
         #pragma warning disable 649
         /// <summary>
         /// Function that returns process path.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 3fd4772..cde216b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -36,6 +36,7 @@ namespace Apache.Ignite.Core.Tests
     using Apache.Ignite.Core.Discovery.Tcp.Static;
     using Apache.Ignite.Core.Events;
     using Apache.Ignite.Core.Impl;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.PersistentStore;
     using Apache.Ignite.Core.Tests.Plugin;
     using Apache.Ignite.Core.Transactions;
@@ -131,6 +132,7 @@ namespace Apache.Ignite.Core.Tests
                 Assert.AreEqual(ip.Endpoints, resIp.Endpoints.Take(2).Select(x => x.Trim('/')).ToArray());
 
                 Assert.AreEqual(cfg.IgniteInstanceName, resCfg.IgniteInstanceName);
+                Assert.AreEqual(cfg.IgniteHome, resCfg.IgniteHome);
                 Assert.AreEqual(cfg.IncludedEventTypes, resCfg.IncludedEventTypes);
                 Assert.AreEqual(cfg.MetricsExpireTime, resCfg.MetricsExpireTime);
                 Assert.AreEqual(cfg.MetricsHistorySize, resCfg.MetricsHistorySize);
@@ -682,6 +684,7 @@ namespace Apache.Ignite.Core.Tests
                     TopologyHistorySize = 1234567
                 },
                 IgniteInstanceName = "gridName1",
+                IgniteHome = IgniteHome.Resolve(null),
                 IncludedEventTypes = EventType.DiscoveryAll,
                 MetricsExpireTime = TimeSpan.FromMinutes(7),
                 MetricsHistorySize = 125,

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
index 2b73da9..c019f0c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteManagerTest.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Tests
 {
     using System;
     using System.IO;
+    using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl.Common;
     using NUnit.Framework;
 
@@ -39,7 +40,14 @@ namespace Apache.Ignite.Core.Tests
 
             try
             {
-                Assert.IsTrue(Directory.Exists(IgniteHome.Resolve(null)));
+                var home = IgniteHome.Resolve(null);
+                Assert.IsTrue(Directory.Exists(home));
+
+                // Invalid home.
+                var cfg = new IgniteConfiguration {IgniteHome = @"c:\foo\bar"};
+                var ex = Assert.Throws<IgniteException>(() => IgniteHome.Resolve(new IgniteConfiguration(cfg)));
+                Assert.AreEqual(string.Format(
+                    "IgniteConfiguration.IgniteHome is not valid: '{0}'", cfg.IgniteHome), ex.Message);
             }
             finally
             {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f23bca2/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index a7a5ff4..b0fe0df 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -734,6 +734,7 @@ namespace Apache.Ignite.Core
             }
 
             SpringConfigUrl = cfg.SpringConfigUrl;
+            IgniteHome = cfg.IgniteHome;
             JvmClasspath = cfg.JvmClasspath;
             JvmOptions = cfg.JvmOptions;
             Assemblies = cfg.Assemblies;