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 28282200C6A for ; Wed, 19 Apr 2017 17:01:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 26AC6160B86; Wed, 19 Apr 2017 15:01:57 +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 A5A16160BB4 for ; Wed, 19 Apr 2017 17:01:54 +0200 (CEST) Received: (qmail 92191 invoked by uid 500); 19 Apr 2017 15:01:53 -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 91949 invoked by uid 99); 19 Apr 2017 15:01:52 -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; Wed, 19 Apr 2017 15:01:52 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1D632E038B; Wed, 19 Apr 2017 15:01:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Wed, 19 Apr 2017 15:01:52 -0000 Message-Id: <4aeb9409615d4a4994d196e4908cad63@git.apache.org> In-Reply-To: <9bdb6df1bbf04c62a3de0fff6d0d6bbd@git.apache.org> References: <9bdb6df1bbf04c62a3de0fff6d0d6bbd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [02/12] ignite git commit: IGNITE-5001 .NET: Tests cleanup archived-at: Wed, 19 Apr 2017 15:01:57 -0000 IGNITE-5001 .NET: Tests cleanup Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d76a7299 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d76a7299 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d76a7299 Branch: refs/heads/ignite-1561 Commit: d76a7299a209c0282b9d7c1c97ea9f8c783d9ce6 Parents: 5dab5fb Author: Pavel Tupitsyn Authored: Wed Apr 19 15:02:59 2017 +0300 Committer: Pavel Tupitsyn Committed: Wed Apr 19 15:02:59 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.csproj | 7 + .../Binary/BinaryBuilderSelfTest.cs | 3 +- .../BinaryBuilderSelfTestDynamicRegistration.cs | 2 + .../Binary/BinaryBuilderSelfTestSimpleName.cs | 2 + .../Binary/BinaryCompactFooterInteropTest.cs | 4 +- .../BinaryConfigurationTest.cs | 4 +- .../Cache/AddArgCacheEntryProcessor.cs | 91 ++++ .../Cache/Affinity/AffinityFunctionTest.cs | 1 - .../Cache/Affinity/AffinityTest.cs | 10 +- .../BinarizableAddArgCacheEntryProcessor.cs | 53 +++ .../Cache/BinarizableTestException.cs | 51 +++ .../Cache/CacheAbstractTest.cs | 422 ++++--------------- .../Cache/CacheDynamicStartTest.cs | 164 +++---- .../Cache/CacheForkedTest.cs | 6 +- .../Cache/CacheTestKey.cs | 68 +++ .../Cache/NonSerializableCacheEntryProcessor.cs | 40 ++ .../Cache/NonSerializableException.cs | 40 ++ .../Cache/Query/CacheQueriesTest.cs | 35 +- .../Continuous/ContinuousQueryAbstractTest.cs | 45 +- .../Continuous/ContinuousQueryJavaFilterTest.cs | 21 +- .../Cache/Store/CacheParallelLoadStoreTest.cs | 9 +- .../Cache/Store/CacheStoreSessionTest.cs | 15 +- .../Cache/Store/CacheStoreTest.cs | 17 +- .../Cache/TestReferenceObject.cs | 40 ++ .../Compute/AbstractTaskTest.cs | 29 +- .../Compute/BinarizableClosureTaskTest.cs | 14 +- .../Compute/BinarizableTaskTest.cs | 15 - .../Compute/ComputeApiTest.cs | 9 +- .../Compute/ComputeApiTestFullFooter.cs | 4 +- .../Compute/FailoverTaskSelfTest.cs | 6 - .../Compute/ResourceTaskTest.cs | 60 +-- .../Compute/SerializableClosureTaskTest.cs | 1 + .../Compute/TaskAdapterTest.cs | 6 - .../Compute/TaskResultTest.cs | 12 - .../Dataload/DataStreamerTest.cs | 55 +-- .../Apache.Ignite.Core.Tests/DeploymentTest.cs | 4 +- .../Apache.Ignite.Core.Tests/EventsTest.cs | 65 +-- .../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 13 +- .../Apache.Ignite.Core.Tests/ExecutableTest.cs | 57 +-- .../Apache.Ignite.Core.Tests/FutureTest.cs | 18 +- .../IgniteStartStopTest.cs | 55 +-- .../Apache.Ignite.Core.Tests/IgniteTestBase.cs | 51 +-- .../Apache.Ignite.Core.Tests/LifecycleTest.cs | 45 +- .../Apache.Ignite.Core.Tests/LoadDllTest.cs | 11 +- .../Apache.Ignite.Core.Tests/MessagingTest.cs | 30 +- .../Impl/Binary/BinaryUtils.cs | 207 +++------ 46 files changed, 748 insertions(+), 1169 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index a13878a..232b033 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -85,10 +85,16 @@ + + + + + + @@ -96,6 +102,7 @@ + http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs index e8d0049..951f5d2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs @@ -135,8 +135,7 @@ namespace Apache.Ignite.Core.Tests.Binary [TestFixtureTearDown] public void TearDown() { - if (_grid != null) - Ignition.Stop(_grid.Name, true); + Ignition.StopAll(true); _grid = null; } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs index 3f37833..591a12f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestDynamicRegistration.cs @@ -19,10 +19,12 @@ namespace Apache.Ignite.Core.Tests.Binary { using System.Collections.Generic; using Apache.Ignite.Core.Binary; + using NUnit.Framework; /// /// Binary builder self test with dynamic type registration. /// + [TestFixture] public class BinaryBuilderSelfTestDynamicRegistration : BinaryBuilderSelfTest { /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs index 918f82d..5f09584 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs @@ -18,10 +18,12 @@ namespace Apache.Ignite.Core.Tests.Binary { using Apache.Ignite.Core.Binary; + using NUnit.Framework; /// /// Builder test with simple names. /// + [TestFixture] public class BinaryBuilderSelfTestSimpleName : BinaryBuilderSelfTest { /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs index bda3438..2ee7cad 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs @@ -133,11 +133,9 @@ namespace Apache.Ignite.Core.Tests.Binary /// private static IgniteConfiguration Config(string springUrl) { - return new IgniteConfiguration + return new IgniteConfiguration(TestUtils.GetTestConfiguration()) { SpringConfigUrl = springUrl, - JvmOptions = TestUtils.TestJavaOptions(), - JvmClasspath = TestUtils.CreateTestClasspath(), BinaryConfiguration = new BinaryConfiguration( typeof (PlatformComputeBinarizable), typeof (PlatformComputeNetBinarizable)) http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs index 4f6bf02..496f46f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs @@ -69,11 +69,9 @@ namespace Apache.Ignite.Core.Tests { Ignition.StopAll(true); - var grid = Ignition.Start(new IgniteConfiguration + var grid = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { SpringConfigUrl = "config\\cache-binarizables.xml", - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), BinaryConfiguration = binaryConfiguration }); http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/AddArgCacheEntryProcessor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/AddArgCacheEntryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/AddArgCacheEntryProcessor.cs new file mode 100644 index 0000000..5187627 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/AddArgCacheEntryProcessor.cs @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using System; + using Apache.Ignite.Core.Cache; + using NUnit.Framework; + + /// + /// Cache entry processor that adds argument value to the entry value. + /// + [Serializable] + public class AddArgCacheEntryProcessor : ICacheEntryProcessor + { + // Expected exception text + public const string ExceptionText = "Exception from AddArgCacheEntryProcessor."; + + // Error flag + public bool ThrowErr { get; set; } + + // Error flag + public bool ThrowErrBinarizable { get; set; } + + // Error flag + public bool ThrowErrNonSerializable { get; set; } + + // Key value to throw error on + public int ThrowOnKey { get; set; } + + // Remove flag + public bool Remove { get; set; } + + // Exists flag + public bool Exists { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public AddArgCacheEntryProcessor() + { + Exists = true; + ThrowOnKey = -1; + } + + /** */ + int ICacheEntryProcessor.Process(IMutableCacheEntry entry, int arg) + { + if (ThrowOnKey < 0 || ThrowOnKey == entry.Key) + { + if (ThrowErr) + throw new Exception(ExceptionText); + + if (ThrowErrBinarizable) + throw new BinarizableTestException {Info = ExceptionText}; + + if (ThrowErrNonSerializable) + throw new NonSerializableException(); + } + + Assert.AreEqual(Exists, entry.Exists); + + if (Remove) + entry.Remove(); + else + entry.Value = entry.Value + arg; + + return entry.Value; + } + + /** */ + public int Process(IMutableCacheEntry entry, int arg) + { + throw new Exception("Invalid method"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs index 5456ba4..22810da 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs @@ -27,7 +27,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity using Apache.Ignite.Core.Cache.Affinity.Rendezvous; using Apache.Ignite.Core.Cache.Configuration; using Apache.Ignite.Core.Cluster; - using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Resource; using NUnit.Framework; http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs index 9bd639b..1ae46c5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs @@ -28,19 +28,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity public sealed class AffinityTest { /// - /// + /// Test set up. /// [TestFixtureSetUp] public void StartGrids() { - TestUtils.KillProcesses(); - for (int i = 0; i < 3; i++) { - var cfg = new IgniteConfiguration + var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = "config\\native-client-test-cache-affinity.xml", IgniteInstanceName = "grid-" + i }; @@ -100,7 +96,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity /// /// Affinity key. /// - public class AffinityTestKey + private class AffinityTestKey { /** ID. */ private readonly int _id; http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableAddArgCacheEntryProcessor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableAddArgCacheEntryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableAddArgCacheEntryProcessor.cs new file mode 100644 index 0000000..1199e54 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableAddArgCacheEntryProcessor.cs @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using Apache.Ignite.Core.Binary; + + /// + /// Binary add processor. + /// + public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable + { + /** */ + public void WriteBinary(IBinaryWriter writer) + { + var w = writer.GetRawWriter(); + + w.WriteBoolean(ThrowErr); + w.WriteBoolean(ThrowErrBinarizable); + w.WriteBoolean(ThrowErrNonSerializable); + w.WriteInt(ThrowOnKey); + w.WriteBoolean(Remove); + w.WriteBoolean(Exists); + } + + /** */ + public void ReadBinary(IBinaryReader reader) + { + var r = reader.GetRawReader(); + + ThrowErr = r.ReadBoolean(); + ThrowErrBinarizable = r.ReadBoolean(); + ThrowErrNonSerializable = r.ReadBoolean(); + ThrowOnKey = r.ReadInt(); + Remove = r.ReadBoolean(); + Exists = r.ReadBoolean(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableTestException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableTestException.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableTestException.cs new file mode 100644 index 0000000..5f76eef --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/BinarizableTestException.cs @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using System; + using Apache.Ignite.Core.Binary; + + /// + /// Binary exception. + /// + public class BinarizableTestException : Exception, IBinarizable + { + /// + /// Gets or sets exception info. + /// + public string Info { get; set; } + + /** */ + public override string Message + { + get { return Info; } + } + + /** */ + public void WriteBinary(IBinaryWriter writer) + { + writer.GetRawWriter().WriteString(Info); + } + + /** */ + public void ReadBinary(IBinaryReader reader) + { + Info = reader.GetRawReader().ReadString(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs index 490a26a..d629331 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs @@ -22,7 +22,6 @@ namespace Apache.Ignite.Core.Tests.Cache using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; - using System.Text; using System.Threading; using System.Threading.Tasks; using System.Transactions; @@ -38,294 +37,32 @@ namespace Apache.Ignite.Core.Tests.Cache using NUnit.Framework; /// - /// + /// Base cache test. /// - class CacheTestKey - { - /// - /// Constructor. - /// - /// ID. - public CacheTestKey(int id) - { - Id = id; - } - - /// - /// ID. - /// - public int Id - { - get; - set; - } - - /** */ - public override bool Equals(object obj) - { - CacheTestKey other = obj as CacheTestKey; - - return other != null && Id == other.Id; - } - - /** */ - public override int GetHashCode() - { - return Id; - } - - /** */ - public override string ToString() - { - return new StringBuilder() - .Append(typeof(CacheTestKey).Name) - .Append(" [id=").Append(Id) - .Append(']').ToString(); - } - } - - /// - /// - /// - class TestReferenceObject + [SuppressMessage("ReSharper", "UnusedVariable")] + public abstract class CacheAbstractTest { - public TestReferenceObject Obj; - /// - /// Default constructor. + /// Fixture setup. /// - public TestReferenceObject() - { - // No-op. - } - - public TestReferenceObject(TestReferenceObject obj) - { - Obj = obj; - } - } - - [Serializable] - public class TestSerializableObject - { - public string Name { get; set; } - public int Id { get; set; } - - public override bool Equals(object obj) + [TestFixtureSetUp] + public void StartGrids() { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - - var other = (TestSerializableObject) obj; - return obj.GetType() == GetType() && (string.Equals(Name, other.Name) && Id == other.Id); - } + TestUtils.KillProcesses(); - public override int GetHashCode() - { - unchecked + IgniteConfiguration cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ Id; - } - } - } - - /// - /// Cache entry processor that adds argument value to the entry value. - /// - [Serializable] - public class AddArgCacheEntryProcessor : ICacheEntryProcessor - { - // Expected exception text - public const string ExceptionText = "Exception from AddArgCacheEntryProcessor."; - - // Error flag - public bool ThrowErr { get; set; } - - // Error flag - public bool ThrowErrBinarizable { get; set; } - - // Error flag - public bool ThrowErrNonSerializable { get; set; } - - // Key value to throw error on - public int ThrowOnKey { get; set; } - - // Remove flag - public bool Remove { get; set; } - - // Exists flag - public bool Exists { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public AddArgCacheEntryProcessor() - { - Exists = true; - ThrowOnKey = -1; - } + BinaryConfiguration = new BinaryConfiguration( + typeof(BinarizablePerson), + typeof(CacheTestKey), + typeof(TestReferenceObject), + typeof(BinarizableAddArgCacheEntryProcessor), + typeof(BinarizableTestException)), + SpringConfigUrl = "config\\native-client-test-cache.xml" + }; - /** */ - int ICacheEntryProcessor.Process(IMutableCacheEntry entry, int arg) - { - if (ThrowOnKey < 0 || ThrowOnKey == entry.Key) + for (int i = 0; i < GridCount(); i++) { - if (ThrowErr) - throw new Exception(ExceptionText); - - if (ThrowErrBinarizable) - throw new BinarizableTestException {Info = ExceptionText}; - - if (ThrowErrNonSerializable) - throw new NonSerializableException(); - } - - Assert.AreEqual(Exists, entry.Exists); - - if (Remove) - entry.Remove(); - else - entry.Value = entry.Value + arg; - - return entry.Value; - } - - /** */ - public int Process(IMutableCacheEntry entry, int arg) - { - throw new Exception("Invalid method"); - } - } - - /// - /// Binary add processor. - /// - public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable - { - /** */ - public void WriteBinary(IBinaryWriter writer) - { - var w = writer.GetRawWriter(); - - w.WriteBoolean(ThrowErr); - w.WriteBoolean(ThrowErrBinarizable); - w.WriteBoolean(ThrowErrNonSerializable); - w.WriteInt(ThrowOnKey); - w.WriteBoolean(Remove); - w.WriteBoolean(Exists); - } - - /** */ - public void ReadBinary(IBinaryReader reader) - { - var r = reader.GetRawReader(); - - ThrowErr = r.ReadBoolean(); - ThrowErrBinarizable = r.ReadBoolean(); - ThrowErrNonSerializable = r.ReadBoolean(); - ThrowOnKey = r.ReadInt(); - Remove = r.ReadBoolean(); - Exists = r.ReadBoolean(); - } - } - - /// - /// Non-serializable processor. - /// - public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable - { - /** */ - public void WriteBinary(IBinaryWriter writer) - { - throw new Exception("ExpectedException"); - } - - /** */ - public void ReadBinary(IBinaryReader reader) - { - throw new Exception("ExpectedException"); - } - } - - /// - /// Binary exception. - /// - public class BinarizableTestException : Exception, IBinarizable - { - /// - /// Gets or sets exception info. - /// - public string Info { get; set; } - - /** */ - public override string Message - { - get { return Info; } - } - - /** */ - public void WriteBinary(IBinaryWriter writer) - { - writer.GetRawWriter().WriteString(Info); - } - - /** */ - public void ReadBinary(IBinaryReader reader) - { - Info = reader.GetRawReader().ReadString(); - } - } - - /// - /// Non-serializable exception. - /// - public class NonSerializableException : Exception, IBinarizable - { - /** */ - public void WriteBinary(IBinaryWriter writer) - { - throw new Exception("ExpectedException"); - } - - /** */ - public void ReadBinary(IBinaryReader reader) - { - throw new Exception("ExpectedException"); - } - } - - /// - /// - /// - [SuppressMessage("ReSharper", "UnusedVariable")] - public abstract class CacheAbstractTest { - /// - /// - /// - [TestFixtureSetUp] - public virtual void StartGrids() { - TestUtils.KillProcesses(); - - IgniteConfiguration cfg = new IgniteConfiguration(); - - BinaryConfiguration portCfg = new BinaryConfiguration(); - - ICollection portTypeCfgs = new List(); - - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizablePerson))); - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(CacheTestKey))); - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestReferenceObject))); - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableAddArgCacheEntryProcessor))); - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTestException))); - - portCfg.TypeConfigurations = portTypeCfgs; - - cfg.BinaryConfiguration = portCfg; - cfg.JvmClasspath = TestUtils.CreateTestClasspath(); - cfg.JvmOptions = TestUtils.TestJavaOptions(); - cfg.SpringConfigUrl = "config\\native-client-test-cache.xml"; - - for (int i = 0; i < GridCount(); i++) { cfg.IgniteInstanceName = "grid-" + i; Ignition.Start(cfg); @@ -335,19 +72,19 @@ namespace Apache.Ignite.Core.Tests.Cache } /// - /// + /// Fixture teardown. /// [TestFixtureTearDown] - public virtual void StopGrids() { - for (int i = 0; i < GridCount(); i++) - Ignition.Stop("grid-" + i, true); + public void StopGrids() + { + Ignition.StopAll(true); } /// /// /// [SetUp] - public virtual void BeforeTest() + public void BeforeTest() { Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name); } @@ -356,7 +93,7 @@ namespace Apache.Ignite.Core.Tests.Cache /// /// [TearDown] - public virtual void AfterTest() { + public void AfterTest() { for (int i = 0; i < GridCount(); i++) Cache(i).WithKeepBinary().RemoveAll(); @@ -378,35 +115,35 @@ namespace Apache.Ignite.Core.Tests.Cache Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name); } - public IIgnite GetIgnite(int idx) + protected static IIgnite GetIgnite(int idx) { return Ignition.GetIgnite("grid-" + idx); } - public ICache Cache(int idx) { + private ICache Cache(int idx) { return Cache(idx); } - public ICache Cache(int idx) { + private ICache Cache(int idx) { return GetIgnite(idx).GetCache(CacheName()); } - public ICache Cache() + protected ICache Cache() { return Cache(0); } - public ICache Cache() + private ICache Cache() { return Cache(0); } - public ICacheAffinity Affinity() + private ICacheAffinity Affinity() { return GetIgnite(0).GetAffinity(CacheName()); } - public ITransactions Transactions + protected ITransactions Transactions { get { return GetIgnite(0).GetTransactions(); } } @@ -452,7 +189,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(i); - cache.Put(PrimaryKeyForCache(cache), 1); + cache.Put(GetPrimaryKeyForCache(cache), 1); } for (int i = 0; i < GridCount(); i++) @@ -468,7 +205,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - int key = PrimaryKeyForCache(cache); + int key = GetPrimaryKeyForCache(cache); cache.Put(key, 1); @@ -481,7 +218,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 5); + var keys = GetPrimaryKeysForCache(cache, 5); Assert.IsFalse(cache.ContainsKeys(keys)); @@ -497,7 +234,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - int key1 = PrimaryKeyForCache(cache); + int key1 = GetPrimaryKeyForCache(cache); cache.Put(key1, 1); @@ -912,7 +649,7 @@ namespace Apache.Ignite.Core.Tests.Cache /// /// Expiry policy tests. /// - public void TestWithExpiryPolicy(Func, IExpiryPolicy, ICache> withPolicyFunc, + private void TestWithExpiryPolicy(Func, IExpiryPolicy, ICache> withPolicyFunc, bool origCache) { ICache cache0 = Cache(0); @@ -927,8 +664,8 @@ namespace Apache.Ignite.Core.Tests.Cache } else { - key0 = PrimaryKeyForCache(cache0); - key1 = PrimaryKeyForCache(Cache(1)); + key0 = GetPrimaryKeyForCache(cache0); + key1 = GetPrimaryKeyForCache(Cache(1)); } // Test unchanged expiration. @@ -1039,8 +776,8 @@ namespace Apache.Ignite.Core.Tests.Cache } else { - key0 = PrimaryKeyForCache(cache0); - key1 = PrimaryKeyForCache(Cache(1)); + key0 = GetPrimaryKeyForCache(cache0); + key1 = GetPrimaryKeyForCache(Cache(1)); } // Test zero expiration. @@ -1103,7 +840,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - int key = PrimaryKeyForCache(cache); + int key = GetPrimaryKeyForCache(cache); cache.Put(key, 1); @@ -1128,7 +865,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - List keys = PrimaryKeysForCache(cache, 3); + List keys = GetPrimaryKeysForCache(cache, 3); cache.Put(keys[0], 1); cache.Put(keys[1], 2); @@ -1163,7 +900,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(i); - cache.Put(PrimaryKeyForCache(cache, 500), 1); + cache.Put(GetPrimaryKeyForCache(cache, 500), 1); Assert.IsFalse(cache.IsEmpty()); } @@ -1178,7 +915,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestClearKey() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 10); + var keys = GetPrimaryKeysForCache(cache, 10); foreach (var key in keys) cache.Put(key, 3); @@ -1202,7 +939,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestClearKeys() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 10); + var keys = GetPrimaryKeysForCache(cache, 10); foreach (var key in keys) cache.Put(key, 3); @@ -1216,7 +953,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestLocalClearKey() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 10); + var keys = GetPrimaryKeysForCache(cache, 10); foreach (var key in keys) cache.Put(key, 3); @@ -1242,7 +979,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestLocalClearKeys() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 10); + var keys = GetPrimaryKeysForCache(cache, 10); foreach (var key in keys) cache.Put(key, 3); @@ -1350,7 +1087,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 2); + var keys = GetPrimaryKeysForCache(cache, 2); cache.Put(keys[0], 1); cache.Put(keys[1], 2); @@ -1370,7 +1107,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache().WrapAsync(); - List keys = PrimaryKeysForCache(cache, 2); + List keys = GetPrimaryKeysForCache(cache, 2); cache.Put(keys[0], 1); cache.Put(keys[1], 2); @@ -1438,7 +1175,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(i); - List keys = PrimaryKeysForCache(cache, 2); + List keys = GetPrimaryKeysForCache(cache, 2); foreach (int key in keys) cache.Put(key, 1); @@ -1465,7 +1202,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestLocalSize() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 3); + var keys = GetPrimaryKeysForCache(cache, 3); cache.Put(keys[0], 1); cache.Put(keys[1], 2); @@ -1474,7 +1211,7 @@ namespace Apache.Ignite.Core.Tests.Cache cache.LocalEvict(keys.Take(2).ToArray()); - //Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Onheap)); // TODO: IGNITE-4535 + Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Onheap)); Assert.AreEqual(localSize, cache.GetLocalSize(CachePeekMode.All)); cache.Put(keys[2], 3); @@ -1492,7 +1229,7 @@ namespace Apache.Ignite.Core.Tests.Cache public void TestEnumerators() { var cache = Cache(); - var keys = PrimaryKeysForCache(cache, 2); + var keys = GetPrimaryKeysForCache(cache, 2); cache.Put(keys[0], keys[0] + 1); cache.Put(keys[1], keys[1] + 1); @@ -1581,7 +1318,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - int key = PrimaryKeyForCache(cache); + int key = GetPrimaryKeyForCache(cache); cache.Put(key, 1); @@ -1606,7 +1343,7 @@ namespace Apache.Ignite.Core.Tests.Cache { var cache = Cache(); - List keys = PrimaryKeysForCache(cache, 3); + List keys = GetPrimaryKeysForCache(cache, 3); cache.Put(keys[0], 1); cache.Put(keys[1], 2); @@ -1839,8 +1576,8 @@ namespace Apache.Ignite.Core.Tests.Cache }, threads); } - //[Test] - //[Category(TestUtils.CATEGORY_INTENSIVE)] + [Test] + [Category(TestUtils.CategoryIntensive)] public void TestAsyncMultithreadedKeepBinary() { var cache = Cache().WithKeepBinary(); @@ -2457,7 +2194,7 @@ namespace Apache.Ignite.Core.Tests.Cache } } - public void TestInvokeAll(bool async, int entryCount) where T : AddArgCacheEntryProcessor, new() + private void TestInvokeAll(bool async, int entryCount) where T : AddArgCacheEntryProcessor, new() { var cache = async ? Cache().WrapAsync() : Cache(); @@ -2740,22 +2477,22 @@ namespace Apache.Ignite.Core.Tests.Cache Assert.AreEqual(expAge, person.Age); } - protected static int PrimaryKeyForCache(ICache cache) + private static int GetPrimaryKeyForCache(ICache cache) { - return PrimaryKeysForCache(cache, 1, 0).First(); + return GetPrimaryKeysForCacheFrom(cache, 0).First(); } - protected static int PrimaryKeyForCache(ICache cache, int startFrom) + private static int GetPrimaryKeyForCache(ICache cache, int startFrom) { - return PrimaryKeysForCache(cache, 1, startFrom).First(); + return GetPrimaryKeysForCacheFrom(cache, startFrom).First(); } - protected static List PrimaryKeysForCache(ICache cache, int cnt) + private static List GetPrimaryKeysForCache(ICache cache, int cnt) { - return PrimaryKeysForCache(cache, cnt, 0).Take(cnt).ToList(); + return GetPrimaryKeysForCacheFrom(cache, 0).Take(cnt).ToList(); } - protected static IEnumerable PrimaryKeysForCache(ICache cache, int cnt, int startFrom) + private static IEnumerable GetPrimaryKeysForCacheFrom(ICache cache, int startFrom) { IClusterNode node = cache.Ignite.GetCluster().GetLocalNode(); @@ -2764,7 +2501,7 @@ namespace Apache.Ignite.Core.Tests.Cache return Enumerable.Range(startFrom, int.MaxValue - startFrom).Where(x => aff.IsPrimary(node, x)); } - protected static int NearKeyForCache(ICache cache) + private static int NearKeyForCache(ICache cache) { IClusterNode node = cache.Ignite.GetCluster().GetLocalNode(); @@ -2781,7 +2518,7 @@ namespace Apache.Ignite.Core.Tests.Cache return 0; } - protected static string GetKeyAffinity(ICache cache, int key) + private static string GetKeyAffinity(ICache cache, int key) { if (cache.Ignite.GetAffinity(cache.Name).IsPrimary(cache.Ignite.GetCluster().GetLocalNode(), key)) return "primary"; @@ -2835,5 +2572,32 @@ namespace Apache.Ignite.Core.Tests.Cache return val; } + + /// + /// Test serializable object. + /// + [Serializable] + private class TestSerializableObject + { + public string Name { get; set; } + public int Id { get; set; } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + + var other = (TestSerializableObject)obj; + return obj.GetType() == GetType() && (string.Equals(Name, other.Name) && Id == other.Id); + } + + public override int GetHashCode() + { + unchecked + { + return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ Id; + } + } + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs index 7f6e824..155375d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs @@ -18,9 +18,7 @@ namespace Apache.Ignite.Core.Tests.Cache { using System; - using System.Collections.Generic; using Apache.Ignite.Core.Binary; - using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Tests.Query; using NUnit.Framework; @@ -68,9 +66,7 @@ namespace Apache.Ignite.Core.Tests.Cache [TearDown] public void StopGrids() { - Ignition.Stop(GridData, true); - Ignition.Stop(GridDataNoCfg, true); - Ignition.Stop(GridClient, true); + Ignition.StopAll(true); } /// @@ -81,24 +77,12 @@ namespace Apache.Ignite.Core.Tests.Cache /// Configuration. private static IgniteConfiguration CreateConfiguration(string name, string springCfg) { - var cfg = new IgniteConfiguration(); - - BinaryConfiguration portCfg = new BinaryConfiguration(); - - ICollection portTypeCfgs = new List(); - - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(DynamicTestKey))); - portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(DynamicTestValue))); - - portCfg.TypeConfigurations = portTypeCfgs; - - cfg.IgniteInstanceName = name; - cfg.BinaryConfiguration = portCfg; - cfg.JvmClasspath = TestUtils.CreateTestClasspath(); - cfg.JvmOptions = TestUtils.TestJavaOptions(); - cfg.SpringConfigUrl = springCfg; - - return cfg; + return new IgniteConfiguration(TestUtils.GetTestConfiguration()) + { + IgniteInstanceName = name, + BinaryConfiguration = new BinaryConfiguration(typeof(DynamicTestKey), typeof(DynamicTestValue)), + SpringConfigUrl = springCfg + }; } /// @@ -145,16 +129,14 @@ namespace Apache.Ignite.Core.Tests.Cache /// Check routine. /// /// Cache name. - private void Check(string cacheName) + private static void Check(string cacheName) { - ICache cacheData = - Ignition.GetIgnite(GridData).GetCache(cacheName); + var cacheData = Ignition.GetIgnite(GridData).GetCache(cacheName); - ICache cacheDataNoCfg = + var cacheDataNoCfg = Ignition.GetIgnite(GridDataNoCfg).GetCache(cacheName); - ICache cacheClient = - Ignition.GetIgnite(GridClient).GetCache(cacheName); + var cacheClient = Ignition.GetIgnite(GridClient).GetCache(cacheName); DynamicTestKey key1 = new DynamicTestKey(1); DynamicTestKey key2 = new DynamicTestKey(2); @@ -186,97 +168,73 @@ namespace Apache.Ignite.Core.Tests.Cache Assert.AreEqual(0, sizeClient); } - } - - /// - /// Key for dynamic cache start tests. - /// - class DynamicTestKey - { - /// - /// Default constructor. - /// - public DynamicTestKey() - { - // No-op. - } - - /// - /// Constructor. - /// - /// ID. - public DynamicTestKey(int id) - { - Id = id; - } /// - /// ID. + /// Key for dynamic cache start tests. /// - public int Id + private class DynamicTestKey { - get; - set; - } + /// + /// Constructor. + /// + /// ID. + public DynamicTestKey(int id) + { + Id = id; + } - /** */ - public override bool Equals(object obj) - { - DynamicTestKey other = obj as DynamicTestKey; + /// + /// ID. + /// + public int Id { get; set; } - return other != null && Id == other.Id; - } + /** */ + public override bool Equals(object obj) + { + DynamicTestKey other = obj as DynamicTestKey; - /** */ - public override int GetHashCode() - { - return Id; - } - } + return other != null && Id == other.Id; + } - /// - /// Value for dynamic cache start tests. - /// - class DynamicTestValue - { - /// - /// Default constructor. - /// - public DynamicTestValue() - { - // No-op. + /** */ + public override int GetHashCode() + { + return Id; + } } /// - /// Constructor. + /// Value for dynamic cache start tests. /// - /// ID. - public DynamicTestValue(int id) + private class DynamicTestValue { - Id = id; - } + /// + /// Constructor. + /// + /// ID. + public DynamicTestValue(int id) + { + Id = id; + } - /// - /// ID. - /// - public int Id - { - get; - set; - } + /// + /// ID. + /// + public int Id { get; set; } - /** */ - public override bool Equals(object obj) - { - DynamicTestValue other = obj as DynamicTestValue; + /** */ + public override bool Equals(object obj) + { + DynamicTestValue other = obj as DynamicTestValue; - return other != null && Id == other.Id; - } + return other != null && Id == other.Id; + } - /** */ - public override int GetHashCode() - { - return Id; + /** */ + public override int GetHashCode() + { + return Id; + } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs index 46c54e6..3401b79 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs @@ -48,14 +48,12 @@ namespace Apache.Ignite.Core.Tests.Cache "-J-DIGNITE_QUIET=false" ); - _grid = Ignition.Start(new IgniteConfiguration + _grid = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = springConfigUrl }); - Assert.IsTrue(_grid.WaitTopology(2, 30000)); + Assert.IsTrue(_grid.WaitTopology(2)); } /// http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestKey.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestKey.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestKey.cs new file mode 100644 index 0000000..6e8a261 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestKey.cs @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using System.Text; + + /// + /// Test key. + /// + internal class CacheTestKey + { + /// + /// Constructor. + /// + /// ID. + public CacheTestKey(int id) + { + Id = id; + } + + /// + /// ID. + /// + public int Id + { + get; + set; + } + + /** */ + public override bool Equals(object obj) + { + CacheTestKey other = obj as CacheTestKey; + + return other != null && Id == other.Id; + } + + /** */ + public override int GetHashCode() + { + return Id; + } + + /** */ + public override string ToString() + { + return new StringBuilder() + .Append(typeof(CacheTestKey).Name) + .Append(" [id=").Append(Id) + .Append(']').ToString(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableCacheEntryProcessor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableCacheEntryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableCacheEntryProcessor.cs new file mode 100644 index 0000000..61bf03b --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableCacheEntryProcessor.cs @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using System; + using Apache.Ignite.Core.Binary; + + /// + /// Non-serializable processor. + /// + public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable + { + /** */ + public void WriteBinary(IBinaryWriter writer) + { + throw new Exception("ExpectedException"); + } + + /** */ + public void ReadBinary(IBinaryReader reader) + { + throw new Exception("ExpectedException"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableException.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableException.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableException.cs new file mode 100644 index 0000000..30e84a1 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/NonSerializableException.cs @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + using System; + using Apache.Ignite.Core.Binary; + + /// + /// Non-serializable exception. + /// + public class NonSerializableException : Exception, IBinarizable + { + /** */ + public void WriteBinary(IBinaryWriter writer) + { + throw new Exception("ExpectedException"); + } + + /** */ + public void ReadBinary(IBinaryReader reader) + { + throw new Exception("ExpectedException"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/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 5cbec0d..0b13bf9 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 @@ -16,6 +16,7 @@ */ // ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global namespace Apache.Ignite.Core.Tests.Cache.Query { using System; @@ -50,35 +51,22 @@ namespace Apache.Ignite.Core.Tests.Cache.Query private const int MaxItemCnt = 100; /// - /// + /// Fixture setup. /// [TestFixtureSetUp] public void StartGrids() { - TestUtils.KillProcesses(); - - IgniteConfiguration cfg = new IgniteConfiguration + for (int i = 0; i < GridCnt; i++) { - BinaryConfiguration = new BinaryConfiguration + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - TypeConfigurations = new[] + BinaryConfiguration = new BinaryConfiguration { - new BinaryTypeConfiguration(typeof (QueryPerson)), - new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter)), - new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter)) + NameMapper = GetNameMapper() }, - NameMapper = GetNameMapper() - }, - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), - SpringConfigUrl = CfgPath - }; - - for (int i = 0; i < GridCnt; i++) - { - cfg.IgniteInstanceName = "grid-" + i; - - Ignition.Start(cfg); + SpringConfigUrl = CfgPath, + IgniteInstanceName = "grid-" + i + }); } } @@ -91,13 +79,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query } /// - /// + /// Fixture teardown. /// [TestFixtureTearDown] public void StopGrids() { - for (int i = 0; i < GridCnt; i++) - Ignition.Stop("grid-" + i, true); + Ignition.StopAll(true); } /// http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/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 a6b68bb..2df2f35 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 @@ -390,36 +390,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous using (cache1.QueryContinuous(qry)) { // Put from local node. - try - { - cache1.GetAndPut(PrimaryKey(cache1), Entry(1)); - - Assert.Fail("Should not reach this place."); - } - catch (IgniteException) - { - // No-op. - } - catch (Exception) - { - Assert.Fail("Unexpected error."); - } + Assert.Throws(() => cache1.GetAndPut(PrimaryKey(cache1), Entry(1))); // Put from remote node. - try - { - cache1.GetAndPut(PrimaryKey(cache2), Entry(1)); - - Assert.Fail("Should not reach this place."); - } - catch (IgniteException) - { - // No-op. - } - catch (Exception) - { - Assert.Fail("Unexpected error."); - } + Assert.Throws(() => cache1.GetAndPut(PrimaryKey(cache2), Entry(1))); } } @@ -552,20 +526,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous CheckFilterSingle(key1, null, Entry(key1)); // Remote put must fail. - try - { - cache1.GetAndPut(PrimaryKey(cache2), Entry(1)); - - Assert.Fail("Should not reach this place."); - } - catch (IgniteException) - { - // No-op. - } - catch (Exception) - { - Assert.Fail("Unexpected error."); - } + Assert.Throws(() => cache1.GetAndPut(PrimaryKey(cache2), Entry(1))); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs index 4b5db93..b70f61d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs @@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous using System.Collections.Generic; using System.Linq; using System.Threading; - using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache.Event; using Apache.Ignite.Core.Cache.Query.Continuous; using Apache.Ignite.Core.Common; @@ -33,6 +32,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous /// /// Tests query in a cluster with Java-only and .NET nodes. /// + [Category(TestUtils.CategoryIntensive)] public class ContinuousQueryJavaFilterTest { /** */ @@ -68,28 +68,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous [TestFixtureSetUp] public void FixtureSetUp() { - // Main .NET nodes - var jvmOpts = TestUtils.TestJavaOptions(); - - _ignite = Ignition.Start(new IgniteConfiguration + // Main .NET node + _ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = jvmOpts, SpringConfigUrl = SpringConfig, - BinaryConfiguration = new BinaryConfiguration - { - TypeConfigurations = new List - { - new BinaryTypeConfiguration(typeof(TestBinary)) - } - } }); // Second .NET node - Ignition.Start(new IgniteConfiguration + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = jvmOpts, SpringConfigUrl = SpringConfig2, IgniteInstanceName = "dotNet2" }); http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs index 2e74b3f..52db794 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs @@ -18,7 +18,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Store { using System; - using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache; using NUnit.Framework; @@ -36,15 +35,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store [TestFixtureSetUp] public void BeforeTests() { - Ignition.Start(new IgniteConfiguration + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = "config\\native-client-test-cache-parallel-store.xml", - BinaryConfiguration = new BinaryConfiguration - { - Types = new[] {typeof (CacheTestParallelLoadStore.Record).FullName} - } }); } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs index 6f9d791..315e285 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs @@ -48,22 +48,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Store [TestFixtureSetUp] public void BeforeTests() { - //TestUtils.JVM_DEBUG = true; - - TestUtils.KillProcesses(); - - TestUtils.JvmDebug = true; - - IgniteConfiguration cfg = new IgniteConfiguration + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { IgniteInstanceName = IgniteName, - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = @"config\cache\store\cache-store-session.xml" - }; - - - Ignition.Start(cfg); + }); } /// http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs index 309c77e..12c442d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs @@ -50,16 +50,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Store [TestFixtureSetUp] public virtual void BeforeTests() { - var cfg = new IgniteConfiguration + Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) { IgniteInstanceName = GridName, - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = "config\\native-client-test-cache-store.xml", - BinaryConfiguration = new BinaryConfiguration(typeof (Key), typeof (Value)) - }; - - Ignition.Start(cfg); + }); } /// @@ -695,12 +690,4 @@ namespace Apache.Ignite.Core.Tests.Cache.Store throw new Exception("Expected exception in ExceptionalEntryFilter"); } } - - /// - /// Filter that can't be serialized. - /// - public class InvalidCacheEntryFilter : CacheEntryFilter - { - // No-op. - } } http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/TestReferenceObject.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/TestReferenceObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/TestReferenceObject.cs new file mode 100644 index 0000000..c8c433e --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/TestReferenceObject.cs @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Core.Tests.Cache +{ + /// + /// Test object with self-reference. + /// + public class TestReferenceObject + { + public TestReferenceObject Obj; + + /// + /// Default constructor. + /// + public TestReferenceObject() + { + // No-op. + } + + public TestReferenceObject(TestReferenceObject obj) + { + Obj = obj; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs index 65bb369..e60ad4a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs @@ -84,7 +84,7 @@ namespace Apache.Ignite.Core.Tests.Compute if (_fork) { - Grid1 = Ignition.Start(Configuration("config\\compute\\compute-standalone.xml")); + Grid1 = Ignition.Start(GetConfiguration("config\\compute\\compute-standalone.xml")); _proc2 = Fork("config\\compute\\compute-standalone.xml"); @@ -114,9 +114,9 @@ namespace Apache.Ignite.Core.Tests.Compute } else { - Grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml")); - _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml")); - _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml")); + Grid1 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid1.xml")); + _grid2 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid2.xml")); + _grid3 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid3.xml")); } } @@ -138,20 +138,11 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// Path to Java XML configuration. /// Node configuration. - private IgniteConfiguration Configuration(string path) + private static IgniteConfiguration GetConfiguration(string path) { - return new IgniteConfiguration + return new IgniteConfiguration(TestUtils.GetTestConfiguration()) { - JvmClasspath = TestUtils.CreateTestClasspath(), - JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = path, - BinaryConfiguration = _fork - ? null - : new BinaryConfiguration - { - TypeConfigurations = - (GetBinaryTypes() ?? new Type[0]).Select(t => new BinaryTypeConfiguration(t)).ToList() - } }; } @@ -174,14 +165,6 @@ namespace Apache.Ignite.Core.Tests.Compute } /// - /// Define binary types. - /// - protected virtual ICollection GetBinaryTypes() - { - return null; - } - - /// /// Gets the server count. /// protected int GetServerCount() http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs index c169f1e..051917b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs @@ -18,7 +18,6 @@ namespace Apache.Ignite.Core.Tests.Compute { using System; - using System.Collections.Generic; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Compute; using NUnit.Framework; @@ -26,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// Closure execution tests for binary objects. /// + [TestFixture] public class BinarizableClosureTaskTest : ClosureTaskTest { /// @@ -40,18 +40,6 @@ namespace Apache.Ignite.Core.Tests.Compute protected BinarizableClosureTaskTest(bool fork) : base(fork) { } /** */ - protected override ICollection GetBinaryTypes() - { - return new [] - { - typeof(BinarizableOutFunc), - typeof(BinarizableFunc), - typeof(BinarizableResult), - typeof(BinarizableException) - }; - } - - /** */ protected override IComputeFunc OutFunc(bool err) { return new BinarizableOutFunc(err); http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs index 6bdfd9c..8399fba 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs @@ -17,7 +17,6 @@ namespace Apache.Ignite.Core.Tests.Compute { - using System; using System.Collections.Generic; using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; @@ -71,20 +70,6 @@ namespace Apache.Ignite.Core.Tests.Compute return (IBinaryObject) cache.Get(1); } - /** */ - protected override ICollection GetBinaryTypes() - { - return new[] - { - typeof(BinarizableJobResult), - typeof(BinarizableTaskArgument), - typeof(BinarizableTaskResult), - typeof(BinarizableJobArgument), - typeof(BinarizableJob), - typeof(BinarizableWrapper) - }; - } - /// /// Test task. /// http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/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 316e5d0..d675d14 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs @@ -169,14 +169,7 @@ namespace Apache.Ignite.Core.Tests.Compute [TestFixtureTearDown] public void StopClient() { - if (_grid1 != null) - Ignition.Stop(_grid1.Name, true); - - if (_grid2 != null) - Ignition.Stop(_grid2.Name, true); - - if (_grid3 != null) - Ignition.Stop(_grid3.Name, true); + Ignition.StopAll(true); } [TearDown] http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTestFullFooter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTestFullFooter.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTestFullFooter.cs index 1b1f98a..a0d54e4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTestFullFooter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTestFullFooter.cs @@ -19,10 +19,12 @@ namespace Apache.Ignite.Core.Tests.Compute { using System; using System.IO; + using NUnit.Framework; /// /// Compute API test with compact footers disabled. /// + [TestFixture] public class ComputeApiTestFullFooter : ComputeApiTest { /// @@ -49,7 +51,7 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// Replaces the footer setting. /// - public static string ReplaceFooterSetting(string path) + internal static string ReplaceFooterSetting(string path) { var text = File.ReadAllText(path).Replace( "property name=\"compactFooter\" value=\"true\"", http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs index 1987245..9eb87c0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs @@ -109,12 +109,6 @@ namespace Apache.Ignite.Core.Tests.Compute _gridName = null; } - /** */ - protected override ICollection GetBinaryTypes() - { - return new[] {typeof(TestBinarizableJob)}; - } - /// /// Test task. /// http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs index c693a8b..546ca58 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs @@ -15,6 +15,12 @@ * limitations under the License. */ +// ReSharper disable UnusedMember.Local +// ReSharper disable UnusedMember.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Local +// ReSharper disable UnassignedField.Global namespace Apache.Ignite.Core.Tests.Compute { using System; @@ -98,12 +104,6 @@ namespace Apache.Ignite.Core.Tests.Compute Assert.AreEqual(GetServerCount(), res); } - /** */ - protected override ICollection GetBinaryTypes() - { - return new[] {typeof(InjectionJobBinarizable)}; - } - /// /// Injection task. /// @@ -191,7 +191,7 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// /// - public InjectionJob(SerializationInfo info, StreamingContext context) : base(info, context) + protected InjectionJob(SerializationInfo info, StreamingContext context) : base(info, context) { // No-op. } @@ -264,24 +264,6 @@ namespace Apache.Ignite.Core.Tests.Compute StaticGrid2 = grid; } - /// - /// - /// - public InjectionClosure() - { - // No-op. - } - - /// - /// - /// - /// - /// - public InjectionClosure(SerializationInfo info, StreamingContext context) - { - // No-op. - } - /** */ [InstanceResource] private readonly IIgnite _grid1 = null; @@ -355,12 +337,6 @@ namespace Apache.Ignite.Core.Tests.Compute } /** */ - public void GetObjectData(SerializationInfo info, StreamingContext context) - { - // No-op. - } - - /** */ public int Invoke(int arg) { CheckInjection(); @@ -459,7 +435,7 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// /// - public Injectee() + protected Injectee() { // No-op. } @@ -469,7 +445,7 @@ namespace Apache.Ignite.Core.Tests.Compute /// /// /// - public Injectee(SerializationInfo info, StreamingContext context) + protected Injectee(SerializationInfo info, StreamingContext context) { // No-op. } @@ -595,24 +571,6 @@ namespace Apache.Ignite.Core.Tests.Compute [Serializable] public class NoResultCacheJob : IComputeJob { - /// - /// - /// - public NoResultCacheJob() - { - // No-op. - } - - /// - /// - /// - /// - /// - public NoResultCacheJob(SerializationInfo info, StreamingContext context) - { - // No-op. - } - /** */ public int Execute() {