IGNITE-2923 .NET: Fixed CacheLinqTest.TestDateTime failing on ToString. This closes #591.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2a55139a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2a55139a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2a55139a Branch: refs/heads/ignite-2004 Commit: 2a55139a93aa71dc486eb17333f8aa2446493e23 Parents: 5c94d64 Author: Pavel Tupitsyn <[email protected]> Authored: Fri Apr 1 08:52:29 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Fri Apr 1 08:52:29 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs | 2 +- .../Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs | 4 ++-- modules/platforms/dotnet/Apache.Ignite.FxCop | 4 ++-- .../Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs | 3 ++- .../dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs | 9 +++++---- modules/platforms/dotnet/Apache.Ignite.sln | 3 +-- 6 files changed, 13 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs index 1342256..9fb529f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs @@ -740,7 +740,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query Assert.AreEqual(RoleCount, join.Count()); // Functions - Assert.AreEqual("01 01 2000 03:00:00", dates.Select(x => x.ToString("DD MM YYYY HH:mm:ss")).First()); + Assert.AreEqual("01 01 2000 00:00:00", dates.Select(x => x.ToString("DD MM YYYY HH:mm:ss")).First()); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs index 295dd56..3c34886 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs @@ -107,10 +107,10 @@ namespace Apache.Ignite.Core.Impl.Services return methods[0]; // 3) 0 or more than 1 matching method - throw. - // ReSharper disable once ConditionIsAlwaysTrueOrFalse - var argsString = arguments == null || arguments.Length == 0 + var argsString = arguments.Length == 0 ? "0" : "(" + + // ReSharper disable once ConditionIsAlwaysTrueOrFalse arguments.Select(x => x == null ? "null" : x.GetType().Name).Aggregate((x, y) => x + ", " + y) + ")"; http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.FxCop ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.FxCop b/modules/platforms/dotnet/Apache.Ignite.FxCop index 2c78f41..5ada560 100644 --- a/modules/platforms/dotnet/Apache.Ignite.FxCop +++ b/modules/platforms/dotnet/Apache.Ignite.FxCop @@ -21,7 +21,8 @@ <IgnoreGeneratedCode>False</IgnoreGeneratedCode> </ProjectOptions> <Targets> - <Target Name="$(ProjectDir)/Apache.Ignite.Core/bin/x64/Debug/Apache.Ignite.Core.dll" Analyze="True" AnalyzeAllChildren="True" /> + <Target Name="$(ProjectDir)/Apache.Ignite.Core/bin/Debug/Apache.Ignite.Core.dll" Analyze="True" AnalyzeAllChildren="True" /> + <Target Name="$(ProjectDir)/Apache.Ignite.Linq/bin/Debug/Apache.Ignite.Linq.dll" Analyze="True" AnalyzeAllChildren="True" /> </Targets> <Rules> <RuleFiles> @@ -84,7 +85,6 @@ <RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="False"> <Rule Name="AvoidDuplicateAccelerators" Enabled="True" /> <Rule Name="DoNotHardcodeLocaleSpecificStrings" Enabled="True" /> - <Rule Name="NormalizeStringsToUppercase" Enabled="True" /> <Rule Name="SetLocaleForDataTypes" Enabled="True" /> <Rule Name="SpecifyCultureInfo" Enabled="True" /> <Rule Name="SpecifyMarshalingForPInvokeStringArguments" Enabled="True" /> http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs index a78c877..1888414 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs @@ -22,6 +22,7 @@ namespace Apache.Ignite.Linq.Impl using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; + using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Text; @@ -273,7 +274,7 @@ namespace Apache.Ignite.Linq.Impl // H2 allows NULL & -1 for unlimited, but Ignite indexing does not // Maximum limit that works is (int.MaxValue - offset) var offsetInt = (int) ((ConstantExpression) offset.Count).Value; - _builder.Append((int.MaxValue - offsetInt).ToString()); + _builder.Append((int.MaxValue - offsetInt).ToString(CultureInfo.InvariantCulture)); } else BuildSqlExpression(limit.Count); http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs index 00ba03f..3c8acc7 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/MethodVisitor.cs @@ -58,7 +58,8 @@ namespace Apache.Ignite.Linq.Impl GetMethod(typeof (Regex), "Replace", new[] {typeof (string), typeof (string), typeof (string)}, GetFunc("regexp_replace")), - GetMethod(typeof (DateTime), "ToString", new[] {typeof (string)}, GetFunc("formatdatetime")), + GetMethod(typeof (DateTime), "ToString", new[] {typeof (string)}, + (e, v) => VisitFunc(e, v, "formatdatetime", ", 'en', 'UTC'")), GetMathMethod("Abs", typeof (int)), GetMathMethod("Abs", typeof (long)), @@ -122,14 +123,14 @@ namespace Apache.Ignite.Linq.Impl /// </summary> private static VisitMethodDelegate GetFunc(string func, params int[] adjust) { - return (e, v) => VisitFunc(e, v, func, adjust); + return (e, v) => VisitFunc(e, v, func, null, adjust); } /// <summary> /// Visits the instance function. /// </summary> private static void VisitFunc(MethodCallExpression expression, CacheQueryExpressionVisitor visitor, - string func, params int[] adjust) + string func, string suffix, params int[] adjust) { visitor.ResultBuilder.Append(func).Append("("); @@ -161,7 +162,7 @@ namespace Apache.Ignite.Linq.Impl AppendAdjustment(visitor, adjust, i + 1); } - visitor.ResultBuilder.Append(")"); + visitor.ResultBuilder.Append(suffix).Append(")"); AppendAdjustment(visitor, adjust, 0); } http://git-wip-us.apache.org/repos/asf/ignite/blob/2a55139a/modules/platforms/dotnet/Apache.Ignite.sln ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.sln b/modules/platforms/dotnet/Apache.Ignite.sln index 407ea27..1f852e5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.sln +++ b/modules/platforms/dotnet/Apache.Ignite.sln @@ -1,5 +1,4 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 +Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core", "Apache.Ignite.Core\Apache.Ignite.Core.csproj", "{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}" EndProject
