You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/11/21 23:45:33 UTC
[05/55] [abbrv] ignite git commit: IGNITE-1881: Internal portable ->
binary renamings.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
new file mode 100644
index 0000000..74ae244
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
@@ -0,0 +1,173 @@
+/*
+ * 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
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Binary configuration tests.
+ /// </summary>
+ public class BinaryConfigurationTest
+ {
+ /** Cache. */
+ private ICache<int, TestGenericBinarizableBase> _cache;
+
+ /** Random generator. */
+ private static readonly Random Rnd = new Random();
+
+ /** Test types for code config */
+ private static readonly Type[] TestTypes = {
+ typeof (TestGenericBinarizable<int>),
+ typeof (TestGenericBinarizable<string>),
+ typeof (TestGenericBinarizable<TestGenericBinarizable<int>>),
+ typeof (TestGenericBinarizable<List<Tuple<int, string>>>),
+ typeof (TestGenericBinarizable<int, string>),
+ typeof (TestGenericBinarizable<int, TestGenericBinarizable<string>>),
+ typeof (TestGenericBinarizable<int, string, Type>),
+ typeof (TestGenericBinarizable<int, string, TestGenericBinarizable<int, string, Type>>)
+ };
+
+ /** Test types for xml config */
+ private static readonly Type[] TestTypesXml = {
+ typeof (TestGenericBinarizable<long>),
+ typeof (TestGenericBinarizable<Type>),
+ typeof (TestGenericBinarizable<TestGenericBinarizable<long>>),
+ typeof (TestGenericBinarizable<List<Tuple<long, string>>>),
+ typeof (TestGenericBinarizable<long, string>),
+ typeof (TestGenericBinarizable<long, TestGenericBinarizable<string>>),
+ typeof (TestGenericBinarizable<long, string, Type>),
+ typeof (TestGenericBinarizable<long, string, TestGenericBinarizable<long, string, Type>>)
+ };
+
+ /// <summary>
+ /// Starts the grid with provided config.
+ /// </summary>
+ /// <param name="binaryConfiguration">The binary configuration.</param>
+ private void StartGrid(BinaryConfiguration binaryConfiguration)
+ {
+ Ignition.StopAll(true);
+
+ var grid = Ignition.Start(new IgniteConfiguration
+ {
+ SpringConfigUrl = "config\\cache-binarizables.xml",
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ BinaryConfiguration = binaryConfiguration
+ });
+
+ _cache = grid.GetCache<int, TestGenericBinarizableBase>(null);
+ }
+
+ /// <summary>
+ /// Test fixture tear-down routine.
+ /// </summary>
+ [TestFixtureTearDown]
+ public void TestFixtureTearDown()
+ {
+ Ignition.StopAll(true);
+ }
+
+ /// <summary>
+ /// Tests the configuration set in code.
+ /// </summary>
+ [Test]
+ public void TestCodeConfiguration()
+ {
+ StartGrid(new BinaryConfiguration
+ {
+ TypeConfigurations = TestTypes.Select(x => new BinaryTypeConfiguration(x)).ToList()
+ });
+
+ CheckBinarizableTypes(TestTypes);
+ }
+
+ /// <summary>
+ /// Tests the configuration set in xml.
+ /// </summary>
+ [Test]
+ public void TestXmlConfiguration()
+ {
+ StartGrid(null);
+
+ CheckBinarizableTypes(TestTypesXml);
+ }
+
+ /// <summary>
+ /// Checks that specified types are binarizable and can be successfully used in cache.
+ /// </summary>
+ private void CheckBinarizableTypes(IEnumerable<Type> testTypes)
+ {
+ int key = 0;
+
+ foreach (var typ in testTypes)
+ {
+ key += 1;
+
+ var inst = CreateInstance(typ);
+
+ _cache.Put(key, inst);
+
+ var result = _cache.Get(key);
+
+ Assert.AreEqual(inst.Prop, result.Prop);
+
+ Assert.AreEqual(typ, result.GetType());
+ }
+ }
+
+ /// <summary>
+ /// Creates the instance of specified test binarizable type and sets a value on it.
+ /// </summary>
+ private static TestGenericBinarizableBase CreateInstance(Type type)
+ {
+ var inst = (TestGenericBinarizableBase)Activator.CreateInstance(type);
+
+ inst.Prop = Rnd.Next(int.MaxValue);
+
+ return inst;
+ }
+ }
+
+ public abstract class TestGenericBinarizableBase
+ {
+ public object Prop { get; set; }
+ }
+
+ public class TestGenericBinarizable<T> : TestGenericBinarizableBase
+ {
+ public T Prop1 { get; set; }
+ }
+
+ public class TestGenericBinarizable<T1, T2> : TestGenericBinarizableBase
+ {
+ public T1 Prop1 { get; set; }
+ public T2 Prop2 { get; set; }
+ }
+
+ public class TestGenericBinarizable<T1, T2, T3> : TestGenericBinarizableBase
+ {
+ public T1 Prop1 { get; set; }
+ public T2 Prop2 { get; set; }
+ public T3 Prop3 { get; set; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 7df0e5a..64124d7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -148,7 +148,7 @@ namespace Apache.Ignite.Core.Tests.Cache
public bool ThrowErr { get; set; }
// Error flag
- public bool ThrowErrPortable { get; set; }
+ public bool ThrowErrBinarizable { get; set; }
// Error flag
public bool ThrowErrNonSerializable { get; set; }
@@ -179,8 +179,8 @@ namespace Apache.Ignite.Core.Tests.Cache
if (ThrowErr)
throw new Exception(ExceptionText);
- if (ThrowErrPortable)
- throw new PortableTestException {Info = ExceptionText};
+ if (ThrowErrBinarizable)
+ throw new BinarizableTestException {Info = ExceptionText};
if (ThrowErrNonSerializable)
throw new NonSerializableException();
@@ -204,9 +204,9 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Portable add processor.
+ /// Binary add processor.
/// </summary>
- public class PortableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
+ public class BinarizableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IBinarizable
{
/** <inheritdoc /> */
public void WriteBinary(IBinaryWriter writer)
@@ -214,7 +214,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var w = writer.GetRawWriter();
w.WriteBoolean(ThrowErr);
- w.WriteBoolean(ThrowErrPortable);
+ w.WriteBoolean(ThrowErrBinarizable);
w.WriteBoolean(ThrowErrNonSerializable);
w.WriteInt(ThrowOnKey);
w.WriteBoolean(Remove);
@@ -227,7 +227,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var r = reader.GetRawReader();
ThrowErr = r.ReadBoolean();
- ThrowErrPortable = r.ReadBoolean();
+ ThrowErrBinarizable = r.ReadBoolean();
ThrowErrNonSerializable = r.ReadBoolean();
ThrowOnKey = r.ReadInt();
Remove = r.ReadBoolean();
@@ -244,9 +244,9 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Portable exception.
+ /// Binary exception.
/// </summary>
- public class PortableTestException : Exception, IBinarizable
+ public class BinarizableTestException : Exception, IBinarizable
{
/// <summary>
/// Gets or sets exception info.
@@ -298,11 +298,11 @@ namespace Apache.Ignite.Core.Tests.Cache
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortablePerson)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizablePerson)));
portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(CacheTestKey)));
portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(TestReferenceObject)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableAddArgCacheEntryProcessor)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableTestException)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableAddArgCacheEntryProcessor)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTestException)));
portCfg.TypeConfigurations = portTypeCfgs;
@@ -1558,11 +1558,11 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortable()
+ public void TestPutGetBinary()
{
- var cache = Cache<int, PortablePerson>();
+ var cache = Cache<int, BinarizablePerson>();
- PortablePerson obj1 = new PortablePerson("obj1", 1);
+ BinarizablePerson obj1 = new BinarizablePerson("obj1", 1);
cache.Put(1, obj1);
@@ -1573,11 +1573,11 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortableAsync()
+ public void TestPutGetBinaryAsync()
{
- var cache = Cache<int, PortablePerson>().WrapAsync();
+ var cache = Cache<int, BinarizablePerson>().WrapAsync();
- PortablePerson obj1 = new PortablePerson("obj1", 1);
+ BinarizablePerson obj1 = new BinarizablePerson("obj1", 1);
cache.Put(1, obj1);
@@ -1588,7 +1588,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestPutGetPortableKey()
+ public void TestPutGetBinaryKey()
{
var cache = Cache<CacheTestKey, string>();
@@ -1674,7 +1674,7 @@ namespace Apache.Ignite.Core.Tests.Cache
[Category(TestUtils.CategoryIntensive)]
public void TestPutGetAsyncMultithreaded()
{
- var cache = Cache<CacheTestKey, PortablePerson>();
+ var cache = Cache<CacheTestKey, BinarizablePerson>();
const int threads = 10;
const int objPerThread = 1000;
@@ -1692,7 +1692,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- futs.Add(cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)));
+ futs.Add(cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key)));
}
foreach (var fut in futs)
@@ -1729,7 +1729,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key)).Wait();
+ cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key)).Wait();
}
}, threads);
@@ -1739,7 +1739,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int threadIdx = Interlocked.Increment(ref cntr);
- var futs = new List<Task<PortablePerson>>();
+ var futs = new List<Task<BinarizablePerson>>();
for (int i = 0; i < objPerThread; i++)
{
@@ -1765,9 +1765,9 @@ namespace Apache.Ignite.Core.Tests.Cache
//[Test]
//[Category(TestUtils.CATEGORY_INTENSIVE)]
- public void TestAsyncMultithreadedKeepPortable()
+ public void TestAsyncMultithreadedKeepBinary()
{
- var cache = Cache().WithKeepBinary<CacheTestKey, PortablePerson>();
+ var cache = Cache().WithKeepBinary<CacheTestKey, BinarizablePerson>();
var portCache = Cache().WithKeepBinary<CacheTestKey, IBinaryObject>();
const int threads = 10;
@@ -1786,7 +1786,7 @@ namespace Apache.Ignite.Core.Tests.Cache
{
int key = threadIdx * objPerThread + i;
- var task = cache.PutAsync(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
+ var task = cache.PutAsync(new CacheTestKey(key), new BinarizablePerson("Person-" + key, key));
futs.Add(task);
}
@@ -2742,15 +2742,15 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestKeepPortableFlag()
+ public void TestKeepBinaryFlag()
{
- TestKeepPortableFlag(false);
+ TestKeepBinaryFlag(false);
}
[Test]
- public void TestKeepPortableFlagAsync()
+ public void TestKeepBinaryFlagAsync()
{
- TestKeepPortableFlag(true);
+ TestKeepBinaryFlag(true);
}
[Test]
@@ -2793,7 +2793,7 @@ namespace Apache.Ignite.Core.Tests.Cache
}
[Test]
- public void TestSerializableKeepPortable()
+ public void TestSerializableKeepBinary()
{
var cache = Cache<int, TestSerializableObject>();
@@ -2801,9 +2801,9 @@ namespace Apache.Ignite.Core.Tests.Cache
cache.Put(1, obj);
- var portableResult = cache.WithKeepBinary<int, IBinaryObject>().Get(1);
+ var binaryRes = cache.WithKeepBinary<int, IBinaryObject>().Get(1);
- var resultObj = portableResult.Deserialize<TestSerializableObject>();
+ var resultObj = binaryRes.Deserialize<TestSerializableObject>();
Assert.AreEqual(obj, resultObj);
}
@@ -2823,7 +2823,7 @@ namespace Apache.Ignite.Core.Tests.Cache
private void TestInvoke(bool async)
{
TestInvoke<AddArgCacheEntryProcessor>(async);
- TestInvoke<PortableAddArgCacheEntryProcessor>(async);
+ TestInvoke<BinarizableAddArgCacheEntryProcessor>(async);
try
{
@@ -2863,7 +2863,7 @@ namespace Apache.Ignite.Core.Tests.Cache
// Test exceptions
AssertThrowsCacheEntryProcessorException(() => cache.Invoke(key, new T {ThrowErr = true}, arg));
AssertThrowsCacheEntryProcessorException(
- () => cache.Invoke(key, new T {ThrowErrPortable = true}, arg));
+ () => cache.Invoke(key, new T {ThrowErrBinarizable = true}, arg));
AssertThrowsCacheEntryProcessorException(
() => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "BinaryObjectException");
}
@@ -2904,7 +2904,7 @@ namespace Apache.Ignite.Core.Tests.Cache
for (var i = 1; i < 10; i++)
{
TestInvokeAll<AddArgCacheEntryProcessor>(async, i);
- TestInvokeAll<PortableAddArgCacheEntryProcessor>(async, i);
+ TestInvokeAll<BinarizableAddArgCacheEntryProcessor>(async, i);
try
{
@@ -2956,7 +2956,7 @@ namespace Apache.Ignite.Core.Tests.Cache
var errKey = entries.Keys.Reverse().Take(5).Last();
TestInvokeAllException(cache, entries, new T { ThrowErr = true, ThrowOnKey = errKey }, arg, errKey);
- TestInvokeAllException(cache, entries, new T { ThrowErrPortable = true, ThrowOnKey = errKey },
+ TestInvokeAllException(cache, entries, new T { ThrowErrBinarizable = true, ThrowOnKey = errKey },
arg, errKey);
TestInvokeAllException(cache, entries, new T { ThrowErrNonSerializable = true, ThrowOnKey = errKey },
arg, errKey, "BinaryObjectException");
@@ -3088,20 +3088,20 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(5, cache[1]);
}
- private void TestKeepPortableFlag(bool async)
+ private void TestKeepBinaryFlag(bool async)
{
var cache0 = async ? Cache().WrapAsync() : Cache();
- var cache = cache0.WithKeepBinary<int, PortablePerson>();
+ var cache = cache0.WithKeepBinary<int, BinarizablePerson>();
- var portCache = cache0.WithKeepBinary<int, IBinaryObject>();
+ var binCache = cache0.WithKeepBinary<int, IBinaryObject>();
int cnt = 10;
IList<int> keys = new List<int>();
for (int i = 0; i < cnt; i++ ) {
- cache.Put(i, new PortablePerson("person-" + i, i));
+ cache.Put(i, new BinarizablePerson("person-" + i, i));
keys.Add(i);
}
@@ -3110,7 +3110,7 @@ namespace Apache.Ignite.Core.Tests.Cache
for (int i = 0; i < cnt; i++)
{
- var obj = portCache.Get(i);
+ var obj = binCache.Get(i);
CheckPersonData(obj, "person-" + i, i);
@@ -3125,10 +3125,10 @@ namespace Apache.Ignite.Core.Tests.Cache
CheckPersonData(obj, "person-" + i, i);
}
- // Check keepPortable for GetAll operation.
- var allObjs1 = portCache.GetAll(keys);
+ // Check keepBinary for GetAll operation.
+ var allObjs1 = binCache.GetAll(keys);
- var allObjs2 = portCache.GetAll(keys);
+ var allObjs2 = binCache.GetAll(keys);
for (int i = 0; i < cnt; i++)
{
@@ -3137,7 +3137,7 @@ namespace Apache.Ignite.Core.Tests.Cache
CheckPersonData(allObjs2[i], "person-" + i, i);
}
- // Check keepPortable for Remove operation.
+ // Check keepBinary for Remove operation.
var success0 = cache.Remove(0);
var success1 = cache.Remove(1);
@@ -3150,7 +3150,7 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(expName, obj.GetField<string>("name"));
Assert.AreEqual(expAge, obj.GetField<int>("age"));
- PortablePerson person = obj.Deserialize<PortablePerson>();
+ BinarizablePerson person = obj.Deserialize<BinarizablePerson>();
Assert.AreEqual(expName, person.Name);
Assert.AreEqual(expAge, person.Age);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
index abb9e02..5a1af03 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
@@ -77,10 +77,10 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
- /// Test affinity with portable flag.
+ /// Test affinity with binary flag.
/// </summary>
[Test]
- public void TestAffinityPortable()
+ public void TestAffinityBinary()
{
IIgnite g = Ignition.GetIgnite("grid-0");
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
index 693a664..63443b7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
@@ -109,17 +109,17 @@ namespace Apache.Ignite.Core.Tests.Cache
{
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridData).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridData).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridDataNoCfg).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridDataNoCfg).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
Assert.Throws<ArgumentException>(() =>
{
- Ignition.GetIgnite(GridClient).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
+ Ignition.GetIgnite(GridClient).GetCache<CacheTestKey, BinarizablePerson>(CacheDummy);
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 74c4801..411ef05 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -64,8 +64,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
TypeConfigurations = new[]
{
new BinaryTypeConfiguration(typeof (QueryPerson)),
- new BinaryTypeConfiguration(typeof (PortableScanQueryFilter<QueryPerson>)),
- new BinaryTypeConfiguration(typeof (PortableScanQueryFilter<BinaryObject>))
+ new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<QueryPerson>)),
+ new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<BinaryObject>))
}
},
JvmClasspath = TestUtils.CreateTestClasspath(),
@@ -359,10 +359,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check SQL query in portable mode.
+ /// Check SQL query in binary mode.
/// </summary>
[Test]
- public void TestSqlQueryPortable()
+ public void TestSqlQueryBinary()
{
CheckSqlQuery(MaxItemCnt, false, true);
}
@@ -377,10 +377,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local SQL query in portable mode.
+ /// Check local SQL query in binary mode.
/// </summary>
[Test]
- public void TestSqlQueryLocalPortable()
+ public void TestSqlQueryLocalBinary()
{
CheckSqlQuery(MaxItemCnt, true, true);
}
@@ -390,8 +390,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckSqlQuery(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckSqlQuery(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
@@ -402,7 +402,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
SqlQuery qry = loc ? new SqlQuery(typeof(QueryPerson), "age < 50", true) :
new SqlQuery(typeof(QueryPerson), "age < 50");
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
}
/// <summary>
@@ -479,10 +479,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check SQL query in portable mode.
+ /// Check SQL query in binary mode.
/// </summary>
[Test]
- public void TestTextQueryPortable()
+ public void TestTextQueryBinary()
{
CheckTextQuery(MaxItemCnt, false, true);
}
@@ -497,10 +497,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local SQL query in portable mode.
+ /// Check local SQL query in binary mode.
/// </summary>
[Test]
- public void TestTextQueryLocalPortable()
+ public void TestTextQueryLocalBinary()
{
CheckTextQuery(MaxItemCnt, true, true);
}
@@ -510,8 +510,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckTextQuery(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckTextQuery(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
@@ -522,7 +522,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
TextQuery qry = loc ? new TextQuery(typeof(QueryPerson), "1*", true) :
new TextQuery(typeof(QueryPerson), "1*");
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
}
/// <summary>
@@ -535,10 +535,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check scan query in portable mode.
+ /// Check scan query in binary mode.
/// </summary>
[Test]
- public void TestScanQueryPortable()
+ public void TestScanQueryBinary()
{
CheckScanQuery<BinaryObject>(MaxItemCnt, false, true);
}
@@ -553,10 +553,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check local scan query in portable mode.
+ /// Check local scan query in binary mode.
/// </summary>
[Test]
- public void TestScanQueryLocalPortable()
+ public void TestScanQueryLocalBinary()
{
CheckScanQuery<BinaryObject>(MaxItemCnt, true, true);
}
@@ -572,11 +572,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Check scan query with partitions in portable mode.
+ /// Check scan query with partitions in binary mode.
/// </summary>
[Test]
[Ignore("IGNITE-1012")]
- public void TestScanQueryPartitionsPortable([Values(true, false)] bool loc)
+ public void TestScanQueryPartitionsBinary([Values(true, false)] bool loc)
{
CheckScanQueryPartitions<BinaryObject>(MaxItemCnt, loc, true);
}
@@ -609,36 +609,36 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckScanQuery<TV>(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckScanQuery<TV>(int cnt, bool loc, bool keepBinary)
{
var cache = Cache();
// No predicate
var exp = PopulateCache(cache, loc, cnt, x => true);
var qry = new ScanQuery<int, TV>();
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
// Serializable
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ ValidateQueryResults(cache, qry, exp, keepBinary);
- // Portable
+ // Binarizable
exp = PopulateCache(cache, loc, cnt, x => x < 50);
- qry = new ScanQuery<int, TV>(new PortableScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
+ qry = new ScanQuery<int, TV>(new BinarizableScanQueryFilter<TV>());
+ ValidateQueryResults(cache, qry, exp, keepBinary);
// Invalid
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new InvalidScanQueryFilter<TV>());
- Assert.Throws<BinaryObjectException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
+ Assert.Throws<BinaryObjectException>(() => ValidateQueryResults(cache, qry, exp, keepBinary));
// Exception
exp = PopulateCache(cache, loc, cnt, x => x < 50);
qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV> {ThrowErr = true});
- var ex = Assert.Throws<IgniteException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
+ var ex = Assert.Throws<IgniteException>(() => ValidateQueryResults(cache, qry, exp, keepBinary));
Assert.AreEqual(ScanQueryFilter<TV>.ErrMessage, ex.Message);
}
@@ -647,8 +647,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
/// <param name="cnt">Amount of cache entries to create.</param>
/// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
- private void CheckScanQueryPartitions<TV>(int cnt, bool loc, bool keepPortable)
+ /// <param name="keepBinary">Keep binary flag.</param>
+ private void CheckScanQueryPartitions<TV>(int cnt, bool loc, bool keepBinary)
{
StopGrids();
StartGrids();
@@ -669,7 +669,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var qry = new ScanQuery<int, TV> { Partition = part };
Console.WriteLine("Checking query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
+ ValidateQueryResults(cache, qry, exp0, keepBinary);
}
// Partitions with predicate
@@ -686,7 +686,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>()) { Partition = part };
Console.WriteLine("Checking predicate query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
+ ValidateQueryResults(cache, qry, exp0, keepBinary);
}
}
@@ -697,11 +697,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// <param name="cache">Cache.</param>
/// <param name="qry">Query.</param>
/// <param name="exp">Expected keys.</param>
- /// <param name="keepPortable">Keep binary flag.</param>
+ /// <param name="keepBinary">Keep binary flag.</param>
private static void ValidateQueryResults(ICache<int, QueryPerson> cache, QueryBase qry, HashSet<int> exp,
- bool keepPortable)
+ bool keepBinary)
{
- if (keepPortable)
+ if (keepBinary)
{
var cache0 = cache.WithKeepBinary<int, IBinaryObject>();
@@ -906,9 +906,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
- /// Portable query filter.
+ /// binary query filter.
/// </summary>
- public class PortableScanQueryFilter<TV> : ScanQueryFilter<TV>, IBinarizable
+ public class BinarizableScanQueryFilter<TV> : ScanQueryFilter<TV>, IBinarizable
{
/** <inheritdoc /> */
public void WriteBinary(IBinaryWriter writer)
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index b81405b..cb9542f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -69,10 +69,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
private IIgnite grid2;
/** Cache on the first node. */
- private ICache<int, PortableEntry> cache1;
+ private ICache<int, BinarizableEntry> cache1;
/** Cache on the second node. */
- private ICache<int, PortableEntry> cache2;
+ private ICache<int, BinarizableEntry> cache2;
/** Cache name. */
private readonly string cacheName;
@@ -101,9 +101,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableEntry)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(PortableFilter)));
- portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(KeepPortableFilter)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableEntry)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFilter)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(KeepBinaryFilter)));
portCfg.TypeConfigurations = portTypeCfgs;
@@ -114,11 +114,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
cfg.GridName = "grid-1";
grid1 = Ignition.Start(cfg);
- cache1 = grid1.GetCache<int, PortableEntry>(cacheName);
+ cache1 = grid1.GetCache<int, BinarizableEntry>(cacheName);
cfg.GridName = "grid-2";
grid2 = Ignition.Start(cfg);
- cache2 = grid2.GetCache<int, PortableEntry>(cacheName);
+ cache2 = grid2.GetCache<int, BinarizableEntry>(cacheName);
}
/// <summary>
@@ -139,10 +139,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
CB_EVTS = new BlockingCollection<CallbackEvent>();
FILTER_EVTS = new BlockingCollection<FilterEvent>();
- AbstractFilter<PortableEntry>.res = true;
- AbstractFilter<PortableEntry>.err = false;
- AbstractFilter<PortableEntry>.marshErr = false;
- AbstractFilter<PortableEntry>.unmarshErr = false;
+ AbstractFilter<BinarizableEntry>.res = true;
+ AbstractFilter<BinarizableEntry>.err = false;
+ AbstractFilter<BinarizableEntry>.marshErr = false;
+ AbstractFilter<BinarizableEntry>.unmarshErr = false;
cache1.Remove(PrimaryKey(cache1));
cache1.Remove(PrimaryKey(cache2));
@@ -159,7 +159,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestValidation()
{
- Assert.Throws<ArgumentException>(() => { cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(null)); });
+ Assert.Throws<ArgumentException>(() => { cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(null)); });
}
/// <summary>
@@ -171,8 +171,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry =
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
IDisposable qryHnd;
@@ -208,9 +208,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>(), true) :
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry = loc ?
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>(), true) :
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
using (cache1.QueryContinuous(qry))
{
@@ -260,21 +260,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestCallbackInjection()
{
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
+ Listener<BinarizableEntry> cb = new Listener<BinarizableEntry>();
Assert.IsNull(cb.ignite);
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb)))
+ using (cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(cb)))
{
Assert.IsNotNull(cb.ignite);
}
}
/// <summary>
- /// Test portable filter logic.
+ /// Test binarizable filter logic.
/// </summary>
[Test]
- public void TestFilterPortable()
+ public void TestFilterBinarizable()
{
CheckFilter(true, false);
}
@@ -291,17 +291,17 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter.
/// </summary>
- /// <param name="portable">Portable.</param>
+ /// <param name="binarizable">Binarizable.</param>
/// <param name="loc">Local cache flag.</param>
- protected void CheckFilter(bool portable, bool loc)
+ protected void CheckFilter(bool binarizable, bool loc)
{
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(lsnr, filter, true) :
- new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = loc ?
+ new ContinuousQuery<int, BinarizableEntry>(lsnr, filter, true) :
+ new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -326,7 +326,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
CheckCallbackSingle(key2, null, Entry(key2));
}
- AbstractFilter<PortableEntry>.res = false;
+ AbstractFilter<BinarizableEntry>.res = false;
// Ignored put from local node.
cache1.GetAndPut(key1, Entry(key1 + 1));
@@ -346,11 +346,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter error during invoke.
+ /// Test binarizable filter error during invoke.
/// </summary>
[Ignore("IGNITE-521")]
[Test]
- public void TestFilterInvokeErrorPortable()
+ public void TestFilterInvokeErrorBinarizable()
{
CheckFilterInvokeError(true);
}
@@ -368,15 +368,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter error handling logic during invoke.
/// </summary>
- private void CheckFilterInvokeError(bool portable)
+ private void CheckFilterInvokeError(bool binarizable)
{
- AbstractFilter<PortableEntry>.err = true;
+ AbstractFilter<BinarizableEntry>.err = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>) new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -415,10 +415,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter marshalling error.
+ /// Test binarizable filter marshalling error.
/// </summary>
[Test]
- public void TestFilterMarshalErrorPortable()
+ public void TestFilterMarshalErrorBinarizable()
{
CheckFilterMarshalError(true);
}
@@ -435,16 +435,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter marshal error handling.
/// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterMarshalError(bool portable)
+ /// <param name="binarizable">Binarizable flag.</param>
+ private void CheckFilterMarshalError(bool binarizable)
{
- AbstractFilter<PortableEntry>.marshErr = true;
+ AbstractFilter<BinarizableEntry>.marshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>)new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
Assert.Throws<Exception>(() =>
{
@@ -470,14 +470,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="loc"></param>
protected void CheckFilterNonSerializable(bool loc)
{
- AbstractFilter<PortableEntry>.unmarshErr = true;
+ AbstractFilter<BinarizableEntry>.unmarshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter = new LocalFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter = new LocalFilter();
- ContinuousQuery<int, PortableEntry> qry = loc
- ? new ContinuousQuery<int, PortableEntry>(lsnr, filter, true)
- : new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = loc
+ ? new ContinuousQuery<int, BinarizableEntry>(lsnr, filter, true)
+ : new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
if (loc)
{
@@ -502,11 +502,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter unmarshalling error.
+ /// Test binarizable filter unmarshalling error.
/// </summary>
[Ignore("IGNITE-521")]
[Test]
- public void TestFilterUnmarshalErrorPortable()
+ public void TestFilterUnmarshalErrorBinarizable()
{
CheckFilterUnmarshalError(true);
}
@@ -524,16 +524,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Check filter unmarshal error handling.
/// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterUnmarshalError(bool portable)
+ /// <param name="binarizable">Binarizable flag.</param>
+ private void CheckFilterUnmarshalError(bool binarizable)
{
- AbstractFilter<PortableEntry>.unmarshErr = true;
+ AbstractFilter<BinarizableEntry>.unmarshErr = true;
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
+ ICacheEntryEventListener<int, BinarizableEntry> lsnr = new Listener<BinarizableEntry>();
+ ICacheEntryEventFilter<int, BinarizableEntry> filter =
+ binarizable ? (AbstractFilter<BinarizableEntry>) new BinarizableFilter() : new SerializableFilter();
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(lsnr, filter);
using (cache1.QueryContinuous(qry))
{
@@ -566,12 +566,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
[Test]
public void TestFilterInjection()
{
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
- PortableFilter filter = new PortableFilter();
+ Listener<BinarizableEntry> cb = new Listener<BinarizableEntry>();
+ BinarizableFilter filter = new BinarizableFilter();
Assert.IsNull(filter.ignite);
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb, filter)))
+ using (cache1.QueryContinuous(new ContinuousQuery<int, BinarizableEntry>(cb, filter)))
{
// Local injection.
Assert.IsNotNull(filter.ignite);
@@ -589,15 +589,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
- /// Test "keep-portable" scenario.
+ /// Test "keep-binary" scenario.
/// </summary>
[Test]
- public void TestKeepPortable()
+ public void TestKeepBinary()
{
var cache = cache1.WithKeepBinary<int, IBinaryObject>();
ContinuousQuery<int, IBinaryObject> qry = new ContinuousQuery<int, IBinaryObject>(
- new Listener<IBinaryObject>(), new KeepPortableFilter());
+ new Listener<IBinaryObject>(), new KeepBinaryFilter());
using (cache.QueryContinuous(qry))
{
@@ -611,14 +611,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
Assert.AreEqual(PrimaryKey(cache1), filterEvt.entry.Key);
Assert.AreEqual(null, filterEvt.entry.OldValue);
Assert.AreEqual(Entry(1), (filterEvt.entry.Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
Assert.AreEqual(1, cbEvt.entries.Count);
Assert.AreEqual(PrimaryKey(cache1), cbEvt.entries.First().Key);
Assert.AreEqual(null, cbEvt.entries.First().OldValue);
Assert.AreEqual(Entry(1), (cbEvt.entries.First().Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
// 2. Remote put.
cache1.GetAndPut(PrimaryKey(cache2), Entry(2));
@@ -627,14 +627,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
Assert.AreEqual(PrimaryKey(cache2), filterEvt.entry.Key);
Assert.AreEqual(null, filterEvt.entry.OldValue);
Assert.AreEqual(Entry(2), (filterEvt.entry.Value as IBinaryObject)
- .Deserialize<PortableEntry>());
+ .Deserialize<BinarizableEntry>());
Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
Assert.AreEqual(1, cbEvt.entries.Count);
Assert.AreEqual(PrimaryKey(cache2), cbEvt.entries.First().Key);
Assert.AreEqual(null, cbEvt.entries.First().OldValue);
Assert.AreEqual(Entry(2),
- (cbEvt.entries.First().Value as IBinaryObject).Deserialize<PortableEntry>());
+ (cbEvt.entries.First().Value as IBinaryObject).Deserialize<BinarizableEntry>());
}
}
/// <summary>
@@ -697,7 +697,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
// Put two remote keys in advance.
List<int> rmtKeys = PrimaryKeys(cache2, 2);
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry = new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
qry.BufferSize = 2;
qry.TimeInterval = TimeSpan.FromMilliseconds(1000000);
@@ -743,8 +743,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
int key1 = PrimaryKey(cache1);
int key2 = PrimaryKey(cache2);
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ ContinuousQuery<int, BinarizableEntry> qry =
+ new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
qry.BufferSize = 2;
qry.TimeInterval = TimeSpan.FromMilliseconds(500);
@@ -791,26 +791,26 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
public void TestInitialQuery()
{
// Scan query, GetAll
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.GetAll());
+ TestInitialQuery(new ScanQuery<int, BinarizableEntry>(new InitialQueryScanFilter()), cur => cur.GetAll());
// Scan query, iterator
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.ToList());
+ TestInitialQuery(new ScanQuery<int, BinarizableEntry>(new InitialQueryScanFilter()), cur => cur.ToList());
// Sql query, GetAll
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.GetAll());
+ TestInitialQuery(new SqlQuery(typeof(BinarizableEntry), "val < 33"), cur => cur.GetAll());
// Sql query, iterator
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.ToList());
+ TestInitialQuery(new SqlQuery(typeof(BinarizableEntry), "val < 33"), cur => cur.ToList());
// Text query, GetAll
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.GetAll());
+ TestInitialQuery(new TextQuery(typeof(BinarizableEntry), "1*"), cur => cur.GetAll());
// Text query, iterator
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.ToList());
+ TestInitialQuery(new TextQuery(typeof(BinarizableEntry), "1*"), cur => cur.ToList());
// Test exception: invalid initial query
var ex = Assert.Throws<IgniteException>(
- () => TestInitialQuery(new TextQuery(typeof (PortableEntry), "*"), cur => cur.GetAll()));
+ () => TestInitialQuery(new TextQuery(typeof (BinarizableEntry), "*"), cur => cur.GetAll()));
Assert.AreEqual("Cannot parse '*': '*' or '?' not allowed as first character in WildcardQuery", ex.Message);
}
@@ -818,10 +818,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Tests the initial query.
/// </summary>
- private void TestInitialQuery(QueryBase initialQry, Func<IQueryCursor<ICacheEntry<int, PortableEntry>>,
- IEnumerable<ICacheEntry<int, PortableEntry>>> getAllFunc)
+ private void TestInitialQuery(QueryBase initialQry, Func<IQueryCursor<ICacheEntry<int, BinarizableEntry>>,
+ IEnumerable<ICacheEntry<int, BinarizableEntry>>> getAllFunc)
{
- var qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
+ var qry = new ContinuousQuery<int, BinarizableEntry>(new Listener<BinarizableEntry>());
cache1.Put(11, Entry(11));
cache1.Put(12, Entry(12));
@@ -829,7 +829,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
try
{
- IContinuousQueryHandle<ICacheEntry<int, PortableEntry>> contQry;
+ IContinuousQueryHandle<ICacheEntry<int, BinarizableEntry>> contQry;
using (contQry = cache1.QueryContinuous(qry, initialQry))
{
@@ -868,7 +868,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expKey">Expected key.</param>
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected value.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
+ private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal)
{
CheckFilterSingle(expKey, expOldVal, expVal, 1000);
}
@@ -880,7 +880,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected value.</param>
/// <param name="timeout">Timeout.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
+ private void CheckFilterSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal, int timeout)
{
FilterEvent evt;
@@ -908,7 +908,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expKey">Expected key.</param>
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected new value.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
+ private void CheckCallbackSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal)
{
CheckCallbackSingle(expKey, expOldVal, expVal, 1000);
}
@@ -920,7 +920,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <param name="expOldVal">Expected old value.</param>
/// <param name="expVal">Expected new value.</param>
/// <param name="timeout">Timeout.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
+ private void CheckCallbackSingle(int expKey, BinarizableEntry expOldVal, BinarizableEntry expVal, int timeout)
{
CallbackEvent evt;
@@ -949,9 +949,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// </summary>
/// <param name="val">Value.</param>
/// <returns>Entry.</returns>
- private static PortableEntry Entry(int val)
+ private static BinarizableEntry Entry(int val)
{
- return new PortableEntry(val);
+ return new BinarizableEntry(val);
}
/// <summary>
@@ -1010,9 +1010,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Portable entry.
+ /// Binarizable entry.
/// </summary>
- public class PortableEntry
+ public class BinarizableEntry
{
/** Value. */
public readonly int val;
@@ -1027,7 +1027,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// Constructor.
/// </summary>
/// <param name="val">Value.</param>
- public PortableEntry(int val)
+ public BinarizableEntry(int val)
{
this.val = val;
}
@@ -1035,7 +1035,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/** <inheritDoc /> */
public override bool Equals(object obj)
{
- return obj != null && obj is PortableEntry && ((PortableEntry)obj).val == val;
+ return obj != null && obj is BinarizableEntry && ((BinarizableEntry)obj).val == val;
}
}
@@ -1076,15 +1076,15 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// <summary>
/// Filter which cannot be serialized.
/// </summary>
- public class LocalFilter : AbstractFilter<PortableEntry>
+ public class LocalFilter : AbstractFilter<BinarizableEntry>
{
// No-op.
}
/// <summary>
- /// Portable filter.
+ /// Binarizable filter.
/// </summary>
- public class PortableFilter : AbstractFilter<PortableEntry>, IBinarizable
+ public class BinarizableFilter : AbstractFilter<BinarizableEntry>, IBinarizable
{
/** <inheritDoc /> */
public void WriteBinary(IBinaryWriter writer)
@@ -1105,7 +1105,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// Serializable filter.
/// </summary>
[Serializable]
- public class SerializableFilter : AbstractFilter<PortableEntry>, ISerializable
+ public class SerializableFilter : AbstractFilter<BinarizableEntry>, ISerializable
{
/// <summary>
/// Constructor.
@@ -1135,9 +1135,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Filter for "keep-portable" scenario.
+ /// Filter for "keep-binary" scenario.
/// </summary>
- public class KeepPortableFilter : AbstractFilter<IBinaryObject>
+ public class KeepBinaryFilter : AbstractFilter<IBinaryObject>
{
// No-op.
}
@@ -1173,7 +1173,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
IBinaryType meta = val.GetBinaryType();
- Assert.AreEqual(typeof(PortableEntry).Name, meta.TypeName);
+ Assert.AreEqual(typeof(BinarizableEntry).Name, meta.TypeName);
}
countDown.Signal();
@@ -1225,10 +1225,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
/// ScanQuery filter for InitialQuery test.
/// </summary>
[Serializable]
- private class InitialQueryScanFilter : ICacheEntryFilter<int, PortableEntry>
+ private class InitialQueryScanFilter : ICacheEntryFilter<int, BinarizableEntry>
{
/** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, PortableEntry> entry)
+ public bool Invoke(ICacheEntry<int, BinarizableEntry> entry)
{
return entry.Key < 33;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
index aa7d627..1d2f1f2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
@@ -43,10 +43,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
}
/// <summary>
- /// Test portable filter logic.
+ /// Test binary filter logic.
/// </summary>
[Test]
- public void TestFilterPortableLocal()
+ public void TestFilterBinarizableLocal()
{
CheckFilter(true, true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/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 eb148f0..1270138 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
@@ -117,7 +117,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
public class CacheStoreTest
{
/** */
- private const string PortableStoreCacheName = "portable_store";
+ private const string BinaryStoreCacheName = "binary_store";
/** */
private const string ObjectStoreCacheName = "object_store";
@@ -145,7 +145,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
IgniteConfigurationEx cfg = new IgniteConfigurationEx();
- cfg.GridName = GridName();
+ cfg.GridName = GridName;
cfg.JvmClasspath = TestUtils.CreateTestClasspath();
cfg.JvmOptions = TestUtils.TestJavaOptions();
cfg.SpringConfigUrl = "config\\native-client-test-cache-store.xml";
@@ -183,7 +183,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[TearDown]
public void AfterTest()
{
- var cache = Cache();
+ var cache = GetCache();
cache.Clear();
@@ -191,7 +191,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
CacheTestStore.Reset();
- TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName()));
+ TestUtils.AssertHandleRegistryHasItems(300, _storeCount, Ignition.GetIgnite(GridName));
Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
}
@@ -199,7 +199,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLoadCache()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -220,7 +220,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLocalLoadCache()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -237,7 +237,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
{
CacheTestStore.LoadObjects = true;
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -255,7 +255,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestLoadCacheAsync()
{
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -272,7 +272,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestPutLoad()
{
- var cache = Cache();
+ var cache = GetCache();
cache.Put(1, "val");
@@ -290,9 +290,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
}
[Test]
- public void TestPutLoadPortables()
+ public void TestPutLoadBinarizable()
{
- var cache = PortableStoreCache<int, Value>();
+ var cache = GetBinaryStoreCache<int, Value>();
cache.Put(1, new Value(1));
@@ -316,7 +316,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestPutLoadObjects()
{
- var cache = ObjectStoreCache<int, Value>();
+ var cache = GetObjectStoreCache<int, Value>();
cache.Put(1, new Value(1));
@@ -345,7 +345,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
for (int i = 0; i < 10; i++)
putMap.Add(i, "val_" + i);
- var cache = Cache();
+ var cache = GetCache();
cache.PutAll(putMap);
@@ -378,7 +378,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestRemove()
{
- var cache = Cache();
+ var cache = GetCache();
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
@@ -399,7 +399,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestRemoveAll()
{
- var cache = Cache();
+ var cache = GetCache();
for (int i = 0; i < 10; i++)
cache.Put(i, "val_" + i);
@@ -419,7 +419,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestTx()
{
- var cache = Cache();
+ var cache = GetCache();
using (var tx = cache.Ignite.GetTransactions().TxStart())
{
@@ -444,7 +444,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
{
CacheTestStore.LoadMultithreaded = true;
- var cache = Cache();
+ var cache = GetCache();
Assert.AreEqual(0, cache.GetSize());
@@ -459,7 +459,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestCustomStoreProperties()
{
- var cache = CustomStoreCache();
+ var cache = GetCustomStoreCache();
Assert.IsNotNull(cache);
Assert.AreEqual(42, CacheTestStore.intProperty);
@@ -469,7 +469,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[Test]
public void TestDynamicStoreStart()
{
- var cache = TemplateStoreCache();
+ var cache = GetTemplateStoreCache();
Assert.IsNotNull(cache);
@@ -483,10 +483,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// <summary>
/// Get's grid name for this test.
/// </summary>
- /// <returns>Grid name.</returns>
- protected virtual string GridName()
+ /// <value>Grid name.</value>
+ protected virtual string GridName
{
- return null;
+ get { return null; }
}
private IDictionary StoreMap()
@@ -494,31 +494,31 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
return CacheTestStore.Map;
}
- private ICache<int, string> Cache()
+ private ICache<int, string> GetCache()
{
- return PortableStoreCache<int, string>();
+ return GetBinaryStoreCache<int, string>();
}
- private ICache<TK, TV> PortableStoreCache<TK, TV>()
+ private ICache<TK, TV> GetBinaryStoreCache<TK, TV>()
{
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(PortableStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<TK, TV>(BinaryStoreCacheName);
}
- private ICache<TK, TV> ObjectStoreCache<TK, TV>()
+ private ICache<TK, TV> GetObjectStoreCache<TK, TV>()
{
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(ObjectStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<TK, TV>(ObjectStoreCacheName);
}
- private ICache<int, string> CustomStoreCache()
+ private ICache<int, string> GetCustomStoreCache()
{
- return Ignition.GetIgnite(GridName()).GetCache<int, string>(CustomStoreCacheName);
+ return Ignition.GetIgnite(GridName).GetCache<int, string>(CustomStoreCacheName);
}
- private ICache<int, string> TemplateStoreCache()
+ private ICache<int, string> GetTemplateStoreCache()
{
var cacheName = TemplateStoreCacheName.Replace("*", Guid.NewGuid().ToString());
- return Ignition.GetIgnite(GridName()).GetOrCreateCache<int, string>(cacheName);
+ return Ignition.GetIgnite(GridName).GetOrCreateCache<int, string>(cacheName);
}
}
@@ -528,9 +528,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
public class NamedNodeCacheStoreTest : CacheStoreTest
{
/** <inheritDoc /> */
- protected override string GridName()
+ protected override string GridName
{
- return "name";
+ get { return "name"; }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
index 9e96ca2..e3d0d96 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
@@ -171,7 +171,7 @@ namespace Apache.Ignite.Core.Tests.Compute
ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
- PortableTypeConfigurations(portTypeCfgs);
+ GetBinaryTypeConfigurations(portTypeCfgs);
portCfg.TypeConfigurations = portTypeCfgs;
@@ -206,10 +206,10 @@ namespace Apache.Ignite.Core.Tests.Compute
}
/// <summary>
- /// Define portable types.
+ /// Define binary types.
/// </summary>
- /// <param name="portTypeCfgs">Portable type configurations.</param>
- protected virtual void PortableTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ /// <param name="portTypeCfgs">Binary type configurations.</param>
+ protected virtual void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
new file mode 100644
index 0000000..b881582
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableClosureTaskTest.cs
@@ -0,0 +1,185 @@
+/*
+ * 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.Compute
+{
+ using System;
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Compute;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Closure execution tests for binary objects.
+ /// </summary>
+ public class BinarizableClosureTaskTest : ClosureTaskTest
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public BinarizableClosureTaskTest() : base(false) { }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="fork">Fork flag.</param>
+ protected BinarizableClosureTaskTest(bool fork) : base(fork) { }
+
+ /** <inheritDoc /> */
+ protected override void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ {
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableOutFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFunc)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableException)));
+ }
+
+ /** <inheritDoc /> */
+ protected override IComputeFunc<object> OutFunc(bool err)
+ {
+ return new BinarizableOutFunc(err);
+ }
+
+ /** <inheritDoc /> */
+ protected override IComputeFunc<object, object> Func(bool err)
+ {
+ return new BinarizableFunc(err);
+ }
+
+ /** <inheritDoc /> */
+ protected override void CheckResult(object res)
+ {
+ Assert.IsTrue(res != null);
+
+ BinarizableResult res0 = res as BinarizableResult;
+
+ Assert.IsTrue(res0 != null);
+ Assert.AreEqual(1, res0.Res);
+ }
+
+ /** <inheritDoc /> */
+ protected override void CheckError(Exception err)
+ {
+ Assert.IsTrue(err != null);
+
+ BinarizableException err0 = err as BinarizableException;
+
+ Assert.IsTrue(err0 != null);
+ Assert.AreEqual(ErrMsg, err0.Msg);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableOutFunc : IComputeFunc<object>
+ {
+ /** Error. */
+ private readonly bool _err;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="err"></param>
+ public BinarizableOutFunc(bool err)
+ {
+ _err = err;
+ }
+
+ /** <inheritDoc /> */
+ public object Invoke()
+ {
+ if (_err)
+ throw new BinarizableException(ErrMsg);
+ return new BinarizableResult(1);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableFunc : IComputeFunc<object, object>
+ {
+ /** Error. */
+ private readonly bool _err;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="err"></param>
+ public BinarizableFunc(bool err)
+ {
+ _err = err;
+ }
+
+ /** <inheritDoc /> */
+ public object Invoke(object arg)
+ {
+ if (_err)
+ throw new BinarizableException(ErrMsg);
+ return new BinarizableResult(1);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableException : Exception, IBinarizable
+ {
+ /** */
+ public string Msg;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="msg"></param>
+ public BinarizableException(string msg)
+ {
+ Msg = msg;
+ }
+
+ /** <inheritDoc /> */
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.GetRawWriter().WriteString(Msg);
+ }
+
+ /** <inheritDoc /> */
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Msg = reader.GetRawReader().ReadString();
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ private class BinarizableResult
+ {
+ /** */
+ public readonly int Res;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="res"></param>
+ public BinarizableResult(int res)
+ {
+ Res = res;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d69362f8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
new file mode 100644
index 0000000..5c1ee34
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/BinarizableTaskTest.cs
@@ -0,0 +1,269 @@
+/*
+ * 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.Compute
+{
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Resource;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Task test result.
+ /// </summary>
+ public class BinarizableTaskTest : AbstractTaskTest
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public BinarizableTaskTest() : base(false) { }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="fork">Fork flag.</param>
+ protected BinarizableTaskTest(bool fork) : base(fork) { }
+
+ /// <summary>
+ /// Test for task result.
+ /// </summary>
+ [Test]
+ public void TestBinarizableObjectInTask()
+ {
+ var taskArg = new BinarizableWrapper {Item = ToBinary(Grid1, new BinarizableTaskArgument(100))};
+
+ TestTask task = new TestTask(Grid1, taskArg);
+
+ var res = Grid1.GetCompute().Execute(task, taskArg).Item;
+
+ Assert.NotNull(res);
+
+ Assert.AreEqual(400, res.GetField<int>("val"));
+
+ BinarizableTaskResult resObj = res.Deserialize<BinarizableTaskResult>();
+
+ Assert.AreEqual(400, resObj.Val);
+ }
+
+ private static IBinaryObject ToBinary(IIgnite grid, object obj)
+ {
+ var cache = grid.GetCache<object, object>(Cache1Name).WithKeepBinary<object, object>();
+
+ cache.Put(1, obj);
+
+ return (IBinaryObject) cache.Get(1);
+ }
+
+ /** <inheritDoc /> */
+ override protected void GetBinaryTypeConfigurations(ICollection<BinaryTypeConfiguration> portTypeCfgs)
+ {
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJobArgument)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJobResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTaskArgument)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableTaskResult)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableJob)));
+ portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableWrapper)));
+ }
+
+ /// <summary>
+ /// Test task.
+ /// </summary>
+ class TestTask : ComputeTaskAdapter<BinarizableWrapper, BinarizableWrapper, BinarizableWrapper>
+ {
+ /** */
+ private readonly IIgnite _grid;
+
+ private readonly BinarizableWrapper _taskArgField;
+
+ public TestTask(IIgnite grid, BinarizableWrapper taskArgField)
+ {
+ _grid = grid;
+ _taskArgField = taskArgField;
+ }
+
+ /** <inheritDoc /> */
+ override public IDictionary<IComputeJob<BinarizableWrapper>, IClusterNode> Map(IList<IClusterNode> subgrid, BinarizableWrapper arg)
+ {
+ Assert.AreEqual(3, subgrid.Count);
+ Assert.NotNull(_grid);
+
+ var taskArg = arg;
+
+ CheckTaskArgument(taskArg);
+
+ CheckTaskArgument(_taskArgField);
+
+ var jobs = new Dictionary<IComputeJob<BinarizableWrapper>, IClusterNode>();
+
+
+ foreach (IClusterNode node in subgrid)
+ {
+ if (!Grid3Name.Equals(node.GetAttribute<string>("org.apache.ignite.ignite.name"))) // Grid3 does not have cache.
+ {
+ var job = new BinarizableJob
+ {
+ Arg = new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableJobArgument(200))}
+ };
+
+ jobs.Add(job, node);
+ }
+ }
+
+ Assert.AreEqual(2, jobs.Count);
+
+ return jobs;
+ }
+
+ private void CheckTaskArgument(BinarizableWrapper arg)
+ {
+ Assert.IsNotNull(arg);
+
+ var taskArg = arg.Item;
+
+ Assert.IsNotNull(taskArg);
+
+ Assert.AreEqual(100, taskArg.GetField<int>("val"));
+
+ BinarizableTaskArgument taskArgObj = taskArg.Deserialize<BinarizableTaskArgument>();
+
+ Assert.AreEqual(100, taskArgObj.Val);
+ }
+
+ /** <inheritDoc /> */
+ override public BinarizableWrapper Reduce(IList<IComputeJobResult<BinarizableWrapper>> results)
+ {
+ Assert.NotNull(_grid);
+
+ Assert.AreEqual(2, results.Count);
+
+ foreach (var res in results)
+ {
+ var jobRes = res.Data.Item;
+
+ Assert.NotNull(jobRes);
+
+ Assert.AreEqual(300, jobRes.GetField<int>("val"));
+
+ BinarizableJobResult jobResObj = jobRes.Deserialize<BinarizableJobResult>();
+
+ Assert.AreEqual(300, jobResObj.Val);
+ }
+
+ return new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableTaskResult(400))};
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJobArgument
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableJobArgument(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJobResult
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableJobResult(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableTaskArgument
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableTaskArgument(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableTaskResult
+ {
+ /** */
+ public readonly int Val;
+
+ public BinarizableTaskResult(int val)
+ {
+ Val = val;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ class BinarizableJob : IComputeJob<BinarizableWrapper>
+ {
+ [InstanceResource]
+ private readonly IIgnite _grid = null;
+
+ /** */
+ public BinarizableWrapper Arg;
+
+ /** <inheritDoc /> */
+
+ public BinarizableWrapper Execute()
+ {
+ Assert.IsNotNull(Arg);
+
+ var arg = Arg.Item;
+
+ Assert.IsNotNull(arg);
+
+ Assert.AreEqual(200, arg.GetField<int>("val"));
+
+ var argObj = arg.Deserialize<BinarizableJobArgument>();
+
+ Assert.AreEqual(200, argObj.Val);
+
+ return new BinarizableWrapper {Item = ToBinary(_grid, new BinarizableJobResult(300))};
+ }
+
+ public void Cancel()
+ {
+ // No-op.
+ }
+ }
+
+ class BinarizableWrapper
+ {
+ public IBinaryObject Item { get; set; }
+ }
+ }
+}