You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/02/17 09:59:51 UTC
[41/50] [abbrv] ignite git commit: IGNITE-4563 .NET: Fix
ICache.LoadCache failures on non-primitive arguments
IGNITE-4563 .NET: Fix ICache.LoadCache failures on non-primitive arguments
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03f68223
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03f68223
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03f68223
Branch: refs/heads/ignite-1.9
Commit: 03f6822319b9c3d4ca7e76daef5a671097b913d9
Parents: 296bc41
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jan 20 12:56:26 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Feb 7 16:03:36 2017 +0300
----------------------------------------------------------------------
.../platform/cache/PlatformCache.java | 11 +-
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Cache/Store/CacheParallelLoadStoreTest.cs | 9 +-
.../Cache/Store/CacheStoreSessionTest.cs | 22 +-
.../Cache/Store/CacheStoreTest.cs | 333 ++++++++++++-------
.../Cache/Store/CacheTestStore.cs | 14 +
.../Cache/Store/NamedNodeCacheStoreTest.cs | 34 ++
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 14 +-
8 files changed, 294 insertions(+), 144 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index aec3703..643907d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -815,7 +815,16 @@ public class PlatformCache extends PlatformAbstractTarget {
if (pred != null)
filter = platformCtx.createCacheEntryFilter(pred, 0);
- Object[] args = reader.readObjectArray();
+ Object[] args = null;
+
+ int argCnt = reader.readInt();
+
+ if (argCnt > 0) {
+ args = new Object[argCnt];
+
+ for (int i = 0; i < argCnt; i++)
+ args[i] = reader.readObjectDetached();
+ }
if (loc)
cache.localLoadCache(filter, args);
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index f440c25..179d67f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -72,6 +72,7 @@
<Compile Include="Cache\CacheResultTest.cs" />
<Compile Include="Cache\CacheSwapSpaceTest.cs" />
<Compile Include="Cache\Store\CacheStoreAdapterTest.cs" />
+ <Compile Include="Cache\Store\NamedNodeCacheStoreTest.cs" />
<Compile Include="Collections\MultiValueDictionaryTest.cs" />
<Compile Include="Collections\ReadOnlyCollectionTest.cs" />
<Compile Include="Collections\ReadOnlyDictionaryTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
index 105dea2..2e74b3f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
@@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Tests for GridCacheParallelLoadStoreAdapter.
/// </summary>
- public class CacheParallelLoadStoreTest
+ public sealed class CacheParallelLoadStoreTest
{
// object store name
private const string ObjectStoreCacheName = "object_store_parallel";
@@ -34,11 +34,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Set up test class.
/// </summary>
[TestFixtureSetUp]
- public virtual void BeforeTests()
+ public void BeforeTests()
{
- TestUtils.KillProcesses();
- TestUtils.JvmDebug = true;
-
Ignition.Start(new IgniteConfiguration
{
JvmClasspath = TestUtils.CreateTestClasspath(),
@@ -55,7 +52,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Tear down test class.
/// </summary>
[TestFixtureTearDown]
- public virtual void AfterTests()
+ public void AfterTests()
{
Ignition.StopAll(true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
index 5cc0849..54e0414 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
@@ -22,14 +22,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using System.Collections.Generic;
using System.Linq;
using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Resource;
using NUnit.Framework;
/// <summary>
/// Tests for store session.
/// </summary>
- public class CacheStoreSessionTest
+ public sealed class CacheStoreSessionTest
{
/** Grid name. */
private const string IgniteName = "grid";
@@ -47,7 +46,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Set up routine.
/// </summary>
[TestFixtureSetUp]
- public virtual void BeforeTests()
+ public void BeforeTests()
{
//TestUtils.JVM_DEBUG = true;
@@ -71,7 +70,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Tear down routine.
/// </summary>
[TestFixtureTearDown]
- public virtual void AfterTests()
+ public void AfterTests()
{
Ignition.StopAll(true);
}
@@ -147,7 +146,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// Dump operations.
/// </summary>
/// <param name="dump">Dump.</param>
- internal static void DumpOperations(ICollection<Operation> dump)
+ private static void DumpOperations(ICollection<Operation> dump)
{
_dumps.Add(dump);
}
@@ -155,6 +154,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Test store implementation.
/// </summary>
+ // ReSharper disable once UnusedMember.Global
public class Store : CacheStoreAdapter
{
/** Store session. */
@@ -215,7 +215,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Logged operation.
/// </summary>
- internal class Operation
+ private class Operation
{
/// <summary>
/// Constructor.
@@ -244,22 +244,22 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Cache name.
/// </summary>
- public string CacheName { get; set; }
+ public string CacheName { get; private set; }
/// <summary>
/// Operation type.
/// </summary>
- public OperationType Type { get; set; }
+ public OperationType Type { get; private set; }
/// <summary>
/// Key.
/// </summary>
- public int Key { get; set; }
+ public int Key { get; private set; }
/// <summary>
/// Value.
/// </summary>
- public int Value { get; set; }
+ public int Value { get; private set; }
/// <summary>
/// Commit flag.
@@ -270,7 +270,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Operation types.
/// </summary>
- internal enum OperationType
+ private enum OperationType
{
/** Write. */
Write,
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 2a235aa..a66aea8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -28,92 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using NUnit.Framework;
/// <summary>
- ///
- /// </summary>
- class Key
- {
- private readonly int _idx;
-
- public Key(int idx)
- {
- _idx = idx;
- }
-
- public int Index()
- {
- return _idx;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null || obj.GetType() != GetType())
- return false;
-
- Key key = (Key)obj;
-
- return key._idx == _idx;
- }
-
- public override int GetHashCode()
- {
- return _idx;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class Value
- {
- private int _idx;
-
- public Value(int idx)
- {
- _idx = idx;
- }
-
- public int Index()
- {
- return _idx;
- }
- }
-
- /// <summary>
- /// Cache entry predicate.
- /// </summary>
- [Serializable]
- public class CacheEntryFilter : ICacheEntryFilter<int, string>
- {
- /** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, string> entry)
- {
- return entry.Key >= 105;
- }
- }
-
- /// <summary>
- /// Cache entry predicate that throws an exception.
- /// </summary>
- [Serializable]
- public class ExceptionalEntryFilter : ICacheEntryFilter<int, string>
- {
- /** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, string> entry)
- {
- throw new Exception("Expected exception in ExceptionalEntryFilter");
- }
- }
-
- /// <summary>
- /// Filter that can't be serialized.
- /// </summary>
- public class InvalidCacheEntryFilter : CacheEntryFilter
- {
- // No-op.
- }
-
- /// <summary>
- ///
+ /// Tests cache store functionality.
/// </summary>
public class CacheStoreTest
{
@@ -129,19 +44,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/** */
private const string TemplateStoreCacheName = "template_store*";
- /** */
- private volatile int _storeCount = 3;
-
/// <summary>
- ///
+ /// Fixture set up.
/// </summary>
[TestFixtureSetUp]
public virtual void BeforeTests()
{
- TestUtils.KillProcesses();
-
- TestUtils.JvmDebug = true;
-
var cfg = new IgniteConfiguration
{
GridName = GridName,
@@ -155,7 +63,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/// <summary>
- ///
+ /// Fixture tear down.
/// </summary>
[TestFixtureTearDown]
public void AfterTests()
@@ -164,16 +72,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/// <summary>
- ///
- /// </summary>
- [SetUp]
- public void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- ///
+ /// Test tear down.
/// </summary>
[TearDown]
public void AfterTest()
@@ -188,11 +87,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
"Cache is not empty: " +
string.Join(", ", cache.Select(x => string.Format("[{0}:{1}]", x.Key, x.Value))));
- TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName));
-
- Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
+ TestUtils.AssertHandleRegistryHasItems(300, 3, Ignition.GetIgnite(GridName));
}
+ /// <summary>
+ /// Tests that simple cache loading works and exceptions are propagated properly.
+ /// </summary>
[Test]
public void TestLoadCache()
{
@@ -219,6 +119,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.LoadCache(new CacheEntryFilter(), 100, 10)).InnerException);
}
+ /// <summary>
+ /// Tests cache loading in local mode.
+ /// </summary>
[Test]
public void TestLocalLoadCache()
{
@@ -234,6 +137,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("val_" + i, cache.Get(i));
}
+ /// <summary>
+ /// Tests that object metadata propagates properly during cache loading.
+ /// </summary>
[Test]
public void TestLoadCacheMetadata()
{
@@ -254,6 +160,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("Value", meta.TypeName);
}
+ /// <summary>
+ /// Tests asynchronous cache load.
+ /// </summary>
[Test]
public void TestLoadCacheAsync()
{
@@ -278,6 +187,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
.InnerException);
}
+ /// <summary>
+ /// Tests write-through and read-through behavior.
+ /// </summary>
[Test]
public void TestPutLoad()
{
@@ -285,7 +197,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.Put(1, "val");
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(1, map.Count);
@@ -331,6 +243,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
}
+ /// <summary>
+ /// Tests write-through and read-through behavior with binarizable values.
+ /// </summary>
[Test]
public void TestPutLoadBinarizable()
{
@@ -338,7 +253,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.Put(1, new Value(1));
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(1, map.Count);
@@ -350,11 +265,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual(0, cache.GetSize());
- Assert.AreEqual(1, cache.Get(1).Index());
+ Assert.AreEqual(1, cache.Get(1).Index);
Assert.AreEqual(1, cache.GetSize());
}
+ /// <summary>
+ /// Tests write-through and read-through behavior with storeKeepBinary=false.
+ /// </summary>
[Test]
public void TestPutLoadObjects()
{
@@ -362,23 +280,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.Put(1, new Value(1));
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(1, map.Count);
Value v = (Value)map[1];
- Assert.AreEqual(1, v.Index());
+ Assert.AreEqual(1, v.Index);
cache.LocalEvict(new[] { 1 });
Assert.AreEqual(0, cache.GetSize());
- Assert.AreEqual(1, cache.Get(1).Index());
+ Assert.AreEqual(1, cache.Get(1).Index);
Assert.AreEqual(1, cache.GetSize());
}
+ /// <summary>
+ /// Tests cache store LoadAll functionality.
+ /// </summary>
[Test]
public void TestPutLoadAll()
{
@@ -391,7 +312,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.PutAll(putMap);
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(10, map.Count);
@@ -417,6 +338,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual(10, cache.GetSize());
}
+ /// <summary>
+ /// Tests cache store removal.
+ /// </summary>
[Test]
public void TestRemove()
{
@@ -425,7 +349,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(10, map.Count);
@@ -438,6 +362,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("val_" + i, map[i]);
}
+ /// <summary>
+ /// Tests cache store removal.
+ /// </summary>
[Test]
public void TestRemoveAll()
{
@@ -446,7 +373,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(10, map.Count);
@@ -458,6 +385,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("val_" + i, map[i]);
}
+ /// <summary>
+ /// Tests cache store with transactions.
+ /// </summary>
[Test]
public void TestTx()
{
@@ -472,13 +402,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
tx.Commit();
}
- IDictionary map = StoreMap();
+ IDictionary map = GetStoreMap();
Assert.AreEqual(1, map.Count);
Assert.AreEqual("val", map[1]);
}
+ /// <summary>
+ /// Tests multithreaded cache loading.
+ /// </summary>
[Test]
public void TestLoadCacheMultithreaded()
{
@@ -496,6 +429,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("val_" + i, cache.Get(i));
}
+ /// <summary>
+ /// Tests that cache store property values are propagated from Spring XML.
+ /// </summary>
[Test]
public void TestCustomStoreProperties()
{
@@ -506,6 +442,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("String value", CacheTestStore.stringProperty);
}
+ /// <summary>
+ /// Tests cache store with dynamically started cache.
+ /// </summary>
[Test]
public void TestDynamicStoreStart()
{
@@ -524,6 +463,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual(handleCount, reg.Count);
}
+ /// <summary>
+ /// Tests the load all.
+ /// </summary>
[Test]
public void TestLoadAll([Values(true, false)] bool isAsync)
{
@@ -555,6 +497,49 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/// <summary>
+ /// Tests the argument passing to LoadCache method.
+ /// </summary>
+ [Test]
+ public void TestArgumentPassing()
+ {
+ var cache = GetBinaryStoreCache<object, object>();
+
+ Action<object> checkValue = o =>
+ {
+ cache.Clear();
+ Assert.AreEqual(0, cache.GetSize());
+ cache.LoadCache(null, null, 1, o);
+ Assert.AreEqual(o, cache[1]);
+ };
+
+ // Null.
+ cache.LoadCache(null, null);
+ Assert.AreEqual(0, cache.GetSize());
+
+ // Empty args array.
+ cache.LoadCache(null);
+ Assert.AreEqual(0, cache.GetSize());
+
+ // Simple types.
+ checkValue(1);
+ checkValue(new[] {1, 2, 3});
+
+ checkValue("1");
+ checkValue(new[] {"1", "2"});
+
+ checkValue(Guid.NewGuid());
+ checkValue(new[] {Guid.NewGuid(), Guid.NewGuid()});
+
+ checkValue(DateTime.Now);
+ checkValue(new[] {DateTime.Now, DateTime.UtcNow});
+
+ // Collections.
+ checkValue(new ArrayList {1, "2", 3.3});
+ checkValue(new List<int> {1, 2});
+ checkValue(new Dictionary<int, string> {{1, "foo"}});
+ }
+
+ /// <summary>
/// Get's grid name for this test.
/// </summary>
/// <value>Grid name.</value>
@@ -563,31 +548,49 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
get { return null; }
}
- private IDictionary StoreMap()
+ /// <summary>
+ /// Gets the store map.
+ /// </summary>
+ private static IDictionary GetStoreMap()
{
return CacheTestStore.Map;
}
+ /// <summary>
+ /// Gets the cache.
+ /// </summary>
private ICache<int, string> GetCache()
{
return GetBinaryStoreCache<int, string>();
}
+ /// <summary>
+ /// Gets the binary store cache.
+ /// </summary>
private ICache<TK, TV> GetBinaryStoreCache<TK, TV>()
{
return Ignition.GetIgnite(GridName).GetCache<TK, TV>(BinaryStoreCacheName);
}
+ /// <summary>
+ /// Gets the object store cache.
+ /// </summary>
private ICache<TK, TV> GetObjectStoreCache<TK, TV>()
{
return Ignition.GetIgnite(GridName).GetCache<TK, TV>(ObjectStoreCacheName);
}
+ /// <summary>
+ /// Gets the custom store cache.
+ /// </summary>
private ICache<int, string> GetCustomStoreCache()
{
return Ignition.GetIgnite(GridName).GetCache<int, string>(CustomStoreCacheName);
}
+ /// <summary>
+ /// Gets the template store cache.
+ /// </summary>
private ICache<int, string> GetTemplateStoreCache()
{
var cacheName = TemplateStoreCacheName.Replace("*", Guid.NewGuid().ToString());
@@ -595,6 +598,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
return Ignition.GetIgnite(GridName).GetOrCreateCache<int, string>(cacheName);
}
+ /// <summary>
+ /// Checks the custom store error.
+ /// </summary>
private static void CheckCustomStoreError(Exception err)
{
var customErr = err as CacheTestStore.CustomStoreException ??
@@ -607,14 +613,93 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
/// <summary>
- ///
+ /// Cache key.
/// </summary>
- public class NamedNodeCacheStoreTest : CacheStoreTest
+ internal class Key
{
- /** <inheritDoc /> */
- protected override string GridName
+ /** */
+ private readonly int _idx;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Key"/> class.
+ /// </summary>
+ public Key(int idx)
+ {
+ _idx = idx;
+ }
+
+ /** <inheritdoc /> */
+ public override bool Equals(object obj)
{
- get { return "name"; }
+ if (obj == null || obj.GetType() != GetType())
+ return false;
+
+ return ((Key)obj)._idx == _idx;
}
+
+ /** <inheritdoc /> */
+ public override int GetHashCode()
+ {
+ return _idx;
+ }
+ }
+
+ /// <summary>
+ /// Cache value.
+ /// </summary>
+ internal class Value
+ {
+ /** */
+ private readonly int _idx;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Value"/> class.
+ /// </summary>
+ public Value(int idx)
+ {
+ _idx = idx;
+ }
+
+ /// <summary>
+ /// Gets the index.
+ /// </summary>
+ public int Index
+ {
+ get { return _idx; }
+ }
+ }
+
+ /// <summary>
+ /// Cache entry predicate.
+ /// </summary>
+ [Serializable]
+ public class CacheEntryFilter : ICacheEntryFilter<int, string>
+ {
+ /** <inheritdoc /> */
+ public bool Invoke(ICacheEntry<int, string> entry)
+ {
+ return entry.Key >= 105;
+ }
+ }
+
+ /// <summary>
+ /// Cache entry predicate that throws an exception.
+ /// </summary>
+ [Serializable]
+ public class ExceptionalEntryFilter : ICacheEntryFilter<int, string>
+ {
+ /** <inheritdoc /> */
+ public bool Invoke(ICacheEntry<int, string> entry)
+ {
+ throw new Exception("Expected exception in ExceptionalEntryFilter");
+ }
+ }
+
+ /// <summary>
+ /// Filter that can't be serialized.
+ /// </summary>
+ public class InvalidCacheEntryFilter : CacheEntryFilter
+ {
+ // No-op.
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
index 4224835..f80f5ce 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
@@ -66,6 +66,20 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Debug.Assert(_grid != null);
+ if (args == null || args.Length == 0)
+ return;
+
+ if (args.Length == 3 && args[0] == null)
+ {
+ // Testing arguments passing.
+ var key = args[1];
+ var val = args[2];
+
+ act(key, val);
+
+ return;
+ }
+
if (LoadMultithreaded)
{
int cnt = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
new file mode 100644
index 0000000..02e257f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/NamedNodeCacheStoreTest.cs
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache.Store
+{
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Cache store test with named node.
+ /// </summary>
+ [TestFixture]
+ public class NamedNodeCacheStoreTest : CacheStoreTest
+ {
+ /** <inheritDoc /> */
+ protected override string GridName
+ {
+ get { return "name"; }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/03f68223/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 186737c..b8dc6cb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -225,7 +225,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/// <summary>
/// Writes the load cache data to the writer.
/// </summary>
- private void WriteLoadCacheData(IBinaryRawWriter writer, ICacheEntryFilter<TK, TV> p, object[] args)
+ private void WriteLoadCacheData(BinaryWriter writer, ICacheEntryFilter<TK, TV> p, object[] args)
{
if (p != null)
{
@@ -237,7 +237,17 @@ namespace Apache.Ignite.Core.Impl.Cache
else
writer.WriteObject<CacheEntryFilterHolder>(null);
- writer.WriteArray(args);
+ if (args != null && args.Length > 0)
+ {
+ writer.WriteInt(args.Length);
+
+ foreach (var o in args)
+ writer.WriteObject(o);
+ }
+ else
+ {
+ writer.WriteInt(0);
+ }
}
/** <inheritDoc /> */