You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2016/02/03 04:24:48 UTC
[07/19] ignite git commit: IGNITE-1906: .NET: Implemented
programmatic configuration.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
new file mode 100644
index 0000000..2e6a8a1
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -0,0 +1,538 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Cache.Store;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Discovery.Tcp;
+ using Apache.Ignite.Core.Discovery.Tcp.Static;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests cache configuration propagation.
+ /// </summary>
+ public class CacheConfigurationTest
+ {
+ /** */
+ private IIgnite _ignite;
+
+ /** */
+ private const string CacheName = "cacheName";
+
+ /** */
+ private static int _factoryProp;
+
+
+ /// <summary>
+ /// Fixture set up.
+ /// </summary>
+ [TestFixtureSetUp]
+ public void FixtureSetUp()
+ {
+ var cfg = new IgniteConfiguration
+ {
+ CacheConfiguration = new List<CacheConfiguration>
+ {
+ new CacheConfiguration(),
+ GetCustomCacheConfiguration()
+ },
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ GridName = CacheName,
+ BinaryConfiguration = new BinaryConfiguration(typeof(Entity)),
+ DiscoverySpi = new TcpDiscoverySpi
+ {
+ IpFinder = new TcpDiscoveryStaticIpFinder
+ {
+ Endpoints = new[] { "127.0.0.1:47500", "127.0.0.1:47501" }
+ }
+ }
+ };
+
+ _ignite = Ignition.Start(cfg);
+ }
+
+ /// <summary>
+ /// Fixture tear down.
+ /// </summary>
+ [TestFixtureTearDown]
+ public void FixtureTearDown()
+ {
+ Ignition.StopAll(true);
+ }
+
+ /// <summary>
+ /// Tests the default configuration.
+ /// </summary>
+ [Test]
+ public void TestDefaultConfiguration()
+ {
+ AssertConfigIsDefault(new CacheConfiguration());
+
+ AssertConfigIsDefault(_ignite.GetCache<int, int>(null).GetConfiguration());
+
+ AssertConfigIsDefault(_ignite.GetConfiguration().CacheConfiguration.Single(c => c.Name == null));
+ }
+
+ /// <summary>
+ /// Tests the custom configuration.
+ /// </summary>
+ [Test]
+ public void TestCustomConfiguration()
+ {
+ AssertConfigsAreEqual(GetCustomCacheConfiguration(),
+ _ignite.GetCache<int, int>(CacheName).GetConfiguration());
+
+ AssertConfigsAreEqual(GetCustomCacheConfiguration(),
+ _ignite.GetConfiguration().CacheConfiguration.Single(c => c.Name == CacheName));
+ }
+
+ /// <summary>
+ /// Tests the create from configuration.
+ /// </summary>
+ [Test]
+ public void TestCreateFromConfiguration()
+ {
+ var cacheName = Guid.NewGuid().ToString();
+ var cfg = GetCustomCacheConfiguration(cacheName);
+
+ var cache = _ignite.CreateCache<int, Entity>(cfg);
+ AssertConfigsAreEqual(cfg, cache.GetConfiguration());
+
+ // Can't create existing cache
+ Assert.Throws<IgniteException>(() => _ignite.CreateCache<int, int>(cfg));
+
+ // Check put-get
+ cache[1] = new Entity { Foo = 1 };
+ Assert.AreEqual(1, cache[1].Foo);
+ }
+
+ /// <summary>
+ /// Tests the get or create from configuration.
+ /// </summary>
+ [Test]
+ public void TestGetOrCreateFromConfiguration()
+ {
+ var cacheName = Guid.NewGuid().ToString();
+ var cfg = GetCustomCacheConfiguration(cacheName);
+
+ var cache = _ignite.GetOrCreateCache<int, Entity>(cfg);
+ AssertConfigsAreEqual(cfg, cache.GetConfiguration());
+
+ var cache2 = _ignite.GetOrCreateCache<int, Entity>(cfg);
+ AssertConfigsAreEqual(cfg, cache2.GetConfiguration());
+
+ // Check put-get
+ cache[1] = new Entity { Foo = 1 };
+ Assert.AreEqual(1, cache[1].Foo);
+ }
+
+ /// <summary>
+ /// Tests the cache store.
+ /// </summary>
+ [Test]
+ public void TestCacheStore()
+ {
+ _factoryProp = 0;
+
+ var factory = new CacheStoreFactoryTest {TestProperty = 15};
+
+ var cache = _ignite.CreateCache<int, int>(new CacheConfiguration("cacheWithStore")
+ {
+ CacheStoreFactory = factory
+ });
+
+ Assert.AreEqual(factory.TestProperty, _factoryProp);
+
+ var factory0 = cache.GetConfiguration().CacheStoreFactory as CacheStoreFactoryTest;
+
+ Assert.IsNotNull(factory0);
+ Assert.AreEqual(factory.TestProperty, factory0.TestProperty);
+ }
+
+ /// <summary>
+ /// Asserts the configuration is default.
+ /// </summary>
+ private static void AssertConfigIsDefault(CacheConfiguration cfg)
+ {
+ Assert.AreEqual(CacheConfiguration.DefaultBackups, cfg.Backups);
+ Assert.AreEqual(CacheConfiguration.DefaultAtomicityMode, cfg.AtomicityMode);
+ Assert.AreEqual(CacheConfiguration.DefaultCacheMode, cfg.CacheMode);
+ Assert.AreEqual(CacheConfiguration.DefaultCopyOnRead, cfg.CopyOnRead);
+ Assert.AreEqual(CacheConfiguration.DefaultStartSize, cfg.StartSize);
+ Assert.AreEqual(CacheConfiguration.DefaultEagerTtl, cfg.EagerTtl);
+ Assert.AreEqual(CacheConfiguration.DefaultEvictSynchronizedKeyBufferSize, cfg.EvictSynchronizedKeyBufferSize);
+ Assert.AreEqual(CacheConfiguration.DefaultEvictSynchronized, cfg.EvictSynchronized);
+ Assert.AreEqual(CacheConfiguration.DefaultEvictSynchronizedConcurrencyLevel, cfg.EvictSynchronizedConcurrencyLevel);
+ Assert.AreEqual(CacheConfiguration.DefaultEvictSynchronizedTimeout, cfg.EvictSynchronizedTimeout);
+ Assert.AreEqual(CacheConfiguration.DefaultInvalidate, cfg.Invalidate);
+ Assert.AreEqual(CacheConfiguration.DefaultKeepVinaryInStore, cfg.KeepBinaryInStore);
+ Assert.AreEqual(CacheConfiguration.DefaultLoadPreviousValue, cfg.LoadPreviousValue);
+ Assert.AreEqual(CacheConfiguration.DefaultLockTimeout, cfg.LockTimeout);
+ Assert.AreEqual(CacheConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout);
+ Assert.AreEqual(CacheConfiguration.DefaultMaxConcurrentAsyncOperations, cfg.MaxConcurrentAsyncOperations);
+ Assert.AreEqual(CacheConfiguration.DefaultMaxEvictionOverflowRatio, cfg.MaxEvictionOverflowRatio);
+ Assert.AreEqual(CacheConfiguration.DefaultMemoryMode, cfg.MemoryMode);
+ Assert.AreEqual(CacheConfiguration.DefaultOffHeapMaxMemory, cfg.OffHeapMaxMemory);
+ Assert.AreEqual(CacheConfiguration.DefaultReadFromBackup, cfg.ReadFromBackup);
+ Assert.AreEqual(CacheConfiguration.DefaultRebalanceBatchSize, cfg.RebalanceBatchSize);
+ Assert.AreEqual(CacheConfiguration.DefaultRebalanceMode, cfg.RebalanceMode);
+ Assert.AreEqual(CacheConfiguration.DefaultRebalanceThrottle, cfg.RebalanceThrottle);
+ Assert.AreEqual(CacheConfiguration.DefaultRebalanceTimeout, cfg.RebalanceTimeout);
+ Assert.AreEqual(CacheConfiguration.DefaultSqlOnheapRowCacheSize, cfg.SqlOnheapRowCacheSize);
+ Assert.AreEqual(CacheConfiguration.DefaultStartSize, cfg.StartSize);
+ Assert.AreEqual(CacheConfiguration.DefaultStartSize, cfg.StartSize);
+ Assert.AreEqual(CacheConfiguration.DefaultEnableSwap, cfg.EnableSwap);
+ Assert.AreEqual(CacheConfiguration.DefaultWriteBehindBatchSize, cfg.WriteBehindBatchSize);
+ Assert.AreEqual(CacheConfiguration.DefaultWriteBehindEnabled, cfg.WriteBehindEnabled);
+ Assert.AreEqual(CacheConfiguration.DefaultWriteBehindFlushFrequency, cfg.WriteBehindFlushFrequency);
+ Assert.AreEqual(CacheConfiguration.DefaultWriteBehindFlushSize, cfg.WriteBehindFlushSize);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(CacheConfiguration x, CacheConfiguration y)
+ {
+ Assert.AreEqual(x.Backups, y.Backups);
+ Assert.AreEqual(x.AtomicityMode, y.AtomicityMode);
+ Assert.AreEqual(x.CacheMode, y.CacheMode);
+ Assert.AreEqual(x.CopyOnRead, y.CopyOnRead);
+ Assert.AreEqual(x.StartSize, y.StartSize);
+ Assert.AreEqual(x.EagerTtl, y.EagerTtl);
+ Assert.AreEqual(x.EvictSynchronizedKeyBufferSize, y.EvictSynchronizedKeyBufferSize);
+ Assert.AreEqual(x.EvictSynchronized, y.EvictSynchronized);
+ Assert.AreEqual(x.EvictSynchronizedConcurrencyLevel, y.EvictSynchronizedConcurrencyLevel);
+ Assert.AreEqual(x.EvictSynchronizedTimeout, y.EvictSynchronizedTimeout);
+ Assert.AreEqual(x.Invalidate, y.Invalidate);
+ Assert.AreEqual(x.KeepBinaryInStore, y.KeepBinaryInStore);
+ Assert.AreEqual(x.LoadPreviousValue, y.LoadPreviousValue);
+ Assert.AreEqual(x.LockTimeout, y.LockTimeout);
+ Assert.AreEqual(x.LongQueryWarningTimeout, y.LongQueryWarningTimeout);
+ Assert.AreEqual(x.MaxConcurrentAsyncOperations, y.MaxConcurrentAsyncOperations);
+ Assert.AreEqual(x.MaxEvictionOverflowRatio, y.MaxEvictionOverflowRatio);
+ Assert.AreEqual(x.MemoryMode, y.MemoryMode);
+ Assert.AreEqual(x.OffHeapMaxMemory, y.OffHeapMaxMemory);
+ Assert.AreEqual(x.ReadFromBackup, y.ReadFromBackup);
+ Assert.AreEqual(x.RebalanceBatchSize, y.RebalanceBatchSize);
+ Assert.AreEqual(x.RebalanceMode, y.RebalanceMode);
+ Assert.AreEqual(x.RebalanceThrottle, y.RebalanceThrottle);
+ Assert.AreEqual(x.RebalanceTimeout, y.RebalanceTimeout);
+ Assert.AreEqual(x.SqlOnheapRowCacheSize, y.SqlOnheapRowCacheSize);
+ Assert.AreEqual(x.StartSize, y.StartSize);
+ Assert.AreEqual(x.StartSize, y.StartSize);
+ Assert.AreEqual(x.EnableSwap, y.EnableSwap);
+ Assert.AreEqual(x.WriteBehindBatchSize, y.WriteBehindBatchSize);
+ Assert.AreEqual(x.WriteBehindEnabled, y.WriteBehindEnabled);
+ Assert.AreEqual(x.WriteBehindFlushFrequency, y.WriteBehindFlushFrequency);
+ Assert.AreEqual(x.WriteBehindFlushSize, y.WriteBehindFlushSize);
+
+ AssertConfigsAreEqual(x.QueryEntities, y.QueryEntities);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(ICollection<QueryEntity> x, ICollection<QueryEntity> y)
+ {
+ if (x == null)
+ {
+ Assert.IsNull(y);
+ return;
+ }
+
+ Assert.AreEqual(x.Count, y.Count);
+
+ for (var i = 0; i < x.Count; i++)
+ AssertConfigsAreEqual(x.ElementAt(i), y.ElementAt(i));
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(QueryEntity x, QueryEntity y)
+ {
+ Assert.IsNotNull(x);
+ Assert.IsNotNull(y);
+
+ Assert.AreEqual(x.KeyTypeName, y.KeyTypeName);
+ Assert.AreEqual(x.ValueTypeName, y.ValueTypeName);
+
+ AssertConfigsAreEqual(x.Fields, y.Fields);
+ AssertConfigsAreEqual(x.Aliases, y.Aliases);
+
+ AssertConfigsAreEqual(x.Indexes, y.Indexes);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(ICollection<QueryIndex> x, ICollection<QueryIndex> y)
+ {
+ if (x == null)
+ {
+ Assert.IsNull(y);
+ return;
+ }
+
+ Assert.AreEqual(x.Count, y.Count);
+
+ for (var i = 0; i < x.Count; i++)
+ AssertConfigsAreEqual(x.ElementAt(i), y.ElementAt(i));
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(ICollection<QueryField> x, ICollection<QueryField> y)
+ {
+ if (x == null)
+ {
+ Assert.IsNull(y);
+ return;
+ }
+
+ Assert.AreEqual(x.Count, y.Count);
+
+ for (var i = 0; i < x.Count; i++)
+ AssertConfigsAreEqual(x.ElementAt(i), y.ElementAt(i));
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(ICollection<QueryAlias> x, ICollection<QueryAlias> y)
+ {
+ if (x == null)
+ {
+ Assert.IsNull(y);
+ return;
+ }
+
+ Assert.AreEqual(x.Count, y.Count);
+
+ for (var i = 0; i < x.Count; i++)
+ AssertConfigsAreEqual(x.ElementAt(i), y.ElementAt(i));
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(ICollection<QueryIndexField> x, ICollection<QueryIndexField> y)
+ {
+ if (x == null)
+ {
+ Assert.IsNull(y);
+ return;
+ }
+
+ Assert.AreEqual(x.Count, y.Count);
+
+ for (var i = 0; i < x.Count; i++)
+ AssertConfigsAreEqual(x.ElementAt(i), y.ElementAt(i));
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(QueryIndex x, QueryIndex y)
+ {
+ Assert.IsNotNull(x);
+ Assert.IsNotNull(y);
+
+ Assert.AreEqual(x.Name, y.Name);
+ Assert.AreEqual(x.IndexType, y.IndexType);
+
+ AssertConfigsAreEqual(x.Fields, y.Fields);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(QueryField x, QueryField y)
+ {
+ Assert.IsNotNull(x);
+ Assert.IsNotNull(y);
+
+ Assert.AreEqual(x.Name, y.Name);
+ Assert.AreEqual(x.FieldTypeName, y.FieldTypeName);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(QueryAlias x, QueryAlias y)
+ {
+ Assert.IsNotNull(x);
+ Assert.IsNotNull(y);
+
+ Assert.AreEqual(x.FullName, y.FullName);
+ Assert.AreEqual(x.Alias, y.Alias);
+ }
+
+ /// <summary>
+ /// Asserts that two configurations have the same properties.
+ /// </summary>
+ private static void AssertConfigsAreEqual(QueryIndexField x, QueryIndexField y)
+ {
+ Assert.IsNotNull(x);
+ Assert.IsNotNull(y);
+
+ Assert.AreEqual(x.Name, y.Name);
+ Assert.AreEqual(x.IsDescending, y.IsDescending);
+ }
+
+ /// <summary>
+ /// Gets the custom cache configuration.
+ /// </summary>
+ private static CacheConfiguration GetCustomCacheConfiguration(string name = null)
+ {
+ return new CacheConfiguration
+ {
+ Name = name ?? CacheName,
+ OffHeapMaxMemory = 1,
+ StartSize = 2,
+ MaxConcurrentAsyncOperations = 3,
+ WriteBehindFlushThreadCount = 4,
+ LongQueryWarningTimeout = TimeSpan.FromSeconds(5),
+ LoadPreviousValue = true,
+ EvictSynchronizedKeyBufferSize = 6,
+ CopyOnRead = true,
+ WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
+ WriteBehindFlushSize = 7,
+ EvictSynchronized = true,
+ AtomicWriteOrderMode = CacheAtomicWriteOrderMode.Primary,
+ AtomicityMode = CacheAtomicityMode.Atomic,
+ Backups = 8,
+ CacheMode = CacheMode.Partitioned,
+ EagerTtl = true,
+ EnableSwap = true,
+ EvictSynchronizedConcurrencyLevel = 9,
+ EvictSynchronizedTimeout = TimeSpan.FromSeconds(10),
+ Invalidate = true,
+ KeepBinaryInStore = true,
+ LockTimeout = TimeSpan.FromSeconds(11),
+ MaxEvictionOverflowRatio = 0.5f,
+ MemoryMode = CacheMemoryMode.OnheapTiered,
+ ReadFromBackup = true,
+ RebalanceBatchSize = 12,
+ RebalanceDelay = TimeSpan.FromSeconds(13),
+ RebalanceMode = CacheRebalanceMode.Async,
+ RebalanceThrottle = TimeSpan.FromSeconds(15),
+ RebalanceTimeout = TimeSpan.FromSeconds(16),
+ SqlEscapeAll = true,
+ SqlOnheapRowCacheSize = 17,
+ WriteBehindBatchSize = 18,
+ WriteBehindEnabled = false,
+ WriteSynchronizationMode = CacheWriteSynchronizationMode.PrimarySync,
+ QueryEntities = new[]
+ {
+ new QueryEntity
+ {
+ KeyTypeName = "Integer",
+ ValueTypeName = "java.lang.String",
+ Fields = new[]
+ {
+ new QueryField("length", typeof(int)),
+ new QueryField("name", typeof(string)),
+ new QueryField("location", typeof(string)),
+ },
+ Aliases = new [] {new QueryAlias("length", "len") },
+ Indexes = new[]
+ {
+ new QueryIndex("name") {Name = "index1" },
+ new QueryIndex(new QueryIndexField("location", true))
+ {
+ Name= "index2",
+ IndexType = QueryIndexType.FullText
+ }
+ }
+ }
+ }
+ };
+ }
+
+ /// <summary>
+ /// Test factory.
+ /// </summary>
+ [Serializable]
+ private class CacheStoreFactoryTest : IFactory<ICacheStore>
+ {
+ /// <summary>
+ /// Gets or sets the test property.
+ /// </summary>
+ /// <value>
+ /// The test property.
+ /// </value>
+ public int TestProperty { get; set; }
+
+ /// <summary>
+ /// Creates an instance of the cache store.
+ /// </summary>
+ /// <returns>
+ /// New instance of the cache store.
+ /// </returns>
+ public ICacheStore CreateInstance()
+ {
+ _factoryProp = TestProperty;
+
+ return new CacheStoreTest();
+ }
+ }
+
+ /// <summary>
+ /// Test store.
+ /// </summary>
+ private class CacheStoreTest : CacheStoreAdapter
+ {
+ /** <inheritdoc /> */
+ public override object Load(object key)
+ {
+ return null;
+ }
+
+ /** <inheritdoc /> */
+ public override void Write(object key, object val)
+ {
+ // No-op.
+ }
+
+ /** <inheritdoc /> */
+ public override void Delete(object key)
+ {
+ // No-op.
+ }
+ }
+
+ /// <summary>
+ /// Test entity.
+ /// </summary>
+ private class Entity
+ {
+ /// <summary>
+ /// Gets or sets the foo.
+ /// </summary>
+ public int Foo { get; set; }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/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 63443b7..7c18a34 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
@@ -79,9 +79,9 @@ namespace Apache.Ignite.Core.Tests.Cache
/// <param name="name">Grid name.</param>
/// <param name="springCfg">Spring configuration.</param>
/// <returns>Configuration.</returns>
- private static IgniteConfigurationEx CreateConfiguration(string name, string springCfg)
+ private static IgniteConfiguration CreateConfiguration(string name, string springCfg)
{
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
+ var cfg = new IgniteConfiguration();
BinaryConfiguration portCfg = new BinaryConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
index 33c9f11..09e57dc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Tests.Cache
using System.Diagnostics;
using System.Threading.Tasks;
using Apache.Ignite.Core.Cache;
+ using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Expiry;
using Apache.Ignite.Core.Cache.Query;
using Apache.Ignite.Core.Cache.Query.Continuous;
@@ -58,6 +59,12 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/** <inheritDoc /> */
+ public CacheConfiguration GetConfiguration()
+ {
+ return _cache.GetConfiguration();
+ }
+
+ /** <inheritDoc /> */
public bool IsEmpty()
{
return _cache.IsEmpty();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
new file mode 100644
index 0000000..a969127
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ */
+
+// ReSharper disable MemberCanBePrivate.Local
+// ReSharper disable UnusedAutoPropertyAccessor.Local
+// ReSharper disable UnusedMember.Local
+namespace Apache.Ignite.Core.Tests.Cache.Query
+{
+ using System;
+ using System.Linq;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Cache.Query;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests queries with in-code configuration.
+ /// </summary>
+ public class CacheQueriesCodeConfigurationTest
+ {
+ const string CacheName = "personCache";
+
+ /// <summary>
+ /// Tests the SQL query.
+ /// </summary>
+ [Test]
+ public void TestQueryEntityConfiguration()
+ {
+ var cfg = new IgniteConfiguration
+ {
+ JvmOptions = TestUtils.TestJavaOptions(),
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ BinaryConfiguration = new BinaryConfiguration(typeof (QueryPerson)),
+ CacheConfiguration = new[]
+ {
+ new CacheConfiguration(CacheName, new QueryEntity(typeof (int), typeof (QueryPerson))
+ {
+ Fields = new[]
+ {
+ new QueryField("Name", typeof (string)),
+ new QueryField("Age", typeof (int))
+ },
+ Indexes = new[]
+ {
+ new QueryIndex(false, QueryIndexType.FullText, "Name"), new QueryIndex("Age")
+ }
+ })
+ }
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ var cache = ignite.GetCache<int, QueryPerson>(CacheName);
+
+ Assert.IsNotNull(cache);
+
+ cache[1] = new QueryPerson("Arnold", 10);
+ cache[2] = new QueryPerson("John", 20);
+
+ using (var cursor = cache.Query(new SqlQuery(typeof (QueryPerson), "age > 10")))
+ {
+ Assert.AreEqual(2, cursor.GetAll().Single().Key);
+ }
+
+ using (var cursor = cache.Query(new TextQuery(typeof (QueryPerson), "Ar*")))
+ {
+ Assert.AreEqual(1, cursor.GetAll().Single().Key);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Tests the attribute configuration.
+ /// </summary>
+ [Test]
+ public void TestAttributeConfiguration()
+ {
+ // ReSharper disable once ObjectCreationAsStatement
+ Assert.Throws<InvalidOperationException>(() => new QueryEntity(typeof (RecursiveQuery)));
+
+ var qe = new QueryEntity {ValueType = typeof(AttributeTest) };
+
+ Assert.AreEqual(typeof(AttributeTest), qe.ValueType);
+
+ var fields = qe.Fields.ToArray();
+
+ CollectionAssert.AreEquivalent(new[]
+ {
+ "SqlField", "IndexedField1", "FullTextField", "Inner", "Inner.Foo",
+ "GroupIndex1", "GroupIndex2", "GroupIndex3"
+ }, fields.Select(x => x.Name));
+
+ var idx = qe.Indexes.ToArray();
+
+ Assert.AreEqual(QueryIndexType.Sorted, idx[0].IndexType);
+ Assert.AreEqual(QueryIndexType.Sorted, idx[1].IndexType);
+ Assert.AreEqual(QueryIndexType.Sorted, idx[2].IndexType);
+ Assert.AreEqual(QueryIndexType.FullText, idx[3].IndexType);
+
+ CollectionAssert.AreEquivalent(new[] {"GroupIndex1", "GroupIndex2"}, idx[0].Fields.Select(f => f.Name));
+ CollectionAssert.AreEquivalent(new[] {"GroupIndex1", "GroupIndex3"}, idx[1].Fields.Select(f => f.Name));
+ CollectionAssert.AreEquivalent(new[] {"IndexedField1"}, idx[2].Fields.Select(f => f.Name));
+ CollectionAssert.AreEquivalent(new[] {"FullTextField"}, idx[3].Fields.Select(f => f.Name));
+ }
+
+ /// <summary>
+ /// Tests the attribute configuration query.
+ /// </summary>
+ [Test]
+ public void TestAttributeConfigurationQuery()
+ {
+ var cfg = new IgniteConfiguration
+ {
+ JvmOptions = TestUtils.TestJavaOptions(),
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ BinaryConfiguration = new BinaryConfiguration(
+ typeof (AttributeQueryPerson), typeof (AttributeQueryAddress)),
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ var cache = ignite.GetOrCreateCache<int, AttributeQueryPerson>(new CacheConfiguration(CacheName,
+ typeof (AttributeQueryPerson)));
+
+ Assert.IsNotNull(cache);
+
+ cache[1] = new AttributeQueryPerson("Arnold", 10)
+ {
+ Address = new AttributeQueryAddress {Country = "USA", Street = "Pine Tree road"}
+ };
+
+ cache[2] = new AttributeQueryPerson("John", 20);
+
+ using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "age > ?", 10)))
+ {
+ Assert.AreEqual(2, cursor.GetAll().Single().Key);
+ }
+
+ using (var cursor = cache.Query(new SqlQuery(typeof(AttributeQueryPerson), "Country = ?", "USA")))
+ {
+ Assert.AreEqual(1, cursor.GetAll().Single().Key);
+ }
+
+ using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Ar*")))
+ {
+ Assert.AreEqual(1, cursor.GetAll().Single().Key);
+ }
+
+ using (var cursor = cache.Query(new TextQuery(typeof(AttributeQueryPerson), "Pin*")))
+ {
+ Assert.AreEqual(1, cursor.GetAll().Single().Key);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Test person.
+ /// </summary>
+ private class AttributeQueryPerson
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AttributeQueryPerson"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="age">The age.</param>
+ public AttributeQueryPerson(string name, int age)
+ {
+ Name = name;
+ Age = age;
+ }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>
+ /// The name.
+ /// </value>
+ [QueryTextField]
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the age.
+ /// </summary>
+ /// <value>
+ /// The age.
+ /// </value>
+ [QuerySqlField]
+ public int Age { get; set; }
+
+ /// <summary>
+ /// Gets or sets the address.
+ /// </summary>
+ /// <value>
+ /// The address.
+ /// </value>
+ [QuerySqlField]
+ public AttributeQueryAddress Address { get; set; }
+ }
+
+ /// <summary>
+ /// Address.
+ /// </summary>
+ private class AttributeQueryAddress
+ {
+ /// <summary>
+ /// Gets or sets the country.
+ /// </summary>
+ /// <value>
+ /// The country.
+ /// </value>
+ [QuerySqlField]
+ public string Country { get; set; }
+
+ /// <summary>
+ /// Gets or sets the street.
+ /// </summary>
+ /// <value>
+ /// The street.
+ /// </value>
+ [QueryTextField]
+ public string Street { get; set; }
+ }
+
+ /// <summary>
+ /// Query.
+ /// </summary>
+ private class RecursiveQuery
+ {
+ /// <summary>
+ /// Gets or sets the inner.
+ /// </summary>
+ /// <value>
+ /// The inner.
+ /// </value>
+ [QuerySqlField]
+ public RecursiveQuery Inner { get; set; }
+ }
+
+ /// <summary>
+ /// Attribute test class.
+ /// </summary>
+ private class AttributeTest
+ {
+ [QuerySqlField]
+ public double SqlField { get; set; }
+
+ [QuerySqlField(IsIndexed = true, Name = "IndexedField1")]
+ public int IndexedField { get; set; }
+
+ [QueryTextField]
+ public string FullTextField { get; set; }
+
+ [QuerySqlField]
+ public AttributeTestInner Inner { get; set; }
+
+ [QuerySqlField(IsIndexed = true, IndexGroups = new[] {"group1", "group2"})]
+ public string GroupIndex1 { get; set; }
+
+ [QuerySqlField(IsIndexed = true, IndexGroups = new[] {"group1"})]
+ public string GroupIndex2 { get; set; }
+
+ [QuerySqlField(IsIndexed = true, IndexGroups = new[] {"group2"})]
+ public string GroupIndex3 { get; set; }
+ }
+
+ /// <summary>
+ /// Inner class.
+ /// </summary>
+ private class AttributeTestInner
+ {
+ /// <summary>
+ /// Gets or sets the foo.
+ /// </summary>
+ /// <value>
+ /// The foo.
+ /// </value>
+ [QuerySqlField]
+ public string Foo { get; set; }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/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 08a98f6..8020649 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
@@ -57,7 +57,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
TestUtils.JvmDebug = true;
TestUtils.KillProcesses();
- IgniteConfigurationEx cfg = new IgniteConfigurationEx
+ IgniteConfiguration cfg = new IgniteConfiguration
{
BinaryConfiguration = new BinaryConfiguration
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/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 bdca918..0036abd 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
@@ -95,7 +95,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
GC.Collect();
TestUtils.JvmDebug = true;
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
+ IgniteConfiguration cfg = new IgniteConfiguration();
BinaryConfiguration portCfg = new BinaryConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/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 137215e..5cc0849 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
@@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
TestUtils.JvmDebug = true;
- IgniteConfigurationEx cfg = new IgniteConfigurationEx
+ IgniteConfiguration cfg = new IgniteConfiguration
{
GridName = IgniteName,
JvmClasspath = TestUtils.CreateTestClasspath(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/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 1270138..b48cdc9 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
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Impl;
using NUnit.Framework;
/// <summary>
@@ -137,24 +136,18 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
[TestFixtureSetUp]
public void BeforeTests()
{
- //TestUtils.JVM_DEBUG = true;
-
TestUtils.KillProcesses();
TestUtils.JvmDebug = true;
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- cfg.GridName = GridName;
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = "config\\native-client-test-cache-store.xml";
-
- BinaryConfiguration portCfg = new BinaryConfiguration();
-
- portCfg.Types = new List<string> { typeof(Key).FullName, typeof(Value).FullName };
-
- cfg.BinaryConfiguration = portCfg;
+ var cfg = new IgniteConfiguration
+ {
+ GridName = GridName,
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ SpringConfigUrl = "config\\native-client-test-cache-store.xml",
+ BinaryConfiguration = new BinaryConfiguration(typeof (Key), typeof (Value))
+ };
Ignition.Start(cfg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
index 20ae629..f5a04c1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
@@ -461,9 +461,9 @@ namespace Apache.Ignite.Core.Tests.Dataload
/// Gets the Ignite configuration.
/// </summary>
/// <param name="gridName">Grid name.</param>
- private static IgniteConfigurationEx GetIgniteConfiguration(string gridName)
+ private static IgniteConfiguration GetIgniteConfiguration(string gridName)
{
- return new IgniteConfigurationEx
+ return new IgniteConfiguration
{
GridName = gridName,
SpringConfigUrl = "config\\native-client-test-cache.xml",
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
index 79297da..50ecfac 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ExceptionsTest.cs
@@ -285,7 +285,7 @@ namespace Apache.Ignite.Core.Tests
/// </summary>
private static IIgnite StartGrid(string gridName = null)
{
- return Ignition.Start(new IgniteConfigurationEx
+ return Ignition.Start(new IgniteConfiguration
{
SpringConfigUrl = "config\\native-client-test-cache.xml",
JvmOptions = TestUtils.TestJavaOptions(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
new file mode 100644
index 0000000..15f5804
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -0,0 +1,367 @@
+/*
+ * 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.
+ */
+
+#pragma warning disable 618 // deprecated SpringConfigUrl
+namespace Apache.Ignite.Core.Tests
+{
+ using System;
+ using System.ComponentModel;
+ using System.IO;
+ using System.Linq;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Discovery;
+ using Apache.Ignite.Core.Discovery.Tcp;
+ using Apache.Ignite.Core.Discovery.Tcp.Multicast;
+ using Apache.Ignite.Core.Discovery.Tcp.Static;
+ using Apache.Ignite.Core.Events;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests code-based configuration.
+ /// </summary>
+ public class IgniteConfigurationTest
+ {
+ /// <summary>
+ /// Fixture setup.
+ /// </summary>
+ [TestFixtureSetUp]
+ public void FixtureSetUp()
+ {
+ Ignition.StopAll(true);
+ }
+
+ /// <summary>
+ /// Tests the default configuration properties.
+ /// </summary>
+ [Test]
+ public void TestDefaultConfigurationProperties()
+ {
+ CheckDefaultProperties(new IgniteConfiguration());
+ }
+
+ /// <summary>
+ /// Tests the default value attributes.
+ /// </summary>
+ [Test]
+ public void TestDefaultValueAttributes()
+ {
+ CheckDefaultValueAttributes(new IgniteConfiguration());
+ CheckDefaultValueAttributes(new TcpDiscoverySpi());
+ CheckDefaultValueAttributes(new CacheConfiguration());
+ CheckDefaultValueAttributes(new TcpDiscoveryMulticastIpFinder());
+ }
+
+ /// <summary>
+ /// Tests all configuration properties.
+ /// </summary>
+ [Test]
+ public void TestAllConfigurationProperties()
+ {
+ var cfg = new IgniteConfiguration(GetCustomConfig());
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ var resCfg = ignite.GetConfiguration();
+
+ var disco = (TcpDiscoverySpi) cfg.DiscoverySpi;
+ var resDisco = (TcpDiscoverySpi) resCfg.DiscoverySpi;
+
+ Assert.AreEqual(disco.NetworkTimeout, resDisco.NetworkTimeout);
+ Assert.AreEqual(disco.AckTimeout, resDisco.AckTimeout);
+ Assert.AreEqual(disco.MaxAckTimeout, resDisco.MaxAckTimeout);
+ Assert.AreEqual(disco.SocketTimeout, resDisco.SocketTimeout);
+ Assert.AreEqual(disco.JoinTimeout, resDisco.JoinTimeout);
+
+ var ip = (TcpDiscoveryStaticIpFinder) disco.IpFinder;
+ var resIp = (TcpDiscoveryStaticIpFinder) resDisco.IpFinder;
+
+ // There can be extra IPv6 endpoints
+ Assert.AreEqual(ip.Endpoints, resIp.Endpoints.Take(2).Select(x => x.Trim('/')).ToArray());
+
+ Assert.AreEqual(cfg.GridName, resCfg.GridName);
+ Assert.AreEqual(cfg.IncludedEventTypes, resCfg.IncludedEventTypes);
+ Assert.AreEqual(cfg.MetricsExpireTime, resCfg.MetricsExpireTime);
+ Assert.AreEqual(cfg.MetricsHistorySize, resCfg.MetricsHistorySize);
+ Assert.AreEqual(cfg.MetricsLogFrequency, resCfg.MetricsLogFrequency);
+ Assert.AreEqual(cfg.MetricsUpdateFrequency, resCfg.MetricsUpdateFrequency);
+ Assert.AreEqual(cfg.NetworkSendRetryCount, resCfg.NetworkSendRetryCount);
+ Assert.AreEqual(cfg.NetworkTimeout, resCfg.NetworkTimeout);
+ Assert.AreEqual(cfg.NetworkSendRetryDelay, resCfg.NetworkSendRetryDelay);
+ Assert.AreEqual(cfg.WorkDirectory, resCfg.WorkDirectory);
+ Assert.AreEqual(cfg.JvmClasspath, resCfg.JvmClasspath);
+ Assert.AreEqual(cfg.JvmOptions, resCfg.JvmOptions);
+ Assert.IsTrue(File.Exists(resCfg.JvmDllPath));
+ Assert.AreEqual(cfg.Localhost, resCfg.Localhost);
+ }
+ }
+
+ /// <summary>
+ /// Tests the spring XML.
+ /// </summary>
+ [Test]
+ public void TestSpringXml()
+ {
+ // When Spring XML is used, all properties are ignored.
+ var cfg = GetCustomConfig();
+
+ cfg.SpringConfigUrl = "config\\marshaller-default.xml";
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ var resCfg = ignite.GetConfiguration();
+
+ CheckDefaultProperties(resCfg);
+ }
+ }
+
+ /// <summary>
+ /// Tests the client mode.
+ /// </summary>
+ [Test]
+ public void TestClientMode()
+ {
+ using (var ignite = Ignition.Start(new IgniteConfiguration
+ {
+ Localhost = "127.0.0.1",
+ DiscoverySpi = GetStaticDiscovery()
+ }))
+ using (var ignite2 = Ignition.Start(new IgniteConfiguration
+ {
+ Localhost = "127.0.0.1",
+ DiscoverySpi = GetStaticDiscovery(),
+ GridName = "client",
+ ClientMode = true
+ }))
+ {
+ const string cacheName = "cache";
+
+ ignite.CreateCache<int, int>(cacheName);
+
+ Assert.AreEqual(2, ignite2.GetCluster().GetNodes().Count);
+ Assert.AreEqual(1, ignite.GetCluster().ForCacheNodes(cacheName).GetNodes().Count);
+
+ Assert.AreEqual(false, ignite.GetConfiguration().ClientMode);
+ Assert.AreEqual(true, ignite2.GetConfiguration().ClientMode);
+ }
+ }
+
+ /// <summary>
+ /// Tests the default spi.
+ /// </summary>
+ [Test]
+ public void TestDefaultSpi()
+ {
+ var cfg = new IgniteConfiguration
+ {
+ DiscoverySpi =
+ new TcpDiscoverySpi
+ {
+ AckTimeout = TimeSpan.FromDays(2),
+ MaxAckTimeout = TimeSpan.MaxValue,
+ JoinTimeout = TimeSpan.MaxValue,
+ NetworkTimeout = TimeSpan.MaxValue,
+ SocketTimeout = TimeSpan.MaxValue
+ },
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ Localhost = "127.0.0.1"
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ cfg.GridName = "ignite2";
+ using (var ignite2 = Ignition.Start(cfg))
+ {
+ Assert.AreEqual(2, ignite.GetCluster().GetNodes().Count);
+ Assert.AreEqual(2, ignite2.GetCluster().GetNodes().Count);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Tests the invalid timeouts.
+ /// </summary>
+ [Test]
+ public void TestInvalidTimeouts()
+ {
+ var cfg = new IgniteConfiguration
+ {
+ DiscoverySpi =
+ new TcpDiscoverySpi
+ {
+ AckTimeout = TimeSpan.FromMilliseconds(-5),
+ JoinTimeout = TimeSpan.MinValue,
+ },
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ };
+
+ Assert.Throws<IgniteException>(() => Ignition.Start(cfg));
+ }
+
+ /// <summary>
+ /// Tests the static ip finder.
+ /// </summary>
+ [Test]
+ public void TestStaticIpFinder()
+ {
+ TestIpFinders(new TcpDiscoveryStaticIpFinder
+ {
+ Endpoints = new[] {"127.0.0.1:47500"}
+ }, new TcpDiscoveryStaticIpFinder
+ {
+ Endpoints = new[] {"127.0.0.1:47501"}
+ });
+ }
+
+ /// <summary>
+ /// Tests the multicast ip finder.
+ /// </summary>
+ [Test]
+ public void TestMulticastIpFinder()
+ {
+ TestIpFinders(
+ new TcpDiscoveryMulticastIpFinder {MulticastGroup = "228.111.111.222", MulticastPort = 54522},
+ new TcpDiscoveryMulticastIpFinder {MulticastGroup = "228.111.111.223", MulticastPort = 54522});
+ }
+
+ /// <summary>
+ /// Tests the ip finders.
+ /// </summary>
+ /// <param name="ipFinder">The ip finder.</param>
+ /// <param name="ipFinder2">The ip finder2.</param>
+ private static void TestIpFinders(TcpDiscoveryIpFinderBase ipFinder, TcpDiscoveryIpFinderBase ipFinder2)
+ {
+ var cfg = new IgniteConfiguration
+ {
+ DiscoverySpi =
+ new TcpDiscoverySpi
+ {
+ IpFinder = ipFinder
+ },
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ Localhost = "127.0.0.1"
+ };
+
+ using (var ignite = Ignition.Start(cfg))
+ {
+ // Start with the same endpoint
+ cfg.GridName = "ignite2";
+ using (var ignite2 = Ignition.Start(cfg))
+ {
+ Assert.AreEqual(2, ignite.GetCluster().GetNodes().Count);
+ Assert.AreEqual(2, ignite2.GetCluster().GetNodes().Count);
+ }
+
+ // Start with incompatible endpoint and check that there are 2 topologies
+ ((TcpDiscoverySpi) cfg.DiscoverySpi).IpFinder = ipFinder2;
+
+ using (var ignite2 = Ignition.Start(cfg))
+ {
+ Assert.AreEqual(1, ignite.GetCluster().GetNodes().Count);
+ Assert.AreEqual(1, ignite2.GetCluster().GetNodes().Count);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Checks the default properties.
+ /// </summary>
+ /// <param name="cfg">The CFG.</param>
+ private static void CheckDefaultProperties(IgniteConfiguration cfg)
+ {
+ Assert.AreEqual(IgniteConfiguration.DefaultMetricsExpireTime, cfg.MetricsExpireTime);
+ Assert.AreEqual(IgniteConfiguration.DefaultMetricsHistorySize, cfg.MetricsHistorySize);
+ Assert.AreEqual(IgniteConfiguration.DefaultMetricsLogFrequency, cfg.MetricsLogFrequency);
+ Assert.AreEqual(IgniteConfiguration.DefaultMetricsUpdateFrequency, cfg.MetricsUpdateFrequency);
+ Assert.AreEqual(IgniteConfiguration.DefaultNetworkTimeout, cfg.NetworkTimeout);
+ Assert.AreEqual(IgniteConfiguration.DefaultNetworkSendRetryCount, cfg.NetworkSendRetryCount);
+ Assert.AreEqual(IgniteConfiguration.DefaultNetworkSendRetryDelay, cfg.NetworkSendRetryDelay);
+ }
+
+ /// <summary>
+ /// Checks the default value attributes.
+ /// </summary>
+ /// <param name="obj">The object.</param>
+ private static void CheckDefaultValueAttributes(object obj)
+ {
+ var props = obj.GetType().GetProperties();
+
+ foreach (var prop in props)
+ {
+ var attr = prop.GetCustomAttributes(true).OfType<DefaultValueAttribute>().FirstOrDefault();
+ var propValue = prop.GetValue(obj, null);
+
+ if (attr != null)
+ Assert.AreEqual(attr.Value, propValue);
+ else if (prop.PropertyType.IsValueType)
+ Assert.AreEqual(Activator.CreateInstance(prop.PropertyType), propValue);
+ else
+ Assert.IsNull(propValue);
+ }
+ }
+
+ /// <summary>
+ /// Gets the custom configuration.
+ /// </summary>
+ private static IgniteConfiguration GetCustomConfig()
+ {
+ return new IgniteConfiguration
+ {
+ DiscoverySpi = new TcpDiscoverySpi
+ {
+ NetworkTimeout = TimeSpan.FromSeconds(1),
+ AckTimeout = TimeSpan.FromSeconds(2),
+ MaxAckTimeout = TimeSpan.FromSeconds(3),
+ SocketTimeout = TimeSpan.FromSeconds(4),
+ JoinTimeout = TimeSpan.FromSeconds(5),
+ IpFinder = new TcpDiscoveryStaticIpFinder
+ {
+ Endpoints = new[] { "127.0.0.1:47500", "127.0.0.1:47501" }
+ }
+ },
+ GridName = "gridName1",
+ IncludedEventTypes = EventType.SwapspaceAll,
+ MetricsExpireTime = TimeSpan.FromMinutes(7),
+ MetricsHistorySize = 125,
+ MetricsLogFrequency = TimeSpan.FromMinutes(8),
+ MetricsUpdateFrequency = TimeSpan.FromMinutes(9),
+ NetworkSendRetryCount = 54,
+ NetworkTimeout = TimeSpan.FromMinutes(10),
+ NetworkSendRetryDelay = TimeSpan.FromMinutes(11),
+ WorkDirectory = Path.GetTempPath(),
+ JvmOptions = TestUtils.TestJavaOptions(),
+ JvmClasspath = TestUtils.CreateTestClasspath(),
+ Localhost = "127.0.0.1"
+ };
+ }
+
+ /// <summary>
+ /// Gets the static discovery.
+ /// </summary>
+ /// <returns></returns>
+ private static IDiscoverySpi GetStaticDiscovery()
+ {
+ return new TcpDiscoverySpi
+ {
+ IpFinder = new TcpDiscoveryStaticIpFinder {Endpoints = new[] {"127.0.0.1:47500", "127.0.0.1:47501"}}
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
index 541de0c..7def56f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
@@ -34,7 +34,7 @@ namespace Apache.Ignite.Core.Tests
{
using (var grid = Ignition.Start("config\\marshaller-default.xml"))
{
- var cache = grid.GetOrCreateCache<int, int>(null);
+ var cache = grid.GetOrCreateCache<int, int>((string) null);
cache.Put(1, 1);
@@ -51,7 +51,7 @@ namespace Apache.Ignite.Core.Tests
{
using (var grid = Ignition.Start("config\\marshaller-explicit.xml"))
{
- var cache = grid.GetOrCreateCache<int, int>(null);
+ var cache = grid.GetOrCreateCache<int, int>((string) null);
cache.Put(1, 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
index 07caaf3..a36e30f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/SerializationTest.cs
@@ -43,7 +43,7 @@ namespace Apache.Ignite.Core.Tests
[TestFixtureSetUp]
public void SetUp()
{
- var cfg = new IgniteConfigurationEx
+ var cfg = new IgniteConfiguration
{
GridName = GridName,
JvmClasspath = TestUtils.CreateTestClasspath(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
index 2b0ab8e..a1083b6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Tests
using System;
using System.Diagnostics;
using System.Reflection;
+ using Apache.Ignite.Core.Tests.Cache.Query;
using Apache.Ignite.Core.Tests.Memory;
using NUnit.ConsoleRunner;
@@ -31,9 +32,9 @@ namespace Apache.Ignite.Core.Tests
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
Debug.AutoFlush = true;
- //TestOne(typeof(ContinuousQueryAtomiclBackupTest), "TestInitialQuery");
+ TestOne(typeof(IgniteConfigurationTest), "TestStaticIpFinder");
- TestAll(typeof (ExecutableTest));
+ //TestAll(typeof (CacheQueriesCodeConfigurationTest));
//TestAllInAssembly();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 7de8330..1c83168 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -17,6 +17,7 @@
<OutputPath>bin\x64\Debug\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>DEBUG;CODE_ANALYSIS</DefineConstants>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x64\Debug\Apache.Ignite.Core.XML</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
@@ -25,6 +26,7 @@
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
<Optimize>true</Optimize>
<DocumentationFile>bin\x64\Release\Apache.Ignite.Core.XML</DocumentationFile>
<CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
@@ -34,6 +36,7 @@
<OutputPath>bin\x86\Debug\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>DEBUG;CODE_ANALYSIS</DefineConstants>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x86\Debug\Apache.Ignite.Core.XML</DocumentationFile>
<CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
@@ -41,6 +44,7 @@
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
<Optimize>true</Optimize>
<DocumentationFile>bin\x86\Release\Apache.Ignite.Core.XML</DocumentationFile>
<CodeAnalysisRuleSet>Apache.Ignite.Core.ruleset</CodeAnalysisRuleSet>
@@ -65,6 +69,8 @@
<Compile Include="Cache\CacheException.cs" />
<Compile Include="Cache\CachePartialUpdateException.cs" />
<Compile Include="Cache\CachePeekMode.cs" />
+ <Compile Include="Cache\Configuration\QueryAlias.cs" />
+ <Compile Include="Cache\Configuration\QueryTextFieldAttribute.cs" />
<Compile Include="Cache\Event\CacheEntryEventType.cs" />
<Compile Include="Cache\Event\ICacheEntryEvent.cs" />
<Compile Include="Cache\Event\ICacheEntryEventFilter.cs" />
@@ -98,6 +104,7 @@
<Compile Include="Cache\Store\CacheStoreAdapter.cs" />
<Compile Include="Cache\Store\CacheStoreException.cs" />
<Compile Include="Cache\Store\ICacheStore.cs" />
+ <Compile Include="Common\IFactory.cs" />
<Compile Include="Cache\Store\ICacheStoreSession.cs" />
<Compile Include="Cache\Store\Package-Info.cs" />
<Compile Include="Cluster\ClusterGroupEmptyException.cs" />
@@ -128,6 +135,25 @@
<Compile Include="Compute\IComputeJobResult.cs" />
<Compile Include="Compute\IComputeReducer.cs" />
<Compile Include="Compute\IComputeTask.cs" />
+ <Compile Include="Cache\Configuration\CacheAtomicityMode.cs" />
+ <Compile Include="Cache\Configuration\CacheAtomicWriteOrderMode.cs" />
+ <Compile Include="Cache\Configuration\CacheConfiguration.cs" />
+ <Compile Include="Cache\Configuration\CacheMemoryMode.cs" />
+ <Compile Include="Cache\Configuration\CacheMode.cs" />
+ <Compile Include="Cache\Configuration\CacheRebalanceMode.cs" />
+ <Compile Include="Cache\Configuration\CacheWriteSynchronizationMode.cs" />
+ <Compile Include="Discovery\Tcp\ITcpDiscoveryIpFinder.cs" />
+ <Compile Include="Discovery\Tcp\TcpDiscoverySpi.cs" />
+ <Compile Include="Cache\Configuration\QueryIndexField.cs" />
+ <Compile Include="Discovery\IDiscoverySpi.cs" />
+ <Compile Include="Discovery\Tcp\TcpDiscoveryIpFinderBase.cs" />
+ <Compile Include="Discovery\Tcp\Multicast\TcpDiscoveryMulticastIpFinder.cs" />
+ <Compile Include="Cache\Configuration\QueryEntity.cs" />
+ <Compile Include="Cache\Configuration\QueryField.cs" />
+ <Compile Include="Cache\Configuration\QueryIndex.cs" />
+ <Compile Include="Cache\Configuration\QueryIndexType.cs" />
+ <Compile Include="Cache\Configuration\QuerySqlFieldAttribute.cs" />
+ <Compile Include="Discovery\Tcp\Static\TcpDiscoveryStaticIpFinder.cs" />
<Compile Include="Compute\Package-Info.cs" />
<Compile Include="Datastream\IDataStreamer.cs" />
<Compile Include="Datastream\IStreamReceiver.cs" />
@@ -158,6 +184,7 @@
<Compile Include="Ignition.cs" />
<Compile Include="IIgnite.cs" />
<Compile Include="Impl\Binary\BinaryEnum.cs" />
+ <Compile Include="Impl\Binary\JavaTypes.cs" />
<Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
<Compile Include="Impl\Cache\CacheEntry.cs" />
<Compile Include="Impl\Cache\CacheEntryFilterHolder.cs" />
@@ -235,7 +262,6 @@
<Compile Include="Impl\Events\Events.cs" />
<Compile Include="Impl\Events\RemoteListenEventFilter.cs" />
<Compile Include="Impl\ExceptionUtils.cs" />
- <Compile Include="Impl\IgniteConfigurationEx.cs" />
<Compile Include="Impl\Ignite.cs" />
<Compile Include="Impl\IgniteManager.cs" />
<Compile Include="Impl\IgniteProxy.cs" />
@@ -405,6 +431,7 @@
<None Include="Apache.Ignite.Core.ruleset" />
<None Include="Apache.Ignite.Core.snk" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
index 4d82a65..fa2fb1c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryConfiguration.cs
@@ -17,8 +17,10 @@
namespace Apache.Ignite.Core.Binary
{
+ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+ using System.Linq;
using Apache.Ignite.Core.Impl.Common;
/// <summary>
@@ -27,7 +29,7 @@ namespace Apache.Ignite.Core.Binary
public class BinaryConfiguration
{
/// <summary>
- /// Constructor.
+ /// Initializes a new instance of the <see cref="BinaryConfiguration"/> class.
/// </summary>
public BinaryConfiguration()
{
@@ -35,9 +37,9 @@ namespace Apache.Ignite.Core.Binary
}
/// <summary>
- /// Copying constructor.
+ /// Initializes a new instance of the <see cref="BinaryConfiguration" /> class.
/// </summary>
- /// <param name="cfg">Configuration to copy.</param>
+ /// <param name="cfg">The binary configuration to copy.</param>
public BinaryConfiguration(BinaryConfiguration cfg)
{
IgniteArgumentCheck.NotNull(cfg, "cfg");
@@ -47,15 +49,20 @@ namespace Apache.Ignite.Core.Binary
DefaultKeepDeserialized = cfg.DefaultKeepDeserialized;
DefaultSerializer = cfg.DefaultSerializer;
- Types = cfg.Types != null ? new List<string>(cfg.Types) : null;
+ TypeConfigurations = cfg.TypeConfigurations == null
+ ? null
+ : cfg.TypeConfigurations.Select(x => new BinaryTypeConfiguration(x)).ToList();
- if (cfg.TypeConfigurations != null)
- {
- TypeConfigurations = new List<BinaryTypeConfiguration>(cfg.TypeConfigurations.Count);
+ Types = cfg.Types == null ? null : cfg.Types.ToList();
+ }
- foreach (BinaryTypeConfiguration typeCfg in cfg.TypeConfigurations)
- TypeConfigurations.Add(new BinaryTypeConfiguration(typeCfg));
- }
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinaryConfiguration"/> class.
+ /// </summary>
+ /// <param name="binaryTypes">Binary types to register.</param>
+ public BinaryConfiguration(params Type[] binaryTypes)
+ {
+ TypeConfigurations = binaryTypes.Select(t => new BinaryTypeConfiguration(t)).ToList();
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
new file mode 100644
index 0000000..c9a41e8
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicWriteOrderMode.cs
@@ -0,0 +1,43 @@
+/*
+ * 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.Cache.Configuration
+{
+ /// <summary>
+ /// Cache write ordering mode. This enumeration is taken into account only in
+ /// <see cref="CacheAtomicityMode.Atomic"/> atomicity mode.
+ /// Write ordering mode determines which node assigns the write version, sender or the primary node.
+ /// </summary>
+ public enum CacheAtomicWriteOrderMode
+ {
+ /// <summary>
+ /// In this mode, write versions are assigned on a sender node which generally leads to better
+ /// performance in <see cref="CacheWriteSynchronizationMode.FullSync"/> synchronization mode,
+ /// since in this case sender can send write requests to primary and backups at the same time.
+ /// <para/>
+ /// This mode will be automatically configured only with <see cref="CacheWriteSynchronizationMode.FullSync"/>
+ /// write synchronization mode, as for other synchronization modes it does not render better performance.
+ /// </summary>
+ Clock,
+
+ /// <summary>
+ /// Cache version is assigned only on primary node. This means that sender will only send write request
+ /// to primary node, which in turn will assign write version and forward it to backups.
+ /// </summary>
+ Primary
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee20f1d9/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs
new file mode 100644
index 0000000..8c36a77
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs
@@ -0,0 +1,54 @@
+/*
+ * 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.Cache.Configuration
+{
+ using Apache.Ignite.Core.Cache;
+
+ /// <summary>
+ /// Cache atomicity mode.
+ /// </summary>
+ public enum CacheAtomicityMode
+ {
+ /// <summary>
+ /// Specifies fully ACID-compliant transactional cache behavior.
+ /// </summary>
+ Transactional,
+
+ /// <summary>
+ /// Specifies atomic-only cache behaviour. In this mode distributed transactions and distributed
+ /// locking are not supported. Disabling transactions and locking allows to achieve much higher
+ /// performance and throughput ratios.
+ /// <para/>
+ /// In addition to transactions and locking, one of the main differences to <see cref="Atomic"/> mode
+ /// is that bulk writes, such as <see cref="ICache{TK,TV}.PutAll"/>
+ /// and <see cref="ICache{TK,TV}.RemoveAll(System.Collections.Generic.IEnumerable{TK})"/> methods,
+ /// become simple batch operations which can partially fail. In case of partial
+ /// failure, <see cref="CachePartialUpdateException"/>will be thrown which will contain a list of keys
+ /// for which the update failed. It is recommended that bulk writes are used
+ /// whenever multiple keys need to be inserted or updated in cache, as they reduce number of network trips and
+ /// provide better performance.
+ /// <para/>
+ /// Note that even without locking and transactions, <see cref="Atomic"/> mode still provides
+ /// full consistency guarantees across all cache nodes.
+ /// <para/>
+ /// Also note that all data modifications in <see cref="Atomic"/> mode are guaranteed to be atomic
+ /// and consistent with writes to the underlying persistent store, if one is configured.
+ /// </summary>
+ Atomic
+ }
+}
\ No newline at end of file