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/04/19 12:03:08 UTC
[2/2] ignite git commit: IGNITE-5001 .NET: Tests cleanup
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-2.0
Commit: d76a7299a209c0282b9d7c1c97ea9f8c783d9ce6
Parents: 5dab5fb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Apr 19 15:02:59 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
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 @@
<Compile Include="Binary\Serializable\SqlDmlTest.cs" />
<Compile Include="Binary\TypeNameParserTest.cs" />
<Compile Include="Binary\TypeResolverTest.cs" />
+ <Compile Include="Cache\AddArgCacheEntryProcessor.cs" />
<Compile Include="Cache\Affinity\AffinityKeyTest.cs" />
<Compile Include="Cache\Affinity\AffinityTopologyVersionTest.cs" />
+ <Compile Include="Cache\BinarizableAddArgCacheEntryProcessor.cs" />
+ <Compile Include="Cache\BinarizableTestException.cs" />
<Compile Include="Cache\CacheMetricsTest.cs" />
<Compile Include="Cache\CacheResultTest.cs" />
+ <Compile Include="Cache\CacheTestKey.cs" />
+ <Compile Include="Cache\NonSerializableCacheEntryProcessor.cs" />
+ <Compile Include="Cache\NonSerializableException.cs" />
<Compile Include="Cache\Query\CacheDmlQueriesTest.cs" />
<Compile Include="Cache\CacheAbstractTransactionalTest.cs" />
<Compile Include="Cache\Query\CacheDmlQueriesTestSimpleName.cs" />
@@ -96,6 +102,7 @@
<Compile Include="Cache\Query\CacheQueriesTestSimpleName.cs" />
<Compile Include="Cache\Store\CacheStoreAdapterTest.cs" />
<Compile Include="Cache\Store\NamedNodeCacheStoreTest.cs" />
+ <Compile Include="Cache\TestReferenceObject.cs" />
<Compile Include="Collections\MultiValueDictionaryTest.cs" />
<Compile Include="Collections\ReadOnlyCollectionTest.cs" />
<Compile Include="Collections\ReadOnlyDictionaryTest.cs" />
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;
/// <summary>
/// Binary builder self test with dynamic type registration.
/// </summary>
+ [TestFixture]
public class BinaryBuilderSelfTestDynamicRegistration : BinaryBuilderSelfTest
{
/** <inheritdoc /> */
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;
/// <summary>
/// Builder test with simple names.
/// </summary>
+ [TestFixture]
public class BinaryBuilderSelfTestSimpleName : BinaryBuilderSelfTest
{
/** <inheritdoc /> */
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
/// </summary>
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;
+
+ /// <summary>
+ /// Cache entry processor that adds argument value to the entry value.
+ /// </summary>
+ [Serializable]
+ public class AddArgCacheEntryProcessor : ICacheEntryProcessor<int, int, int, int>
+ {
+ // 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; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AddArgCacheEntryProcessor"/> class.
+ /// </summary>
+ public AddArgCacheEntryProcessor()
+ {
+ Exists = true;
+ ThrowOnKey = -1;
+ }
+
+ /** <inheritdoc /> */
+ int ICacheEntryProcessor<int, int, int, int>.Process(IMutableCacheEntry<int, int> 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;
+ }
+
+ /** <inheritdoc /> */
+ public int Process(IMutableCacheEntry<int, int> 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
{
/// <summary>
- ///
+ /// Test set up.
/// </summary>
[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
/// <summary>
/// Affinity key.
/// </summary>
- 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;
+
+ /// <summary>
+ /// Binary add processor.
+ /// </summary>
+ public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
+ {
+ /** <inheritdoc /> */
+ 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);
+ }
+
+ /** <inheritdoc /> */
+ 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;
+
+ /// <summary>
+ /// Binary exception.
+ /// </summary>
+ public class BinarizableTestException : Exception, IBinarizable
+ {
+ /// <summary>
+ /// Gets or sets exception info.
+ /// </summary>
+ public string Info { get; set; }
+
+ /** <inheritdoc /> */
+ public override string Message
+ {
+ get { return Info; }
+ }
+
+ /** <inheritdoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.GetRawWriter().WriteString(Info);
+ }
+
+ /** <inheritdoc /> */
+ 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;
/// <summary>
- ///
+ /// Base cache test.
/// </summary>
- class CacheTestKey
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- public CacheTestKey(int id)
- {
- Id = id;
- }
-
- /// <summary>
- /// ID.
- /// </summary>
- public int Id
- {
- get;
- set;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- CacheTestKey other = obj as CacheTestKey;
-
- return other != null && Id == other.Id;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
- }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- return new StringBuilder()
- .Append(typeof(CacheTestKey).Name)
- .Append(" [id=").Append(Id)
- .Append(']').ToString();
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class TestReferenceObject
+ [SuppressMessage("ReSharper", "UnusedVariable")]
+ public abstract class CacheAbstractTest
{
- public TestReferenceObject Obj;
-
/// <summary>
- /// Default constructor.
+ /// Fixture setup.
/// </summary>
- 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;
- }
- }
- }
-
- /// <summary>
- /// Cache entry processor that adds argument value to the entry value.
- /// </summary>
- [Serializable]
- public class AddArgCacheEntryProcessor : ICacheEntryProcessor<int, int, int, int>
- {
- // 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; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AddArgCacheEntryProcessor"/> class.
- /// </summary>
- 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"
+ };
- /** <inheritdoc /> */
- int ICacheEntryProcessor<int, int, int, int>.Process(IMutableCacheEntry<int, int> 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;
- }
-
- /** <inheritdoc /> */
- public int Process(IMutableCacheEntry<int, int> entry, int arg)
- {
- throw new Exception("Invalid method");
- }
- }
-
- /// <summary>
- /// Binary add processor.
- /// </summary>
- public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
- {
- /** <inheritdoc /> */
- 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);
- }
-
- /** <inheritdoc /> */
- 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();
- }
- }
-
- /// <summary>
- /// Non-serializable processor.
- /// </summary>
- public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
- {
- /** <inheritdoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- throw new Exception("ExpectedException");
- }
-
- /** <inheritdoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- throw new Exception("ExpectedException");
- }
- }
-
- /// <summary>
- /// Binary exception.
- /// </summary>
- public class BinarizableTestException : Exception, IBinarizable
- {
- /// <summary>
- /// Gets or sets exception info.
- /// </summary>
- public string Info { get; set; }
-
- /** <inheritdoc /> */
- public override string Message
- {
- get { return Info; }
- }
-
- /** <inheritdoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.GetRawWriter().WriteString(Info);
- }
-
- /** <inheritdoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- Info = reader.GetRawReader().ReadString();
- }
- }
-
- /// <summary>
- /// Non-serializable exception.
- /// </summary>
- public class NonSerializableException : Exception, IBinarizable
- {
- /** <inheritdoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- throw new Exception("ExpectedException");
- }
-
- /** <inheritdoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- throw new Exception("ExpectedException");
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [SuppressMessage("ReSharper", "UnusedVariable")]
- public abstract class CacheAbstractTest {
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public virtual void StartGrids() {
- TestUtils.KillProcesses();
-
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- BinaryConfiguration portCfg = new BinaryConfiguration();
-
- ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
-
- 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
}
/// <summary>
- ///
+ /// Fixture teardown.
/// </summary>
[TestFixtureTearDown]
- public virtual void StopGrids() {
- for (int i = 0; i < GridCount(); i++)
- Ignition.Stop("grid-" + i, true);
+ public void StopGrids()
+ {
+ Ignition.StopAll(true);
}
/// <summary>
///
/// </summary>
[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
///
/// </summary>
[TearDown]
- public virtual void AfterTest() {
+ public void AfterTest() {
for (int i = 0; i < GridCount(); i++)
Cache(i).WithKeepBinary<object, object>().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<int, int> Cache(int idx) {
+ private ICache<int, int> Cache(int idx) {
return Cache<int, int>(idx);
}
- public ICache<TK, TV> Cache<TK, TV>(int idx) {
+ private ICache<TK, TV> Cache<TK, TV>(int idx) {
return GetIgnite(idx).GetCache<TK, TV>(CacheName());
}
- public ICache<int, int> Cache()
+ protected ICache<int, int> Cache()
{
return Cache<int, int>(0);
}
- public ICache<TK, TV> Cache<TK, TV>()
+ private ICache<TK, TV> Cache<TK, TV>()
{
return Cache<TK, TV>(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
/// <summary>
/// Expiry policy tests.
/// </summary>
- public void TestWithExpiryPolicy(Func<ICache<int, int>, IExpiryPolicy, ICache<int, int>> withPolicyFunc,
+ private void TestWithExpiryPolicy(Func<ICache<int, int>, IExpiryPolicy, ICache<int, int>> withPolicyFunc,
bool origCache)
{
ICache<int, int> 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<int> keys = PrimaryKeysForCache(cache, 3);
+ List<int> 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<int> keys = PrimaryKeysForCache(cache, 2);
+ List<int> 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<int> keys = PrimaryKeysForCache(cache, 2);
+ List<int> 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<int> keys = PrimaryKeysForCache(cache, 3);
+ List<int> 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<CacheTestKey, BinarizablePerson>();
@@ -2457,7 +2194,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
}
- public void TestInvokeAll<T>(bool async, int entryCount) where T : AddArgCacheEntryProcessor, new()
+ private void TestInvokeAll<T>(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<int, int> cache)
+ private static int GetPrimaryKeyForCache(ICache<int, int> cache)
{
- return PrimaryKeysForCache(cache, 1, 0).First();
+ return GetPrimaryKeysForCacheFrom(cache, 0).First();
}
- protected static int PrimaryKeyForCache(ICache<int, int> cache, int startFrom)
+ private static int GetPrimaryKeyForCache(ICache<int, int> cache, int startFrom)
{
- return PrimaryKeysForCache(cache, 1, startFrom).First();
+ return GetPrimaryKeysForCacheFrom(cache, startFrom).First();
}
- protected static List<int> PrimaryKeysForCache(ICache<int, int> cache, int cnt)
+ private static List<int> GetPrimaryKeysForCache(ICache<int, int> cache, int cnt)
{
- return PrimaryKeysForCache(cache, cnt, 0).Take(cnt).ToList();
+ return GetPrimaryKeysForCacheFrom(cache, 0).Take(cnt).ToList();
}
- protected static IEnumerable<int> PrimaryKeysForCache(ICache<int, int> cache, int cnt, int startFrom)
+ private static IEnumerable<int> GetPrimaryKeysForCacheFrom(ICache<int, int> 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<int, int> cache)
+ private static int NearKeyForCache(ICache<int, int> cache)
{
IClusterNode node = cache.Ignite.GetCluster().GetLocalNode();
@@ -2781,7 +2518,7 @@ namespace Apache.Ignite.Core.Tests.Cache
return 0;
}
- protected static string GetKeyAffinity(ICache<int, int> cache, int key)
+ private static string GetKeyAffinity(ICache<int, int> 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;
}
+
+ /// <summary>
+ /// Test serializable object.
+ /// </summary>
+ [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);
}
/// <summary>
@@ -81,24 +77,12 @@ namespace Apache.Ignite.Core.Tests.Cache
/// <returns>Configuration.</returns>
private static IgniteConfiguration CreateConfiguration(string name, string springCfg)
{
- var cfg = new IgniteConfiguration();
-
- BinaryConfiguration portCfg = new BinaryConfiguration();
-
- ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
-
- 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
+ };
}
/// <summary>
@@ -145,16 +129,14 @@ namespace Apache.Ignite.Core.Tests.Cache
/// Check routine.
/// </summary>
/// <param name="cacheName">Cache name.</param>
- private void Check(string cacheName)
+ private static void Check(string cacheName)
{
- ICache<DynamicTestKey, DynamicTestValue> cacheData =
- Ignition.GetIgnite(GridData).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
+ var cacheData = Ignition.GetIgnite(GridData).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
- ICache<DynamicTestKey, DynamicTestValue> cacheDataNoCfg =
+ var cacheDataNoCfg =
Ignition.GetIgnite(GridDataNoCfg).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
- ICache<DynamicTestKey, DynamicTestValue> cacheClient =
- Ignition.GetIgnite(GridClient).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
+ var cacheClient = Ignition.GetIgnite(GridClient).GetCache<DynamicTestKey, DynamicTestValue>(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);
}
- }
-
- /// <summary>
- /// Key for dynamic cache start tests.
- /// </summary>
- class DynamicTestKey
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public DynamicTestKey()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- public DynamicTestKey(int id)
- {
- Id = id;
- }
/// <summary>
- /// ID.
+ /// Key for dynamic cache start tests.
/// </summary>
- public int Id
+ private class DynamicTestKey
{
- get;
- set;
- }
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="id">ID.</param>
+ public DynamicTestKey(int id)
+ {
+ Id = id;
+ }
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- DynamicTestKey other = obj as DynamicTestKey;
+ /// <summary>
+ /// ID.
+ /// </summary>
+ public int Id { get; set; }
- return other != null && Id == other.Id;
- }
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ DynamicTestKey other = obj as DynamicTestKey;
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
- }
- }
+ return other != null && Id == other.Id;
+ }
- /// <summary>
- /// Value for dynamic cache start tests.
- /// </summary>
- class DynamicTestValue
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public DynamicTestValue()
- {
- // No-op.
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return Id;
+ }
}
/// <summary>
- /// Constructor.
+ /// Value for dynamic cache start tests.
/// </summary>
- /// <param name="id">ID.</param>
- public DynamicTestValue(int id)
+ private class DynamicTestValue
{
- Id = id;
- }
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="id">ID.</param>
+ public DynamicTestValue(int id)
+ {
+ Id = id;
+ }
- /// <summary>
- /// ID.
- /// </summary>
- public int Id
- {
- get;
- set;
- }
+ /// <summary>
+ /// ID.
+ /// </summary>
+ public int Id { get; set; }
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- DynamicTestValue other = obj as DynamicTestValue;
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ DynamicTestValue other = obj as DynamicTestValue;
- return other != null && Id == other.Id;
- }
+ return other != null && Id == other.Id;
+ }
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
+ /** <inheritdoc /> */
+ 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));
}
/// <summary>
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;
+
+ /// <summary>
+ /// Test key.
+ /// </summary>
+ internal class CacheTestKey
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="id">ID.</param>
+ public CacheTestKey(int id)
+ {
+ Id = id;
+ }
+
+ /// <summary>
+ /// ID.
+ /// </summary>
+ public int Id
+ {
+ get;
+ set;
+ }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
+ {
+ CacheTestKey other = obj as CacheTestKey;
+
+ return other != null && Id == other.Id;
+ }
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return Id;
+ }
+
+ /** <inheritdoc /> */
+ 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;
+
+ /// <summary>
+ /// Non-serializable processor.
+ /// </summary>
+ public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
+ {
+ /** <inheritdoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ throw new Exception("ExpectedException");
+ }
+
+ /** <inheritdoc /> */
+ 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;
+
+ /// <summary>
+ /// Non-serializable exception.
+ /// </summary>
+ public class NonSerializableException : Exception, IBinarizable
+ {
+ /** <inheritdoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ throw new Exception("ExpectedException");
+ }
+
+ /** <inheritdoc /> */
+ 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;
/// <summary>
- ///
+ /// Fixture setup.
/// </summary>
[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<QueryPerson>)),
- new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<BinaryObject>))
+ 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
}
/// <summary>
- ///
+ /// Fixture teardown.
/// </summary>
[TestFixtureTearDown]
public void StopGrids()
{
- for (int i = 0; i < GridCnt; i++)
- Ignition.Stop("grid-" + i, true);
+ Ignition.StopAll(true);
}
/// <summary>
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<IgniteException>(() => 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<IgniteException>(() => 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<IgniteException>(() => 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
/// <summary>
/// Tests query in a cluster with Java-only and .NET nodes.
/// </summary>
+ [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<BinaryTypeConfiguration>
- {
- 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);
+ });
}
/// <summary>
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);
+ });
}
/// <summary>
@@ -695,12 +690,4 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
throw new Exception("Expected exception in ExceptionalEntryFilter");
}
}
-
- /// <summary>
- /// Filter that can't be serialized.
- /// </summary>
- 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
+{
+ /// <summary>
+ /// Test object with self-reference.
+ /// </summary>
+ public class TestReferenceObject
+ {
+ public TestReferenceObject Obj;
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ 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
/// </summary>
/// <param name="path">Path to Java XML configuration.</param>
/// <returns>Node configuration.</returns>
- 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
}
/// <summary>
- /// Define binary types.
- /// </summary>
- protected virtual ICollection<Type> GetBinaryTypes()
- {
- return null;
- }
-
- /// <summary>
/// Gets the server count.
/// </summary>
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
/// <summary>
/// Closure execution tests for binary objects.
/// </summary>
+ [TestFixture]
public class BinarizableClosureTaskTest : ClosureTaskTest
{
/// <summary>
@@ -40,18 +40,6 @@ namespace Apache.Ignite.Core.Tests.Compute
protected BinarizableClosureTaskTest(bool fork) : base(fork) { }
/** <inheritDoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new []
- {
- typeof(BinarizableOutFunc),
- typeof(BinarizableFunc),
- typeof(BinarizableResult),
- typeof(BinarizableException)
- };
- }
-
- /** <inheritDoc /> */
protected override IComputeFunc<object> 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);
}
- /** <inheritDoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new[]
- {
- typeof(BinarizableJobResult),
- typeof(BinarizableTaskArgument),
- typeof(BinarizableTaskResult),
- typeof(BinarizableJobArgument),
- typeof(BinarizableJob),
- typeof(BinarizableWrapper)
- };
- }
-
/// <summary>
/// Test task.
/// </summary>
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;
/// <summary>
/// Compute API test with compact footers disabled.
/// </summary>
+ [TestFixture]
public class ComputeApiTestFullFooter : ComputeApiTest
{
/// <summary>
@@ -49,7 +51,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Replaces the footer setting.
/// </summary>
- 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;
}
- /** <inheritDoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new[] {typeof(TestBinarizableJob)};
- }
-
/// <summary>
/// Test task.
/// </summary>
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);
}
- /** <inheritdoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new[] {typeof(InjectionJobBinarizable)};
- }
-
/// <summary>
/// Injection task.
/// </summary>
@@ -191,7 +191,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- 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;
}
- /// <summary>
- ///
- /// </summary>
- public InjectionClosure()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public InjectionClosure(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
/** */
[InstanceResource]
private readonly IIgnite _grid1 = null;
@@ -355,12 +337,6 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
public int Invoke(int arg)
{
CheckInjection();
@@ -459,7 +435,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
///
/// </summary>
- public Injectee()
+ protected Injectee()
{
// No-op.
}
@@ -469,7 +445,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
- 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<int>
{
- /// <summary>
- ///
- /// </summary>
- public NoResultCacheJob()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public NoResultCacheJob(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
/** <inheritDoc /> */
public int Execute()
{