IGNITE-1367: Moved .Net executable to Ignite.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c2d19b17 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c2d19b17 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c2d19b17 Branch: refs/heads/ignite-843 Commit: c2d19b177c7ebde873f9eecd609aed33b4050a0c Parents: 99187cf Author: Pavel Tupitsyn <[email protected]> Authored: Mon Sep 7 16:45:31 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Mon Sep 7 16:45:31 2015 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Core/Cluster/IClusterGroup.cs | 2 +- .../Impl/Common/DelegateTypeDescriptor.cs | 17 +- .../Impl/Compute/ComputeImpl.cs | 2 +- .../Impl/Compute/ComputeJobHolder.cs | 6 + .../Apache.Ignite.Core/Impl/IgniteManager.cs | 2 +- .../Properties/AssemblyInfo.cs | 1 + .../platform/src/main/dotnet/Apache.Ignite.sln | 10 + .../dotnet/Apache.Ignite/Apache.Ignite.csproj | 76 +++++++ .../src/main/dotnet/Apache.Ignite/App.config | 56 +++++ .../Config/AppSettingsConfigurator.cs | 113 ++++++++++ .../Apache.Ignite/Config/ArgsConfigurator.cs | 164 ++++++++++++++ .../Apache.Ignite/Config/ConfigValueParser.cs | 42 ++++ .../Apache.Ignite/Config/IConfigurator.cs | 34 +++ .../main/dotnet/Apache.Ignite/IgniteRunner.cs | 171 ++++++++++++++ .../Apache.Ignite/Properties/AssemblyInfo.cs | 35 +++ .../Apache.Ignite/Service/IgniteService.cs | 219 ++++++++++++++++++ .../Apache.Ignite/Service/NativeMethods.cs | 57 +++++ .../Apache.Ignite/Service/ServiceDescription.cs | 32 +++ .../Apache.Ignite.Core.Tests.csproj | 5 +- .../Cache/CacheForkedTest.cs | 1 - .../Forked/ForkedPortableClosureTaskTest.cs | 3 - .../Compute/Forked/ForkedResourceTaskTest.cs | 2 +- .../Forked/ForkedSerializableClosureTaskTest.cs | 2 +- .../Compute/Forked/ForkedTaskAdapterTest.cs | 3 - .../Config/Apache.Ignite.exe.config.test | 41 ++++ .../Config/Ignite.exe.config.test | 41 ---- .../native-client-test-cache-portables.xml | 226 ------------------- .../Config/native-client-test-cache.xml | 30 --- .../Apache.Ignite.Core.Tests/ExecutableTest.cs | 39 ++-- .../IgniteStartStopTest.cs | 28 --- .../Apache.Ignite.Core.Tests/LoadDllTest.cs | 2 +- .../Process/IgniteProcess.cs | 33 +-- .../Apache.Ignite.Core.Tests/TestUtils.cs | 2 +- 33 files changed, 1098 insertions(+), 399 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs index 1fa11b5..21d6931 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs @@ -174,7 +174,7 @@ namespace Apache.Ignite.Core.Cluster IClusterGroup ForYoungest(); /// <summary> - /// Creates grid projection for nodes supporting .Net, i.e. for nodes started with Ignite.exe. + /// Creates grid projection for nodes supporting .Net, i.e. for nodes started with Apache.Ignite.exe. /// </summary> /// <returns>Grid projection for nodes supporting .Net.</returns> IClusterGroup ForDotNet(); http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs index 680228d..8d7cb3a 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs @@ -48,10 +48,7 @@ namespace Apache.Ignite.Core.Impl.Common /** */ private readonly Func<object, object, object, bool> _cacheEntryFilter; - - /** */ - private readonly Func<object, object, object, byte, bool> _cacheDrEntryFilter; - + /** */ private readonly Tuple<Func<object, IMutableCacheEntryInternal, object, object>, Tuple<Type, Type>> _cacheEntryProcessor; @@ -110,17 +107,7 @@ namespace Apache.Ignite.Core.Impl.Common { return Get(type)._cacheEntryFilter; } - - /// <summary> - /// Gets the <see cref="ICacheDrEntryFilter{K, V}" /> invocator. - /// </summary> - /// <param name="type">Type.</param> - /// <returns>Precompiled invocator delegate.</returns> - public static Func<object, object, object, byte, bool> GetCacheDrEntryFilter(Type type) - { - return Get(type)._cacheDrEntryFilter; - } - + /// <summary> /// Gets the <see cref="ICacheEntryProcessor{K, V, A, R}" /> invocator. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs index 789e1c4..45c847a 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs @@ -573,7 +573,7 @@ namespace Apache.Ignite.Core.Impl.Compute /// <returns>Handle to the job holder</returns> private long WriteJob(IComputeJob job, PortableWriterImpl writer) { - var jobHolder = new ComputeJobHolder(_prj.Ignite as Ignite, job); + var jobHolder = new ComputeJobHolder((Ignite) _prj.Ignite, job); var jobHandle = Marshaller.Ignite.HandleRegistry.Allocate(jobHolder); http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs index 9bdb5cf..4e63282 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Impl.Compute { using System; + using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Impl.Cluster; @@ -48,6 +49,8 @@ namespace Apache.Ignite.Core.Impl.Compute /// <param name="reader"></param> public ComputeJobHolder(IPortableReader reader) { + Debug.Assert(reader != null); + var reader0 = (PortableReaderImpl) reader.RawReader(); _ignite = reader0.Marshaller.Ignite; @@ -62,6 +65,9 @@ namespace Apache.Ignite.Core.Impl.Compute /// <param name="job">Job.</param> public ComputeJobHolder(Ignite grid, IComputeJob job) { + Debug.Assert(grid != null); + Debug.Assert(job != null); + _ignite = grid; _job = job; } http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs index 6203b3c..0edaeab 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs @@ -39,7 +39,7 @@ namespace Apache.Ignite.Core.Impl internal const string EnvIgniteHome = "IGNITE_HOME"; /** Environment variable: whether to set test classpath or not. */ - private const string EnvIgniteNativeTestClasspath = "IGNITE_NATIVE_TEST_CLASSPATH"; + internal const string EnvIgniteNativeTestClasspath = "IGNITE_NATIVE_TEST_CLASSPATH"; /** Classpath prefix. */ private const string ClasspathPrefix = "-Djava.class.path="; http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs index 5dbfce9..1876e24 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs +++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs @@ -37,6 +37,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyFileVersion("1.5.0")] [assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Apache.Ignite")] #if !EXCLUDE_TESTS http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite.sln ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.sln b/modules/platform/src/main/dotnet/Apache.Ignite.sln index 11fc4ce..e9886ed 100644 --- a/modules/platform/src/main/dotnet/Apache.Ignite.sln +++ b/modules/platform/src/main/dotnet/Apache.Ignite.sln @@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\cpp\common\pro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core.Tests.TestDll", "..\..\test\dotnet\Apache.Ignite.Core.Tests.TestDll\Apache.Ignite.Core.Tests.TestDll.csproj", "{F4A69E2D-908E-4F0F-A794-84D508D60E5F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite", "Apache.Ignite\Apache.Ignite.csproj", "{27F7F3C6-BDDE-43A9-B565-856F8395A04B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -51,6 +53,14 @@ Global {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x64.Build.0 = Release|x64 {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x86.ActiveCfg = Release|x86 {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x86.Build.0 = Release|x86 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.ActiveCfg = Debug|x64 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.Build.0 = Debug|x64 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.ActiveCfg = Debug|x86 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.Build.0 = Debug|x86 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.ActiveCfg = Release|x64 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.Build.0 = Release|x64 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.ActiveCfg = Release|x86 + {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj b/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj new file mode 100644 index 0000000..7f6db3a --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{27F7F3C6-BDDE-43A9-B565-856F8395A04B}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Apache.Ignite</RootNamespace> + <AssemblyName>Apache.Ignite</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <PlatformTarget>x64</PlatformTarget> + <OutputPath>bin\x64\Debug\</OutputPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <PlatformTarget>x64</PlatformTarget> + <OutputPath>bin\x64\Release\</OutputPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <PlatformTarget>x86</PlatformTarget> + <OutputPath>bin\x86\Debug\</OutputPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <PlatformTarget>x86</PlatformTarget> + <OutputPath>bin\x86\Release\</OutputPath> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Core" /> + <Reference Include="System.ServiceProcess" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Config\AppSettingsConfigurator.cs" /> + <Compile Include="Config\ArgsConfigurator.cs" /> + <Compile Include="Config\ConfigValueParser.cs" /> + <Compile Include="Config\IConfigurator.cs" /> + <Compile Include="IgniteRunner.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Service\IgniteService.cs"> + <SubType>Component</SubType> + </Compile> + <Compile Include="Service\NativeMethods.cs" /> + <Compile Include="Service\ServiceDescription.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Apache.Ignite.Core\Apache.Ignite.Core.csproj"> + <Project>{4cd2f726-7e2b-46c4-a5ba-057bb82eecb6}</Project> + <Name>Apache.Ignite.Core</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PostBuildEvent>copy $(TargetPath) $(SolutionDir)..\..\test\dotnet\Apache.Ignite.Core.Tests\$(OutDir) +copy $(TargetPath).config $(SolutionDir)..\..\test\dotnet\Apache.Ignite.Core.Tests\$(OutDir)</PostBuildEvent> + </PropertyGroup> + <!-- 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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/App.config ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/App.config b/modules/platform/src/main/dotnet/Apache.Ignite/App.config new file mode 100644 index 0000000..a9e8c39 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/App.config @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + 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. +--> + + +<!-- + Apache Ignite .Net startup application configuration file. +--> + +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + </startup> + + <runtime> + <gcServer enabled="true" /> + </runtime> + + <appSettings> + <!-- Path to spring configuration file relative from IGNITE_HOME (if not provided "config/default-config.xml" is used) --> + <!-- <add key="Ignite.SpringConfigUrl" value="my-config.xml"/> --> + + <!-- Absolute path to spring configuration file (if not provided "config/default-config.xml" is used) --> + <!-- <add key="Ignite.SpringConfigUrl" value="C:\my-dir\my-config.xml"/> --> + + <!-- Path to Java library jvm.dll (if not provided JAVA_HOME environment variable is used to find jvm.dll) --> + <!-- <add key="Ignite.JvmDllPath" value="C:\Program Files\Java\jdk1.7.0_45\jre\bin\server\jvm.dll"/> --> + + <!-- Additional classpath passed to JVM (enlist additional jar files here) --> + <!-- <add key="Ignite.JvmClasspath" value="c:\my-dir\my-lib1.jar;c:\my-dir\my-lib2.jar"/> --> + + <!-- JVM Options passed to JVM --> + <!-- <add key="Ignite.JvmOption.1" value="-Xmx512m"/> --> + <!-- <add key="Ignite.JvmOption.2" value="-DIGNITE_QUIET=false"/> --> + + <!-- Additional .Net assemblies to be loaded on startup. --> + <!-- <add key="Ignite.Assembly.1" value="System.Data.Linq,Culture=neutral,Version=1.0.0.0,PublicKeyToken=b77a5c561934e089"/> --> + <!-- <add key="Ignite.Assembly.2" value="my-assembly.dll"/> --> + </appSettings> + +</configuration> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs new file mode 100644 index 0000000..b2e827e --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs @@ -0,0 +1,113 @@ +/* + * 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.Config +{ + using System.Collections.Generic; + using System.Collections.Specialized; + using Apache.Ignite.Core; + + /// <summary> + /// Configurator which uses application configuration. + /// </summary> + internal class AppSettingsConfigurator : IConfigurator<NameValueCollection> + { + /** Common configuration property prefix. */ + private static readonly string CfgPrefix = "Ignite.".ToLower(); + + /** Configuration property: Ignite home. */ + private static readonly string CfgHome = "Home".ToLower(); + + /** Configuration property: Spring config URL. */ + private static readonly string CfgSpringCfgUrl = "SpringConfigUrl".ToLower(); + + /** Configuration property: Path to JVM dll. */ + private static readonly string CfgJvmDll = "JvmDll".ToLower(); + + /** Configuration property: JVM classpath. */ + private static readonly string CfgJvmClasspath = "JvmClasspath".ToLower(); + + /** Configuration property: suppress warnings flag. */ + private static readonly string CfgSuppressWarn = "SuppressWarnings".ToLower(); + + /** Configuration property: JVM option prefix. */ + private static readonly string CfgJvmOptPrefix = "JvmOption".ToLower(); + + /** Configuration property: assembly prefix. */ + private static readonly string CfgAssemblyPrefix = "Assembly".ToLower(); + + /** Configuration property: JVM min memory. */ + private static readonly string CfgJvmMinMem = "JvmInitialMemoryMB".ToLower(); + + /** Configuration property: JVM max memory. */ + private static readonly string CfgJvmMaxMem = "JvmMaxMemoryMB".ToLower(); + + /** <inheritDoc /> */ + public void Configure(IgniteConfiguration cfg, NameValueCollection src) + { + var jvmOpts = new List<string>(); + var assemblies = new List<string>(); + + foreach (string key in src.Keys) + { + var key0 = key.ToLower(); + + if (key0.StartsWith(CfgPrefix)) + { + key0 = key0.Substring(CfgPrefix.Length); + + var val = src[key]; + + if (CfgHome.Equals(key0)) + cfg.IgniteHome = val; + else if (CfgSpringCfgUrl.Equals(key0)) + cfg.SpringConfigUrl = val; + else if (CfgJvmDll.Equals(key0)) + cfg.JvmDllPath = val; + else if (CfgJvmClasspath.Equals(key0)) + cfg.JvmClasspath = val; + else if (CfgSuppressWarn.Equals(key0)) + cfg.SuppressWarnings = val != null && bool.TrueString.ToLower().Equals(val.ToLower()); + else if (key0.StartsWith(CfgJvmOptPrefix)) + jvmOpts.Add(val); + else if (key0.StartsWith(CfgAssemblyPrefix)) + assemblies.Add(val); + else if (CfgJvmMinMem.Equals(key0)) + cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(val, key); + else if (CfgJvmMaxMem.Equals(key0)) + cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(val, key); + } + } + + if (jvmOpts.Count > 0) + { + if (cfg.JvmOptions == null) + cfg.JvmOptions = jvmOpts; + else + jvmOpts.ForEach(val => cfg.JvmOptions.Add(val)); + } + + if (assemblies.Count > 0) + { + if (cfg.Assemblies == null) + cfg.Assemblies = assemblies; + else + assemblies.ForEach(val => cfg.Assemblies.Add(val)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs new file mode 100644 index 0000000..b0651d7 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs @@ -0,0 +1,164 @@ +/* + * 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.Config +{ + using System.Collections.Generic; + using Apache.Ignite.Core; + + /// <summary> + /// Configurator which uses arguments array. + /// </summary> + internal class ArgsConfigurator : IConfigurator<string[]> + { + /** Command line argument: Ignite home. */ + private static readonly string CmdIgniteHome = "-IgniteHome=".ToLower(); + + /** Command line argument: Spring config URL. */ + private static readonly string CmdSpringCfgUrl = "-SpringConfigUrl=".ToLower(); + + /** Command line argument: Path to JVM dll. */ + private static readonly string CmdJvmDll = "-JvmDll=".ToLower(); + + /** Command line argument: JVM classpath. */ + private static readonly string CmdJvmClasspath = "-JvmClasspath=".ToLower(); + + /** Command line argument: suppress warnings flag. */ + private static readonly string CmdSuppressWarn = "-SuppressWarnings=".ToLower(); + + /** Command line argument: JVM option prefix. */ + private static readonly string CmdJvmOpt = "-J".ToLower(); + + /** Command line argument: assembly. */ + private static readonly string CmdAssembly = "-Assembly=".ToLower(); + + /** Command line argument: JvmInitialMemoryMB. */ + private static readonly string CmdJvmMinMem = "-JvmInitialMemoryMB=".ToLower(); + + /** Command line argument: JvmMaxMemoryMB. */ + private static readonly string CmdJvmMaxMem = "-JvmMaxMemoryMB=".ToLower(); + + /// <summary> + /// Convert configuration to arguments. + /// </summary> + /// <param name="cfg"></param> + /// <returns></returns> + internal static string[] ToArgs(IgniteConfiguration cfg) + { + var args = new List<string>(); + + if (cfg.IgniteHome != null) + args.Add(CmdIgniteHome + cfg.IgniteHome); + + if (cfg.SpringConfigUrl != null) + args.Add(CmdSpringCfgUrl + cfg.SpringConfigUrl); + + if (cfg.JvmDllPath != null) + args.Add(CmdJvmDll + cfg.JvmDllPath); + + if (cfg.JvmClasspath != null) + args.Add(CmdJvmClasspath + cfg.JvmClasspath); + + if (cfg.SuppressWarnings) + args.Add(CmdSuppressWarn + bool.TrueString); + + if (cfg.JvmOptions != null) + { + foreach (var jvmOpt in cfg.JvmOptions) + args.Add(CmdJvmOpt + jvmOpt); + } + + if (cfg.Assemblies != null) + { + foreach (var assembly in cfg.Assemblies) + args.Add(CmdAssembly + assembly); + } + + args.Add(CmdJvmMinMem + cfg.JvmInitialMemoryMb); + args.Add(CmdJvmMaxMem + cfg.JvmMaxMemoryMb); + + return args.ToArray(); + } + + /// <summary> + /// Convert arguments to configuration. + /// </summary> + /// <param name="args">Arguments.</param> + /// <returns>Configuration.</returns> + internal static IgniteConfiguration FromArgs(string[] args) + { + var cfg = new IgniteConfiguration(); + + new ArgsConfigurator().Configure(cfg, args); + + return cfg; + } + + /** <inheritDoc /> */ + public void Configure(IgniteConfiguration cfg, string[] src) + { + var jvmOpts = new List<string>(); + var assemblies = new List<string>(); + + foreach (var arg in src) + { + var argLow = arg.ToLower(); + + if (argLow.StartsWith(CmdIgniteHome)) + cfg.IgniteHome = arg.Substring(CmdIgniteHome.Length); + else if (argLow.StartsWith(CmdSpringCfgUrl)) + cfg.SpringConfigUrl = arg.Substring(CmdSpringCfgUrl.Length); + else if (argLow.StartsWith(CmdJvmDll)) + cfg.JvmDllPath = arg.Substring(CmdJvmDll.Length); + else if (argLow.StartsWith(CmdJvmClasspath)) + cfg.JvmClasspath = arg.Substring(CmdJvmClasspath.Length); + else if (argLow.StartsWith(CmdSuppressWarn)) + { + var val = arg.Substring(CmdSuppressWarn.Length); + + cfg.SuppressWarnings = bool.TrueString.ToLower().Equals(val.ToLower()); + } + else if (argLow.StartsWith(CmdJvmMinMem)) + cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMinMem.Length), + CmdJvmMinMem); + else if (argLow.StartsWith(CmdJvmMaxMem)) + cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMaxMem.Length), + CmdJvmMaxMem); + else if (argLow.StartsWith(CmdJvmOpt)) + jvmOpts.Add(arg.Substring(CmdJvmOpt.Length)); + else if (argLow.StartsWith(CmdAssembly)) + assemblies.Add(arg.Substring(CmdAssembly.Length)); + } + + if (jvmOpts.Count > 0) + { + if (cfg.JvmOptions == null) + cfg.JvmOptions = jvmOpts; + else + jvmOpts.ForEach(val => cfg.JvmOptions.Add(val)); + } + + if (assemblies.Count > 0) + { + if (cfg.Assemblies == null) + cfg.Assemblies = assemblies; + else + assemblies.ForEach(val => cfg.Assemblies.Add(val)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs new file mode 100644 index 0000000..796b8e1 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs @@ -0,0 +1,42 @@ +/* + * 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.Config +{ + using System; + + /// <summary> + /// Parses Ignite config values. + /// </summary> + internal class ConfigValueParser + { + /// <summary> + /// Parses provided string to int. Throws a custom exception if failed. + /// </summary> + public static int ParseInt(string value, string propertyName) + { + int result; + + if (int.TryParse(value, out result)) + return result; + + throw new InvalidOperationException( + string.Format("Failed to configure Ignite: property '{0}' has value '{1}', which is not an integer.", + propertyName, value)); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs new file mode 100644 index 0000000..f5c0acf --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Config +{ + using Apache.Ignite.Core; + + /// <summary> + /// Configurator which is capable of setting configuration properties taken from somewhere. + /// </summary> + internal interface IConfigurator<in T> + { + /// <summary> + /// Set configuration. + /// </summary> + /// <param name="cfg">Configuration.</param> + /// <param name="src">Source.</param> + void Configure(IgniteConfiguration cfg, T src); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs b/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs new file mode 100644 index 0000000..122994f --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs @@ -0,0 +1,171 @@ +/* + * 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 +{ + using System; + using System.Collections.Generic; + using System.Configuration; + using System.Linq; + using System.ServiceProcess; + using Apache.Ignite.Config; + using Apache.Ignite.Core; + using Apache.Ignite.Core.Impl; + using Apache.Ignite.Service; + + /// <summary> + /// Runner class. + /// </summary> + public class IgniteRunner + { + /** Help commands. */ + private static readonly IList<string> Help = new List<string> { "/help", "-help", "--help" }; + + /** Argument meaning that this is service call. */ + internal static readonly string Svc = "/service"; + + /** Service install command. */ + internal static readonly string SvcInstall = "/install"; + + /** Service uninstall command. */ + internal static readonly string SvcUninstall = "/uninstall"; + + /// <summary> + /// Application entry point. + /// </summary> + internal static void Main(string[] args) + { + IgniteConfiguration cfg; + + bool svc = false; + bool install = false; + + try + { + // Check for special cases. + if (args.Length > 0) + { + string first = args[0].ToLower(); + + if (Help.Contains(first)) + { + PrintHelp(); + + return; + } + + if (Svc.Equals(first)) + { + args = RemoveFirstArg(args); + + svc = true; + } + + else if (SvcInstall.Equals(first)) + { + args = RemoveFirstArg(args); + + install = true; + } + else if (SvcUninstall.Equals(first)) + { + IgniteService.Uninstall(); + + return; + } + } + + if (!svc) + { + // Pick application configuration. + cfg = new IgniteConfiguration(); + + new AppSettingsConfigurator().Configure(cfg, ConfigurationManager.AppSettings); + + // Pick command line arguments. + new ArgsConfigurator().Configure(cfg, args); + + if (install) + IgniteService.DoInstall(cfg); + else + { + Ignition.Start(cfg); + + IgniteManager.DestroyJvm(); + } + + return; + } + } + catch (Exception e) + { + Console.WriteLine("ERROR: " + e.Message); + + Environment.Exit(-1); + } + + // If we are here, then this is a service call. + cfg = new IgniteConfiguration(); + + // Use only arguments, not app.config. + new ArgsConfigurator().Configure(cfg, args); + + ServiceBase.Run(new IgniteService(cfg)); + } + + /// <summary> + /// Prints help. + /// </summary> + private static void PrintHelp() + { + Console.WriteLine("Usage: Apache.Ignite.exe [/install] [/uninstall] [-options]"); + Console.WriteLine(""); + Console.WriteLine("\t/install [-options] installs Ignite Windows service with provided options"); + Console.WriteLine("\t/uninstall uninstalls Ignite Windows service"); + Console.WriteLine(""); + Console.WriteLine("Options:"); + Console.WriteLine("\t-IgniteHome path to Ignite installation directory (if not provided IGNITE_HOME environment variable is used)"); + Console.WriteLine("\t-springConfigUrl path to spring configuration file (if not provided \"config/default-config.xml\" is used)"); + Console.WriteLine("\t-jvmDllPath path to JVM library jvm.dll (if not provided JAVA_HOME environment variable is used)"); + Console.WriteLine("\t-jvmClasspath classpath passed to JVM (enlist additional jar files here)"); + Console.WriteLine("\t-suppressWarnings wether to print warnings"); + Console.WriteLine("\t-J<javaOption> JVM options passed to created JVM"); + Console.WriteLine("\t-assembly=userLib.dll additional .Net assemblies"); + Console.WriteLine("\t-jvmInitialMemoryMB Initial Java heap size, in megabytes. Maps to -Xms Java parameter. Defaults to 512."); + Console.WriteLine("\t-jvmMaxMemoryMB Maximum Java heap size, in megabytes. Maps to -Xmx Java parameter. Defaults to 1024."); + Console.WriteLine(""); + Console.WriteLine("Examples:"); + Console.WriteLine("\tApache.Ignite.exe -J-Xms1024m -J-Xmx1024m -springConfigUrl=C:/woer/gg-test/my-test-gg-confignative.xml"); + Console.WriteLine("\tApache.Ignite.exe -IgniteHome=c:/apache-ignite -jvmClasspath=libs/myLib1.jar;libs/myLib2.jar"); + Console.WriteLine("\tApache.Ignite.exe -assembly=c:/myProject/libs/lib1.dll -assembly=c:/myProject/libs/lib2.dll"); + Console.WriteLine("\tApache.Ignite.exe -jvmInitialMemoryMB=1024 -jvmMaxMemoryMB=4096"); + Console.WriteLine(""); + Console.WriteLine("Note:"); + Console.WriteLine("Command line settings have priority over Apache.Ignite.exe.config settings. JVM options and assemblies are concatenated; data from config file comes first, then data from command line."); + } + + /// <summary> + /// Remove the first argument. + /// </summary> + /// <param name="args">Arguments.</param> + /// <returns>New arguments.</returns> + private static string[] RemoveFirstArg(string[] args) + { + return args.Skip(1).ToArray(); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..03f7fb9 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +/* + * 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. + */ + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Apache.Ignite")] +[assembly: AssemblyDescription("Apache Ignite .NET Executable")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Apache Ignite")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("0f9702ec-da7d-4ce5-b4b7-73310c885355")] + +[assembly: AssemblyVersion("1.5.0")] +[assembly: AssemblyFileVersion("1.5.0")] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs new file mode 100644 index 0000000..a818171 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs @@ -0,0 +1,219 @@ +/* + * 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.Service +{ + using System; + using System.ComponentModel; + using System.IO; + using System.Linq; + using System.Reflection; + using System.Runtime.InteropServices; + using System.ServiceProcess; + using System.Text; + using Apache.Ignite.Config; + using Apache.Ignite.Core; + using Apache.Ignite.Core.Common; + + /// <summary> + /// Ignite windows service. + /// </summary> + internal class IgniteService : ServiceBase + { + /** Service name. */ + internal static readonly string SvcName = "Apache Ignite"; + + /** Service display name. */ + internal static readonly string SvcDisplayName = "Apache Ignite .NET " + + Assembly.GetExecutingAssembly().GetName().Version.ToString(4); + + /** Service description. */ + internal static readonly string SvcDesc = "Apache Ignite .Net Service."; + + /** Current executable name. */ + internal static readonly string ExeName = + new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).FullName; + + /** Current executable fully qualified name. */ + internal static readonly string FullExeName = Path.GetFileName(FullExeName); + + /** Ignite configuration to start with. */ + private readonly IgniteConfiguration _cfg; + + /// <summary> + /// Constructor. + /// </summary> + public IgniteService(IgniteConfiguration cfg) + { + AutoLog = true; + CanStop = true; + ServiceName = SvcName; + + _cfg = cfg; + } + + /** <inheritDoc /> */ + protected override void OnStart(string[] args) + { + Ignition.Start(_cfg); + } + + /** <inheritDoc /> */ + protected override void OnStop() + { + Ignition.StopAll(true); + } + + /// <summary> + /// Install service programmatically. + /// </summary> + /// <param name="cfg">Ignite configuration.</param> + internal static void DoInstall(IgniteConfiguration cfg) + { + // 1. Check if already defined. + if (ServiceController.GetServices().Any(svc => SvcName.Equals(svc.ServiceName))) + { + throw new IgniteException("Ignite service is already installed (uninstall it using \"" + + ExeName + " " + IgniteRunner.SvcUninstall + "\" first)"); + } + + // 2. Create startup arguments. + var args = ArgsConfigurator.ToArgs(cfg); + + if (args.Length > 0) + { + Console.WriteLine("Installing \"" + SvcName + "\" service with the following startup " + + "arguments:"); + + foreach (var arg in args) + Console.WriteLine("\t" + arg); + } + else + Console.WriteLine("Installing \"" + SvcName + "\" service ..."); + + // 3. Actual installation. + Install0(args); + + Console.WriteLine("\"" + SvcName + "\" service installed successfully."); + } + + /// <summary> + /// Uninstall service programmatically. + /// </summary> + internal static void Uninstall() + { + var svc = ServiceController.GetServices().FirstOrDefault(x => SvcName == x.ServiceName); + + if (svc == null) + { + Console.WriteLine("\"" + SvcName + "\" service is not installed."); + } + else if (svc.Status != ServiceControllerStatus.Stopped) + { + throw new IgniteException("Ignite service is running, please stop it first."); + } + else + { + Console.WriteLine("Uninstalling \"" + SvcName + "\" service ..."); + + Uninstall0(); + + Console.WriteLine("\"" + SvcName + "\" service uninstalled successfully."); + } + } + + /// <summary> + /// Native service installation. + /// </summary> + /// <param name="args">Arguments.</param> + private static void Install0(string[] args) + { + // 1. Prepare arguments. + var binPath = new StringBuilder(FullExeName).Append(" ").Append(IgniteRunner.Svc); + + foreach (var arg in args) + binPath.Append(" ").Append(arg); + + // 2. Get SC manager. + var scMgr = OpenServiceControlManager(); + + // 3. Create service. + var svc = NativeMethods.CreateService( + scMgr, + SvcName, + SvcDisplayName, + 983551, // Access constant. + 0x10, // Service type SERVICE_WIN32_OWN_PROCESS. + 0x2, // Start type SERVICE_AUTO_START. + 0x2, // Error control SERVICE_ERROR_SEVERE. + binPath.ToString(), + null, + IntPtr.Zero, + null, + null, // Use priviliged LocalSystem account. + null + ); + + if (svc == IntPtr.Zero) + throw new IgniteException("Failed to create the service.", new Win32Exception()); + + // 4. Set description. + var desc = new ServiceDescription {desc = Marshal.StringToHGlobalUni(SvcDesc)}; + + + try + { + if (!NativeMethods.ChangeServiceConfig2(svc, 1u, ref desc)) + throw new IgniteException("Failed to set service description.", new Win32Exception()); + } + finally + { + Marshal.FreeHGlobal(desc.desc); + } + } + + /// <summary> + /// Native service uninstallation. + /// </summary> + private static void Uninstall0() + { + var scMgr = OpenServiceControlManager(); + + var svc = NativeMethods.OpenService(scMgr, SvcName, 65536); + + if (svc == IntPtr.Zero) + throw new IgniteException("Failed to uninstall the service.", new Win32Exception()); + + NativeMethods.DeleteService(svc); + } + + /// <summary> + /// Opens SC manager. + /// </summary> + /// <returns>SC manager pointer.</returns> + private static IntPtr OpenServiceControlManager() + { + var ptr = NativeMethods.OpenSCManager(null, null, 983103); + + if (ptr == IntPtr.Zero) + throw new IgniteException("Failed to initialize Service Control manager " + + "(did you run the command as administrator?)", new Win32Exception()); + + return ptr; + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs new file mode 100644 index 0000000..56ab15d --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs @@ -0,0 +1,57 @@ +/* + * 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.Service +{ + using System; + using System.Runtime.InteropServices; + + /// <summary> + /// Native methods. + /// </summary> + internal class NativeMethods + { + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern IntPtr OpenSCManager(string machineName, string dbName, int access); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern IntPtr CreateService( + IntPtr db, + string svcName, + string displayName, + int access, + int svcType, + int startType, + int errControl, + string binPath, + string loadOrderGrp, + IntPtr pTagId, + string dependencies, + string servicesStartName, + string pwd + ); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern IntPtr OpenService(IntPtr db, string svcName, int access); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool DeleteService(IntPtr svc); + + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool ChangeServiceConfig2(IntPtr svc, uint infoLevel, ref ServiceDescription desc); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs new file mode 100644 index 0000000..a81a737 --- /dev/null +++ b/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs @@ -0,0 +1,32 @@ +/* + * 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.Service +{ + using System; + using System.Runtime.InteropServices; + + /// <summary> + /// Service description structure. + /// </summary> + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct ServiceDescription + { + /** Pointer to description. */ + public IntPtr desc; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj index 62440a1..226f95f 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj @@ -190,9 +190,6 @@ <Content Include="Config\native-client-test-cache-parallel-store.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> - <Content Include="Config\native-client-test-cache-portables.xml"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </Content> <Content Include="Config\native-client-test-cache-store.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> @@ -213,7 +210,7 @@ </Content> </ItemGroup> <ItemGroup> - <Content Include="Config\Ignite.exe.config.test"> + <Content Include="Config\Apache.Ignite.exe.config.test"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs index 04aff5f..2f3e0d0 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs @@ -24,7 +24,6 @@ namespace Apache.Ignite.Core.Tests.Cache /// <summary> /// Tests cache with a standalone process. /// </summary> - [Ignore("IGNITE-1367")] public class CacheForkedTest { /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs index 4b303ce..4ce917b 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs @@ -17,12 +17,9 @@ namespace Apache.Ignite.Core.Tests.Compute.Forked { - using NUnit.Framework; - /// <summary> /// Forked closure execution tests for portable objects. /// </summary> - [Ignore("IGNITE-1367")] public class ForkedPortableClosureTaskTest : PortableClosureTaskTest { /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs index 00fd28a..84c1ba2 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs @@ -22,7 +22,7 @@ namespace Apache.Ignite.Core.Tests.Compute.Forked /// <summary> /// Forked resource task test. /// </summary> - [Ignore("IGNITE-1367")] + [Ignore("IGNITE-1381")] public class ForkedResourceTaskTest : ResourceTaskTest { /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs index edc18f2..0324125 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs @@ -22,7 +22,7 @@ namespace Apache.Ignite.Core.Tests.Compute.Forked /// <summary> /// Forked closure execution tests for serializable objects. /// </summary> - [Ignore("IGNITE-1367")] + [Ignore("IGNITE-1381")] public class ForkedSerializableClosureTaskTest : SerializableClosureTaskTest { /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs index e7bad17..a4cf182 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs @@ -17,12 +17,9 @@ namespace Apache.Ignite.Core.Tests.Compute.Forked { - using NUnit.Framework; - /// <summary> /// Forked task adapter test. /// </summary> - [Ignore("IGNITE-1367")] public class ForkedTaskAdapterTest : TaskAdapterTest { /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test new file mode 100644 index 0000000..2bda365 --- /dev/null +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + 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. +--> + +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + </startup> + + <runtime> + <gcServer enabled="true" /> + </runtime> + + <appSettings> + <add key="Ignite.SpringConfigUrl" value="config\compute\compute-standalone.xml" /> + <add key="Ignite.Assembly.1" value="test-1.dll" /> + <add key="Ignite.Assembly.2" value="test-2.dll" /> + <add key="Ignite.JvmOption.1" value="-DOPT1" /> + <add key="Ignite.JvmOption.2" value="-DOPT2" /> + <add key="Ignite.JvmOption.3" value="-Xms601m" /> + <add key="Ignite.JvmOption.4" value="-Xmx702m" /> + <add key="Ignite.JvmInitialMemoryMB" value="601" /> + <add key="Ignite.JvmMaxMemoryMB" value="702" /> + </appSettings> + +</configuration> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Ignite.exe.config.test ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Ignite.exe.config.test b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Ignite.exe.config.test deleted file mode 100644 index 305fbd5..0000000 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Ignite.exe.config.test +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - 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. ---> - -<configuration> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> - </startup> - - <runtime> - <gcServer enabled="true" /> - </runtime> - - <appSettings> - <add key="GridGain.SpringConfigUrl" value="config\compute\compute-standalone.xml" /> - <add key="GridGain.Assembly.1" value="test-1.dll" /> - <add key="GridGain.Assembly.2" value="test-2.dll" /> - <add key="GridGain.JvmOption.1" value="-DOPT1" /> - <add key="GridGain.JvmOption.2" value="-DOPT2" /> - <add key="GridGain.JvmOption.3" value="-Xms601m" /> - <add key="GridGain.JvmOption.4" value="-Xmx702m" /> - <add key="GridGain.JvmInitialMemoryMB" value="601" /> - <add key="GridGain.JvmMaxMemoryMB" value="702" /> - </appSettings> - -</configuration> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-portables.xml ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-portables.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-portables.xml deleted file mode 100644 index 1d90c99..0000000 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-portables.xml +++ /dev/null @@ -1,226 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - 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. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - 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"> - <property name="localHost" value="127.0.0.1"/> - - <property name="marshaller"> - <bean class="org.gridgain.grid.marshaller.optimized.GridOptimizedMarshaller"> - <property name="requireSerializable" value="false"/> - </bean> - </property> - - <property name="includeEventTypes"> - <util:constant static-field="org.apache.ignite.events.IgniteEventType.EVTS_CACHE"/> - </property> - - <property name="portableConfiguration"> - <bean class="org.gridgain.grid.configuration.PortableConfiguration"> - <property name="typeConfigurations"> - <list> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.client.GridClientTestPortable"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.client.model.PortablePerson"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.client.model.ImplicitPortablePerson"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="NoDefPortablePerson"/> - </bean> - </list> - </property> - </bean> - </property> - - <property name="cacheConfiguration"> - <list> - <bean parent="cache-template"> - <property name="name" value="local"/> - <property name="cacheMode" value="LOCAL"/> - <property name="atomicityMode" value="TRANSACTIONAL"/> - </bean> - - <bean parent="cache-template"> - <property name="name" value="local_atomic"/> - <property name="cacheMode" value="LOCAL"/> - <property name="atomicityMode" value="ATOMIC"/> - </bean> - - <bean parent="cache-template"> - <property name="name" value="partitioned"/> - <property name="cacheMode" value="PARTITIONED"/> - <property name="atomicityMode" value="TRANSACTIONAL"/> - </bean> - - <bean parent="cache-template"> - <property name="name" value="partitioned_atomic"/> - <property name="cacheMode" value="PARTITIONED"/> - <property name="atomicityMode" value="ATOMIC"/> - <property name="atomicWriteOrderMode" value="PRIMARY"/> - </bean> - - <bean parent="cache-template"> - <property name="name" value="partitioned_near"/> - <property name="cacheMode" value="PARTITIONED"/> - <property name="atomicityMode" value="TRANSACTIONAL"/> - <property name="nearConfiguration"> - <bean class="org.apache.ignite.configuration.NearCacheConfiguration" /> - </property> - </bean> - - <bean parent="cache-template"> - <property name="name" value="partitioned_atomic_near"/> - <property name="cacheMode" value="PARTITIONED"/> - <property name="atomicityMode" value="ATOMIC"/> - <property name="atomicWriteOrderMode" value="PRIMARY"/> - <property name="nearConfiguration"> - <bean class="org.apache.ignite.configuration.NearCacheConfiguration" /> - </property> - </bean> - - <bean parent="cache-template"> - <property name="name" value="replicated"/> - <property name="cacheMode" value="REPLICATED"/> - <property name="atomicityMode" value="TRANSACTIONAL"/> - </bean> - - <bean parent="cache-template"> - <property name="name" value="replicated_atomic"/> - <property name="cacheMode" value="REPLICATED"/> - <property name="atomicityMode" value="ATOMIC"/> - <property name="atomicWriteOrderMode" value="PRIMARY"/> - </bean> - </list> - </property> - - <property name="swapSpaceSpi"> - <bean class="org.gridgain.grid.spi.swapspace.inmemory.GridTestSwapSpaceSpi"/> - </property> - - <property name="indexingSpi"> - <list> - <bean class="org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi"> - </bean> - </list> - </property> - - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <!-- In distributed environment, replace with actual host IP address. --> - <value>127.0.0.1:47500..47501</value> - </list> - </property> - </bean> - </property> - </bean> - </property> - - <property name="platformConfiguration"> - <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration"> - <property name="portableConfiguration"> - <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration"> - <property name="types"> - <util:list value-type="java.lang.String"> - - </util:list> - </property> - </bean> - </property> - </bean> - </property> - </bean> - - <bean id="cache-template" abstract="true" class="org.apache.ignite.cache.CacheConfiguration"> - <property name="rebalanceMode" value="SYNC"/> - <property name="writeSynchronizationMode" value="FULL_SYNC"/> - <property name="swapEnabled" value="true"/> - <property name="portableEnabled" value="true"/> - <property name="txSerializableEnabled" value="true"/> - <property name="backups" value="1"/> - - <property name="store"> - <bean class="org.gridgain.grid.internal.processors.cache.GridCacheGenericTestStore"/> - </property> - - <property name="typeMetadata"> - <list> - <bean class="org.apache.ignite.cache.CacheTypeMetadata"> - <property name="valueType" value="PortablePerson"/> - <property name="ascendingFields"> - <map> - <entry key="age" value="java.lang.Integer"/> - </map> - </property> - <property name="queryFields"> - <map> - <entry key="name" value="java.lang.String"/> - </map> - </property> - <property name="textFields"> - <list> - <value>address</value> - </list> - </property> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeMetadata"> - <property name="valueType" value="ImplicitPortablePerson"/> - <property name="ascendingFields"> - <map> - <entry key="age" value="java.lang.Integer"/> - </map> - </property> - <property name="queryFields"> - <map> - <entry key="name" value="java.lang.String"/> - </map> - </property> - </bean> - <bean class="org.apache.ignite.cache.CacheTypeMetadata"> - <property name="valueType" value="NoDefPortablePerson"/> - <property name="ascendingFields"> - <map> - <entry key="age" value="java.lang.Integer"/> - </map> - </property> - <property name="queryFields"> - <map> - <entry key="name" value="java.lang.String"/> - </map> - </property> - </bean> - </list> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml index 5d65ae8..c48e867 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml @@ -29,27 +29,6 @@ <property name="localHost" value="127.0.0.1"/> <property name="connectorConfiguration"><null/></property> - <property name="marshaller"> - <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"> - <property name="typeConfigurations"> - <list> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.client.ClientTestPortable"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.internal.client.model.PortablePerson"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="org.gridgain.internal.client.model.ImplicitPortablePerson"/> - </bean> - <bean class="org.apache.ignite.portable.PortableTypeConfiguration"> - <property name="className" value="NoDefPortablePerson"/> - </bean> - </list> - </property> - </bean> - </property> - <property name="includeEventTypes"> <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/> </property> @@ -132,15 +111,6 @@ <bean class="org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi"/> </property> - <!-- TODO: --> - <!--<property name="indexingSpi"> - <list> - <bean class="org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi"> - <property name="defaultIndexFixedTyping" value="false"/> - </bean> - </list> - </property>--> - <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="ipFinder"> http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs index 9c47cbc..e4530cb 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/ExecutableTest.cs @@ -33,7 +33,6 @@ namespace Apache.Ignite.Core.Tests /// <summary> /// Tests for executable. /// </summary> - [Ignore("IGNITE-1367")] public class ExecutableTest { /** Spring configuration path. */ @@ -98,18 +97,18 @@ namespace Apache.Ignite.Core.Tests [Test] public void TestConfig() { - IgniteProcess.ReplaceConfiguration("config\\Ignite.exe.config.test"); + IgniteProcess.ReplaceConfiguration("config\\Apache.Ignite.exe.config.test"); GenerateDll("test-1.dll"); GenerateDll("test-2.dll"); - IgniteProcess proc = new IgniteProcess( + var proc = new IgniteProcess( "-jvmClasspath=" + TestUtils.CreateTestClasspath() ); Assert.IsTrue(_grid.WaitTopology(2, 30000)); - RemoteConfiguration cfg = RemoteConfig(); + var cfg = RemoteConfig(); Assert.AreEqual(SpringCfgPath, cfg.SpringConfigUrl); Assert.IsTrue(cfg.JvmOptions.Contains("-DOPT1") && cfg.JvmOptions.Contains("-DOPT2")); @@ -127,7 +126,7 @@ namespace Apache.Ignite.Core.Tests GenerateDll("test-1.dll"); GenerateDll("test-2.dll"); - IgniteProcess proc = new IgniteProcess( + var proc = new IgniteProcess( "-jvmClasspath=" + TestUtils.CreateTestClasspath(), "-springConfigUrl=" + SpringCfgPath, "-assembly=test-1.dll", @@ -136,7 +135,7 @@ namespace Apache.Ignite.Core.Tests Assert.IsTrue(_grid.WaitTopology(2, 30000)); - RemoteConfiguration cfg = RemoteConfig(); + var cfg = RemoteConfig(); Assert.IsTrue(cfg.Assemblies.Contains("test-1.dll") && cfg.Assemblies.Contains("test-2.dll")); } @@ -147,7 +146,7 @@ namespace Apache.Ignite.Core.Tests [Test] public void TestJvmOptsCmd() { - IgniteProcess proc = new IgniteProcess( + var proc = new IgniteProcess( "-jvmClasspath=" + TestUtils.CreateTestClasspath(), "-springConfigUrl=" + SpringCfgPath, "-J-DOPT1", @@ -156,7 +155,7 @@ namespace Apache.Ignite.Core.Tests Assert.IsTrue(_grid.WaitTopology(2, 30000)); - RemoteConfiguration cfg = RemoteConfig(); + var cfg = RemoteConfig(); Assert.IsTrue(cfg.JvmOptions.Contains("-DOPT1") && cfg.JvmOptions.Contains("-DOPT2")); } @@ -211,7 +210,7 @@ namespace Apache.Ignite.Core.Tests [Test] public void TestJvmMemoryOptsAppConfig() { - IgniteProcess.ReplaceConfiguration("config\\Ignite.exe.config.test"); + IgniteProcess.ReplaceConfiguration("config\\Apache.Ignite.exe.config.test"); GenerateDll("test-1.dll"); GenerateDll("test-2.dll"); @@ -285,10 +284,10 @@ namespace Apache.Ignite.Core.Tests /// <returns>Node configuration.</returns> private static IgniteConfiguration Configuration(string path) { - IgniteConfiguration cfg = new IgniteConfiguration(); + var cfg = new IgniteConfiguration(); - PortableConfiguration portCfg = new PortableConfiguration(); + var portCfg = new PortableConfiguration(); ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>(); @@ -307,7 +306,7 @@ namespace Apache.Ignite.Core.Tests "-Xcheck:jni", "-Xms4g", "-Xmx4g", - "-DGRIDGAIN_QUIET=false", + "-DIGNITE_QUIET=false", "-Xnoagent", "-Djava.compiler=NONE", "-Xdebug", @@ -326,21 +325,21 @@ namespace Apache.Ignite.Core.Tests /// <param name="outputPath"></param> private static void GenerateDll(string outputPath) { - CSharpCodeProvider codeProvider = new CSharpCodeProvider(); + var codeProvider = new CSharpCodeProvider(); #pragma warning disable 0618 - ICodeCompiler icc = codeProvider.CreateCompiler(); + var icc = codeProvider.CreateCompiler(); #pragma warning restore 0618 - CompilerParameters parameters = new CompilerParameters(); + var parameters = new CompilerParameters(); parameters.GenerateExecutable = false; parameters.OutputAssembly = outputPath; - string src = "namespace GridGain.Client.Test { public class Foo {}}"; + var src = "namespace Apache.Ignite.Client.Test { public class Foo {}}"; - CompilerResults results = icc.CompileAssemblyFromSource(parameters, src); + var results = icc.CompileAssemblyFromSource(parameters, src); Assert.False(results.Errors.HasErrors); } @@ -372,11 +371,11 @@ namespace Apache.Ignite.Core.Tests public RemoteConfiguration Invoke() { - Ignite grid0 = (Ignite) ((IgniteProxy) _grid).Target; + var grid0 = (Ignite) ((IgniteProxy) _grid).Target; - IgniteConfiguration cfg = grid0.Configuration; + var cfg = grid0.Configuration; - RemoteConfiguration res = new RemoteConfiguration + var res = new RemoteConfiguration { IgniteHome = cfg.IgniteHome, SpringConfigUrl = cfg.SpringConfigUrl, http://git-wip-us.apache.org/repos/asf/ignite/blob/c2d19b17/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs ---------------------------------------------------------------------- diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs index d2b2efa..ec7e157 100644 --- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs +++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs @@ -186,34 +186,6 @@ namespace Apache.Ignite.Core.Tests } } - /* - [Test] - public void TestStartInvalidJvmOptions() - { - GridGain.Impl.IgniteManager.DestroyJvm(); - - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.NativeXmlConfig = "config\\start-test-grid1.xml"; - cfg.NativeJvmOptions = new List<string> { "invalid_option"}; - - try - { - Ignition.Start(cfg); - - Assert.Fail("Start should fail."); - } - catch (IgniteException e) - { - Console.WriteLine("Expected exception: " + e); - } - - cfg.NativeJvmOptions = new List<string> { "-Xmx1g", "-Xms1g" }; - - Ignition.Start(cfg); - } - */ - /// <summary> /// /// </summary>
