Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 20085200CE6 for ; Tue, 11 Jul 2017 11:27:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1E9021657F1; Tue, 11 Jul 2017 09:27:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6CA691657F4 for ; Tue, 11 Jul 2017 11:27:12 +0200 (CEST) Received: (qmail 61270 invoked by uid 500); 11 Jul 2017 09:27:11 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 59757 invoked by uid 99); 11 Jul 2017 09:27:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jul 2017 09:27:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 39CD8F5538; Tue, 11 Jul 2017 09:27:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Tue, 11 Jul 2017 09:27:33 -0000 Message-Id: <980bebdca48841af8fbe0c65c34334bd@git.apache.org> In-Reply-To: <096298b6c4494885acf914701d59bd3a@git.apache.org> References: <096298b6c4494885acf914701d59bd3a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [34/50] ignite git commit: IGNITE-5716 .NET: Fix 2-byte field offset handling - improve tests archived-at: Tue, 11 Jul 2017 09:27:13 -0000 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/master Commit: f1c8e59cb9410915a6e61ba6f4f63c6f3c795c75 Parents: 313f86e Author: Pavel Tupitsyn Authored: Mon Jul 10 13:15:20 2017 +0300 Committer: Pavel Tupitsyn 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()); } } } /// + /// Tests SQL query, which verifies Java side of things. + /// + private static void TestSql(OffsetTest dt, Marshaller marsh) + { + var ignite = marsh.Ignite; + + if (ignite == null) + { + return; + } + + var cache = ignite.GetOrCreateCache( + 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); + } + + /// /// Offset test. /// 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)