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:07 UTC
[1/2] ignite git commit: IGNITE-5001 .NET: Tests cleanup
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 5dab5fb65 -> d76a7299a
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
index 8db4876..9f1ae68 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
@@ -25,6 +25,7 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Closure execution tests for serializable objects.
/// </summary>
+ [TestFixture]
public class SerializableClosureTaskTest : ClosureTaskTest
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
index 32a28a7..8d23fc4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
@@ -100,12 +100,6 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
- /** <inheritDoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new[] { typeof(BinarizableJob) };
- }
-
/// <summary>
/// Test task.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
index 289b68b..2fb698f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
@@ -154,18 +154,6 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(101 * 1024, res.Length);
}
- /** <inheritDoc /> */
- protected override ICollection<Type> GetBinaryTypes()
- {
- return new[]
- {
- typeof(BinarizableResult),
- typeof(TestBinarizableJob),
- typeof(BinarizableOutFunc),
- typeof(BinarizableFunc)
- };
- }
-
[Test]
public void TestOutFuncResultPrimitive1()
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
index 33c7704..eb025f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
@@ -25,8 +25,6 @@ namespace Apache.Ignite.Core.Tests.Dataload
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Tests.Cache;
using NUnit.Framework;
/// <summary>
@@ -34,9 +32,6 @@ namespace Apache.Ignite.Core.Tests.Dataload
/// </summary>
public sealed class DataStreamerTest
{
- /** Node name. */
- private const string GridName = "grid";
-
/** Cache name. */
private const string CacheName = "partitioned";
@@ -52,15 +47,18 @@ namespace Apache.Ignite.Core.Tests.Dataload
[TestFixtureSetUp]
public void InitClient()
{
- _grid = Ignition.Start(GetIgniteConfiguration(GridName));
+ _grid = Ignition.Start(TestUtils.GetTestConfiguration());
- Ignition.Start(GetIgniteConfiguration(GridName + "_1"));
+ Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ IgniteInstanceName = "grid1"
+ });
- _cache = _grid.GetCache<int, int?>(CacheName);
+ _cache = _grid.CreateCache<int, int?>(CacheName);
}
/// <summary>
- ///
+ /// Fixture teardown.
/// </summary>
[TestFixtureTearDown]
public void StopGrids()
@@ -458,45 +456,6 @@ namespace Apache.Ignite.Core.Tests.Dataload
}
/// <summary>
- /// Gets the Ignite configuration.
- /// </summary>
- /// <param name="gridName">Grid name.</param>
- private static IgniteConfiguration GetIgniteConfiguration(string gridName)
- {
- return new IgniteConfiguration
- {
- IgniteInstanceName = gridName,
- SpringConfigUrl = "config\\native-client-test-cache.xml",
- JvmClasspath = TestUtils.CreateTestClasspath(),
- BinaryConfiguration = new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (CacheTestKey)),
- new BinaryTypeConfiguration(typeof (TestReferenceObject)),
- new BinaryTypeConfiguration(typeof (StreamReceiverBinarizable)),
- new BinaryTypeConfiguration(typeof (EntryProcessorBinarizable)),
- new BinaryTypeConfiguration(typeof (BinarizableEntry))
- }
- },
- JvmOptions = TestUtils.TestJavaOptions().Concat(new[]
- {
- "-Xms3096m",
- "-Xmx3096m",
- "-XX:+UseParNewGC",
- "-XX:+UseConcMarkSweepGC",
- "-XX:+UseTLAB",
- "-XX:NewSize=128m",
- "-XX:MaxNewSize=128m",
- "-XX:MaxTenuringThreshold=0",
- "-XX:SurvivorRatio=1024",
- "-XX:+UseCMSInitiatingOccupancyOnly",
- "-XX:CMSInitiatingOccupancyFraction=60"
- }).ToArray()
- };
- }
-
- /// <summary>
/// Test binarizable receiver.
/// </summary>
private class StreamReceiverBinarizable : IStreamReceiver<int, int>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
index 5f2ecfa..74da531 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/DeploymentTest.cs
@@ -125,11 +125,9 @@ namespace Apache.Ignite.Core.Tests
/// </summary>
private static void VerifyNodeStarted(string exePath)
{
- using (var ignite = Ignition.Start(new IgniteConfiguration
+ using (var ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
SpringConfigUrl = "config\\compute\\compute-grid1.xml",
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions()
}))
{
Assert.IsTrue(ignite.WaitTopology(2));
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 6f0e2d1..545a5c5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedParameter.Global
#pragma warning disable 618
namespace Apache.Ignite.Core.Tests
{
@@ -24,7 +26,7 @@ namespace Apache.Ignite.Core.Tests
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
- using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Query;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
@@ -691,21 +693,14 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Gets the Ignite configuration.
/// </summary>
- private static IgniteConfiguration GetConfiguration(string springConfigUrl)
+ private static IgniteConfiguration GetConfiguration(string name, bool client = false)
{
- return new IgniteConfiguration
+ return new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
- SpringConfigUrl = springConfigUrl,
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- BinaryConfiguration = new BinaryConfiguration
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>
- {
- new BinaryTypeConfiguration(typeof (RemoteEventBinarizableFilter))
- }
- },
- EventStorageSpi = new MemoryEventStorageSpi()
+ IgniteInstanceName = name,
+ EventStorageSpi = new MemoryEventStorageSpi(),
+ CacheConfiguration = new [] {new CacheConfiguration() },
+ ClientMode = client
};
}
@@ -792,9 +787,9 @@ namespace Apache.Ignite.Core.Tests
if (_grid1 != null)
return;
- _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"));
+ _grid1 = Ignition.Start(GetConfiguration("grid1"));
+ _grid2 = Ignition.Start(GetConfiguration("grid2"));
+ _grid3 = Ignition.Start(GetConfiguration("grid3", true));
_grids = new[] {_grid1, _grid2, _grid3};
}
@@ -975,42 +970,6 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
- /// Binary remote event filter.
- /// </summary>
- public class RemoteEventBinarizableFilter : IEventFilter<IEvent>, IBinarizable
- {
- /** */
- private int _type;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RemoteEventBinarizableFilter"/> class.
- /// </summary>
- /// <param name="type">The event type.</param>
- public RemoteEventBinarizableFilter(int type)
- {
- _type = type;
- }
-
- /** <inheritdoc /> */
- public bool Invoke(IEvent evt)
- {
- return evt.Type == _type;
- }
-
- /** <inheritdoc /> */
- public void WriteBinary(IBinaryWriter writer)
- {
- writer.GetRawWriter().WriteInt(_type);
- }
-
- /** <inheritdoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- _type = reader.GetRawReader().ReadInt();
- }
- }
-
- /// <summary>
/// Event test case.
/// </summary>
public class EventTestCase
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
index 7217e1a..d84e6dc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -340,7 +340,7 @@ namespace Apache.Ignite.Core.Tests
{
using (var grid = StartGrid())
{
- var cache = grid.GetCache<TK, int>("partitioned_atomic").WithNoRetries();
+ var cache = grid.GetOrCreateCache<TK, int>("partitioned_atomic").WithNoRetries();
if (typeof (TK) == typeof (IBinaryObject))
cache = cache.WithKeepBinary<TK, int>();
@@ -416,11 +416,8 @@ namespace Apache.Ignite.Core.Tests
/// </summary>
private static IIgnite StartGrid(string gridName = null)
{
- return Ignition.Start(new IgniteConfiguration
+ return Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
- SpringConfigUrl = "config\\native-client-test-cache.xml",
- JvmOptions = TestUtils.TestJavaOptions(),
- JvmClasspath = TestUtils.CreateTestClasspath(),
IgniteInstanceName = gridName,
BinaryConfiguration = new BinaryConfiguration
{
@@ -458,7 +455,8 @@ namespace Apache.Ignite.Core.Tests
/** <inheritDoc /> */
public override bool Equals(object obj)
{
- return obj is BinarizableEntry && ((BinarizableEntry)obj)._val == _val;
+ var entry = obj as BinarizableEntry;
+ return entry != null && entry._val == _val;
}
}
@@ -489,7 +487,8 @@ namespace Apache.Ignite.Core.Tests
/** <inheritDoc /> */
public override bool Equals(object obj)
{
- return obj is SerializableEntry && ((SerializableEntry)obj)._val == _val;
+ var entry = obj as SerializableEntry;
+ return entry != null && entry._val == _val;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
index dbac120..8f422f4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs
@@ -38,7 +38,7 @@ namespace Apache.Ignite.Core.Tests
public class ExecutableTest
{
/** Spring configuration path. */
- private static readonly string SpringCfgPath = "config\\compute\\compute-standalone.xml";
+ private const string SpringCfgPath = "config\\compute\\compute-standalone.xml";
/** Min memory Java task. */
private const string MinMemTask = "org.apache.ignite.platform.PlatformMinMemoryTask";
@@ -57,7 +57,18 @@ namespace Apache.Ignite.Core.Tests
{
TestUtils.KillProcesses();
- _grid = Ignition.Start(Configuration(SpringCfgPath));
+ _grid = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ BinaryConfiguration = new BinaryConfiguration
+ {
+ TypeConfigurations = new List<BinaryTypeConfiguration>
+ {
+ new BinaryTypeConfiguration(typeof(RemoteConfiguration)),
+ new BinaryTypeConfiguration(typeof(RemoteConfigurationClosure))
+ }
+ },
+ SpringConfigUrl = SpringCfgPath
+ });
Assert.IsTrue(_grid.WaitTopology(1));
@@ -354,48 +365,6 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
- /// Configuration for node.
- /// </summary>
- /// <param name="path">Path to Java XML configuration.</param>
- /// <returns>Node configuration.</returns>
- private static IgniteConfiguration Configuration(string path)
- {
- var cfg = new IgniteConfiguration();
-
-
- var portCfg = new BinaryConfiguration();
-
- ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
-
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof (RemoteConfiguration)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof (RemoteConfigurationClosure)));
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.BinaryConfiguration = portCfg;
-
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
-
- cfg.JvmOptions = new List<string>
- {
- "-ea",
- "-Xcheck:jni",
- "-Xms4g",
- "-Xmx4g",
- "-DIGNITE_QUIET=false",
- "-Xnoagent",
- "-Djava.compiler=NONE",
- "-Xdebug",
- "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",
- "-XX:+HeapDumpOnOutOfMemoryError"
- };
-
- cfg.SpringConfigUrl = path;
-
- return cfg;
- }
-
- /// <summary>
///
/// </summary>
/// <param name="outputPath"></param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
index bc1f08f..4abd75e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/FutureTest.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Tests
{
using System;
- using System.Collections.Generic;
using System.Threading;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
@@ -42,21 +41,9 @@ namespace Apache.Ignite.Core.Tests
[TestFixtureSetUp]
public void TestFixtureSetUp()
{
- TestUtils.KillProcesses();
+ var grid = Ignition.Start(TestUtils.GetTestConfiguration());
- var grid = Ignition.Start(new IgniteConfiguration
- {
- SpringConfigUrl = "config\\compute\\compute-standalone.xml",
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- BinaryConfiguration = new BinaryConfiguration
- {
- TypeConfigurations =
- new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof(Binarizable)) }
- }
- });
-
- _cache = grid.GetCache<object, object>(null);
+ _cache = grid.CreateCache<object, object>("cache");
_compute = grid.GetCompute();
}
@@ -68,7 +55,6 @@ namespace Apache.Ignite.Core.Tests
public void TestFixtureTearDown()
{
Ignition.StopAll(true);
- TestUtils.KillProcesses();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
index bc40f48..2c9a63b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
@@ -35,16 +35,7 @@ namespace Apache.Ignite.Core.Tests
public class IgniteStartStopTest
{
/// <summary>
- ///
- /// </summary>
- [SetUp]
- public void SetUp()
- {
- TestUtils.KillProcesses();
- }
-
- /// <summary>
- ///
+ /// Test teardown.
/// </summary>
[TearDown]
public void TearDown()
@@ -170,27 +161,17 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestStartTheSameName()
{
- var cfg = new IgniteConfiguration
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
SpringConfigUrl = "config\\start-test-grid1.xml",
- JvmOptions = TestUtils.TestJavaOptions(),
- JvmClasspath = TestUtils.CreateTestClasspath()
};
var grid1 = Ignition.Start(cfg);
Assert.AreEqual("grid1", grid1.Name);
-
- try
- {
- Ignition.Start(cfg);
-
- Assert.Fail("Start should fail.");
- }
- catch (IgniteException e)
- {
- Console.WriteLine("Expected exception: " + e);
- }
+
+ var ex = Assert.Throws<IgniteException>(() => Ignition.Start(cfg));
+ Assert.AreEqual("Ignite instance with this name has already been started: grid1", ex.Message);
}
/// <summary>
@@ -216,11 +197,9 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestUsageAfterStop()
{
- var cfg = new IgniteConfiguration
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
SpringConfigUrl = "config\\start-test-grid1.xml",
- JvmOptions = TestUtils.TestJavaOptions(),
- JvmClasspath = TestUtils.CreateTestClasspath()
};
var grid = Ignition.Start(cfg);
@@ -229,16 +208,10 @@ namespace Apache.Ignite.Core.Tests
grid.Dispose();
- try
- {
- grid.GetCache<int, int>("cache1");
-
- Assert.Fail();
- }
- catch (InvalidOperationException e)
- {
- Console.WriteLine("Expected exception: " + e);
- }
+ var ex = Assert.Throws<InvalidOperationException>(() => grid.GetCache<int, int>("cache1"));
+ Assert.AreEqual("Grid is in invalid state to perform this operation. " +
+ "It either not started yet or has already being or have stopped " +
+ "[igniteInstanceName=grid1, state=STOPPED]", ex.Message);
}
/// <summary>
@@ -285,18 +258,14 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestClientMode()
{
- var servCfg = new IgniteConfiguration
+ var servCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
SpringConfigUrl = "config\\start-test-grid1.xml",
- JvmOptions = TestUtils.TestJavaOptions(),
- JvmClasspath = TestUtils.CreateTestClasspath()
};
- var clientCfg = new IgniteConfiguration
+ var clientCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
SpringConfigUrl = "config\\start-test-grid2.xml",
- JvmOptions = TestUtils.TestJavaOptions(),
- JvmClasspath = TestUtils.CreateTestClasspath()
};
try
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteTestBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteTestBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteTestBase.cs
index a6ffd84..51ce585 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteTestBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteTestBase.cs
@@ -18,11 +18,8 @@
namespace Apache.Ignite.Core.Tests
{
using System;
- using System.Collections.Generic;
using System.Linq;
using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Messaging;
using NUnit.Framework;
/// <summary>
@@ -72,7 +69,7 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Gets the grid1.
/// </summary>
- public IIgnite Grid
+ protected IIgnite Grid
{
get { return _grids[0]; }
}
@@ -80,56 +77,24 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Gets the grid2.
/// </summary>
- public IIgnite Grid2
+ protected IIgnite Grid2
{
get { return _grids[1]; }
}
/// <summary>
- /// Gets the grid3.
- /// </summary>
- public IIgnite Grid3
- {
- get { return _grids[2]; }
- }
-
- /// <summary>
- /// Gets the events.
- /// </summary>
- public IEvents Events
- {
- get { return Grid.GetEvents(); }
- }
-
- /// <summary>
- /// Gets the messaging.
- /// </summary>
- public IMessaging Messaging
- {
- get { return Grid.GetMessaging(); }
- }
-
- /// <summary>
/// Gets the compute.
/// </summary>
- public ICompute Compute
+ protected ICompute Compute
{
get { return Grid.GetCompute(); }
}
/// <summary>
- /// Gets the grids.
- /// </summary>
- public ICollection<IIgnite> Grids
- {
- get { return _grids; }
- }
-
- /// <summary>
/// Fixture tear down.
/// </summary>
[TestFixtureTearDown]
- public virtual void FixtureTearDown()
+ public void FixtureTearDown()
{
StopGrids();
}
@@ -147,7 +112,7 @@ namespace Apache.Ignite.Core.Tests
/// Executes after each test.
/// </summary>
[TearDown]
- public virtual void TestTearDown()
+ public void TestTearDown()
{
try
{
@@ -178,11 +143,9 @@ namespace Apache.Ignite.Core.Tests
/// </summary>
protected virtual IgniteConfiguration GetConfiguration(string springConfigUrl)
{
- return new IgniteConfiguration
+ return new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
- SpringConfigUrl = springConfigUrl,
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions()
+ SpringConfigUrl = springConfigUrl
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LifecycleTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LifecycleTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LifecycleTest.cs
index 2180a74..8f16876 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LifecycleTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LifecycleTest.cs
@@ -15,6 +15,10 @@
* limitations under the License.
*/
+// ReSharper disable MemberCanBeProtected.Global
+// ReSharper disable UnassignedField.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+// ReSharper disable MemberCanBePrivate.Global
namespace Apache.Ignite.Core.Tests
{
using System;
@@ -171,16 +175,8 @@ namespace Apache.Ignite.Core.Tests
{
ThrowErr = true;
- try
- {
- Start(CfgNoBeans);
-
- Assert.Fail("Should not reach this place.");
- }
- catch (Exception e)
- {
- Assert.AreEqual(typeof(IgniteException), e.GetType());
- }
+ var ex = Assert.Throws<IgniteException>(() => Start(CfgNoBeans));
+ Assert.AreEqual("Lifecycle exception.", ex.Message);
}
/// <summary>
@@ -190,17 +186,11 @@ namespace Apache.Ignite.Core.Tests
/// <returns>Grid.</returns>
private static IIgnite Start(string cfgPath)
{
- TestUtils.JvmDebug = true;
-
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = cfgPath;
-
- cfg.LifecycleHandlers = new List<ILifecycleHandler> { new Bean(), new Bean() };
-
- return Ignition.Start(cfg);
+ return Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ SpringConfigUrl = cfgPath,
+ LifecycleHandlers = new List<ILifecycleHandler> {new Bean(), new Bean()}
+ });
}
/// <summary>
@@ -249,12 +239,13 @@ namespace Apache.Ignite.Core.Tests
if (LifecycleTest.ThrowErr)
throw new Exception("Lifecycle exception.");
- Event evt = new Event();
-
- evt.Grid1 = Grid1;
- evt.Grid2 = Grid2;
- evt.Prop1 = Property1;
- evt.Prop2 = Property2;
+ Event evt = new Event
+ {
+ Grid1 = Grid1,
+ Grid2 = Grid2,
+ Prop1 = Property1,
+ Prop2 = Property2
+ };
switch (evtType)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LoadDllTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LoadDllTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LoadDllTest.cs
index 25ffab3..e466642 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LoadDllTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/LoadDllTest.cs
@@ -192,16 +192,7 @@ namespace Apache.Ignite.Core.Tests
JvmClasspath = TestUtils.CreateTestClasspath()
};
- try
- {
- Ignition.Start(cfg);
-
- Assert.Fail("Grid has been started with broken configuration.");
- }
- catch (IgniteException)
- {
-
- }
+ Assert.Throws<IgniteException>(() => Ignition.Start(cfg));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
index a35aeff..f41474d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MessagingTest.cs
@@ -33,7 +33,7 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// <see cref="IMessaging"/> tests.
/// </summary>
- public class MessagingTest
+ public sealed class MessagingTest
{
/** */
private IIgnite _grid1;
@@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Tests
private IIgnite _grid3;
/** */
- public static int MessageId;
+ private static int _messageId;
/// <summary>
/// Executes before each test.
@@ -53,9 +53,9 @@ namespace Apache.Ignite.Core.Tests
[SetUp]
public void SetUp()
{
- _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("grid-1"));
+ _grid2 = Ignition.Start(GetConfiguration("grid-2"));
+ _grid3 = Ignition.Start(GetConfiguration("grid-3"));
Assert.AreEqual(3, _grid1.GetCluster().GetNodes().Count);
}
@@ -64,7 +64,7 @@ namespace Apache.Ignite.Core.Tests
/// Executes after each test.
/// </summary>
[TearDown]
- public virtual void TearDown()
+ public void TearDown()
{
try
{
@@ -94,7 +94,7 @@ namespace Apache.Ignite.Core.Tests
/// Tests LocalListen.
/// </summary>
[SuppressMessage("ReSharper", "AccessToModifiedClosure")]
- public void TestLocalListen(object topic)
+ private void TestLocalListen(object topic)
{
var messaging = _grid1.GetMessaging();
var listener = MessagingTestHelper.GetListener();
@@ -484,13 +484,11 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Gets the Ignite configuration.
/// </summary>
- private static IgniteConfiguration Configuration(string springConfigUrl)
+ private static IgniteConfiguration GetConfiguration(string name)
{
- return new IgniteConfiguration
+ return new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
- SpringConfigUrl = springConfigUrl,
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions()
+ IgniteInstanceName = name
};
}
@@ -508,7 +506,7 @@ namespace Apache.Ignite.Core.Tests
/// </summary>
private static int NextId()
{
- return Interlocked.Increment(ref MessageId);
+ return Interlocked.Increment(ref _messageId);
}
}
@@ -522,13 +520,13 @@ namespace Apache.Ignite.Core.Tests
public static readonly ConcurrentStack<string> ReceivedMessages = new ConcurrentStack<string>();
/** */
- public static readonly ConcurrentStack<string> Failures = new ConcurrentStack<string>();
+ private static readonly ConcurrentStack<string> Failures = new ConcurrentStack<string>();
/** */
- public static readonly CountdownEvent ReceivedEvent = new CountdownEvent(0);
+ private static readonly CountdownEvent ReceivedEvent = new CountdownEvent(0);
/** */
- public static readonly ConcurrentStack<Guid> LastNodeIds = new ConcurrentStack<Guid>();
+ private static readonly ConcurrentStack<Guid> LastNodeIds = new ConcurrentStack<Guid>();
/** */
public static volatile bool ListenResult = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d76a7299/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 67edede..dee0a80 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -30,9 +30,9 @@ namespace Apache.Ignite.Core.Impl.Binary
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Common;
- /**
- * <summary>Utilities for binary serialization.</summary>
- */
+ /// <summary>
+ /// Utilities for binary serialization.
+ /// </summary>
internal static class BinaryUtils
{
/** Header of NULL object. */
@@ -76,7 +76,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type: boolean. */
public const byte TypeBool = 8;
-
+
/** Type: decimal. */
public const byte TypeDecimal = 30;
@@ -133,7 +133,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type: map. */
public const byte TypeDictionary = 25;
-
+
/** Type: binary object. */
public const byte TypeBinary = 27;
@@ -142,13 +142,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type: enum array. */
public const byte TypeArrayEnum = 29;
-
+
/** Type: native job holder. */
public const byte TypeNativeJobHolder = 77;
- /** Type: Ignite proxy. */
- public const byte TypeIgniteProxy = 74;
-
/** Type: function wrapper. */
public const byte TypeComputeOutFuncJob = 80;
@@ -175,7 +172,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Type: entry predicate holder. */
public const byte TypeCacheEntryPredicateHolder = 90;
-
+
/** Type: message filter holder. */
public const byte TypeMessageListenerHolder = 92;
@@ -196,25 +193,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Collection: linked list. */
public const byte CollectionLinkedList = 2;
-
+
/** Map: custom. */
public const byte MapCustom = 0;
/** Map: hash map. */
public const byte MapHashMap = 1;
-
+
/** Byte "0". */
public const byte ByteZero = 0;
- /** Byte "1". */
- public const byte ByteOne = 1;
-
/** Indicates object array. */
public const int ObjTypeId = -1;
- /** Length of array size. */
- public const int LengthArraySize = 4;
-
/** Int type. */
public static readonly Type TypInt = typeof(int);
@@ -226,13 +217,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Ticks for Java epoch. */
private static readonly long JavaDateTicks = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
-
+
/** Bindig flags for static search. */
private const BindingFlags BindFlagsStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
/** System marshaller. */
private static readonly Marshaller Marsh = new Marshaller(
- new BinaryConfiguration {CompactFooter = false})
+ new BinaryConfiguration { CompactFooter = false })
{
RegistrationDisabled = true
};
@@ -335,31 +326,13 @@ namespace Apache.Ignite.Core.Impl.Binary
fixed (sbyte* res0 = res)
{
- stream.Read((byte*) res0, len);
+ stream.Read((byte*)res0, len);
}
return res;
}
/**
- * <summary>Read byte array.</summary>
- * <param name="data">Data.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static byte[] ReadByteArray(byte[] data, int pos) {
- int len = ReadInt(data, pos);
-
- pos += 4;
-
- byte[] res = new byte[len];
-
- Buffer.BlockCopy(data, pos, res, 0, len);
-
- return res;
- }
-
- /**
* <summary>Write short array.</summary>
* <param name="vals">Value.</param>
* <param name="stream">Output stream.</param>
@@ -384,7 +357,7 @@ namespace Apache.Ignite.Core.Impl.Binary
fixed (ushort* res0 = res)
{
- stream.Read((byte*) res0, len * 2);
+ stream.Read((byte*)res0, len * 2);
}
return res;
@@ -401,42 +374,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/**
- * <summary>Read int value.</summary>
- * <param name="data">Data array.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static int ReadInt(byte[] data, int pos) {
- int val = data[pos];
-
- val |= data[pos + 1] << 8;
- val |= data[pos + 2] << 16;
- val |= data[pos + 3] << 24;
-
- return val;
- }
-
- /**
- * <summary>Read long value.</summary>
- * <param name="data">Data array.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static long ReadLong(byte[] data, int pos) {
- long val = (long)(data[pos]) << 0;
-
- val |= (long)(data[pos + 1]) << 8;
- val |= (long)(data[pos + 2]) << 16;
- val |= (long)(data[pos + 3]) << 24;
- val |= (long)(data[pos + 4]) << 32;
- val |= (long)(data[pos + 5]) << 40;
- val |= (long)(data[pos + 6]) << 48;
- val |= (long)(data[pos + 7]) << 56;
-
- return val;
- }
-
- /**
* <summary>Write int array.</summary>
* <param name="vals">Value.</param>
* <param name="stream">Output stream.</param>
@@ -471,7 +408,7 @@ namespace Apache.Ignite.Core.Impl.Binary
fixed (uint* res0 = res)
{
- stream.Read((byte*) res0, len * 4);
+ stream.Read((byte*)res0, len * 4);
}
return res;
@@ -512,7 +449,7 @@ namespace Apache.Ignite.Core.Impl.Binary
fixed (ulong* res0 = res)
{
- stream.Read((byte*) res0, len * 8);
+ stream.Read((byte*)res0, len * 8);
}
return res;
@@ -618,7 +555,7 @@ namespace Apache.Ignite.Core.Impl.Binary
return new DateTime(JavaDateTicks + high * TimeSpan.TicksPerMillisecond + low / 100, DateTimeKind.Utc);
}
-
+
/// <summary>
/// Write nullable date array.
/// </summary>
@@ -640,7 +577,7 @@ namespace Apache.Ignite.Core.Impl.Binary
stream.WriteByte(HdrNull);
}
}
-
+
/**
* <summary>Write string in UTF8 encoding.</summary>
* <param name="val">String.</param>
@@ -735,7 +672,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="arr">The bytes.</param>
/// <returns>Resulting string.</returns>
- public static string Utf8BytesToString(byte[] arr)
+ private static string Utf8BytesToString(byte[] arr)
{
if (!UseStringSerializationVer2)
return Utf8.GetString(arr);
@@ -859,28 +796,11 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/**
- * <summary>Read string array in UTF8 encoding.</summary>
- * <param name="stream">Stream.</param>
- * <returns>String array.</returns>
- */
- public static string[] ReadStringArray(IBinaryStream stream)
- {
- int len = stream.ReadInt();
-
- string[] vals = new string[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ReadString(stream);
-
- return vals;
- }
-
- /**
* <summary>Write decimal value.</summary>
* <param name="val">Decimal value.</param>
* <param name="stream">Stream.</param>
*/
- public static void WriteDecimal(decimal val, IBinaryStream stream)
+ public static void WriteDecimal(decimal val, IBinaryStream stream)
{
// Vals are:
// [0] = lo
@@ -888,12 +808,12 @@ namespace Apache.Ignite.Core.Impl.Binary
// [2] = high
// [3] = flags
int[] vals = decimal.GetBits(val);
-
+
// Get start index skipping leading zeros.
int idx = vals[2] != 0 ? 2 : vals[1] != 0 ? 1 : vals[0] != 0 ? 0 : -1;
-
+
// Write scale and negative flag.
- int scale = (vals[3] & 0x00FF0000) >> 16;
+ int scale = (vals[3] & 0x00FF0000) >> 16;
stream.WriteInt(scale);
@@ -908,7 +828,7 @@ namespace Apache.Ignite.Core.Impl.Binary
else
{
int len = (idx + 1) << 2;
-
+
// Write data.
for (int i = idx; i >= 0; i--)
{
@@ -918,7 +838,7 @@ namespace Apache.Ignite.Core.Impl.Binary
int part16 = (curPart >> 16) & 0xFF;
int part8 = (curPart >> 8) & 0xFF;
int part0 = curPart & 0xFF;
-
+
if (i == idx)
{
// Possibly skipping some values here.
@@ -927,7 +847,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if ((part24 & 0x80) == 0x80)
{
stream.WriteInt(len + 1);
-
+
stream.WriteByte((byte)(neg ? -0x80 : ByteZero));
neg = false;
@@ -952,7 +872,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
else
stream.WriteInt(len - 1);
-
+
stream.WriteByte((byte)(neg ? ((sbyte)part16 | -0x80) : part16));
stream.WriteByte((byte)part8);
stream.WriteByte((byte)part0);
@@ -969,7 +889,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
else
stream.WriteInt(len - 2);
-
+
stream.WriteByte((byte)(neg ? ((sbyte)part8 | -0x80) : part8));
stream.WriteByte((byte)part0);
}
@@ -1024,7 +944,7 @@ namespace Apache.Ignite.Core.Impl.Binary
throw new BinaryObjectException("Decimal value scale overflow (must be between 0 and 28): " + scale);
if (mag.Length > 13)
- throw new BinaryObjectException("Decimal magnitude overflow (must be less than 96 bits): " +
+ throw new BinaryObjectException("Decimal magnitude overflow (must be less than 96 bits): " +
mag.Length * 8);
if (mag.Length == 13 && mag[0] != 0)
@@ -1108,7 +1028,7 @@ namespace Apache.Ignite.Core.Impl.Binary
var bytes = guid.ToByteArray();
- var bytes0 = (byte*) &guid;
+ var bytes0 = (byte*)&guid;
for (var i = 0; i < bytes.Length; i++)
if (bytes[i] != bytes0[i])
@@ -1129,7 +1049,7 @@ namespace Apache.Ignite.Core.Impl.Binary
var ptr = &jguid;
- stream.Write((byte*) ptr, 16);
+ stream.Write((byte*)ptr, 16);
}
/// <summary>
@@ -1137,7 +1057,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="val">The value.</param>
/// <param name="stream">The stream.</param>
- public static unsafe void WriteGuidSlow(Guid val, IBinaryStream stream)
+ private static unsafe void WriteGuidSlow(Guid val, IBinaryStream stream)
{
var bytes = val.ToByteArray();
byte* jBytes = stackalloc byte[16];
@@ -1161,7 +1081,7 @@ namespace Apache.Ignite.Core.Impl.Binary
jBytes[13] = bytes[10]; // f
jBytes[14] = bytes[9]; // e
jBytes[15] = bytes[8]; // d
-
+
stream.Write(jBytes, 16);
}
@@ -1175,13 +1095,13 @@ namespace Apache.Ignite.Core.Impl.Binary
{
JavaGuid jguid;
- var ptr = (byte*) &jguid;
+ var ptr = (byte*)&jguid;
stream.Read(ptr, 16);
var dotnetGuid = new GuidAccessor(jguid);
- return *(Guid*) (&dotnetGuid);
+ return *(Guid*)(&dotnetGuid);
}
/// <summary>
@@ -1242,23 +1162,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
}
- /**
- * <summary>Read GUID array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>GUID array.</returns>
- */
- public static Guid?[] ReadGuidArray(IBinaryStream stream)
- {
- int len = stream.ReadInt();
-
- Guid?[] vals = new Guid?[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ReadGuid(stream);
-
- return vals;
- }
-
/// <summary>
/// Write array.
/// </summary>
@@ -1311,7 +1214,7 @@ namespace Apache.Ignite.Core.Impl.Binary
result = ArrayReaders.GetOrAdd(elementType, t =>
DelegateConverter.CompileFunc<Func<BinaryReader, bool, object>>(null,
MtdhReadArray.MakeGenericMethod(t),
- new[] {typeof (BinaryReader), typeof (bool)}, new[] {false, false, true}));
+ new[] { typeof(BinaryReader), typeof(bool) }, new[] { false, false, true }));
return result(ctx, typed);
}
@@ -1373,22 +1276,22 @@ namespace Apache.Ignite.Core.Impl.Binary
public static void WriteCollection(ICollection val, BinaryWriter ctx)
{
var valType = val.GetType();
-
+
byte colType;
if (valType.IsGenericType)
{
var genType = valType.GetGenericTypeDefinition();
- if (genType == typeof (List<>))
+ if (genType == typeof(List<>))
colType = CollectionArrayList;
- else if (genType == typeof (LinkedList<>))
+ else if (genType == typeof(LinkedList<>))
colType = CollectionLinkedList;
else
colType = CollectionCustom;
}
else
- colType = valType == typeof (ArrayList) ? CollectionArrayList : CollectionCustom;
+ colType = valType == typeof(ArrayList) ? CollectionArrayList : CollectionCustom;
WriteCollection(val, ctx, colType);
}
@@ -1442,7 +1345,7 @@ namespace Apache.Ignite.Core.Impl.Binary
ctx.AddHandle(pos - 1, res);
if (adder == null)
- adder = (col, elem) => ((ArrayList) col).Add(elem);
+ adder = (col, elem) => ((ArrayList)col).Add(elem);
for (int i = 0; i < len; i++)
adder.Invoke(res, ctx.Deserialize<object>());
@@ -1465,10 +1368,10 @@ namespace Apache.Ignite.Core.Impl.Binary
{
var genType = valType.GetGenericTypeDefinition();
- dictType = genType == typeof (Dictionary<,>) ? MapHashMap : MapCustom;
+ dictType = genType == typeof(Dictionary<,>) ? MapHashMap : MapCustom;
}
else
- dictType = valType == typeof (Hashtable) ? MapHashMap : MapCustom;
+ dictType = valType == typeof(Hashtable) ? MapHashMap : MapCustom;
WriteDictionary(val, ctx, dictType);
}
@@ -1553,7 +1456,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="enumType">The enum type.</param>
/// <param name="marshaller">The marshaller.</param>
/// <returns>Enum type id.</returns>
- public static int GetEnumTypeId(Type enumType, Marshaller marshaller)
+ private static int GetEnumTypeId(Type enumType, Marshaller marshaller)
{
if (Enum.GetUnderlyingType(enumType) == TypInt)
{
@@ -1647,13 +1550,12 @@ namespace Apache.Ignite.Core.Impl.Binary
return fieldName;
}
- /**
- * <summary>Convert field name.</summary>
- * <param name="fieldName">Field name.</param>
- * <param name="converter">Converter.</param>
- * <returns>Converted name.</returns>
- */
- public static string ConvertFieldName(string fieldName, IBinaryNameMapper converter)
+ /// <summary>
+ /// Convert field name.
+ /// </summary>
+ /// <param name="fieldName">Field name.</param>
+ /// <param name="converter">Converter.</param>
+ private static string ConvertFieldName(string fieldName, IBinaryNameMapper converter)
{
var fieldName0 = fieldName;
@@ -1717,7 +1619,7 @@ namespace Apache.Ignite.Core.Impl.Binary
id = GetStringHashCode(fieldName);
if (id == 0)
- throw new BinaryObjectException("Field ID is zero (please provide ID mapper or change field name) " +
+ throw new BinaryObjectException("Field ID is zero (please provide ID mapper or change field name) " +
"[typeId=" + typeId + ", fieldName=" + fieldName + ", idMapper=" + idMapper + ']');
return id;
@@ -1814,7 +1716,7 @@ namespace Apache.Ignite.Core.Impl.Binary
high = diff / TimeSpan.TicksPerMillisecond;
- low = (int)(diff % TimeSpan.TicksPerMillisecond) * 100;
+ low = (int)(diff % TimeSpan.TicksPerMillisecond) * 100;
}
/// <summary>
@@ -1901,7 +1803,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
public static unsafe float IntToFloatBits(int val)
{
- return *(float*) &val;
+ return *(float*)&val;
}
/// <summary>
@@ -1909,7 +1811,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
public static unsafe double LongToDoubleBits(long val)
{
- return *(double*) &val;
+ return *(double*)&val;
}
/// <summary>
@@ -1975,7 +1877,8 @@ namespace Apache.Ignite.Core.Impl.Binary
[FieldOffset(0)] public readonly ulong CBA;
[FieldOffset(8)] public readonly ulong KJIHGFED;
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
- [FieldOffset(0)] public unsafe fixed byte Bytes [16];
+ [FieldOffset(0)]
+ public unsafe fixed byte Bytes[16];
/// <summary>
/// Initializes a new instance of the <see cref="JavaGuid"/> struct.
[2/2] ignite git commit: IGNITE-5001 .NET: Tests cleanup
Posted by pt...@apache.org.
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()
{