This is an automated email from the ASF dual-hosted git repository. ptupitsyn pushed a commit to branch ignite-16771 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/ignite-16771 by this push: new 2efb0782f wip ClientComputeTest 2efb0782f is described below commit 2efb0782f540741cdc1e7f6d8519a8d97db80dd8 Author: Pavel Tupitsyn <ptupit...@apache.org> AuthorDate: Thu Apr 14 15:06:12 2022 +0300 wip ClientComputeTest --- .../apache/ignite/client/ClientComputeTest.java | 65 ++++++++++++++++++++++ .../org/apache/ignite/client/RetryPolicyTest.java | 4 +- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java b/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java new file mode 100644 index 000000000..2758ca36c --- /dev/null +++ b/modules/client/src/test/java/org/apache/ignite/client/ClientComputeTest.java @@ -0,0 +1,65 @@ +/* + * 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.client; + +import java.util.function.Function; +import org.apache.ignite.client.fakes.FakeIgnite; +import org.apache.ignite.internal.util.IgniteUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +/** + * Compute tests. + */ +public class ClientComputeTest { + private TestServer server; + + @AfterEach + void tearDown() throws Exception { + IgniteUtils.closeAll(server); + } + + @Test + public void testClientSendsComputeJobToTargetNodeWhenDirectConnectionExists() { + // TODO: Multiple servers. + initServer(reqId -> false); + + + } + + @Test + public void testClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist() { + + } + + @Test + public void testClientRetriesComputeJobOnPrimaryAndDefaultNodes() { + + } + + private IgniteClient getClient() { + return IgniteClient.builder() + .addresses("127.0.0.1:" + server.port()) + .reconnectThrottlingPeriod(0) + .build(); + } + + private void initServer(Function<Integer, Boolean> shouldDropConnection) { + server = new TestServer(10900, 10, 0, new FakeIgnite(), shouldDropConnection); + } +} diff --git a/modules/client/src/test/java/org/apache/ignite/client/RetryPolicyTest.java b/modules/client/src/test/java/org/apache/ignite/client/RetryPolicyTest.java index 1e9cc27bb..057ff2009 100644 --- a/modules/client/src/test/java/org/apache/ignite/client/RetryPolicyTest.java +++ b/modules/client/src/test/java/org/apache/ignite/client/RetryPolicyTest.java @@ -227,10 +227,10 @@ public class RetryPolicyTest { .build(); } - private void initServer(Function<Integer, Boolean> integerBooleanFunction) { + private void initServer(Function<Integer, Boolean> shouldDropConnection) { FakeIgnite ign = new FakeIgnite(); ign.tables().createTable("t", c -> {}); - server = new TestServer(10900, 10, 0, ign, integerBooleanFunction); + server = new TestServer(10900, 10, 0, ign, shouldDropConnection); } }