ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject ignite git commit: IGNITE-3289 .NET: Add logging messages.
Date Thu, 18 Aug 2016 14:26:44 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 632ff9c00 -> 314eec5ea


IGNITE-3289 .NET: Add logging messages.


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

Branch: refs/heads/master
Commit: 314eec5ea49b5687710b205712af1717c189f112
Parents: 632ff9c
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Thu Aug 18 17:26:26 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Thu Aug 18 17:26:26 2016 +0300

----------------------------------------------------------------------
 .../Compute/ComputeApiTest.cs                   | 39 +++++++-------------
 .../Log/CustomLoggerTest.cs                     | 17 +++++++--
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |  6 ++-
 .../Apache.Ignite.Core/Impl/Common/Classpath.cs | 12 ++++--
 .../Impl/Common/IgniteHome.cs                   | 30 ++++++++++++---
 5 files changed, 66 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/314eec5e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 5a29167..a7becb0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -30,7 +30,6 @@ namespace Apache.Ignite.Core.Tests.Compute
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Compute;
     using Apache.Ignite.Core.Impl;
-    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Resource;
     using NUnit.Framework;
 
@@ -1208,33 +1207,23 @@ namespace Apache.Ignite.Core.Tests.Compute
         /// Create configuration.
         /// </summary>
         /// <param name="path">XML config path.</param>
-        private IgniteConfiguration Configuration(string path)
+        private static IgniteConfiguration Configuration(string path)
         {
-            IgniteConfiguration cfg = new IgniteConfiguration();
-
-            BinaryConfiguration portCfg = new BinaryConfiguration();
-
-            var portTypeCfgs = new List<BinaryTypeConfiguration>
+            return new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
-                new BinaryTypeConfiguration(typeof (PlatformComputeBinarizable)),
-                new BinaryTypeConfiguration(typeof (PlatformComputeNetBinarizable)),
-                new BinaryTypeConfiguration(JavaBinaryCls),
-                new BinaryTypeConfiguration(typeof(PlatformComputeEnum)),
-                new BinaryTypeConfiguration(typeof(InteropComputeEnumFieldTest))
+                BinaryConfiguration = new BinaryConfiguration
+                {
+                    TypeConfigurations = new List<BinaryTypeConfiguration>
+                    {
+                        new BinaryTypeConfiguration(typeof(PlatformComputeBinarizable)),
+                        new BinaryTypeConfiguration(typeof(PlatformComputeNetBinarizable)),
+                        new BinaryTypeConfiguration(JavaBinaryCls),
+                        new BinaryTypeConfiguration(typeof(PlatformComputeEnum)),
+                        new BinaryTypeConfiguration(typeof(InteropComputeEnumFieldTest))
+                    }
+                },
+                SpringConfigUrl = path
             };
-
-
-            portCfg.TypeConfigurations = portTypeCfgs;
-
-            cfg.BinaryConfiguration = portCfg;
-
-            cfg.JvmClasspath = Classpath.CreateClasspath(cfg, true);
-
-            cfg.JvmOptions = TestUtils.TestJavaOptions();
-
-            cfg.SpringConfigUrl = path;
-
-            return cfg;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/314eec5e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
index 73134fe..e097047 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Log/CustomLoggerTest.cs
@@ -363,7 +363,7 @@ namespace Apache.Ignite.Core.Tests.Log
         /// </summary>
         private class TestLogger : ILogger
         {
-            public static readonly List<LogEntry> Entries = new List<LogEntry>(5000);
+            private static readonly List<LogEntry> Logs = new List<LogEntry>(5000);
 
             private readonly LogLevel _minLevel;
 
@@ -372,15 +372,26 @@ namespace Apache.Ignite.Core.Tests.Log
                 _minLevel = minLevel;
             }
 
