You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/03/31 11:52:03 UTC

ignite git commit: IGNITE-3506 .NET: Fix ContinuousQuery, QueryBase, and SqlFieldsQuery class constants

Repository: ignite
Updated Branches:
  refs/heads/master b44432dd9 -> 2ad2365a0


IGNITE-3506 .NET: Fix ContinuousQuery, QueryBase, and SqlFieldsQuery class constants

This closes #1695


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

Branch: refs/heads/master
Commit: 2ad2365a03686530ab10993966e7153105380fa9
Parents: b44432d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Mar 31 14:51:57 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Mar 31 14:51:57 2017 +0300

----------------------------------------------------------------------
 .../Cache/Query/CacheLinqTest.cs                |  2 +-
 .../Cache/Query/CacheQueriesTest.cs             |  2 +
 .../Continuous/ContinuousQueryAbstractTest.cs   | 14 +++++
 .../Cache/Query/Continuous/ContinuousQuery.cs   | 59 +++++++++++---------
 .../Apache.Ignite.Core/Cache/Query/QueryBase.cs |  4 +-
 .../Cache/Query/SqlFieldsQuery.cs               |  6 +-
 .../dotnet/Apache.Ignite.Linq/QueryOptions.cs   |  2 +-
 7 files changed, 57 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/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 8acf89c..856fb49 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
@@ -1250,7 +1250,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             fq = fieldsQuery.GetFieldsQuery();
             Assert.AreEqual("select _T0.Name from \"\".Person as _T0", fq.Sql);
             Assert.IsFalse(fq.Local);
-            Assert.AreEqual(SqlFieldsQuery.DfltPageSize, fq.PageSize);
+            Assert.AreEqual(SqlFieldsQuery.DefaultPageSize, fq.PageSize);
             Assert.IsFalse(fq.EnableDistributedJoins);
             Assert.IsFalse(fq.EnforceJoinOrder);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 4061ac2..fc47f52 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -245,6 +245,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
 
             SqlQuery qry = new SqlQuery(typeof (QueryPerson), "age < 60");
 
+            Assert.AreEqual(QueryBase.DefaultPageSize, qry.PageSize);
+
             // 2. Page size is bigger than result set.
             qry.PageSize = 4;
             CheckEnumeratorQuery(qry);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index 40d8525..e890198 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -290,6 +290,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         }
 
         /// <summary>
+        /// Tests the defaults.
+        /// </summary>
+        [Test]
+        public void TestDefaults()
+        {
+            var qry = new ContinuousQuery<int, int>(null);
+
+            Assert.AreEqual(ContinuousQuery.DefaultAutoUnsubscribe, qry.AutoUnsubscribe);
+            Assert.AreEqual(ContinuousQuery.DefaultBufferSize, qry.BufferSize);
+            Assert.AreEqual(ContinuousQuery.DefaultTimeInterval, qry.TimeInterval);
+            Assert.IsFalse(qry.Local);
+        }
+
+        /// <summary>
         /// Check filter.
         /// </summary>
         /// <param name="binarizable">Binarizable.</param>

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
index 3bb136e..81913c8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
@@ -18,10 +18,38 @@
 namespace Apache.Ignite.Core.Cache.Query.Continuous
 {
     using System;
-    using System.Diagnostics.CodeAnalysis;
     using Apache.Ignite.Core.Cache.Event;
 
     /// <summary>
+    /// Continuous query base class, see <see cref="ContinuousQuery{K, V}"/>.
+    /// </summary>
+    public abstract class ContinuousQuery
+    {
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ContinuousQuery"/> class.
+        /// </summary>
+        protected internal ContinuousQuery()
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Default buffer size.
+        /// </summary>
+        public const int DefaultBufferSize = 1;
+
+        /// <summary>
+        /// Default time interval.
+        /// </summary>
+        public static readonly TimeSpan DefaultTimeInterval = new TimeSpan(0);
+
+        /// <summary>
+        /// Default auto-unsubscribe flag value.
+        /// </summary>
+        public const bool DefaultAutoUnsubscribe = true;
+    }
+
+    /// <summary>
     /// API for configuring continuous cache queries.
     /// <para />
     /// Continuous queries allow to register a remote and a listener for cache update events. 
@@ -36,28 +64,9 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
     /// To execute the query use method 
     /// <see cref="ICache{K,V}.QueryContinuous(ContinuousQuery{K,V})"/>.
     /// </summary>
-    public class ContinuousQuery<TK, TV>
+    public class ContinuousQuery<TK, TV> : ContinuousQuery
     {
         /// <summary>
-        /// Default buffer size.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        public const int DfltBufSize = 1;
-
-        /// <summary>
-        /// Default time interval.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
-        public static readonly TimeSpan DfltTimeInterval = new TimeSpan(0);
-
-        /// <summary>
-        /// Default auto-unsubscribe flag value.
-        /// </summary>
-        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
-        public const bool DfltAutoUnsubscribe = true;
-
-        /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="lsnr">Listener.</param>
@@ -99,9 +108,9 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
             Filter = filter;
             Local = loc;
 
-            BufferSize = DfltBufSize;
-            TimeInterval = DfltTimeInterval;
-            AutoUnsubscribe = DfltAutoUnsubscribe;
+            BufferSize = DefaultBufferSize;
+            TimeInterval = DefaultTimeInterval;
+            AutoUnsubscribe = DefaultAutoUnsubscribe;
         }
 
         /// <summary>
@@ -124,7 +133,7 @@ namespace Apache.Ignite.Core.Cache.Query.Continuous
         /// Entries from buffer will be sent to the master node only if the buffer is 
         /// full or time provided via <see cref="TimeInterval"/> is exceeded.
         /// <para />
-        /// Defaults to <see cref="DfltBufSize"/>
+        /// Defaults to <see cref="ContinuousQuery.DefaultBufferSize"/>
         /// </summary>
         public int BufferSize { get; set; }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
index d992845..e4ab6e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
@@ -28,14 +28,14 @@ namespace Apache.Ignite.Core.Cache.Query
     public abstract class QueryBase
     {
         /// <summary> Default page size. </summary>
-        public const int DfltPageSize = 1024;
+        public const int DefaultPageSize = 1024;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="QueryBase"/> class.
         /// </summary>
         protected internal QueryBase()
         {
-            PageSize = DfltPageSize;
+            PageSize = DefaultPageSize;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
index 1d896b8..aab2bfe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
@@ -26,7 +26,7 @@ namespace Apache.Ignite.Core.Cache.Query
     public class SqlFieldsQuery
     {
         /// <summary> Default page size. </summary>
-        public const int DfltPageSize = 1024;
+        public const int DefaultPageSize = 1024;
 
         /// <summary>
         /// Constructor.
@@ -50,7 +50,7 @@ namespace Apache.Ignite.Core.Cache.Query
             Local = loc;
             Arguments = args;
 
-            PageSize = DfltPageSize;
+            PageSize = DefaultPageSize;
         }
 
         /// <summary>
@@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <summary>
         /// Optional page size.
         /// <para />
-        /// Defaults to <see cref="DfltPageSize"/>.
+        /// Defaults to <see cref="DefaultPageSize"/>.
         /// </summary>
         public int PageSize { get; set; }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ad2365a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
index 4fe3ee5..c70152e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
@@ -27,7 +27,7 @@ namespace Apache.Ignite.Linq
     public class QueryOptions
     {
         /// <summary> Default page size. </summary>
-        public const int DefaultPageSize = SqlFieldsQuery.DfltPageSize;
+        public const int DefaultPageSize = SqlFieldsQuery.DefaultPageSize;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="QueryOptions"/> class.