You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/20 07:49:22 UTC
[49/70] [abbrv] ignite git commit: IGNITE-5001 .NET: Tests cleanup
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.