Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 25575200B54 for ; Thu, 28 Jul 2016 15:27:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 23B02160A56; Thu, 28 Jul 2016 13:27:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E13E160AAA for ; Thu, 28 Jul 2016 15:27:11 +0200 (CEST) Received: (qmail 5507 invoked by uid 500); 28 Jul 2016 13:27:10 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 5478 invoked by uid 99); 28 Jul 2016 13:27:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2016 13:27:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0CFA2DFDD3; Thu, 28 Jul 2016 13:27:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Thu, 28 Jul 2016 13:27:11 -0000 Message-Id: In-Reply-To: <23ea997f2bf6452498b7f9c1c46d1fa8@git.apache.org> References: <23ea997f2bf6452498b7f9c1c46d1fa8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/5] ignite git commit: IGNITE-3427 .NET: Moved examples from Spring XML to app.config. This closes #897. archived-at: Thu, 28 Jul 2016 13:27:13 -0000 IGNITE-3427 .NET: Moved examples from Spring XML to app.config. This closes #897. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fa81b4a9 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fa81b4a9 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fa81b4a9 Branch: refs/heads/ignite-3553 Commit: fa81b4a90f527bae638009e19ad9d4131c6a6dad Parents: 8386dd8 Author: Pavel Tupitsyn Authored: Thu Jul 28 16:17:06 2016 +0300 Committer: vozerov-gridgain Committed: Thu Jul 28 16:17:06 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core.Tests.csproj | 1 + .../Examples/Example.cs | 8 +- .../Examples/ExamplesTest.cs | 46 ++++----- .../Examples/PathUtil.cs | 10 +- .../Examples/ProjectFilesTest.cs | 2 +- .../Apache.Ignite.Core.Tests/TestAppConfig.cs | 100 +++++++++++++++++++ .../Multicast/TcpDiscoveryMulticastIpFinder.cs | 7 ++ .../dotnet/Apache.Ignite.Core/Ignition.cs | 9 +- modules/platforms/dotnet/Apache.Ignite.sln | 1 - .../dotnet/examples/Apache.Ignite.Examples.sln | 8 -- .../examples/Apache.Ignite.Examples/App.config | 33 +++++- .../Compute/ClosureExample.cs | 4 +- .../Compute/TaskExample.cs | 4 +- .../Datagrid/ContinuousQueryExample.cs | 4 +- .../Datagrid/DataStreamerExample.cs | 4 +- .../Datagrid/LinqExample.cs | 4 +- .../Datagrid/PutGetExample.cs | 4 +- .../Datagrid/QueryExample.cs | 4 +- .../Datagrid/StoreExample.cs | 4 +- .../Datagrid/TransactionExample.cs | 4 +- .../Events/EventsExample.cs | 6 +- .../Messaging/MessagingExample.cs | 4 +- .../Misc/LifecycleExample.cs | 13 ++- .../Services/ServicesExample.cs | 4 +- .../dotnet/examples/Config/examples-config.xml | 98 ------------------ 25 files changed, 210 insertions(+), 176 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index 4e33a91..95fea8f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -54,6 +54,7 @@ + http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs index e532360..663711c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs @@ -35,7 +35,7 @@ namespace Apache.Ignite.Core.Tests.Examples private Action _runAction; /** Config url */ - public string SpringConfigUrl { get; private set; } + public string ConfigPath { get; private set; } /** Source path */ public string SourceFilePath { get; private set; } @@ -90,7 +90,7 @@ namespace Apache.Ignite.Core.Tests.Examples yield return new Example { SourceFilePath = sourceFile, - SpringConfigUrl = GetSpringConfigUrl(sourceCode), + ConfigPath = GetConfigPath(sourceCode), NeedsTestDll = sourceCode.Contains(examplesDllName), _runAction = GetRunAction(type), Name = type.Name @@ -109,9 +109,9 @@ namespace Apache.Ignite.Core.Tests.Examples /// /// Gets the spring configuration URL. /// - private static string GetSpringConfigUrl(string code) + private static string GetConfigPath(string code) { - var match = Regex.Match(code, "-springConfigUrl=(.*?.xml)"); + var match = Regex.Match(code, "-configFileName=(.*?.config)"); return match.Success ? match.Groups[1].Value : null; } http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs index 7cf0d57..02a5d0b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs @@ -30,6 +30,9 @@ namespace Apache.Ignite.Core.Tests.Examples [Category(TestUtils.CategoryIntensive)] public class ExamplesTest { + /** */ + private IDisposable _changedConfig; + /// /// Tests the example in a single node mode. /// @@ -68,24 +71,14 @@ namespace Apache.Ignite.Core.Tests.Examples private static void TestRemoteNodes(Example example, bool clientMode) { // Exclude LifecycleExample - if (string.IsNullOrEmpty(example.SpringConfigUrl)) + if (string.IsNullOrEmpty(example.ConfigPath)) { Assert.AreEqual("LifecycleExample", example.Name); return; } - // First node to start in current process defines JVM options. - var gridConfig = new IgniteConfiguration - { - SpringConfigUrl = example.SpringConfigUrl, - JvmOptions = - new[] - { - "-Xms512m", "-Xmx1024m", "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", - "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" - } - }; + var configPath = Path.Combine(PathUtil.IgniteHome, PathUtil.DevPrefix, example.ConfigPath); // Try with multiple standalone nodes for (var i = 0; i < 2; i++) @@ -94,9 +87,10 @@ namespace Apache.Ignite.Core.Tests.Examples // Stop it after topology check so we don't interfere with example Ignition.ClientMode = false; - using (var ignite = Ignition.Start(gridConfig)) + using (var ignite = Ignition.StartFromApplicationConfiguration( + "igniteConfiguration", configPath)) { - var args = new List {"-springConfigUrl=" + example.SpringConfigUrl}; + var args = new List { "-configFileName=" + configPath}; if (example.NeedsTestDll) args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location); @@ -122,34 +116,36 @@ namespace Apache.Ignite.Core.Tests.Examples public void FixtureSetUp() { Environment.SetEnvironmentVariable("IGNITE_NATIVE_TEST_CLASSPATH", "true"); - Environment.SetEnvironmentVariable(Ignition.EnvIgniteSpringConfigUrlPrefix, - PathUtil.SpringConfigUrlDevPrefix); Directory.SetCurrentDirectory(PathUtil.IgniteHome); + + _changedConfig = TestAppConfig.Change(PathUtil.ExamplesAppConfigPath); } /// - /// Test teardown. + /// Fixture teardown. /// - [TearDown] - public void TearDown() + [TestFixtureTearDown] + public void FixtureTearDown() { - Ignition.ClientMode = false; - IgniteProcess.KillAll(); + _changedConfig.Dispose(); } /// - /// Fixture tear down. + /// Test teardown. /// - [TestFixtureTearDown] - public void FixtureTearDown() + [TearDown] + public void TearDown() { - Environment.SetEnvironmentVariable(Ignition.EnvIgniteSpringConfigUrlPrefix, null); + Ignition.ClientMode = false; + IgniteProcess.KillAll(); } /// /// Gets the test cases. /// + // ReSharper disable once MemberCanBePrivate.Global + // ReSharper disable once MemberCanBeMadeStatic.Global public IEnumerable TestCases { get { return Example.GetExamples(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs index a128b7d..7c82d80 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs @@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Tests.Examples public static class PathUtil { /** */ - public const string SpringConfigUrlDevPrefix = "modules\\"; + public const string DevPrefix = "modules\\"; /** */ public static readonly string IgniteHome = Impl.Common.IgniteHome.Resolve(null); @@ -37,6 +37,12 @@ namespace Apache.Ignite.Core.Tests.Examples Path.Combine(IgniteHome, @"modules\platforms\dotnet\examples"); /// + /// Examples application configuration path. + /// + public static readonly string ExamplesAppConfigPath = + Path.Combine(ExamplesSourcePath, @"Apache.Ignite.Examples\App.config"); + + /// /// Gets the full configuration path. /// public static string GetFullConfigPath(string springConfigUrl) @@ -44,7 +50,7 @@ namespace Apache.Ignite.Core.Tests.Examples if (string.IsNullOrEmpty(springConfigUrl)) return springConfigUrl; - return Path.GetFullPath(Path.Combine(IgniteHome, SpringConfigUrlDevPrefix + springConfigUrl)); + return Path.GetFullPath(Path.Combine(IgniteHome, DevPrefix + springConfigUrl)); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs index b99b54e..3f87217 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs @@ -35,7 +35,7 @@ namespace Apache.Ignite.Core.Tests.Examples { var paths = Directory.GetFiles(PathUtil.ExamplesSourcePath, "*.cs", SearchOption.AllDirectories) .Select(File.ReadAllText) - .SelectMany(src => Regex.Matches(src, @"platforms[^\s]+.xml").OfType()) + .SelectMany(src => Regex.Matches(src, @"platforms[^\s]+.config").OfType()) .Where(match => match.Success) .Select(match => PathUtil.GetFullConfigPath(match.Value)) .Distinct() http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestAppConfig.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestAppConfig.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestAppConfig.cs new file mode 100644 index 0000000..094aee5 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestAppConfig.cs @@ -0,0 +1,100 @@ +/* + * 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.Linq; + using System.Configuration; + using System.Reflection; + + /// + /// Replaces app.config at runtime for test purposes. + /// + public static class TestAppConfig + { + /// + /// Changes the current app config with the specified one. + /// + /// The path. + /// Disposable object that will revert the change when disposed. + public static IDisposable Change(string path) + { + return new ChangeAppConfig(path); + } + + /// + /// Disposable config changer. + /// + private class ChangeAppConfig : IDisposable + { + /** */ + private readonly string _oldConfig = + AppDomain.CurrentDomain.GetData("APP_CONFIG_FILE").ToString(); + + /** */ + private bool _isDisposed; + + /// + /// Initializes a new instance of the class. + /// + /// The path. + public ChangeAppConfig(string path) + { + AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", path); + ResetConfigMechanism(); + } + + /** */ + public void Dispose() + { + if (!_isDisposed) + { + AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", _oldConfig); + ResetConfigMechanism(); + + + _isDisposed = true; + } + GC.SuppressFinalize(this); + } + + /// + /// Resets the internal configuration mechanism. + /// + private static void ResetConfigMechanism() + { + // ReSharper disable PossibleNullReferenceException + + typeof(ConfigurationManager) + .GetField("s_initState", BindingFlags.NonPublic | BindingFlags.Static) + .SetValue(null, 0); + + typeof(ConfigurationManager) + .GetField("s_configSystem", BindingFlags.NonPublic | BindingFlags.Static) + .SetValue(null, null); + + typeof(ConfigurationManager) + .Assembly.GetTypes().First(x => x.FullName == "System.Configuration.ClientConfigPaths") + .GetField("s_current", BindingFlags.NonPublic | BindingFlags.Static) + .SetValue(null, null); + + // ReSharper restore PossibleNullReferenceException + } + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/Multicast/TcpDiscoveryMulticastIpFinder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/Multicast/TcpDiscoveryMulticastIpFinder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/Multicast/TcpDiscoveryMulticastIpFinder.cs index 4581a04..b1cb719 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/Multicast/TcpDiscoveryMulticastIpFinder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/Multicast/TcpDiscoveryMulticastIpFinder.cs @@ -41,6 +41,11 @@ namespace Apache.Ignite.Core.Discovery.Tcp.Multicast public const int DefaultAddressRequestAttempts = 2; /// + /// Default multicast group. + /// + public const string DefaultMulticastGroup = "228.1.2.4"; + + /// /// Default response timeout. /// public static readonly TimeSpan DefaultResponseTimeout = TimeSpan.FromMilliseconds(500); @@ -53,6 +58,7 @@ namespace Apache.Ignite.Core.Discovery.Tcp.Multicast MulticastPort = DefaultMulticastPort; AddressRequestAttempts = DefaultAddressRequestAttempts; ResponseTimeout = DefaultResponseTimeout; + MulticastGroup = DefaultMulticastGroup; } /// @@ -66,6 +72,7 @@ namespace Apache.Ignite.Core.Discovery.Tcp.Multicast /// /// Gets or sets the IP address of the multicast group. /// + [DefaultValue(DefaultMulticastGroup)] public string MulticastGroup { get; set; } /// http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs index c9ff3ff..552a7f2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs @@ -52,9 +52,6 @@ namespace Apache.Ignite.Core public static class Ignition { /** */ - internal const string EnvIgniteSpringConfigUrlPrefix = "IGNITE_SPRING_CONFIG_URL_PREFIX"; - - /** */ private static readonly object SyncRoot = new object(); /** GC warning flag. */ @@ -216,10 +213,6 @@ namespace Apache.Ignite.Core var gridName = cfg.GridName; - var cfgPath = cfg.SpringConfigUrl == null - ? null - : Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl; - // 3. Create startup object which will guide us through the rest of the process. _startup = new Startup(cfg, cbs); @@ -228,7 +221,7 @@ namespace Apache.Ignite.Core try { // 4. Initiate Ignite start. - UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode); + UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl, gridName, ClientMode); // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data. var node = _startup.Ignite; http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/Apache.Ignite.sln ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.sln b/modules/platforms/dotnet/Apache.Ignite.sln index ca4f9c4..2362ce2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.sln +++ b/modules/platforms/dotnet/Apache.Ignite.sln @@ -27,7 +27,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Apache.Ignite.sln.DotSettings = Apache.Ignite.sln.DotSettings Apache.Ignite.sln.TeamCity.DotSettings = Apache.Ignite.sln.TeamCity.DotSettings DEVNOTES.txt = DEVNOTES.txt - examples\Config\examples-config.xml = examples\Config\examples-config.xml README.txt = README.txt EndProjectSection EndProject http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples.sln ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples.sln b/modules/platforms/dotnet/examples/Apache.Ignite.Examples.sln index 1254245..c88d698 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples.sln +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples.sln @@ -5,14 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Examples", "A EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.ExamplesDll", "Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj", "{DFB08363-202E-412D-8812-349EF10A8702}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{F1491682-C798-4C23-8239-16C5BC2C5A02}" - ProjectSection(SolutionItems) = preProject - Config\example-cache-query.xml = Config\example-cache-query.xml - Config\example-cache-store.xml = Config\example-cache-store.xml - Config\example-cache.xml = Config\example-cache.xml - Config\example-compute.xml = Config\example-compute.xml - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config index 8e69aeb..1d180e8 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/App.config @@ -18,7 +18,34 @@ --> - - - + +
+ + + + + + + + + + + + + Apache.Ignite.ExamplesDll.Binary.Account + Apache.Ignite.ExamplesDll.Binary.Address + Apache.Ignite.ExamplesDll.Binary.Employee + Apache.Ignite.ExamplesDll.Binary.EmployeeKey + Apache.Ignite.ExamplesDll.Binary.Organization + + + + + + + 127.0.0.1:47500 + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/ClosureExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/ClosureExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/ClosureExample.cs index 875696b..34e32b9 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/ClosureExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/ClosureExample.cs @@ -34,7 +34,7 @@ namespace Apache.Ignite.Examples.Compute /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. ///
public class ClosureExample @@ -45,7 +45,7 @@ namespace Apache.Ignite.Examples.Compute [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Closure execution example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs index d9f45f9..a7873cb 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Compute/TaskExample.cs @@ -34,7 +34,7 @@ namespace Apache.Ignite.Examples.Compute /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. ///
public class TaskExample @@ -45,7 +45,7 @@ namespace Apache.Ignite.Examples.Compute [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Task execution example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs index 6bdb33f..e3fc583 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs @@ -36,7 +36,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class ContinuousQueryExample @@ -50,7 +50,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache continuous query example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs index 25d4e8e..88a0529 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs @@ -36,7 +36,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class DataStreamerExample @@ -53,7 +53,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache data streamer example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs index 49611cf..b4a8493 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/LinqExample.cs @@ -39,7 +39,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class LinqExample @@ -50,7 +50,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache LINQ example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs index 10c6e1b..ebf77ec 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs @@ -37,7 +37,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class PutGetExample @@ -51,7 +51,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache put-get example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs index c08a78b..7880eac 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs @@ -38,7 +38,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class QueryExample @@ -49,7 +49,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache query example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs index c95b01d..25721b8 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs @@ -35,7 +35,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// class StoreExample @@ -49,7 +49,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Cache store example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs index 46f871f..b0e953c 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs @@ -34,7 +34,7 @@ namespace Apache.Ignite.Examples.Datagrid /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// class TransactionExample @@ -48,7 +48,7 @@ namespace Apache.Ignite.Examples.Datagrid [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(); Console.WriteLine(">>> Transaction example started."); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs index b19d646..3b804f6 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs @@ -36,7 +36,7 @@ namespace Apache.Ignite.Examples.Events /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class EventsExample @@ -47,7 +47,7 @@ namespace Apache.Ignite.Examples.Events [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(">>> Events example started."); Console.WriteLine(); @@ -55,6 +55,8 @@ namespace Apache.Ignite.Examples.Events // Local listen example Console.WriteLine(">>> Listening for a local event..."); + ignite.GetEvents().EnableLocal(EventType.TaskExecutionAll); + var listener = new LocalListener(); ignite.GetEvents().LocalListen(listener, EventType.TaskExecutionAll); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs index cf94d79..be267df 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs @@ -28,7 +28,7 @@ namespace Apache.Ignite.Examples.Messaging /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build). /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder; /// 2) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 3) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties -> /// Application -> Startup object); /// 4) Start example (F5 or Ctrl+F5). @@ -41,7 +41,7 @@ namespace Apache.Ignite.Examples.Messaging [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { var remotes = ignite.GetCluster().ForRemotes(); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs index e79e729..b7acb61 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs @@ -23,6 +23,9 @@ using Apache.Ignite.Core.Resource; namespace Apache.Ignite.Examples.Misc { + using Apache.Ignite.Core.Discovery.Tcp; + using Apache.Ignite.Core.Discovery.Tcp.Static; + /// /// This example shows how to provide your own implementation /// to be able to hook into Apache lifecycle. Example bean will output occurred lifecycle @@ -50,8 +53,14 @@ namespace Apache.Ignite.Examples.Misc var cfg = new IgniteConfiguration { - SpringConfigUrl = @"platforms\dotnet\examples\config\examples-config.xml", - LifecycleBeans = new List { lifecycleExampleBean } + DiscoverySpi = new TcpDiscoverySpi + { + IpFinder = new TcpDiscoveryStaticIpFinder + { + Endpoints = new[] {"127.0.0.1:47500"} + } + }, + LifecycleBeans = new List {lifecycleExampleBean} }; // Provide lifecycle bean to configuration. http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Services/ServicesExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Services/ServicesExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Services/ServicesExample.cs index ae2dfa8..fcfce14 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Services/ServicesExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Services/ServicesExample.cs @@ -32,7 +32,7 @@ namespace Apache.Ignite.Examples.Services /// /// This example can be run with standalone Apache Ignite.NET node: /// 1) Run %IGNITE_HOME%/platforms/dotnet/bin/Apache.Ignite.exe: - /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\examples-config.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] + /// Apache.Ignite.exe -configFileName=platforms\dotnet\examples\apache.ignite.examples\app.config -assembly=[path_to_Apache.Ignite.ExamplesDll.dll] /// 2) Start example. /// public class ServicesExample @@ -43,7 +43,7 @@ namespace Apache.Ignite.Examples.Services [STAThread] public static void Main() { - using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml")) + using (var ignite = Ignition.StartFromApplicationConfiguration()) { Console.WriteLine(">>> Services example started."); Console.WriteLine(); http://git-wip-us.apache.org/repos/asf/ignite/blob/fa81b4a9/modules/platforms/dotnet/examples/Config/examples-config.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Config/examples-config.xml b/modules/platforms/dotnet/examples/Config/examples-config.xml deleted file mode 100644 index 40b7a43..0000000 --- a/modules/platforms/dotnet/examples/Config/examples-config.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - 127.0.0.1:47500 - - - - - - - - - - - - - - - Apache.Ignite.ExamplesDll.Binary.Account - Apache.Ignite.ExamplesDll.Binary.Address - Apache.Ignite.ExamplesDll.Binary.Employee - Apache.Ignite.ExamplesDll.Binary.EmployeeKey - Apache.Ignite.ExamplesDll.Binary.Organization - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -