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 2016/08/19 11:48:59 UTC
[42/53] [abbrv] ignite git commit: IGNITE-3368 .NET: Improve test
coverage
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
index 0c983fd..912102c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
@@ -105,7 +105,7 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(1, res);
- Assert.AreEqual(1, JobErrs.Count);
+ Assert.AreEqual(4, JobErrs.Count);
Assert.IsNotNull(JobErrs.First() as GoodException);
Assert.AreEqual(ErrorMode.LocJobErr, ((GoodException) JobErrs.First()).Mode);
}
@@ -122,7 +122,7 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(1, res);
- Assert.AreEqual(1, JobErrs.Count);
+ Assert.AreEqual(4, JobErrs.Count);
Assert.IsNotNull(JobErrs.First() as BadException); // Local job exception is not marshalled.
}
@@ -153,7 +153,7 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(1, res);
- Assert.AreEqual(1, JobErrs.Count);
+ Assert.AreEqual(4, JobErrs.Count);
Assert.IsNotNull(JobErrs.ElementAt(0) as GoodException);
@@ -172,7 +172,7 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(1, res);
- Assert.AreEqual(1, JobErrs.Count);
+ Assert.AreEqual(4, JobErrs.Count);
Assert.IsNotNull(JobErrs.ElementAt(0) as IgniteException);
}
@@ -189,7 +189,7 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(1, res);
- Assert.AreEqual(1, JobErrs.Count);
+ Assert.AreEqual(4, JobErrs.Count);
Assert.IsNotNull(JobErrs.ElementAt(0) as IgniteException);
}
@@ -305,9 +305,19 @@ namespace Apache.Ignite.Core.Tests.Compute
{
JobErrs.Clear();
- object res = Grid1.GetCompute().Execute(new Task());
+ Func<object, int> getRes = r => r is GoodTaskResult ? ((GoodTaskResult) r).Res : ((BadTaskResult) r).Res;
- return res is GoodTaskResult ? ((GoodTaskResult)res).Res : ((BadTaskResult)res).Res;
+ var res1 = getRes(Grid1.GetCompute().Execute(new Task()));
+ var res2 = getRes(Grid1.GetCompute().Execute<object, object>(typeof(Task)));
+
+ var resAsync1 = getRes(Grid1.GetCompute().ExecuteAsync(new Task()).Result);
+ var resAsync2 = getRes(Grid1.GetCompute().ExecuteAsync<object, object>(typeof(Task)).Result);
+
+ Assert.AreEqual(res1, res2);
+ Assert.AreEqual(res2, resAsync1);
+ Assert.AreEqual(resAsync1, resAsync2);
+
+ return res1;
}
/// <summary>
@@ -318,20 +328,7 @@ namespace Apache.Ignite.Core.Tests.Compute
{
JobErrs.Clear();
- Exception err = null;
-
- try
- {
- Grid1.GetCompute().Execute(new Task());
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- err = e;
- }
-
- return err;
+ return Assert.Catch(() => Grid1.GetCompute().Execute(new Task()));
}
/// <summary>
@@ -391,11 +388,11 @@ namespace Apache.Ignite.Core.Tests.Compute
/// <summary>
/// Task.
/// </summary>
- public class Task : IComputeTask<object, object>
+ private class Task : IComputeTask<object, object>
{
/** Grid. */
[InstanceResource]
- private IIgnite _grid = null;
+ private readonly IIgnite _grid = null;
/** Result. */
private int _res;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 522341a..433b635 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
@@ -54,6 +54,17 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
+ /// Test Ignite injection into the task.
+ /// </summary>
+ [Test]
+ public void TestTaskInjectionBinarizable()
+ {
+ int res = Grid1.GetCompute().Execute(new InjectionTaskBinarizable(), 0);
+
+ Assert.AreEqual(GetServerCount(), res);
+ }
+
+ /// <summary>
/// Test Ignite injection into the closure.
/// </summary>
[Test]
@@ -86,6 +97,12 @@ namespace Apache.Ignite.Core.Tests.Compute
Assert.AreEqual(GetServerCount(), res);
}
+ /** <inheritdoc /> */
+ protected override ICollection<Type> GetBinaryTypes()
+ {
+ return new[] {typeof(InjectionJobBinarizable)};
+ }
+
/// <summary>
/// Injection task.
/// </summary>
@@ -113,6 +130,40 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
+ /// Injection task.
+ /// </summary>
+ private class InjectionTaskBinarizable : Injectee, IComputeTask<object, int, int>
+ {
+ /** <inheritDoc /> */
+ public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
+ {
+ CheckInjection();
+
+ return subgrid.ToDictionary(x => (IComputeJob<int>) new InjectionJobBinarizable(), x => x);
+ }
+
+ /** <inheritDoc /> */
+ public ComputeJobResultPolicy OnResult(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd)
+ {
+ return ComputeJobResultPolicy.Wait;
+ }
+
+ /** <inheritDoc /> */
+ public int Reduce(IList<IComputeJobResult<int>> results)
+ {
+ return results.Sum(res => res.Data);
+ }
+ }
+
+ /// <summary>
+ /// Binarizable job.
+ /// </summary>
+ public class InjectionJobBinarizable : InjectionJob
+ {
+ // No-op.
+ }
+
+ /// <summary>
/// Injection job.
/// </summary>
[Serializable]
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 ded56ed..8db4876 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
@@ -66,6 +66,11 @@ namespace Apache.Ignite.Core.Tests.Compute
{
Assert.IsTrue(err != null);
+ var aggregate = err as AggregateException;
+
+ if (aggregate != null)
+ err = aggregate.InnerException;
+
SerializableException err0 = err as SerializableException;
Assert.IsTrue(err0 != null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 7789ac4..32a28a7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
@@ -22,7 +22,6 @@ namespace Apache.Ignite.Core.Tests.Compute
using System;
using System.Collections.Generic;
using System.Linq;
- using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Resource;
using NUnit.Framework;
@@ -102,9 +101,9 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ protected override ICollection<Type> GetBinaryTypes()
{
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJob)));
+ return new[] { typeof(BinarizableJob) };
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 26286de..289b68b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Tests.Compute
{
using System;
using System.Collections.Generic;
- using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Resource;
@@ -156,12 +155,15 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/** <inheritDoc /> */
- override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ protected override ICollection<Type> GetBinaryTypes()
{
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableResult)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestBinarizableJob)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableOutFunc)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFunc)));
+ return new[]
+ {
+ typeof(BinarizableResult),
+ typeof(TestBinarizableJob),
+ typeof(BinarizableOutFunc),
+ typeof(BinarizableFunc)
+ };
}
[Test]
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
index af5f499..3990e3b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
@@ -68,6 +68,7 @@
<value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableFunc</value>
<value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableResult</value>
<value>Apache.Ignite.Core.Tests.Compute.BinarizableClosureTaskTest+BinarizableException</value>
+ <value>Apache.Ignite.Core.Tests.Compute.ResourceTaskTest+InjectionJobBinarizable</value>
</list>
</property>
<property name="typesConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 c2ccd1a..cc21490 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#pragma warning disable 618
namespace Apache.Ignite.Core.Tests
{
using System;
@@ -25,6 +26,7 @@ namespace Apache.Ignite.Core.Tests
using System.Threading.Tasks;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache.Query;
+ using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl;
@@ -141,7 +143,7 @@ namespace Apache.Ignite.Core.Tests
CheckSend(2);
// Unsubscribe from all events
- events.StopLocalListen(listener);
+ events.StopLocalListen(listener, Enumerable.Empty<int>());
CheckNoEvent();
@@ -299,10 +301,19 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
+ /// Tests the record local.
+ /// </summary>
+ [Test]
+ public void TestRecordLocal()
+ {
+ Assert.Throws<NotImplementedException>(() => _grid1.GetEvents().RecordLocal(new MyEvent()));
+ }
+
+ /// <summary>
/// Tests the WaitForLocal.
/// </summary>
[Test]
- public void TestWaitForLocal([Values(true, false)] bool async)
+ public void TestWaitForLocal()
{
var events = _grid1.GetEvents();
@@ -312,50 +323,80 @@ namespace Apache.Ignite.Core.Tests
events.EnableLocal(eventType);
- Func<IEventFilter<IEvent>, int[], Task<IEvent>> getWaitTask;
+ var taskFuncs = GetWaitTasks(events).Select(
+ func => (Func<IEventFilter<IEvent>, int[], Task<IEvent>>) (
+ (filter, types) =>
+ {
+ var task = func(filter, types);
- if (async)
- getWaitTask = (filter, types) =>
- {
- var task = events.WaitForLocalAsync(filter, types);
- GenerateTaskEvent();
- return task;
- };
- else
- getWaitTask = (filter, types) =>
+ Thread.Sleep(100); // allow task to start and begin waiting for events
+
+ GenerateTaskEvent();
+
+ return task;
+ })).ToArray();
+
+ for (int i = 0; i < taskFuncs.Length; i++)
+ {
+ var getWaitTask = taskFuncs[i];
+
+ // No params
+ var waitTask = getWaitTask(null, new int[0]);
+
+ waitTask.Wait(timeout);
+
+ // Event types
+ waitTask = getWaitTask(null, new[] {EventType.TaskReduced});
+
+ Assert.IsTrue(waitTask.Wait(timeout));
+ Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
+ Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
+
+ if (i > 3)
{
- var task = Task.Factory.StartNew(() => events.WaitForLocal(filter, types));
- Thread.Sleep(500); // allow task to start and begin waiting for events
- GenerateTaskEvent();
- return task;
- };
+ // Filter
+ waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced), new int[0]);
- // No params
- var waitTask = getWaitTask(null, new int[0]);
+ Assert.IsTrue(waitTask.Wait(timeout));
+ Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
+ Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
- waitTask.Wait(timeout);
+ // Filter & types
+ waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced),
+ new[] {EventType.TaskReduced});
- // Event types
- waitTask = getWaitTask(null, new[] {EventType.TaskReduced});
+ Assert.IsTrue(waitTask.Wait(timeout));
+ Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
+ Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
+ }
+ }
+ }
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
+ /// <summary>
+ /// Gets the wait tasks for different overloads of WaitForLocal.
+ /// </summary>
+ private static IEnumerable<Func<IEventFilter<IEvent>, int[], Task<IEvent>>> GetWaitTasks(IEvents events)
+ {
+ yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(types));
+ yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(types.ToList()));
- // Filter
- waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced), new int[0]);
+ yield return (filter, types) => events.WaitForLocalAsync(types);
+ yield return (filter, types) => events.WaitForLocalAsync(types.ToList());
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
+ yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(filter, types));
+ yield return (filter, types) => Task.Factory.StartNew(() => events.WaitForLocal(filter, types.ToList()));
- // Filter & types
- waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced),
- new[] {EventType.TaskReduced});
+ yield return (filter, types) => events.WaitForLocalAsync(filter, types);
+ yield return (filter, types) => events.WaitForLocalAsync(filter, types.ToList());
+ }
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
+ /// <summary>
+ /// Tests the wait for local overloads.
+ /// </summary>
+ [Test]
+ public void TestWaitForLocalOverloads()
+ {
+
}
/*
@@ -492,6 +533,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(expectedGuid, cacheEvent.SubjectId);
Assert.AreEqual("cloClsName", cacheEvent.ClosureClassName);
Assert.AreEqual("taskName", cacheEvent.TaskName);
+ Assert.IsTrue(cacheEvent.ToShortString().StartsWith("SWAP_SPACE_CLEARED: IsNear="));
var qryExecEvent = EventReader.Read<CacheQueryExecutedEvent>(reader);
CheckEventBase(qryExecEvent);
@@ -501,6 +543,9 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("clause", qryExecEvent.Clause);
Assert.AreEqual(expectedGuid, qryExecEvent.SubjectId);
Assert.AreEqual("taskName", qryExecEvent.TaskName);
+ Assert.AreEqual(
+ "SWAP_SPACE_CLEARED: QueryType=qryType, CacheName=cacheName, ClassName=clsName, Clause=clause, " +
+ "SubjectId=00000000-0000-0001-0000-000000000002, TaskName=taskName", qryExecEvent.ToShortString());
var qryReadEvent = EventReader.Read<CacheQueryReadEvent>(reader);
CheckEventBase(qryReadEvent);
@@ -514,6 +559,10 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(2, qryReadEvent.Value);
Assert.AreEqual(3, qryReadEvent.OldValue);
Assert.AreEqual(4, qryReadEvent.Row);
+ Assert.AreEqual(
+ "SWAP_SPACE_CLEARED: QueryType=qryType, CacheName=cacheName, ClassName=clsName, Clause=clause, " +
+ "SubjectId=00000000-0000-0001-0000-000000000002, TaskName=taskName, Key=1, Value=2, " +
+ "OldValue=3, Row=4", qryReadEvent.ToShortString());
var cacheRebalancingEvent = EventReader.Read<CacheRebalancingEvent>(reader);
CheckEventBase(cacheRebalancingEvent);
@@ -522,15 +571,19 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(locNode, cacheRebalancingEvent.DiscoveryNode);
Assert.AreEqual(2, cacheRebalancingEvent.DiscoveryEventType);
Assert.AreEqual(3, cacheRebalancingEvent.DiscoveryTimestamp);
-
+ Assert.IsTrue(cacheRebalancingEvent.ToShortString().StartsWith(
+ "SWAP_SPACE_CLEARED: CacheName=cacheName, Partition=1, DiscoveryNode=GridNode"));
+
var checkpointEvent = EventReader.Read<CheckpointEvent>(reader);
CheckEventBase(checkpointEvent);
Assert.AreEqual("cpKey", checkpointEvent.Key);
-
+ Assert.AreEqual("SWAP_SPACE_CLEARED: Key=cpKey", checkpointEvent.ToShortString());
+
var discoEvent = EventReader.Read<DiscoveryEvent>(reader);
CheckEventBase(discoEvent);
Assert.AreEqual(grid.TopologyVersion, discoEvent.TopologyVersion);
Assert.AreEqual(grid.GetNodes(), discoEvent.TopologyNodes);
+ Assert.IsTrue(discoEvent.ToShortString().StartsWith("SWAP_SPACE_CLEARED: EventNode=GridNode"));
var jobEvent = EventReader.Read<JobEvent>(reader);
CheckEventBase(jobEvent);
@@ -540,10 +593,12 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(locNode, jobEvent.TaskNode);
Assert.AreEqual(expectedGridGuid, jobEvent.TaskSessionId);
Assert.AreEqual(expectedGuid, jobEvent.TaskSubjectId);
+ Assert.IsTrue(jobEvent.ToShortString().StartsWith("SWAP_SPACE_CLEARED: TaskName=taskName"));
var spaceEvent = EventReader.Read<SwapSpaceEvent>(reader);
CheckEventBase(spaceEvent);
Assert.AreEqual("space", spaceEvent.Space);
+ Assert.IsTrue(spaceEvent.ToShortString().StartsWith("SWAP_SPACE_CLEARED: Space=space"));
var taskEvent = EventReader.Read<TaskEvent>(reader);
CheckEventBase(taskEvent);
@@ -552,6 +607,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("taskClsName", taskEvent.TaskClassName);
Assert.AreEqual("taskName", taskEvent.TaskName);
Assert.AreEqual(expectedGridGuid, taskEvent.TaskSessionId);
+ Assert.IsTrue(taskEvent.ToShortString().StartsWith("SWAP_SPACE_CLEARED: TaskName=taskName"));
}
}
@@ -570,6 +626,11 @@ namespace Apache.Ignite.Core.Tests
Assert.AreNotEqual(Guid.Empty, evt.Id.GlobalId);
Assert.IsTrue(Math.Abs((evt.Timestamp - DateTime.UtcNow).TotalSeconds) < 20,
"Invalid event timestamp: '{0}', current time: '{1}'", evt.Timestamp, DateTime.Now);
+
+ Assert.Greater(evt.LocalOrder, 0);
+
+ Assert.IsTrue(evt.ToString().Contains("[Name=SWAP_SPACE_CLEARED"));
+ Assert.IsTrue(evt.ToShortString().StartsWith("SWAP_SPACE_CLEARED"));
}
/// <summary>
@@ -855,6 +916,7 @@ namespace Apache.Ignite.Core.Tests
}
/** <inheritdoc /> */
+ // ReSharper disable once UnusedMember.Global
public bool Invoke(T evt)
{
throw new Exception("Invalid method");
@@ -954,4 +1016,58 @@ namespace Apache.Ignite.Core.Tests
return EventObjectType.ToString();
}
}
+
+ /// <summary>
+ /// Custom event.
+ /// </summary>
+ public class MyEvent : IEvent
+ {
+ /** <inheritdoc /> */
+ public IgniteGuid Id
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public long LocalOrder
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public IClusterNode Node
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public string Message
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public int Type
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public string Name
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public DateTime Timestamp
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ /** <inheritdoc /> */
+ public string ToShortString()
+ {
+ throw new NotImplementedException();
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
index 02a5d0b..f6730d7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
@@ -27,7 +27,7 @@ namespace Apache.Ignite.Core.Tests.Examples
/// <summary>
/// Tests all examples in various modes.
/// </summary>
- [Category(TestUtils.CategoryIntensive)]
+ [Category(TestUtils.CategoryExamples)]
public class ExamplesTest
{
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/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 a324191..e766f5a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -122,6 +122,52 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
+ /// Tests that all exceptions have mandatory constructors and are serializable.
+ /// </summary>
+ [Test]
+ public void TestAllExceptionsConstructors()
+ {
+ var types = typeof(IIgnite).Assembly.GetTypes().Where(x => x.IsSubclassOf(typeof(Exception)));
+
+ foreach (var type in types)
+ {
+ Assert.IsTrue(type.IsSerializable, "Exception is not serializable: " + type);
+
+ // Default ctor.
+ var defCtor = type.GetConstructor(new Type[0]);
+ Assert.IsNotNull(defCtor);
+
+ var ex = (Exception) defCtor.Invoke(new object[0]);
+ Assert.AreEqual(string.Format("Exception of type '{0}' was thrown.", type.FullName), ex.Message);
+
+ // Message ctor.
+ var msgCtor = type.GetConstructor(new[] {typeof(string)});
+ Assert.IsNotNull(msgCtor);
+
+ ex = (Exception) msgCtor.Invoke(new object[] {"myMessage"});
+ Assert.AreEqual("myMessage", ex.Message);
+
+ // Serialization.
+ var stream = new MemoryStream();
+ var formatter = new BinaryFormatter();
+
+ formatter.Serialize(stream, ex);
+ stream.Seek(0, SeekOrigin.Begin);
+
+ ex = (Exception) formatter.Deserialize(stream);
+ Assert.AreEqual("myMessage", ex.Message);
+
+ // Message+cause ctor.
+ var msgCauseCtor = type.GetConstructor(new[] { typeof(string), typeof(Exception) });
+ Assert.IsNotNull(msgCauseCtor);
+
+ ex = (Exception) msgCauseCtor.Invoke(new object[] {"myMessage", new Exception("innerEx")});
+ Assert.AreEqual("myMessage", ex.Message);
+ Assert.AreEqual("innerEx", ex.InnerException.Message);
+ }
+ }
+
+ /// <summary>
/// Tests CachePartialUpdateException serialization.
/// </summary>
private static void TestPartialUpdateExceptionSerialization(Exception ex)
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index d3851db..88a2b52 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -39,6 +39,9 @@ namespace Apache.Ignite.Core.Tests
/** Indicates long running and/or memory/cpu intensive test. */
public const string CategoryIntensive = "LONG_TEST";
+ /** Indicates examples tests. */
+ public const string CategoryExamples = "EXAMPLES_TEST";
+
/** */
public const int DfltBusywaitSleepInterval = 200;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index db2a96b..953b72f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -308,7 +308,6 @@
<Compile Include="Impl\Common\IgniteConfigurationXmlSerializer.cs" />
<Compile Include="Impl\Common\IgniteHome.cs" />
<Compile Include="Impl\Common\LoadedAssembliesResolver.cs" />
- <Compile Include="Impl\Common\ResizeableArray.cs" />
<Compile Include="Impl\Common\TypeCaster.cs" />
<Compile Include="Impl\Common\TypeStringConverter.cs" />
<Compile Include="Impl\Compute\Closure\ComputeAbstractClosureTask.cs" />
@@ -349,7 +348,6 @@
<Compile Include="Impl\Handle\HandleRegistry.cs" />
<Compile Include="Impl\Handle\IHandle.cs" />
<Compile Include="Impl\IInteropCallback.cs" />
- <Compile Include="Impl\InteropExceptionHolder.cs" />
<Compile Include="Impl\LifecycleBeanHolder.cs" />
<Compile Include="Impl\Memory\InteropExternalMemory.cs" />
<Compile Include="Impl\Memory\InteropMemoryUtils.cs" />
@@ -384,7 +382,6 @@
<Compile Include="Impl\Binary\BinarizableSerializer.cs" />
<Compile Include="Impl\Binary\Marshaller.cs" />
<Compile Include="Impl\Binary\BinaryMode.cs" />
- <Compile Include="Impl\Binary\BinaryObjectHandle.cs" />
<Compile Include="Impl\Binary\BinaryObjectHeader.cs" />
<Compile Include="Impl\Binary\BinaryObjectSchema.cs" />
<Compile Include="Impl\Binary\BinaryObjectSchemaField.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityKey.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityKey.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityKey.cs
index 1d27d65..1b7fcb0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityKey.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityKey.cs
@@ -158,5 +158,16 @@ namespace Apache.Ignite.Core.Cache.Affinity
{
return !left.Equals(right);
}
+
+ /// <summary>
+ /// Returns a <see cref="string" /> that represents this instance.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="string" /> that represents this instance.
+ /// </returns>
+ public override string ToString()
+ {
+ return string.Format("AffinityKey [Key={0}, Affinity={1}]", _key, _affinity);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
index 907af14..484fceb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
@@ -71,7 +71,8 @@ namespace Apache.Ignite.Core.Cache
/// </summary>
/// <param name="msg">Exception message.</param>
/// <param name="failedKeysException">Exception occurred during failed keys read/write.</param>
- public CachePartialUpdateException(string msg, Exception failedKeysException) : this(msg, null, failedKeysException)
+ public CachePartialUpdateException(string msg, Exception failedKeysException)
+ : this(msg, null, failedKeysException)
{
// No-op.
}
@@ -92,7 +93,8 @@ namespace Apache.Ignite.Core.Cache
/// <param name="msg">Exception message.</param>
/// <param name="failedKeys">Failed keys.</param>
/// <param name="failedKeysException">Exception occurred during failed keys read/write.</param>
- private CachePartialUpdateException(string msg, IList<object> failedKeys, Exception failedKeysException) : base(msg)
+ private CachePartialUpdateException(string msg, IList<object> failedKeys, Exception failedKeysException)
+ : base(msg, failedKeysException)
{
_failedKeys = failedKeys;
_failedKeysException = failedKeysException;
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
index 147f1bd..c506838 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
@@ -110,6 +110,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// The value for the entry that is to be stored in the cache
/// or <c>null</c> if the object can't be loaded
/// </returns>
+ [ExcludeFromCodeCoverage]
public virtual object Load(object key)
{
return null;
@@ -124,6 +125,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <returns>
/// A map of key, values to be stored in the cache.
/// </returns>
+ [ExcludeFromCodeCoverage]
public virtual IDictionary LoadAll(ICollection keys)
{
return null;
@@ -136,6 +138,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// </summary>
/// <param name="key">Key to write.</param>
/// <param name="val">Value to write.</param>
+ [ExcludeFromCodeCoverage]
public virtual void Write(object key, object val)
{
// No-op.
@@ -154,6 +157,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="entries">a mutable collection to write. Upon invocation, it contains the entries
/// to write for write-through. Upon return the collection must only contain entries
/// that were not successfully written. (see partial success above).</param>
+ [ExcludeFromCodeCoverage]
public virtual void WriteAll(IDictionary entries)
{
// No-op.
@@ -167,6 +171,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// This method is invoked even if no mapping for the key exists.
/// </summary>
/// <param name="key">The key that is used for the delete operation.</param>
+ [ExcludeFromCodeCoverage]
public virtual void Delete(object key)
{
// No-op.
@@ -189,6 +194,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <param name="keys">a mutable collection of keys for entries to delete. Upon invocation,
/// it contains the keys to delete for write-through. Upon return the collection must only contain
/// the keys that were not successfully deleted.</param>
+ [ExcludeFromCodeCoverage]
public virtual void DeleteAll(ICollection keys)
{
// No-op.
@@ -199,6 +205,7 @@ namespace Apache.Ignite.Core.Cache.Store
/// <c>commit</c> parameter.
/// </summary>
/// <param name="commit"><c>True</c> if transaction should commit, <c>false</c> for rollback.</param>
+ [ExcludeFromCodeCoverage]
public virtual void SessionEnd(bool commit)
{
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
index a634010..5f7ba66 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Common
/// <summary>
/// Indicates an error on Java side and contains full Java stack trace.
/// </summary>
+ [Serializable]
public class JavaException : IgniteException
{
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index 13d3133..39a2f8b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
@@ -125,6 +126,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/** <inheritdoc /> */
+ [ExcludeFromCodeCoverage]
public int EnumValue
{
get
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index 646d563..1626a2d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -1027,7 +1027,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Mutation ocntext.
+ /// Mutation context.
/// </summary>
private class Context
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHandle.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHandle.cs
deleted file mode 100644
index 35735fe..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHandle.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.Impl.Binary
-{
- /// <summary>
- /// Object handle. Wraps a single value.
- /// </summary>
- internal class BinaryObjectHandle
- {
- /** Value. */
- private readonly object _val;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="BinaryObjectHandle"/> class.
- /// </summary>
- /// <param name="val">The value.</param>
- public BinaryObjectHandle(object val)
- {
- _val = val;
- }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- public object Value
- {
- get { return _val; }
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- var that = obj as BinaryObjectHandle;
-
- return that != null && _val == that._val;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return _val != null ? _val.GetHashCode() : 0;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
index 2624d52..bb5c207 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
using System;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using Apache.Ignite.Core.Impl.Binary.IO;
@@ -100,6 +101,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Initializes a new instance of the <see cref="BinaryObjectHeader"/> struct from specified stream.
/// </summary>
/// <param name="stream">The stream.</param>
+ [ExcludeFromCodeCoverage] // big-endian only
private BinaryObjectHeader(IBinaryStream stream)
{
Header = stream.ReadByte();
@@ -116,6 +118,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Writes this instance to the specified stream.
/// </summary>
/// <param name="stream">The stream.</param>
+ [ExcludeFromCodeCoverage] // big-endian only
private void Write(IBinaryStream stream)
{
stream.WriteByte(Header);
@@ -292,7 +295,7 @@ namespace Apache.Ignite.Core.Impl.Binary
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
-
+
return obj is BinaryObjectHeader && Equals((BinaryObjectHeader) obj);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index 16e3032..b572e7c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -58,7 +58,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Constrcutor.
+ /// Constructor.
/// </summary>
/// <param name="cfg">Configuration.</param>
/// <param name="name">Type name.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 063aa9d..9f4c8c8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -1442,26 +1442,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Check whether the given object is binarizeble, i.e. it can be serialized with binary marshaller.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <returns>True if binarizable.</returns>
- internal bool IsBinarizable(object obj)
- {
- if (obj != null)
- {
- Type type = obj.GetType();
-
- // We assume object as binarizable only in case it has descriptor.
- // Collections, Enums and non-primitive arrays do not have descriptors
- // and this is fine here because we cannot know whether their members are binarizable.
- return _marsh.GetDescriptor(type) != null || BinarySystemHandlers.GetWriteHandler(type) != null;
- }
-
- return true;
- }
-
- /// <summary>
/// Write field ID.
/// </summary>
/// <param name="fieldName">Field name.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
index dcbff81..b062689 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamAdapter.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Impl.Binary.IO
{
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.IO;
/// <summary>
@@ -78,12 +79,14 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException("Stream is not seekable.");
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public override long Position
{
get
@@ -97,6 +100,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public override long Length
{
get
@@ -106,6 +110,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public override void SetLength(long value)
{
throw new NotSupportedException("Stream is not seekable.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamBase.cs
index a5e140d..6286602 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/BinaryStreamBase.cs
@@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
/// <summary>
/// Base class for managed and unmanaged data streams.
/// </summary>
- internal unsafe abstract class BinaryStreamBase : IBinaryStream
+ internal abstract unsafe class BinaryStreamBase : IBinaryStream
{
/** Byte: zero. */
private const byte ByteZero = 0;
@@ -1070,13 +1070,10 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
/// <returns>
/// <c>True</c> if they are same.
/// </returns>
- public virtual bool IsSameArray(byte[] arr)
- {
- return false;
- }
-
+ public abstract bool IsSameArray(byte[] arr);
+
/// <summary>
- /// Seek to the given positoin.
+ /// Seek to the given position.
/// </summary>
/// <param name="offset">Offset.</param>
/// <param name="origin">Seek origin.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
index d530713..cd509c6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Io/IBinaryStream.cs
@@ -312,7 +312,7 @@ namespace Apache.Ignite.Core.Impl.Binary.IO
bool IsSameArray(byte[] arr);
/// <summary>
- /// Seek to the given positoin.
+ /// Seek to the given position.
/// </summary>
/// <param name="offset">Offset.</param>
/// <param name="origin">Seek origin.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
index a8d94f2..109d55f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/JavaTypes.cs
@@ -62,9 +62,6 @@ namespace Apache.Ignite.Core.Impl.Binary
private static readonly Dictionary<string, Type> JavaToNet =
NetToJava.GroupBy(x => x.Value).ToDictionary(g => g.Key, g => g.First().Key);
- /** */
- private static readonly string MappedTypes = string.Join(", ", NetToJava.Keys.Select(x => x.Name));
-
/// <summary>
/// Gets the corresponding Java type name.
/// </summary>
@@ -110,13 +107,5 @@ namespace Apache.Ignite.Core.Impl.Binary
return JavaToNet.TryGetValue(javaTypeName, out res) ? res : null;
}
-
- /// <summary>
- /// Gets the supported types as a comma-separated string.
- /// </summary>
- public static string SupportedTypesString
- {
- get { return MappedTypes; }
- }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/JavaCacheEntryEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/JavaCacheEntryEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/JavaCacheEntryEventFilter.cs
index b5c2ece..a56e12a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/JavaCacheEntryEventFilter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Event/JavaCacheEntryEventFilter.cs
@@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Event
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Cache.Event;
using Apache.Ignite.Core.Impl.Common;
@@ -30,6 +31,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Event
internal class JavaCacheEntryEventFilter<TK, TV> : PlatformJavaObjectFactoryProxy, ICacheEntryEventFilter<TK, TV>
{
/** <inheritdoc /> */
+ [ExcludeFromCodeCoverage]
public bool Evaluate(ICacheEntryEvent<TK, TV> evt)
{
throw new InvalidOperationException(GetType() + " cannot be invoked directly.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
index 2adb021..a4e9c93 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
@@ -52,32 +52,6 @@ namespace Apache.Ignite.Core.Impl.Collections
}
/// <summary>
- /// Tries the get a value. In case of multiple values for a key, returns the last one.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- /// <returns>True if value has been found for specified key; otherwise false.</returns>
- public bool TryGetValue(TKey key, out TValue val)
- {
- object val0;
-
- if (!_dict.TryGetValue(key, out val0))
- {
- val = default(TValue);
- return false;
- }
-
- var list = val0 as List<TValue>;
-
- if (list != null)
- val = list[list.Count - 1];
- else
- val = (TValue) val0;
-
- return true;
- }
-
- /// <summary>
/// Removes the specified value for the specified key.
/// </summary>
/// <param name="key">The key.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
index 60ec9d0..a51a149 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
@@ -110,7 +110,7 @@ namespace Apache.Ignite.Core.Impl.Collections
/** <inheritdoc /> */
public bool Remove(TKey key)
{
- return _dict.Remove(key);
+ throw GetReadonlyException();
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ResizeableArray.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ResizeableArray.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ResizeableArray.cs
deleted file mode 100644
index 82a8eee..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/ResizeableArray.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.Impl.Common
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Simple append-only <see cref="List{T}"/> alternative which exposes internal array.
- /// </summary>
- internal class ResizeableArray<T>
- {
- /** Array. */
- private T[] _arr;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="capacity">Capacity.</param>
- public ResizeableArray(int capacity)
- {
- _arr = new T[capacity];
- }
-
- /// <summary>
- /// Array.
- /// </summary>
- public T[] Array
- {
- get { return _arr; }
- }
-
- /// <summary>
- /// Count.
- /// </summary>
- public int Count { get; private set; }
-
- /// <summary>
- /// Add element.
- /// </summary>
- /// <param name="element">Element.</param>
- public void Add(T element)
- {
- if (Count == _arr.Length)
- System.Array.Resize(ref _arr, _arr.Length*2);
-
- _arr[Count++] = element;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventTypeConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventTypeConverter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventTypeConverter.cs
index 6b8f935..f0d1564 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventTypeConverter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventTypeConverter.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.Events
using System;
using System.Collections.Generic;
using System.ComponentModel;
+ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Apache.Ignite.Core.Events;
@@ -57,6 +58,7 @@ namespace Apache.Ignite.Core.Impl.Events
/// <returns>
/// true if this converter can perform the conversion; otherwise, false.
/// </returns>
+ [ExcludeFromCodeCoverage] // not called
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string);
@@ -72,6 +74,7 @@ namespace Apache.Ignite.Core.Impl.Events
/// <returns>
/// true if this converter can perform the conversion; otherwise, false.
/// </returns>
+ [ExcludeFromCodeCoverage] // not called
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(string);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
index 783ba94..1d06072 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
@@ -154,6 +154,7 @@ namespace Apache.Ignite.Core.Impl.Events
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true,
IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types)
where T : IEvent
@@ -187,6 +188,7 @@ namespace Apache.Ignite.Core.Impl.Events
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true,
IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, IEnumerable<int> types = null)
where T : IEvent
@@ -195,6 +197,7 @@ namespace Apache.Ignite.Core.Impl.Events
}
/** <inheritDoc /> */
+ [ExcludeFromCodeCoverage]
public void StopRemoteListen(Guid opId)
{
DoOutOp((int) Op.StopRemoteListen, writer =>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
index 22881c6..a8c1471 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
@@ -201,6 +201,7 @@ namespace Apache.Ignite.Core.Impl
/// <param name="msg">Message.</param>
/// <param name="stackTrace">Stack trace.</param>
/// <returns>Exception.</returns>
+ [ExcludeFromCodeCoverage] // Covered by a test in a separate process.
public static Exception GetJvmInitializeException(string clsName, string msg, string stackTrace)
{
if (clsName != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
index fb56891..7791c91 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
@@ -39,7 +39,7 @@ namespace Apache.Ignite.Core.Impl.Handle
/// </summary>
/// <param name="target">Target.</param>
/// <param name="releaseAction">Release action.</param>
- public Handle(T target, Action<T> releaseAction)
+ protected Handle(T target, Action<T> releaseAction)
{
_target = target;
_releaseAction = releaseAction;
@@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Impl.Handle
/// <summary>
/// Target.
/// </summary>
- public T Target
+ protected T Target
{
get { return _target; }
}
@@ -61,13 +61,5 @@ namespace Apache.Ignite.Core.Impl.Handle
if (Interlocked.CompareExchange(ref _released, 1, 0) == 0)
_releaseAction(_target);
}
-
- /// <summary>
- /// Resource released flag.
- /// </summary>
- public bool Released
- {
- get { return Thread.VolatileRead(ref _released) == 1; }
- }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
index e18970f..4e1135a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
@@ -102,16 +102,6 @@ namespace Apache.Ignite.Core.Impl.Handle
}
/// <summary>
- /// Allocate a handle for critical resource in safe mode.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <returns>Pointer.</returns>
- public long AllocateCriticalSafe(object target)
- {
- return Allocate0(target, true, true);
- }
-
- /// <summary>
/// Internal allocation routine.
/// </summary>
/// <param name="target">Target.</param>
@@ -121,7 +111,7 @@ namespace Apache.Ignite.Core.Impl.Handle
private long Allocate0(object target, bool critical, bool safe)
{
if (Closed)
- throw ClosedException();
+ throw GetClosedException();
// Try allocating on critical path.
if (critical)
@@ -140,7 +130,7 @@ namespace Apache.Ignite.Core.Impl.Handle
Release0(target, true);
- throw ClosedException();
+ throw GetClosedException();
}
return fastIdx;
@@ -159,7 +149,7 @@ namespace Apache.Ignite.Core.Impl.Handle
Release0(target, true);
- throw ClosedException();
+ throw GetClosedException();
}
return slowIdx;
@@ -320,6 +310,7 @@ namespace Apache.Ignite.Core.Impl.Handle
/// Gets a snapshot of currently referenced objects list.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Semantics.")]
+ [ExcludeFromCodeCoverage]
public IList<KeyValuePair<long, object>> GetItems()
{
Thread.MemoryBarrier();
@@ -335,7 +326,8 @@ namespace Apache.Ignite.Core.Impl.Handle
/// Create new exception for closed state.
/// </summary>
/// <returns>Exception.</returns>
- private static Exception ClosedException()
+ [ExcludeFromCodeCoverage]
+ private static Exception GetClosedException()
{
return new InvalidOperationException("Cannot allocate a resource handle because Ignite is stopping.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
index d147f8b..700ab5f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
@@ -26,10 +26,5 @@ namespace Apache.Ignite.Core.Impl.Handle
/// Release the resource.
/// </summary>
void Release();
-
- /// <summary>
- /// Resource released flag.
- /// </summary>
- bool Released { get; }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
index ef811f5..ff63d55 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -41,6 +41,7 @@ namespace Apache.Ignite.Core.Impl
/// Grid proxy with fake serialization.
/// </summary>
[Serializable]
+ [ExcludeFromCodeCoverage]
internal class IgniteProxy : IIgnite, IClusterGroupEx, IBinaryWriteAware, ICluster
{
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
index 70d483d..04296c7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
@@ -20,7 +20,6 @@ namespace Apache.Ignite.Core.Impl
using System;
using System.Collections.Generic;
using System.ComponentModel;
- using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
@@ -238,6 +237,7 @@ namespace Apache.Ignite.Core.Impl
/// <summary>
/// Formats the Win32 error.
/// </summary>
+ [ExcludeFromCodeCoverage]
private static string FormatWin32Error(int errorCode)
{
if (errorCode == NativeMethods.ERROR_BAD_EXE_FORMAT)
@@ -493,25 +493,5 @@ namespace Apache.Ignite.Core.Impl
return res;
}
-
- /// <summary>
- /// Writes the node collection to a stream.
- /// </summary>
- /// <param name="writer">The writer.</param>
- /// <param name="nodes">The nodes.</param>
- public static void WriteNodes(IBinaryRawWriter writer, ICollection<IClusterNode> nodes)
- {
- Debug.Assert(writer != null);
-
- if (nodes != null)
- {
- writer.WriteInt(nodes.Count);
-
- foreach (var node in nodes)
- writer.WriteGuid(node.Id);
- }
- else
- writer.WriteInt(-1);
- }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
deleted file mode 100644
index 9edcb03..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.Impl
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization.Formatters.Binary;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl.Binary;
- using Apache.Ignite.Core.Impl.Binary.IO;
-
- /// <summary>
- /// Holder of exception which must be serialized to Java and then backwards to the native platform.
- /// </summary>
- internal class InteropExceptionHolder : IBinarizable
- {
- /** Initial exception. */
- private readonly Exception _err;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public InteropExceptionHolder()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="err">Error.</param>
- public InteropExceptionHolder(Exception err)
- {
- _err = err;
- }
-
- /// <summary>
- /// Underlying exception.
- /// </summary>
- public Exception Error
- {
- get { return _err; }
- }
-
- /** <inheritDoc /> */
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public void WriteBinary(IBinaryWriter writer)
- {
- var writer0 = (BinaryWriter) writer.GetRawWriter();
-
- if (writer0.IsBinarizable(_err))
- {
- writer0.WriteBoolean(true);
- writer0.WriteObject(_err);
- }
- else
- {
- writer0.WriteBoolean(false);
-
- using (var streamAdapter = new BinaryStreamAdapter(writer0.Stream))
- {
- new BinaryFormatter().Serialize(streamAdapter, _err);
- }
- }
- }
-
- /** <inheritDoc /> */
- public void ReadBinary(IBinaryReader reader)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
index a991b3d..3aa5490 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
@@ -88,16 +88,6 @@ namespace Apache.Ignite.Core.Impl.Memory
}
/// <summary>
- /// Sets capacity for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">CalculateCapacity.</param>
- public static void SetCapacity(long memPtr, int cap)
- {
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- }
-
- /// <summary>
/// Gets length for the given memory chunk.
/// </summary>
/// <param name="memPtr">Memory pointer.</param>
@@ -138,16 +128,6 @@ namespace Apache.Ignite.Core.Impl.Memory
}
/// <summary>
- /// Check whether this memory chunk is external.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns><c>True</c> if owned by Java.</returns>
- public static bool IsExternal(long memPtr)
- {
- return IsExternal(GetFlags(memPtr));
- }
-
- /// <summary>
/// Check whether flags denote that this memory chunk is external.
/// </summary>
/// <param name="flags">Flags.</param>
@@ -158,16 +138,6 @@ namespace Apache.Ignite.Core.Impl.Memory
}
/// <summary>
- /// Check whether this memory chunk is pooled.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns><c>True</c> if pooled.</returns>
- public static bool IsPooled(long memPtr)
- {
- return IsPooled(GetFlags(memPtr));
- }
-
- /// <summary>
/// Check whether flags denote pooled memory chunk.
/// </summary>
/// <param name="flags">Flags.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
index 8e54261..f252ef3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
@@ -52,6 +52,7 @@ namespace Apache.Ignite.Core.Impl.Memory
}
/** <inheritdoc /> */
+ [ExcludeFromCodeCoverage]
public long Pointer
{
get { throw new NotSupportedException(); }
@@ -73,10 +74,13 @@ namespace Apache.Ignite.Core.Impl.Memory
public int Length
{
get { return _size; }
+
+ [ExcludeFromCodeCoverage]
set { throw new NotSupportedException(); }
}
/** <inheritdoc /> */
+ [ExcludeFromCodeCoverage]
public void Reallocate(int cap)
{
throw new NotSupportedException();
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4eda7cf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 26b6033..f757cbc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -798,13 +798,5 @@ namespace Apache.Ignite.Core.Impl
if (_disposed)
throw new ObjectDisposedException(GetType().Name, "Object has been disposed.");
}
-
- /// <summary>
- /// Gets a value indicating whether this instance is disposed.
- /// </summary>
- protected bool IsDisposed
- {
- get { return _disposed; }
- }
}
}