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/12/16 13:26:12 UTC
[09/16] ignite git commit: IGNITE-1994: Removed .Net:
CrossPlatformExample.
IGNITE-1994: Removed .Net: CrossPlatformExample.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1acbce1e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1acbce1e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1acbce1e
Branch: refs/heads/ignite-2100
Commit: 1acbce1e7a59ae9e7436e083ab919df618e57c1a
Parents: ec3fd19
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Dec 16 11:16:55 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Dec 16 11:16:55 2015 +0300
----------------------------------------------------------------------
.../Examples/ExamplesTest.cs | 4 +-
.../Apache.Ignite.Examples.csproj | 1 -
.../Datagrid/CrossPlatformExample.cs | 205 -------------------
3 files changed, 2 insertions(+), 208 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1acbce1e/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 bcf6baa..4e8a036 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
@@ -68,10 +68,10 @@ namespace Apache.Ignite.Core.Tests.Examples
/// <param name="clientMode">Client mode flag.</param>
private static void TestRemoteNodes(Example example, bool clientMode)
{
- // Exclude CrossPlatformExample and LifecycleExample
+ // Exclude LifecycleExample
if (string.IsNullOrEmpty(example.SpringConfigUrl))
{
- Assert.IsTrue(new[] {"CrossPlatformExample", "LifecycleExample"}.Contains(example.Name));
+ Assert.AreEqual("LifecycleExample", example.Name);
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1acbce1e/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
index 2f4ce18..abe4b14 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
@@ -57,7 +57,6 @@
<Compile Include="Compute\ClosureExample.cs" />
<Compile Include="Compute\TaskExample.cs" />
<Compile Include="Datagrid\ContinuousQueryExample.cs" />
- <Compile Include="Datagrid\CrossPlatformExample.cs" />
<Compile Include="Datagrid\DataStreamerExample.cs" />
<Compile Include="Datagrid\PutGetExample.cs" />
<Compile Include="Datagrid\QueryExample.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/1acbce1e/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
deleted file mode 100644
index 5c07204..0000000
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Binary;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- using Apache.Ignite.ExamplesDll.Binary;
-
- /// <summary>
- /// This example demonstrates use of binary objects between different platforms.
- /// <para/>
- /// This example must be run with standalone Java node. To achieve this start a node from %IGNITE_HOME%
- /// using "ignite.bat" with proper configuration:
- /// <example>'bin\ignite.bat examples\config\example-server.xml'</example>.
- /// <para />
- /// Once remote node is started, launch this example as follows:
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build);
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start application (F5 or Ctrl+F5).
- /// <para />
- /// To see how objects can be transferred between platforms, start cross-platform Java example
- /// without restarting remote node.
- /// </summary>
- public class CrossPlatformExample
- {
- /// <summary>Key for Java object.</summary>
- private const int KeyJava = 100;
-
- /// <summary>Key for .Net object.</summary>
- private const int KeyDotnet = 200;
-
- /// <summary>Key for C++ object.</summary>
- private const int KeyCpp = 300;
-
- /// <summary>Cache Name.</summary>
- private const string CacheName = "cacheCrossPlatform";
-
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cross-platform example started.");
-
- if (ignite.GetCluster().ForRemotes().GetNodes().Count == 0)
- {
- Console.WriteLine();
- Console.WriteLine(">>> This example requires remote nodes to be started.");
- Console.WriteLine(">>> Please start at least 1 remote node.");
- Console.WriteLine(">>> Refer to example's documentation for details on configuration.");
- Console.WriteLine();
- }
- else
- {
- var cache = ignite.GetOrCreateCache<int, Organization>(CacheName);
-
- // Create new Organization object to store in cache.
- Organization org = new Organization(
- "Apache",
- new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
- OrganizationType.Private,
- DateTime.Now
- );
-
- // Put created data entry to cache.
- cache.Put(KeyDotnet, org);
-
- // Retrieve value stored by Java client.
- GetFromJava(ignite);
-
- // Retrieve value stored by C++ client.
- GetFromCpp(ignite);
-
- // Gets binary value from cache in binary format, without de-serializing it.
- GetDotNetBinaryInstance(ignite);
-
- // Gets binary value form cache as a strongly-typed fully de-serialized instance.
- GetDotNetTypedInstance(ignite);
-
- Console.WriteLine();
- }
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Gets entry put by Java client. In order for entry to be in cache, Java client example
- /// must be run before this example.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetFromJava(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName)
- .WithKeepBinary<int, IBinaryObject>();
-
- var orgBinary = cache.GetAsync(KeyJava).Result;
-
- if (orgBinary == null)
- {
- Console.WriteLine(">>> Java client hasn't put entry to cache. Run Java example before this example " +
- "to see the output.");
- }
- else
- {
- Console.WriteLine(">>> Entry from Java client:");
- Console.WriteLine(">>> Binary: " + orgBinary);
- Console.WriteLine(">>> Deserialized: " + orgBinary.Deserialize<Organization>());
- }
- }
-
- /// <summary>
- /// Gets entry put by C++ client. In order for entry to be in cache, C++ client example
- /// must be run before this example.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetFromCpp(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName)
- .WithKeepBinary<int, IBinaryObject>();
-
- var orgBinary = cache.GetAsync(KeyCpp).Result;
-
- Console.WriteLine();
-
- if (orgBinary == null)
- {
- Console.WriteLine(">>> CPP client hasn't put entry to cache. Run CPP example before this example " +
- "to see the output.");
- }
- else
- {
- Console.WriteLine(">>> Entry from CPP client:");
- Console.WriteLine(">>> Binary: " + orgBinary);
- Console.WriteLine(">>> Deserialized: " + orgBinary.Deserialize<Organization>());
- }
- }
-
- /// <summary>
- /// Gets binary value from cache in binary format, without de-serializing it.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetDotNetBinaryInstance(IIgnite ignite)
- {
- // Apply "KeepBinary" flag on data projection.
- var cache = ignite.GetOrCreateCache<int, IBinaryObject>(CacheName)
- .WithKeepBinary<int, IBinaryObject>();
-
- var org = cache.Get(KeyDotnet);
-
- string name = org.GetField<string>("name");
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization name from binary field: " + name);
- }
-
- /// <summary>
- /// Gets binary value form cache as a strongly-typed fully de-serialized instance.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetDotNetTypedInstance(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, Organization>(CacheName);
-
- // Get recently created employee as a strongly-typed fully de-serialized instance.
- Organization emp = cache.Get(KeyDotnet);
-
- string name = emp.Name;
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization name from deserialized Organization instance: " + name);
- }
- }
-}