ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [34/49] ignite git commit: IGNITE-5716 .NET: Fix 2-byte field offset handling - improve tests
Date Tue, 11 Jul 2017 09:03:32 GMT
IGNITE-5716 .NET: Fix 2-byte field offset handling - improve tests


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

Branch: refs/heads/ignite-2.1
Commit: f1c8e59cb9410915a6e61ba6f4f63c6f3c795c75
Parents: 313f86e
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Mon Jul 10 13:15:20 2017 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Mon Jul 10 13:15:20 2017 +0300

----------------------------------------------------------------------
 .../Binary/BinaryFooterTest.cs                  | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f1c8e59c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryFooterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryFooterTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryFooterTest.cs
index 36f2f65..5088e5a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryFooterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryFooterTest.cs
@@ -20,6 +20,8 @@ namespace Apache.Ignite.Core.Tests.Binary
     using System;
     using System.Linq;
     using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Cache.Configuration;
+    using Apache.Ignite.Core.Cache.Query;
     using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Impl.Binary;
     using NUnit.Framework;
@@ -117,16 +119,46 @@ namespace Apache.Ignite.Core.Tests.Binary
                         Assert.AreEqual(dt.Arr, r.Arr);
                         Assert.AreEqual(dt.Int, r.Int);
                     }
+
+                    TestSql(dt, getMarsh());
                 }
             }
         }
 
         /// <summary>
+        /// Tests SQL query, which verifies Java side of things.
+        /// </summary>
+        private static void TestSql(OffsetTest dt, Marshaller marsh)
+        {
+            var ignite = marsh.Ignite;
+
+            if (ignite == null)
+            {
+                return;
+            }
+
+            var cache = ignite.GetOrCreateCache<int, OffsetTest>(
+                    new CacheConfiguration("offs", new QueryEntity(typeof(int), typeof(OffsetTest))));
+
+            // Cache operation.
+            cache[1] = dt;
+            Assert.AreEqual(dt.Int, cache[1].Int);
+            Assert.AreEqual(dt.Arr, cache[1].Arr);
+
+            // SQL: read field on Java side to ensure correct offset handling.
+            var res = cache.QueryFields(new SqlFieldsQuery("select int from OffsetTest")).GetAll()[0][0];
+            Assert.AreEqual(dt.Int, (int) res);
+        }
+
+        /// <summary>
         /// Offset test.
         /// </summary>
         private class OffsetTest : IBinarizable
         {
+            [QuerySqlField]
             public byte[] Arr;  // Array to enforce field offset.
+
+            [QuerySqlField]
             public int Int;     // Value at offset.
 
             public void WriteBinary(IBinaryWriter writer)


Mime
View raw message