+            public static List<LogEntry> Entries
+            {
+                get
+                {
+                    lock (Logs)
+                    {
+                        return Logs.ToList();
+                    }
+                }
+            }
+
             public void Log(LogLevel level, string message, object[] args, IFormatProvider
formatProvider, 
                 string category, string nativeErrorInfo, Exception ex)
             {
                 if (!IsEnabled(level))
                     return;
 
-                lock (Entries)
+                lock (Logs)
                 {
-                    Entries.Add(new LogEntry
+                    Logs.Add(new LogEntry
                     {
                         Level = level,
                         Message = message,

http://git-wip-us.apache.org/repos/asf/ignite/blob/314eec5e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 88a2b52..4ff3fea 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -53,7 +53,8 @@ namespace Apache.Ignite.Core.Tests
                 "-XX:+HeapDumpOnOutOfMemoryError",
                 "-Xms1g",
                 "-Xmx4g",
-                "-ea"
+                "-ea",
+                "-DIGNITE_QUIET=true"
             }
             : new List<string>
             {
@@ -61,7 +62,8 @@ namespace Apache.Ignite.Core.Tests
                 "-Xms512m",
                 "-Xmx512m",
                 "-ea",
-                "-DIGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE=1000"
+                "-DIGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE=1000",
+                "-DIGNITE_QUIET=true"
             };
 
         /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/314eec5e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
index be68074..6c4040b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/Classpath.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.Common
     using System;
     using System.Text;
     using System.IO;
+    using Apache.Ignite.Core.Log;
 
     /// <summary>
     /// Classpath resolver.
@@ -37,11 +38,13 @@ namespace Apache.Ignite.Core.Impl.Common
         /// </summary>
         /// <param name="cfg">The configuration.</param>
         /// <param name="forceTestClasspath">Append test directories even if
-        ///     <see cref="EnvIgniteNativeTestClasspath" /> is not set.</param>
+        /// <see cref="EnvIgniteNativeTestClasspath" /> is not set.</param>
+        /// <param name="log">The log.</param>
         /// <returns>
         /// Classpath string.
         /// </returns>
-        internal static string CreateClasspath(IgniteConfiguration cfg = null, bool forceTestClasspath
= false)
+        internal static string CreateClasspath(IgniteConfiguration cfg = null, bool forceTestClasspath
= false, 
+            ILogger log = null)
         {
             var cpStr = new StringBuilder();
 
@@ -53,11 +56,14 @@ namespace Apache.Ignite.Core.Impl.Common
                     cpStr.Append(';');
             }
 
-            var ggHome = IgniteHome.Resolve(cfg);
+            var ggHome = IgniteHome.Resolve(cfg, log);
 
             if (!string.IsNullOrWhiteSpace(ggHome))
                 AppendHomeClasspath(ggHome, forceTestClasspath, cpStr);
 
+            if (log != null)
+                log.Debug("Classpath resolved to: " + cpStr);
+
             return ClasspathPrefix + cpStr;
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/314eec5e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs
index 6485201..08f6d84 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteHome.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Common
     using System.IO;
     using System.Reflection;
     using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Log;
 
     /// <summary>
     /// IgniteHome resolver.
@@ -35,29 +36,40 @@ namespace Apache.Ignite.Core.Impl.Common
         /// Calculate Ignite home.
         /// </summary>
         /// <param name="cfg">Configuration.</param>
-        /// <returns></returns>
-        public static string Resolve(IgniteConfiguration cfg)
+        /// <param name="log">The log.</param>
+        public static string Resolve(IgniteConfiguration cfg, ILogger log = null)
         {
             var home = cfg == null ? null : cfg.IgniteHome;
 
             if (string.IsNullOrWhiteSpace(home))
+            {
                 home = Environment.GetEnvironmentVariable(EnvIgniteHome);
+
+                if (log != null)
+                    log.Debug("IgniteHome retrieved from {0} environment variable: '{1}'",
EnvIgniteHome, home);
+            }
             else if (!IsIgniteHome(new DirectoryInfo(home)))
                 throw new IgniteException(string.Format("IgniteConfiguration.IgniteHome is
not valid: '{0}'", home));
 
             if (string.IsNullOrWhiteSpace(home))
-                home = Resolve();
+                home = Resolve(log);
             else if (!IsIgniteHome(new DirectoryInfo(home)))
                 throw new IgniteException(string.Format("{0} is not valid: '{1}'", EnvIgniteHome,
home));
 
+            if (log != null)
+                log.Debug("IgniteHome resolved to '{0}'", home);
+
             return home;
         }
 
         /// <summary>
         /// Automatically resolve Ignite home directory.
         /// </summary>
-        /// <returns>Ignite home directory.</returns>
-        private static string Resolve()
+        /// <param name="log">The log.</param>
+        /// <returns>
+        /// Ignite home directory.
+        /// </returns>
+        private static string Resolve(ILogger log)
         {
             var probeDirs = new[]
             {
@@ -65,8 +77,16 @@ namespace Apache.Ignite.Core.Impl.Common
                 Directory.GetCurrentDirectory()
             };
 
+            if (log != null)
+                log.Debug("Attempting to resolve IgniteHome in the assembly directory " +
+                          "'{0}' and current directory '{1}'...", probeDirs[0], probeDirs[1]);
+
+
             foreach (var probeDir in probeDirs.Where(x => !string.IsNullOrEmpty(x)))
             {
+                if (log != null)
+                    log.Debug("Probing IgniteHome in '{0}'...", probeDir);
+
                 var dir = new DirectoryInfo(probeDir);
 
                 while (dir != null)


Mime
View raw message