You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/10/02 10:44:20 UTC
ignite git commit: IGNITE-1565 .Net: Fixed examples test suite to let
it work in development environment. This closes #112.
Repository: ignite
Updated Branches:
refs/heads/ignite-1282 3852b0b65 -> 40bf02879
IGNITE-1565 .Net: Fixed examples test suite to let it work in development environment. This closes #112.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40bf0287
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40bf0287
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40bf0287
Branch: refs/heads/ignite-1282
Commit: 40bf02879447c765bf0c5f7758bf716937f9e4ee
Parents: 3852b0b
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Fri Oct 2 11:45:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Oct 2 11:45:01 2015 +0300
----------------------------------------------------------------------
.../Examples/Example.cs | 15 ++---------
.../Examples/ExamplesTest.cs | 27 +++++++++++++++++---
.../Examples/PathUtil.cs | 19 +++++---------
.../Examples/ProjectFilesTest.cs | 14 ++++++----
.../dotnet/Apache.Ignite.Core/Ignition.cs | 18 +++++--------
.../dotnet/examples/Config/example-cache.xml | 3 ---
6 files changed, 48 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/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 edb04cb..e532360 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs
@@ -31,9 +31,6 @@ namespace Apache.Ignite.Core.Tests.Examples
/// </summary>
public class Example
{
- /** All examples */
- private static readonly Example[] Examples = GetExamples().ToArray();
-
/** Execute action */
private Action _runAction;
@@ -70,15 +67,7 @@ namespace Apache.Ignite.Core.Tests.Examples
/// <summary>
/// Gets all examples.
/// </summary>
- public static IEnumerable<Example> All
- {
- get { return Examples; }
- }
-
- /// <summary>
- /// Gets all examples.
- /// </summary>
- private static IEnumerable<Example> GetExamples()
+ public static IEnumerable<Example> GetExamples()
{
var examplesAsm = typeof (ClosureExample).Assembly;
@@ -101,7 +90,7 @@ namespace Apache.Ignite.Core.Tests.Examples
yield return new Example
{
SourceFilePath = sourceFile,
- SpringConfigUrl = PathUtil.GetFullConfigPath(GetSpringConfigUrl(sourceCode)),
+ SpringConfigUrl = GetSpringConfigUrl(sourceCode),
NeedsTestDll = sourceCode.Contains(examplesDllName),
_runAction = GetRunAction(type),
Name = type.Name
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/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 0f4ba5e..087f886 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
@@ -76,9 +76,17 @@ namespace Apache.Ignite.Core.Tests.Examples
return;
}
- Assert.IsTrue(File.Exists(example.SpringConfigUrl));
-
- var gridConfig = new IgniteConfiguration {SpringConfigUrl = example.SpringConfigUrl};
+ // 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"
+ }
+ };
// Try with multiple standalone nodes
for (var i = 0; i < 2; i++)
@@ -112,6 +120,8 @@ 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);
}
@@ -127,11 +137,20 @@ namespace Apache.Ignite.Core.Tests.Examples
}
/// <summary>
+ /// Fixture tear down.
+ /// </summary>
+ [TestFixtureTearDown]
+ public void FixtureTearDown()
+ {
+ Environment.SetEnvironmentVariable(Ignition.EnvIgniteSpringConfigUrlPrefix, null);
+ }
+
+ /// <summary>
/// Gets the test cases.
/// </summary>
public IEnumerable<Example> TestCases
{
- get { return Example.All; }
+ get { return Example.GetExamples(); }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/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 d806b36..9ac3530 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/PathUtil.cs
@@ -25,22 +25,17 @@ namespace Apache.Ignite.Core.Tests.Examples
/// </summary>
public static class PathUtil
{
- public static readonly string IgniteHome = Impl.Common.IgniteHome.Resolve(null);
-
- /// <summary>
- /// Full Apache.Ignite.exe path.
- /// </summary>
- public static readonly string IgniteExePath = typeof(IgniteRunner).Assembly.Location;
+ /** */
+ public const string SpringConfigUrlDevPrefix = "modules\\";
- /// <summary>
- /// Examples source code path.
- /// </summary>
- public static readonly string ExamplesSourcePath = Path.Combine(IgniteHome, @"platforms\dotnet\examples");
+ /** */
+ public static readonly string IgniteHome = Impl.Common.IgniteHome.Resolve(null);
/// <summary>
/// Examples source code path.
/// </summary>
- public static readonly string ExamplesDevSourcePath = Path.Combine(IgniteHome, @"examples");
+ public static readonly string ExamplesSourcePath =
+ Path.Combine(IgniteHome, @"modules\platforms\dotnet\examples");
/// <summary>
/// Gets the full configuration path.
@@ -50,7 +45,7 @@ namespace Apache.Ignite.Core.Tests.Examples
if (string.IsNullOrEmpty(springConfigUrl))
return springConfigUrl;
- return Path.GetFullPath(Path.Combine(IgniteHome, springConfigUrl));
+ return Path.GetFullPath(Path.Combine(IgniteHome, SpringConfigUrlDevPrefix + springConfigUrl));
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/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 4f2577a..509618e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ProjectFilesTest.cs
@@ -33,13 +33,17 @@ namespace Apache.Ignite.Core.Tests.Examples
[Test]
public void CheckConfigFilesExist()
{
- Directory.GetFiles(PathUtil.ExamplesDevSourcePath, "*.cs", SearchOption.AllDirectories)
+ var paths = Directory.GetFiles(PathUtil.ExamplesSourcePath, "*.cs", SearchOption.AllDirectories)
.Select(File.ReadAllText)
- .SelectMany(src => Regex.Matches(src, @"modules\\platform[^\s]+.xml").OfType<Match>())
+ .SelectMany(src => Regex.Matches(src, @"platforms[^\s]+.xml").OfType<Match>())
.Where(match => match.Success)
- .Select(match => Path.Combine(PathUtil.ExamplesDevSourcePath, match.Value))
- .ToList()
- .ForEach(path => Assert.IsTrue(File.Exists(path), "Config file does not exist: " + path));
+ .Select(match => PathUtil.GetFullConfigPath(match.Value))
+ .Distinct()
+ .ToList();
+
+ Assert.AreEqual(4, paths.Count);
+
+ paths.ForEach(path => Assert.IsTrue(File.Exists(path), "Config file does not exist: " + path));
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/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 a34c4e5..d02b5ac 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -26,7 +26,6 @@ namespace Apache.Ignite.Core
using System.Linq;
using System.Reflection;
using System.Runtime;
- using System.Runtime.InteropServices;
using System.Threading;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl;
@@ -74,6 +73,9 @@ namespace Apache.Ignite.Core
public static class Ignition
{
/** */
+ internal const string EnvIgniteSpringConfigUrlPrefix = "IGNITE_SPRING_CONFIG_URL_PREFIX";
+
+ /** */
private const string DefaultCfg = "config/default-config.xml";
/** */
@@ -169,10 +171,10 @@ namespace Apache.Ignite.Core
IgniteManager.CreateJvmContext(cfg, cbs);
- sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfg.SpringConfigUrl ?? DefaultCfg);
+ var gridName = cfgEx != null ? cfgEx.GridName : null;
- string gridName = cfgEx != null ? cfgEx.GridName : null;
- sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);
+ var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) +
+ (cfg.SpringConfigUrl ?? DefaultCfg);
// 3. Create startup object which will guide us through the rest of the process.
_startup = new Startup(cfg, cbs);
@@ -182,8 +184,7 @@ namespace Apache.Ignite.Core
try
{
// 4. Initiate Ignite start.
- UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl ?? DefaultCfg,
- cfgEx != null ? cfgEx.GridName : null, ClientMode);
+ UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode);
// 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
var node = _startup.Ignite;
@@ -223,11 +224,6 @@ namespace Apache.Ignite.Core
{
_startup = null;
- Marshal.FreeHGlobal((IntPtr)cfgPath0);
-
- if ((IntPtr)gridName0 != IntPtr.Zero)
- Marshal.FreeHGlobal((IntPtr)gridName0);
-
if (interopProc != null)
UU.ProcessorReleaseStart(interopProc);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/40bf0287/modules/platforms/dotnet/examples/Config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Config/example-cache.xml b/modules/platforms/dotnet/examples/Config/example-cache.xml
index a262ce1..e6b44d6 100644
--- a/modules/platforms/dotnet/examples/Config/example-cache.xml
+++ b/modules/platforms/dotnet/examples/Config/example-cache.xml
@@ -26,9 +26,6 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
<property name="platformConfiguration">
<bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
<property name="portableConfiguration">