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 2017/07/11 09:03:41 UTC
[43/49] ignite git commit: IGNITE-2492 .NET: Peer assembly loading -
add TestCacheGetOnRemoteNode
IGNITE-2492 .NET: Peer assembly loading - add TestCacheGetOnRemoteNode
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ac39082
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ac39082
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ac39082
Branch: refs/heads/ignite-2.1
Commit: 2ac39082c6aa660085ea94df121166920821b427
Parents: 92becc8
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Jul 10 17:05:08 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Jul 10 17:05:08 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Deployment/CacheGetFunc.cs | 50 ++++++++++++++++++++
.../Deployment/PeerAssemblyLoadingTest.cs | 24 ++++++++++
3 files changed, 75 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ac39082/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 d91f0e6..4787c4d 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
@@ -78,6 +78,7 @@
<Compile Include="Binary\BinarySelfTestSimpleName.cs" />
<Compile Include="Binary\EnumsTestOnline.cs" />
<Compile Include="Cache\PersistentStoreTest.cs" />
+ <Compile Include="Deployment\CacheGetFunc.cs" />
<Compile Include="Deployment\GetAddressFunc.cs" />
<Compile Include="Deployment\PeerAssemblyLoadingAllApisTest.cs" />
<Compile Include="Deployment\PeerAssemblyLoadingVersioningTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ac39082/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/CacheGetFunc.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/CacheGetFunc.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/CacheGetFunc.cs
new file mode 100644
index 0000000..2679130
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/CacheGetFunc.cs
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Deployment
+{
+ using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Resource;
+
+ /// <summary>
+ /// Function to get a value from cache.
+ /// </summary>
+ public class CacheGetFunc<TKey, TValue> : IComputeFunc<TValue>
+ {
+ /// <summary>
+ /// Gets or sets the cache key.
+ /// </summary>
+ public TKey Key { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the cache.
+ /// </summary>
+ public string CacheName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the ignite.
+ /// </summary>
+ [InstanceResource]
+ public IIgnite Ignite { get;set; }
+
+ /** <inheritdoc /> */
+ public TValue Invoke()
+ {
+ return Ignite.GetCache<TKey, TValue>(CacheName).Get(Key);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ac39082/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingTest.cs
index 8245333..da896dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Deployment/PeerAssemblyLoadingTest.cs
@@ -131,6 +131,30 @@ namespace Apache.Ignite.Core.Tests.Deployment
}
/// <summary>
+ /// Tests the cache get operation on remote node.
+ /// </summary>
+ [Test]
+ public void TestCacheGetOnRemoteNode()
+ {
+ TestDeployment(remoteCompute =>
+ {
+ var cache = remoteCompute.ClusterGroup.Ignite.GetOrCreateCache<int, Address>("addr");
+ cache[1] = new Address("street", 123);
+
+ // This will fail for <object, object> func, because cache operations are not p2p-enabled.
+ // However, generic nature of the func causes Address to be peer-deployed before cache.Get call.
+ var func = new CacheGetFunc<int, Address>
+ {
+ CacheName = cache.Name,
+ Key = 1
+ };
+
+ var res = remoteCompute.Call(func);
+ Assert.AreEqual("street", res.Street);
+ });
+ }
+
+ /// <summary>
/// Tests the peer deployment.
/// </summary>
public static void TestDeployment(Action<ICompute> test, bool enablePeerDeployment = true)