IGNITE-2977: Fixed .NET compilation and tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73152db7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73152db7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73152db7 Branch: refs/heads/ignite-testing-discovery Commit: 73152db78bb439968d0dc909cbfcd9c534dadc01 Parents: e050ac0 Author: vozerov-gridgain <[email protected]> Authored: Thu Apr 14 09:47:01 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Thu Apr 14 09:47:01 2016 +0300 ---------------------------------------------------------------------- .../platform/PlatformStartIgniteTask.java | 78 ++++++++++++++++++++ .../ignite/platform/PlatformStopIgniteTask.java | 75 +++++++++++++++++++ .../Apache.Ignite.Core.Tests.csproj | 2 + .../Continuous/ContinuousQueryJavaFilterTest.cs | 22 ++++-- .../Config/Compute/compute-grid1.xml | 4 +- .../Config/Compute/compute-grid2.xml | 4 +- 6 files changed, 178 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/modules/core/src/test/java/org/apache/ignite/platform/PlatformStartIgniteTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformStartIgniteTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStartIgniteTask.java new file mode 100644 index 0000000..e703431 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStartIgniteTask.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + +package org.apache.ignite.platform; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteException; +import org.apache.ignite.Ignition; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.compute.ComputeJob; +import org.apache.ignite.compute.ComputeJobAdapter; +import org.apache.ignite.compute.ComputeJobResult; +import org.apache.ignite.compute.ComputeTaskAdapter; +import org.apache.ignite.internal.util.typedef.F; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Task to start an Ignite node. + */ +public class PlatformStartIgniteTask extends ComputeTaskAdapter<String, String> { + /** {@inheritDoc} */ + @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, + @Nullable String arg) throws IgniteException { + return Collections.singletonMap(new PlatformStartIgniteJob(arg), F.first(subgrid)); + } + + /** {@inheritDoc} */ + @Nullable @Override public String reduce(List<ComputeJobResult> results) throws IgniteException { + ComputeJobResult res = results.get(0); + + if (res.getException() != null) + throw res.getException(); + else + return results.get(0).getData(); + } + + /** + * Job. + */ + private static class PlatformStartIgniteJob extends ComputeJobAdapter { + /** */ + private final String springConfig; + + /** + * Ctor. + * + * @param springConfig Config. + */ + private PlatformStartIgniteJob(String springConfig) { + this.springConfig = springConfig; + } + + /** {@inheritDoc} */ + @Override public Object execute() throws IgniteException { + Ignite ignite = Ignition.start(springConfig); + + return ignite.name(); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java new file mode 100644 index 0000000..238f058 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformStopIgniteTask.java @@ -0,0 +1,75 @@ +/* + * 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. + */ + +package org.apache.ignite.platform; + +import org.apache.ignite.IgniteException; +import org.apache.ignite.Ignition; +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.compute.ComputeJob; +import org.apache.ignite.compute.ComputeJobAdapter; +import org.apache.ignite.compute.ComputeJobResult; +import org.apache.ignite.compute.ComputeTaskAdapter; +import org.apache.ignite.internal.util.typedef.F; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Task to stop an Ignite node. + */ +public class PlatformStopIgniteTask extends ComputeTaskAdapter<String, Boolean> { + /** {@inheritDoc} */ + @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, + @Nullable String arg) throws IgniteException { + return Collections.singletonMap(new PlatformStopIgniteJob(arg), F.first(subgrid)); + } + + /** {@inheritDoc} */ + @Nullable @Override public Boolean reduce(List<ComputeJobResult> results) throws IgniteException { + ComputeJobResult res = results.get(0); + + if (res.getException() != null) + throw res.getException(); + else + return results.get(0).getData(); + } + + /** + * Job. + */ + private static class PlatformStopIgniteJob extends ComputeJobAdapter { + /** */ + private final String gridName; + + /** + * Ctor. + * + * @param gridName Name. + */ + private PlatformStopIgniteJob(String gridName) { + this.gridName = gridName; + } + + /** {@inheritDoc} */ + @Override public Object execute() throws IgniteException { + return Ignition.stop(gridName, true); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/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 26b4352..497a869 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 @@ -180,9 +180,11 @@ </Content> <Content Include="Config\Compute\compute-grid1.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> + <SubType>Designer</SubType> </Content> <Content Include="Config\Compute\compute-grid2.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> + <SubType>Designer</SubType> </Content> <Content Include="Config\Compute\compute-grid3.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs index fa73621..edd7026 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryJavaFilterTest.cs @@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous using Apache.Ignite.Core.Cache.Event; using Apache.Ignite.Core.Cache.Query.Continuous; using Apache.Ignite.Core.Common; + using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Interop; using NUnit.Framework; @@ -63,24 +64,35 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous public void FixtureSetUp() { // Main .NET nodes - _ignite = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) + IList<String> jvmOpts = TestUtils.TestJavaOptions(); + + _ignite = Ignition.Start(new IgniteConfiguration { + JvmClasspath = TestUtils.CreateTestClasspath(), + JvmOptions = jvmOpts, SpringConfigUrl = SpringConfig, - BinaryConfiguration = new BinaryConfiguration(typeof (TestBinary)) + BinaryConfiguration = new BinaryConfiguration + { + TypeConfigurations = new List<BinaryTypeConfiguration> + { + new BinaryTypeConfiguration(typeof(TestBinary)) + } + } }); // Second .NET node - Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration()) + Ignition.Start(new IgniteConfigurationEx { + JvmClasspath = TestUtils.CreateTestClasspath(), + JvmOptions = jvmOpts, SpringConfigUrl = SpringConfig2, GridName = "dotNet2" }); - // Java-only node _javaNodeName = _ignite.GetCompute().ExecuteJavaTask<string>(StartTask, SpringConfig2); - Assert.IsTrue(_ignite.WaitTopology(3)); + Assert.IsTrue(_ignite.WaitTopology(3, 5000)); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml index 3061773..76ada53 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml @@ -69,7 +69,9 @@ </bean> </list> </property> - + <property name="idMapper"> + <bean class="org.apache.ignite.binary.BinaryBasicIdMapper" /> + </property> </bean> </property> http://git-wip-us.apache.org/repos/asf/ignite/blob/73152db7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml index ef29a89..87cf561 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml @@ -62,7 +62,9 @@ </bean> </list> </property> - + <property name="idMapper"> + <bean class="org.apache.ignite.binary.BinaryBasicIdMapper" /> + </property> </bean> </property>
