Exemplo n.º 1
0
        public void TestExecuteJavaTaskAsyncMultithreaded()
        {
            var count   = 10000;
            var compute = Client.GetCompute().WithKeepBinary();
            var cache   = Client.GetOrCreateCache <int, int>(TestUtils.TestName);

            cache[1] = 1;

            TestUtils.RunMultiThreaded(() =>
            {
                while (true)
                {
                    var arg = new PlatformComputeNetBinarizable {
                        Field = Interlocked.Decrement(ref count)
                    };

                    var res = compute.ExecuteJavaTask <int>(ComputeApiTest.BinaryArgTask, arg);

                    Assert.AreEqual(arg.Field, res);

                    // Perform other operations to mix notifications and responses.
                    Assert.AreEqual(1, cache[1]);
                    Assert.AreEqual(1, cache.GetAsync(1).Result);

                    if (res < 0)
                    {
                        break;
                    }
                }
            }, MaxTasks - 2);
        }
Exemplo n.º 2
0
        public void TestExecuteJavaTaskWithKeepBinaryDotnetOnlyArgClass()
        {
            var arg = new PlatformComputeNetBinarizable {
                Field = 42
            };

            var res = Client.GetCompute().WithKeepBinary().ExecuteJavaTask <int>(ComputeApiTest.BinaryArgTask, arg);

            Assert.AreEqual(arg.Field, res);
        }
        public void TestFromDotNet([Values(true, false)] bool client)
        {
            var grid = client ? _clientGrid : _grid;

            var compute = grid.GetCompute().WithKeepBinary();

            var arg = new PlatformComputeNetBinarizable {Field = 100};

            var res = compute.ExecuteJavaTask<int>(ComputeApiTest.BinaryArgTask, arg);

            Assert.AreEqual(arg.Field, res);
        }
        public void TestFromDotNet([Values(true, false)] bool client)
        {
            var grid = client ? _clientGrid : _grid;

            var compute = grid.GetCompute().WithKeepBinary();

            var arg = new PlatformComputeNetBinarizable {
                Field = 100
            };

            var res = compute.ExecuteJavaTask <int>(ComputeApiTest.BinaryArgTask, arg);

            Assert.AreEqual(arg.Field, res);
        }
Exemplo n.º 5
0
        public void TestBinarizableArgTask()
        {
            ICompute compute = _grid1.GetCompute();

            compute.WithKeepBinary();

            PlatformComputeNetBinarizable arg = new PlatformComputeNetBinarizable {
                Field = 100
            };

            int res = compute.ExecuteJavaTask <int>(BinaryArgTask, arg);

            Assert.AreEqual(arg.Field, res);
        }
Exemplo n.º 6
0
        public void TestExecuteJavaTaskWithDotnetOnlyArgClassThrowsCorrectException()
        {
            var arg = new PlatformComputeNetBinarizable {
                Field = 42
            };

            var ex = Assert.Throws <AggregateException>(() =>
                                                        Client.GetCompute().ExecuteJavaTask <int>(ComputeApiTest.BinaryArgTask, arg));

            var clientEx = (IgniteClientException)ex.GetInnermostException();

            var expected = string.Format(
                "Failed to resolve .NET class '{0}' in Java [platformId=0, typeId=-315989221].",
                arg.GetType().FullName);

            Assert.AreEqual(expected, clientEx.Message);
        }