You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2025/08/05 14:58:54 UTC
(ignite) branch master updated: IGNITE-24044 Remove deprecated GridClient tests (#12248)
This is an automated email from the ASF dual-hosted git repository.
nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 47ced6e6320 IGNITE-24044 Remove deprecated GridClient tests (#12248)
47ced6e6320 is described below
commit 47ced6e63205017eff6e550537911eebf9698c3f
Author: Nikita Amelchev <ns...@gmail.com>
AuthorDate: Tue Aug 5 17:58:44 2025 +0300
IGNITE-24044 Remove deprecated GridClient tests (#12248)
---
.../clients/config/grid-client-config.properties | 104 ---
.../clients/config/grid-client-spring-config.xml | 69 --
...CacheCreateDestroyEventSecurityContextTest.java | 22 -
.../ignite/common/ComputeTaskPermissionsTest.java | 19 -
.../ComputeTaskRemoteSecurityContextTest.java | 37 --
.../ignite/common/NodeSslConnectionMetricTest.java | 65 --
.../ClientAbstractMultiThreadedSelfTest.java | 365 ----------
.../client/ClientReconnectionSelfTest.java | 246 -------
.../internal/client/ClientSslParametersTest.java | 312 ---------
.../internal/client/ClientStringLengthTask.java | 77 ---
.../client/ClientTcpMultiThreadedSelfTest.java | 46 --
.../client/ClientTcpSslAuthenticationSelfTest.java | 272 --------
.../client/ClientTcpSslMultiThreadedSelfTest.java | 47 --
...pTaskExecutionAfterTopologyRestartSelfTest.java | 77 ---
.../client/impl/ClientComputeImplSelfTest.java | 182 -----
.../client/impl/ClientDataImplSelfTest.java | 285 --------
.../client/impl/ClientFutureAdapterSelfTest.java | 120 ----
.../ClientPropertiesConfigurationSelfTest.java | 248 -------
.../ClientAbstractConnectivitySelfTest.java | 328 ---------
.../ClientAbstractMultiNodeSelfTest.java | 488 --------------
.../client/integration/ClientAbstractSelfTest.java | 733 ---------------------
.../integration/ClientPreferDirectSelfTest.java | 190 ------
.../integration/ClientTcpConnectivitySelfTest.java | 76 ---
.../ClientTcpDirectMultiNodeSelfTest.java | 58 --
.../integration/ClientTcpDirectSelfTest.java | 60 --
.../integration/ClientTcpMultiNodeSelfTest.java | 35 -
.../client/integration/ClientTcpSelfTest.java | 47 --
.../ClientTcpSslDirectMultiNodeSelfTest.java | 66 --
.../integration/ClientTcpSslDirectSelfTest.java | 61 --
.../integration/ClientTcpSslMultiNodeSelfTest.java | 43 --
.../client/integration/ClientTcpSslSelfTest.java | 48 --
.../ClientTcpUnreachableMultiNodeSelfTest.java | 146 ----
.../client/router/ClientFailedInitSelfTest.java | 284 --------
.../client/router/RouterFactorySelfTest.java | 109 ---
.../client/router/TcpRouterAbstractSelfTest.java | 129 ----
.../client/router/TcpRouterMultiNodeSelfTest.java | 111 ----
.../internal/client/router/TcpRouterSelfTest.java | 36 -
.../client/router/TcpSslRouterSelfTest.java | 51 --
.../client/suite/IgniteClientTestSuite.java | 79 ---
.../client/util/ClientConsistentHashSelfTest.java | 312 ---------
.../rest/AbstractRestProcessorSelfTest.java | 2 +-
.../rest/ChangeStateCommandHandlerTest.java | 109 ---
.../rest/RestProcessorStartSelfTest.java | 165 -----
.../processors/rest/RestProtocolStartTest.java | 4 +-
.../rest/TaskCommandHandlerSelfTest.java | 203 ------
.../loadtests/client/ClientCacheBenchmark.java | 271 --------
.../loadtests/client/ClientTcpSslLoadTest.java | 91 ---
.../benchmark/spring-cache-client-benchmark-1.xml | 133 ----
.../benchmark/spring-cache-client-benchmark-2.xml | 123 ----
.../benchmark/spring-cache-client-benchmark-3.xml | 123 ----
50 files changed, 3 insertions(+), 7304 deletions(-)
diff --git a/modules/clients/config/grid-client-config.properties b/modules/clients/config/grid-client-config.properties
deleted file mode 100644
index d25352b3239..00000000000
--- a/modules/clients/config/grid-client-config.properties
+++ /dev/null
@@ -1,104 +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.
-#
-
-# Required. Comma-separated list of servers to connect to in format "host:port".
-ignite.client.servers=localhost:11211
-
-# Optional. Default client load balancer. Default value is "".
-# Balancer may be "random", "roundrobin" or full class name for "your.balancer.ImplementationClass"
-#ignite.client.balancer=
-
-# Optional. Socket connect timeout (ms). Default value is "0".
-#ignite.client.connectTimeout=10000
-
-# Optional. Credentials if grid requires authentication. Default value is "".
-#ignite.client.credentials=
-
-# Optional. Flag indicating whether topology cache is enabled. Default value is "false".
-#ignite.client.cacheTop=false
-
-# Optional. Max time of connection idleness (ms). Default value is "30000".
-#ignite.client.idleTimeout=30000
-
-# Optional. Client protocol, one of TCP or HTTP. Default value is "TCP".
-#ignite.client.protocol=TCP
-
-# Optional. TCP_NODELAY communication flag. Default value is "true".
-#ignite.client.tcp.noDelay=true
-
-# Optional. Topology refresh frequency (ms). Default value is "2000".
-#ignite.client.topology.refresh=2000
-
-#
-# Data configurations.
-#
-
-# Optional. List of comma-separated names of data configurations. Default value is "".
-#ignite.client.data.configurations=cfg1, cfg2
-
-# Optional. Cache name (space) to work with (for configuration 'cfg1').
-#ignite.client.data.cfg1.name=
-
-# Optional. Specific load balancer for configuration 'cfg1'. Default value is "".
-# Balancer may be "random", "roundrobin" or full class name for "your.balancer.ImplementationClass"
-#ignite.client.data.cfg1.balancer=random
-
-# Optional. Specific affinity for configuration 'cfg1'. Default value is "".
-# Affinity may be "" (no affinity), "partitioned" or full class name for "your.affinity.ImplementationClass"
-#ignite.client.data.cfg1.affinity=
-
-# Optional. Cache name (space) to work with (for configuration 'cfg2').
-#ignite.client.data.cfg2.name=partitioned
-
-# Optional. Specific load balancer for configuration 'cfg2'. Default value is "".
-# Balancer may be "random", "roundrobin" or full class name for "your.balancer.ImplementationClass"
-#ignite.client.data.cfg2.balancer=roundrobin
-
-# Optional. Specific affinity for configuration 'cfg2'. Default value is "".
-# Affinity may be "" (no affinity), "partitioned" or full class name for "your.affinity.ImplementationClass"
-#ignite.client.data.cfg2.affinity=partitioned
-
-#
-# SSL configuration.
-#
-
-# Optional. SSL enabled. Default value is "false".
-#ignite.client.ssl.enabled=false
-
-# Optional. SSL protocol. Default value is "TLS".
-#ignite.client.ssl.protocol=TLS
-
-# Optional. Key manager algorithm. Default value is "SunX509".
-#ignite.client.ssl.key.algorithm=SunX509
-
-# Optional. Keystore to be used by client to connect with Ignite topology over SSL. Default value is "".
-#ignite.client.ssl.keystore.location=
-
-# Optional. Default value is "".
-#ignite.client.ssl.keystore.password=
-
-# Optional. Default value is "jks".
-#ignite.client.ssl.keystore.type=jks
-
-# Optional. Truststore to be used by client to connect with Ignite topology over SSL. Default value is "".
-#ignite.client.ssl.truststore.location=
-
-# Optional. Default value is "".
-#ignite.client.ssl.truststore.password=
-
-# Optional. Default value is "jks".
-#ignite.client.ssl.truststore.type=jks
diff --git a/modules/clients/config/grid-client-spring-config.xml b/modules/clients/config/grid-client-spring-config.xml
deleted file mode 100644
index 4758eb939f5..00000000000
--- a/modules/clients/config/grid-client-spring-config.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Client Spring configuration file to start grid client.
-
- When starting Ignite Client from Java IDE, pass configuration bean into GridClientFactory:
- GridClientFactory.start(new FileSystemXmlApplicationContext(
- "/path/to/grid-client-spring-config.xml").getBean(GridClientConfiguration.class));
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <!--
- Optional description.
- -->
- <description>
- Spring file for grid client configuration.
- </description>
-
- <!--
- Configuration below demonstrates how to setup caches within grid nodes.
- -->
- <bean id="grid.client.cfg" class="org.apache.ignite.internal.client.GridClientConfiguration">
- <!-- Data configurations. -->
- <property name="dataConfigurations">
- <list>
- <bean class="org.apache.ignite.internal.client.GridClientDataConfiguration">
- <property name="name" value="partitioned"/>
- <property name="affinity">
- <bean class="org.apache.ignite.internal.client.GridClientPartitionAffinity"/>
- </property>
- </bean>
- </list>
- </property>
-
- <!--
- The list of servers this client should connect to.
- -->
- <property name="servers">
- <list>
- <value>127.0.0.1:11211</value>
- </list>
- </property>
-
- <!--
- Client credentials used in authentication process.
- -->
- <!--<property name="credentials" value="s3cret"/>-->
- </bean>
-</beans>
diff --git a/modules/clients/src/test/java/org/apache/ignite/common/CacheCreateDestroyEventSecurityContextTest.java b/modules/clients/src/test/java/org/apache/ignite/common/CacheCreateDestroyEventSecurityContextTest.java
index 47fec1bc084..f5e8c453870 100644
--- a/modules/clients/src/test/java/org/apache/ignite/common/CacheCreateDestroyEventSecurityContextTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/common/CacheCreateDestroyEventSecurityContextTest.java
@@ -28,14 +28,9 @@ import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.cluster.ClusterState;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ClientConfiguration;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
import org.apache.ignite.internal.processors.rest.GridRestCommand;
import org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider;
import org.apache.ignite.internal.util.lang.RunnableX;
-import org.apache.ignite.plugin.security.SecurityCredentials;
-import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
import org.junit.Test;
import static java.util.Collections.singletonList;
@@ -98,23 +93,6 @@ public class CacheCreateDestroyEventSecurityContextTest extends AbstractEventSec
}
}
- /** Tests cache create/destroy event security context in case operation is initiated from the {@link GridClient}. */
- @Test
- public void testGridClient() throws Exception {
- operationInitiatorLogin = GRID_CLIENT_LOGIN;
-
- GridClientConfiguration cfg = new GridClientConfiguration()
- .setServers(singletonList("127.0.0.1:11211"))
- .setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(new SecurityCredentials(operationInitiatorLogin, "")));
-
- grid("crd").createCache(cacheConfiguration());
-
- try (GridClient cli = GridClientFactory.start(cfg)) {
- checkCacheEvents(() -> cli.state().state(INACTIVE, true), EVT_CACHE_STOPPED);
- checkCacheEvents(() -> cli.state().state(ACTIVE, true), EVT_CACHE_STARTED);
- }
- }
-
/** Tests cache create/destroy event security context in case operation is initiated from the REST client. */
@Test
public void testRestClient() throws Exception {
diff --git a/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskPermissionsTest.java b/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskPermissionsTest.java
index e3e337468ac..efe5f7a4bac 100644
--- a/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskPermissionsTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskPermissionsTest.java
@@ -48,9 +48,6 @@ import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.ThinClientConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataVerificationTask;
import org.apache.ignite.internal.processors.security.AbstractSecurityTest;
import org.apache.ignite.internal.processors.security.OperationSecurityContext;
@@ -71,7 +68,6 @@ import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.plugin.security.AuthenticationContext;
import org.apache.ignite.plugin.security.SecurityCredentials;
-import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
import org.apache.ignite.plugin.security.SecurityException;
import org.apache.ignite.plugin.security.SecurityPermissionSet;
import org.apache.ignite.plugin.security.SecurityPermissionSetBuilder;
@@ -281,21 +277,6 @@ public class ComputeTaskPermissionsTest extends AbstractSecurityTest {
);
}
- /** */
- @Test
- public void testGridClient() throws Exception {
- GridClientConfiguration cfg = new GridClientConfiguration()
- .setServers(singletonList("127.0.0.1:11211"))
- .setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(new SecurityCredentials("grid-client", "")));
-
- try (GridClient cli = GridClientFactory.start(cfg)) {
- checkTask(String.class, (t, a) -> cli.compute().execute(t, a));
- checkTask(String.class, (t, a) -> cli.compute().executeAsync(t, a).get());
- checkTask(String.class, (t, a) -> cli.compute().affinityExecute(t, CACHE, "key", a));
- checkTask(String.class, (t, a) -> cli.compute().affinityExecuteAsync(t, CACHE, "key", a).get());
- }
- }
-
/** */
@Test
public void testRestClient() {
diff --git a/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskRemoteSecurityContextTest.java b/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskRemoteSecurityContextTest.java
index 21bfcbee8a5..bc990d11005 100644
--- a/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskRemoteSecurityContextTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/common/ComputeTaskRemoteSecurityContextTest.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
import java.util.concurrent.CountDownLatch;
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.ignite.Ignite;
@@ -46,21 +45,13 @@ import org.apache.ignite.configuration.ClientConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.ThinClientConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientNode;
import org.apache.ignite.internal.client.thin.ClientServerError;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.security.SecurityCredentials;
-import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.JobContextResource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -79,7 +70,6 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
import static org.apache.ignite.events.EventType.EVT_TASK_REDUCED;
import static org.apache.ignite.events.EventType.EVT_TASK_STARTED;
import static org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME;
import static org.apache.ignite.internal.processors.rest.GridRestCommand.EXE;
import static org.apache.ignite.internal.processors.rest.GridRestCommand.RESULT;
@@ -186,33 +176,6 @@ public class ComputeTaskRemoteSecurityContextTest extends AbstractEventSecurityC
.setMaxActiveComputeTasksPerConnection(1)));
}
- /** Tests task execution security context in case task was initiated from the {@link GridClient}. */
- @Test
- public void testGridClient() throws Exception {
- Assume.assumeFalse(failWithTimeout);
-
- GridClientConfiguration cfg = new GridClientConfiguration()
- .setServers(singletonList("127.0.0.1:11211"))
- .setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(new SecurityCredentials(GRID_CLIENT_LOGIN, "")));
-
- try (GridClient cli = GridClientFactory.start(cfg)) {
- GridClientNode taskReqRecipient = cli.compute().nodes().stream()
- .filter(n -> "crd".equals(n.attribute(ATTR_IGNITE_INSTANCE_NAME)))
- .findFirst().orElseThrow(NoSuchElementException::new);
-
- GridClientCompute comp = cli.compute().projection(taskReqRecipient);
-
- String taskName = mapAsync ? MapAsyncTestTask.class.getName() : TestTask.class.getName();
-
- if (async)
- comp.executeAsync(taskName, GRID_CLIENT_LOGIN).get();
- else
- comp.execute(taskName, GRID_CLIENT_LOGIN);
-
- checkTaskEvents("crd", GRID_CLIENT_LOGIN, REDUCER_SUCCEEDED_TASK_EVENTS, MAP_NODE_SUCCEEDED_TASK_EVENTS);
- }
- }
-
/** Tests task execution security context in case task was initiated from the {@link IgniteClient}. */
@Test
public void testIgniteClient() throws Exception {
diff --git a/modules/clients/src/test/java/org/apache/ignite/common/NodeSslConnectionMetricTest.java b/modules/clients/src/test/java/org/apache/ignite/common/NodeSslConnectionMetricTest.java
index f34c2437243..a1be30723f5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/common/NodeSslConnectionMetricTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/common/NodeSslConnectionMetricTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.common;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
-import java.util.Collections;
import java.util.function.Supplier;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.client.ClientConnectionException;
@@ -32,9 +31,6 @@ import org.apache.ignite.configuration.ClientConnectorConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
import org.apache.ignite.metric.MetricRegistry;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.metric.BooleanMetric;
@@ -48,7 +44,6 @@ import org.junit.Test;
import static java.sql.DriverManager.getConnection;
import static org.apache.ignite.Ignition.startClient;
-import static org.apache.ignite.internal.client.GridClientFactory.start;
import static org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.DISCO_METRICS;
import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLIENT_CONNECTOR_METRICS;
import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestProtocol.REST_CONNECTOR_METRIC_REGISTRY_NAME;
@@ -83,8 +78,6 @@ public class NodeSslConnectionMetricTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
-
- GridClientFactory.stopAll(false);
}
/** {@inheritDoc} */
@@ -173,50 +166,6 @@ public class NodeSslConnectionMetricTest extends GridCommonAbstractTest {
checkSslCommunicationMetrics(reg, 4, 0, 3);
}
- /** Tests SSL metrics produced by REST TCP client connection. */
- @Test
- public void testRestClientConnector() throws Exception {
- MetricRegistry reg = mreg(startClusterNode(0), REST_CONNECTOR_METRIC_REGISTRY_NAME);
-
- assertEquals(0, reg.<LongMetric>findMetric(SENT_BYTES_METRIC_NAME).value());
- assertEquals(0, reg.<LongMetric>findMetric(RECEIVED_BYTES_METRIC_NAME).value());
-
- try (
- GridClient ignored = start(gridClientConfiguration("connectorClient", "trustthree", CIPHER_SUITE, "TLSv1.2"))
- ) {
- checkSslCommunicationMetrics(reg, 1, 1, 0);
- }
-
- assertTrue(reg.<LongMetric>findMetric(SENT_BYTES_METRIC_NAME).value() > 0);
- assertTrue(reg.<LongMetric>findMetric(RECEIVED_BYTES_METRIC_NAME).value() > 0);
-
- checkSslCommunicationMetrics(reg, 1, 0, 0);
-
- // Tests untrusted certificate.
- try (GridClient ignored = start(gridClientConfiguration("client", "trustthree", CIPHER_SUITE, "TLSv1.2"))) {
- // GridClient makes 2 additional silent connection attempts if an SSL error occurs.
- }
-
- checkSslCommunicationMetrics(reg, 4, 0, 3);
-
- // Tests unsupported cipher suite.
- try (
- GridClient ignored = start(gridClientConfiguration("connectorClient", "trustthree",
- UNSUPPORTED_CIPHER_SUITE, "TLSv1.2"))
- ) {
- // GridClient makes 2 additional silent connection attempts if an SSL error occurs.
- }
-
- checkSslCommunicationMetrics(reg, 7, 0, 6);
-
- // Tests mismatched protocol versions.
- try (GridClient ignored = start(gridClientConfiguration("connectorClient", "trustthree", null, "TLSv1.1"))) {
- // GridClient makes 2 additional silent connection attempts if an SSL error occurs.
- }
-
- checkSslCommunicationMetrics(reg, 10, 0, 9);
- }
-
/** Tests SSL discovery metrics produced by node connection. */
@Test
public void testDiscovery() throws Exception {
@@ -377,20 +326,6 @@ public class NodeSslConnectionMetricTest extends GridCommonAbstractTest {
.setClientMode(client);
}
- /** @return Grid client connection configuration with specified SSL options. */
- private GridClientConfiguration gridClientConfiguration(
- String keyStore,
- String trustStore,
- String cipherSuite,
- String protocol
- ) {
- SslContextFactory sslCtxFactory = sslContextFactory(keyStore, trustStore, cipherSuite, protocol);
-
- return new GridClientConfiguration()
- .setServers(Collections.singleton("127.0.0.1:11211"))
- .setSslContextFactory(sslCtxFactory::create);
- }
-
/** @return Thin client connection configuration with specified SSL options. */
private ClientConfiguration clientConfiguration(
String keyStore,
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
deleted file mode 100644
index a2c9bf1271a..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,365 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
-
-/**
- *
- */
-public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
- /** Partitioned cache name. */
- protected static final String PARTITIONED_CACHE_NAME = "partitioned";
-
- /** Partitioned cache with async commit and backup name. */
- protected static final String PARTITIONED_ASYNC_BACKUP_CACHE_NAME = "partitioned-async-backup";
-
- /** Replicated cache name. */
- private static final String REPLICATED_CACHE_NAME = "replicated";
-
- /** Replicated cache with async commit name. */
- private static final String REPLICATED_ASYNC_CACHE_NAME = "replicated-async";
-
- /** Nodes count. */
- protected static final int NODES_CNT = 5;
-
- /** Thread count to run tests. */
- private static final int THREAD_CNT = 20;
-
- /** Count of tasks to run. */
- private static final int TASK_EXECUTION_CNT = 50000;
-
- /** Count of cache puts in tests. */
- private static final int CACHE_PUT_CNT = 10000;
-
- /** Topology update frequency. */
- private static final int TOP_REFRESH_FREQ = 1000;
-
- /** Info messages will be printed each 5000 iterations. */
- private static final int STATISTICS_PRINT_STEP = 5000;
-
- /** Host. */
- public static final String HOST = "127.0.0.1";
-
- /** Base for tcp rest ports. */
- public static final int REST_TCP_PORT_BASE = 12345;
-
- static {
- System.setProperty("CLIENTS_MODULE_PATH", U.resolveIgnitePath("modules/clients").getAbsolutePath());
- }
-
- /** Client instance for each test. */
- protected GridClient client;
-
- /**
- * @return Client protocol that should be used.
- */
- protected abstract GridClientProtocol protocol();
-
- /**
- * @return Server address to create first connection.
- */
- protected abstract String serverAddress();
-
- /**
- * @return Whether SSL should be used.
- */
- protected abstract boolean useSsl();
-
- /**
- * @return SSL context factory to use if SSL is enabled.
- */
- protected abstract Factory<SSLContext> sslContextFactory();
-
- /**
- * @return Topology refresh frequency interval.
- */
- protected int topologyRefreshFrequency() {
- return TOP_REFRESH_FREQ;
- }
-
- /**
- * @return Max connection idle time.
- */
- protected int maxConnectionIdleTime() {
- return 5000;
- }
-
- /**
- * @return Number of tasks that should be executed during test.
- */
- protected int taskExecutionCount() {
- return TASK_EXECUTION_CNT;
- }
-
- /**
- * @return Number of puts to the cache.
- */
- protected int cachePutCount() {
- return CACHE_PUT_CNT;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
-
- c.setLocalHost(HOST);
-
- assert c.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(REST_TCP_PORT_BASE);
-
- if (useSsl()) {
- clientCfg.setSslEnabled(true);
-
- clientCfg.setSslFactory(sslContextFactory());
- }
-
- c.setConnectorConfiguration(clientCfg);
-
- CacheConfiguration<?, ?> ccfg1 = defaultCacheConfiguration()
- .setName(PARTITIONED_CACHE_NAME)
- .setCacheMode(PARTITIONED)
- .setBackups(0);
-
- CacheConfiguration<?, ?> ccfg2 = defaultCacheConfiguration()
- .setName(PARTITIONED_ASYNC_BACKUP_CACHE_NAME)
- .setCacheMode(PARTITIONED)
- .setBackups(1)
- .setWriteSynchronizationMode(FULL_ASYNC);
-
- CacheConfiguration<?, ?> ccfg3 = defaultCacheConfiguration()
- .setName(REPLICATED_CACHE_NAME)
- .setCacheMode(REPLICATED);
-
- CacheConfiguration<?, ?> ccfg4 = defaultCacheConfiguration()
- .setName(REPLICATED_ASYNC_CACHE_NAME)
- .setCacheMode(REPLICATED)
- .setWriteSynchronizationMode(FULL_ASYNC);
-
- c.setCacheConfiguration(ccfg1, ccfg2, ccfg3, ccfg4);
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(NODES_CNT);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- client = GridClientFactory.start(clientConfiguration());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- GridClientFactory.stop(client.id(), false);
-
- client = null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMultithreadedTaskRun() throws Exception {
- final AtomicLong cnt = new AtomicLong();
-
- final AtomicReference<GridClientException> err = new AtomicReference<>();
-
- final ConcurrentLinkedQueue<String> execQueue = new ConcurrentLinkedQueue<>();
-
- IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
- @Override public void run() {
- long processed;
-
- while ((processed = cnt.getAndIncrement()) < taskExecutionCount()) {
- try {
- if (processed > 0 && processed % STATISTICS_PRINT_STEP == 0)
- info(">>>>>>> " + processed + " tasks finished.");
-
- String res = client.compute().execute(TestTask.class.getName(), null);
-
- execQueue.add(res);
- }
- catch (GridClientException e) {
- err.compareAndSet(null, e);
- }
- }
- }
- }, THREAD_CNT, "client-task-request");
-
- fut.get();
-
- if (err.get() != null)
- throw new Exception(err.get());
-
- assertEquals(taskExecutionCount(), execQueue.size());
-
- // With round-robin balancer each node must receive equal count of task requests.
- Collection<String> executionIds = new HashSet<>(execQueue);
-
- assertTrue(executionIds.size() == NODES_CNT);
-
- Map<String, AtomicInteger> statisticsMap = new HashMap<>();
-
- for (String id : executionIds)
- statisticsMap.put(id, new AtomicInteger());
-
- for (String id : execQueue)
- statisticsMap.get(id).incrementAndGet();
-
- info(">>>>>>> Execution statistics per node:");
-
- for (Map.Entry<String, AtomicInteger> e : statisticsMap.entrySet())
- info(">>>>>>> " + e.getKey() + " run " + e.getValue().get() + " tasks");
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return 5 * 60 * 1000;
- }
-
- /**
- * Creates client that will try to connect to only first node in grid.
- *
- * @return Client.
- */
- private GridClientConfiguration clientConfiguration() {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setTopologyRefreshFrequency(topologyRefreshFrequency());
- cfg.setMaxConnectionIdleTime(maxConnectionIdleTime());
-
- cfg.setProtocol(protocol());
- cfg.setServers(Arrays.asList(serverAddress()));
- cfg.setBalancer(new GridClientRoundRobinBalancer());
-
- if (useSsl())
- cfg.setSslContextFactory(sslContextFactory());
-
- GridClientDataConfiguration loc = new GridClientDataConfiguration();
-
- GridClientDataConfiguration partitioned = new GridClientDataConfiguration();
- partitioned.setName(PARTITIONED_CACHE_NAME);
- partitioned.setAffinity(new GridClientPartitionAffinity());
-
- GridClientDataConfiguration partitionedAsyncBackup = new GridClientDataConfiguration();
- partitionedAsyncBackup.setName(PARTITIONED_ASYNC_BACKUP_CACHE_NAME);
- partitionedAsyncBackup.setAffinity(new GridClientPartitionAffinity());
-
- GridClientDataConfiguration replicated = new GridClientDataConfiguration();
- replicated.setName(REPLICATED_CACHE_NAME);
-
- GridClientDataConfiguration replicatedAsync = new GridClientDataConfiguration();
- replicatedAsync.setName(REPLICATED_ASYNC_CACHE_NAME);
-
- cfg.setDataConfigurations(Arrays.asList(loc, partitioned, replicated, replicatedAsync, partitionedAsyncBackup));
-
- return cfg;
- }
-
- /**
- * Test task. Returns a tuple in which first component is id of node that has split the task,
- * and second component is count of nodes that executed jobs.
- */
- private static class TestTask extends ComputeTaskSplitAdapter<Object, String> {
- /** Injected grid. */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Count of tasks this job was split to. */
- private int gridSize;
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>(gridSize);
-
- this.gridSize = gridSize;
-
- final String locNodeId = ignite.cluster().localNode().id().toString();
-
- for (int i = 0; i < gridSize; i++) {
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- return new IgniteBiTuple<>(locNodeId, 1);
- }
- });
- }
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public String reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- String locNodeId = null;
-
- for (ComputeJobResult res : results) {
- IgniteBiTuple<String, Integer> part = res.getData();
-
- if (locNodeId == null)
- locNodeId = part.get1();
-
- Integer i = part.get2();
-
- if (i != null)
- sum += i;
- }
-
- assert gridSize == sum;
-
- return locNodeId;
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
deleted file mode 100644
index f4ed7977270..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientReconnectionSelfTest.java
+++ /dev/null
@@ -1,246 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.nio.channels.ClosedChannelException;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.apache.ignite.internal.client.ClientTestRestServer.FIRST_SERVER_PORT;
-import static org.apache.ignite.internal.client.ClientTestRestServer.SERVERS_CNT;
-
-/**
- *
- */
-public class ClientReconnectionSelfTest extends GridCommonAbstractTest {
- /** */
- public static final String HOST = "127.0.0.1";
-
- /** */
- private ClientTestRestServer[] srvs = new ClientTestRestServer[SERVERS_CNT];
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- for (int i = 0; i < srvs.length; i++) {
- ClientTestRestServer srv = srvs[i];
-
- if (srv != null)
- srv.stop();
-
- srvs[i] = null;
- }
-
- super.afterTest();
- }
-
- /**
- * @return Client for test.
- * @throws GridClientException In case of error.
- */
- private GridClient client() throws GridClientException {
- return client(HOST);
- }
-
- /**
- * @param host - server host
- * @return Client for test.
- * @throws GridClientException In case of error.
- */
- private GridClient client(String host) throws GridClientException {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setProtocol(GridClientProtocol.TCP);
-
- Collection<String> addrs = new ArrayList<>();
-
- for (int port = FIRST_SERVER_PORT; port < FIRST_SERVER_PORT + SERVERS_CNT; port++)
- addrs.add(host + ":" + port);
-
- cfg.setServers(addrs);
-
- cfg.setTopologyRefreshFrequency(60 * 60 * 1000);
-
- return GridClientFactory.start(cfg);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNoFailedReconnection() throws Exception {
- for (int i = 0; i < SERVERS_CNT; i++)
- runServer(i, false);
-
- try (GridClient client = client()) { // Here client opens initial connection and fetches topology.
- // Only first server in list should be contacted.
- assertEquals(1, srvs[0].getConnectCount());
-
- for (int i = 1; i < SERVERS_CNT; i++)
- assertEquals(0, srvs[i].getConnectCount());
-
- srvs[0].resetCounters();
-
- int contactedSrv = 0;
-
- for (int i = 0; i < 100; i++) {
- int failed = contactedSrv;
-
- srvs[failed].fail();
-
- // Sometimes session close missing on client side. Retry few times until request succeeds.
- while (true)
- try {
- client.compute().refreshTopology(false, false);
-
- break;
- }
- catch (GridClientConnectionResetException e) {
- info("Exception caught: " + e);
- }
-
- // Check which servers where contacted,
- int connects = 0;
-
- for (int srv = 0; srv < SERVERS_CNT; srv++) {
- if (srvs[srv].getSuccessfulConnectCount() > 0) {
- assertTrue("Failed server was contacted: " + srv, srv != failed);
-
- contactedSrv = srv;
- }
-
- connects += srvs[srv].getSuccessfulConnectCount();
- }
-
- assertEquals(1, connects); // Only one new connection should be opened.
-
- srvs[failed].repair();
-
- srvs[contactedSrv].resetCounters(); // It should be the only server with non-0 counters.
- }
-
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCorrectInit() throws Exception {
- for (int i = 0; i < SERVERS_CNT; i++)
- runServer(i, i == 0);
-
- try (GridClient ignored = client()) { // Here client opens initial connection and fetches topology.
- // First and second should be contacted, due to failure in initial request to the first.
- for (int i = 0; i < 2; i++)
- assertEquals("Iteration: " + i, 1, srvs[i].getConnectCount());
-
- for (int i = 2; i < SERVERS_CNT; i++)
- assertEquals(0, srvs[i].getConnectCount());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testFailedInit() throws Exception {
- for (int i = 0; i < SERVERS_CNT; i++)
- runServer(i, true);
-
- GridClient c = client();
-
- try {
- c.compute().execute("fake", "arg");
-
- fail("Client operation should fail when server resets connections.");
- }
- catch (GridClientDisconnectedException e) {
- assertTrue("Thrown exception doesn't have an expected cause: " + X.getFullStackTrace(e),
- X.hasCause(e, GridClientConnectionResetException.class, ClosedChannelException.class));
- }
-
- for (int i = 0; i < SERVERS_CNT; i++)
- // Connection manager does 3 attempts to get topology before failure.
- assertEquals("Server: " + i, 3, srvs[i].getConnectCount());
- }
-
- /**
- * TODO: IGNITE-590.
- *
- * @throws Exception If failed.
- */
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-590")
- @Test
- public void testIdleConnection() throws Exception {
- int srvsCnt = 4; // TODO: IGNITE-590 it may be wrong value. Need to investigate after IGNITE-590 will be fixed.
-
- for (int i = 0; i < srvsCnt; i++)
- runServer(i, false);
-
- GridClient client = client(); // Here client opens initial connection and fetches topology.
-
- try {
- // Only first server in list should be contacted.
- assertEquals(1, srvs[0].getConnectCount());
-
- Thread.sleep(35000); // Timeout as idle.
-
- assertEquals(1, srvs[0].getDisconnectCount());
-
- for (int i = 1; i < srvsCnt; i++)
- assertEquals(0, srvs[i].getConnectCount());
-
- srvs[0].resetCounters();
-
- // On new request connection should be re-opened.
- client.compute().refreshTopology(false, false);
-
- assertEquals(1, srvs[0].getConnectCount());
-
- for (int i = 1; i < srvsCnt; i++)
- assertEquals(0, srvs[i].getConnectCount());
- }
- finally {
- GridClientFactory.stop(client.id());
- }
- }
-
- /**
- * Runs a new server with given index.
- *
- * @param idx Server index, same as in client configuration's servers property.
- * @param failOnConnect If {@code true} the server should fail incoming connection immediately.
- * @return Server instance.
- * @throws IgniteCheckedException If failed.
- */
- private ClientTestRestServer runServer(int idx, boolean failOnConnect) throws IgniteCheckedException {
- ClientTestRestServer srv = new ClientTestRestServer(FIRST_SERVER_PORT + idx, failOnConnect, log());
-
- srv.start();
-
- srvs[idx] = srv;
-
- return srv;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientSslParametersTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientSslParametersTest.java
deleted file mode 100644
index 27d01e4c8a2..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientSslParametersTest.java
+++ /dev/null
@@ -1,312 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Callable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.ssl.SslContextFactory;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-
-/**
- * Tests cases when node connects to cluster with different set of cipher suites.
- */
-public class ClientSslParametersTest extends GridCommonAbstractTest {
- /** */
- public static final String TEST_CACHE_NAME = "TEST";
-
- /** */
- private volatile String[] cipherSuites;
-
- /** */
- private volatile String[] protocols;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setSslContextFactory(createSslFactory());
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration()
- .setSslEnabled(true)
- .setSslClientAuth(true));
-
- cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE_NAME));
-
- return cfg;
- }
-
- /**
- * @return Client configuration.
- */
- protected GridClientConfiguration getClientConfiguration() {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setServers(Collections.singleton("127.0.0.1:11211"));
-
- cfg.setSslContextFactory(createSslFactory());
-
- return cfg;
- }
-
- /**
- * @return SSL factory.
- */
- @NotNull private SslContextFactory createSslFactory() {
- SslContextFactory factory = (SslContextFactory)GridTestUtils.sslFactory();
-
- factory.setCipherSuites(cipherSuites);
-
- factory.setProtocols(protocols);
-
- return factory;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- protocols = null;
-
- cipherSuites = null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSameCipherSuite() throws Exception {
- cipherSuites = new String[] {
- "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- };
-
- startGrid();
-
- checkSuccessfulClientStart(
- new String[] {
- "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- },
- null
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testOneCommonCipherSuite() throws Exception {
- cipherSuites = new String[] {
- "TLS_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- };
-
- startGrid();
-
- checkSuccessfulClientStart(
- new String[] {
- "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- },
- null
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNoCommonCipherSuite() throws Exception {
- cipherSuites = new String[] {
- "TLS_RSA_WITH_AES_128_GCM_SHA256"
- };
-
- startGrid();
-
- checkClientStartFailure(
- new String[] {
- "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- },
- null
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNonExistentCipherSuite() throws Exception {
- cipherSuites = new String[] {
- "TLS_RSA_WITH_AES_128_GCM_SHA256"
- };
-
- startGrid();
-
- checkClientStartFailure(
- new String[] {
- "TLC_FAKE_CIPHER",
- "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- },
- null
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNoCommonProtocols() throws Exception {
- protocols = new String[] {
- "TLSv1.1",
- "SSLv3"
- };
-
- startGrid();
-
- checkClientStartFailure(
- null,
- new String[] {
- "TLSv1",
- "TLSv1.2"
- }
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNonExistentProtocol() throws Exception {
- protocols = new String[] {
- "SSLv3"
- };
-
- startGrid();
-
- checkClientStartFailure(
- null,
- new String[] {
- "SSLv3",
- "SSLvDoesNotExist"
- }
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSameProtocols() throws Exception {
- protocols = new String[] {
- "TLSv1.1",
- "TLSv1.2"
- };
-
- startGrid();
-
- checkSuccessfulClientStart(
- null,
- new String[] {
- "TLSv1.1",
- "TLSv1.2"
- }
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testOneCommonProtocol() throws Exception {
- protocols = new String[] {
- "TLSv1",
- "TLSv1.1",
- "TLSv1.2"
- };
-
- startGrid();
-
- checkSuccessfulClientStart(
- null,
- new String[] {
- "TLSv1.2",
- "SSLv3"
- }
- );
- }
-
- /**
- * @param cipherSuites list of cipher suites
- * @param protocols list of protocols
- * @throws Exception If failed.
- */
- private void checkSuccessfulClientStart(String[] cipherSuites, String[] protocols) throws Exception {
- this.cipherSuites = F.isEmpty(cipherSuites) ? null : cipherSuites;
- this.protocols = F.isEmpty(protocols) ? null : protocols;
-
- try (GridClient client = GridClientFactory.start(getClientConfiguration())) {
- List<GridClientNode> top = client.compute().refreshTopology(false, false);
-
- assertEquals(1, top.size());
- }
- }
-
- /**
- * @param cipherSuites list of cipher suites
- * @param protocols list of protocols
- */
- private void checkClientStartFailure(String[] cipherSuites, String[] protocols) {
- checkClientStartFailure(cipherSuites, protocols, "Latest topology update failed.");
- }
-
- /**
- * @param cipherSuites list of cipher suites
- * @param protocols list of protocols
- * @param msg exception message
- */
- private void checkClientStartFailure(String[] cipherSuites, String[] protocols, String msg) {
- this.cipherSuites = F.isEmpty(cipherSuites) ? null : cipherSuites;
- this.protocols = F.isEmpty(protocols) ? null : protocols;
-
- GridTestUtils.assertThrows(
- null,
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- GridClient client = GridClientFactory.start(getClientConfiguration());
-
- client.compute().refreshTopology(false, false);
-
- return null;
- }
- },
- GridClientException.class,
- msg
- );
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStringLengthTask.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStringLengthTask.java
deleted file mode 100644
index f7409d43500..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientStringLengthTask.java
+++ /dev/null
@@ -1,77 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeJobResultPolicy;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-
-import static org.apache.ignite.compute.ComputeJobResultPolicy.FAILOVER;
-import static org.apache.ignite.compute.ComputeJobResultPolicy.WAIT;
-
-/**
- * Test task calculate length of the string passed in the argument.
- * <p>
- * The argument of the task is a simple string to calculate length of.
- */
-public class ClientStringLengthTask extends ComputeTaskSplitAdapter<String, Integer> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>();
-
- if (arg != null)
- for (final Object val : arg.split(""))
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(5);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
-
- return val == null ? 0 : val.toString().length();
- }
- });
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- for (ComputeJobResult res : results)
- sum += res.<Integer>getData();
-
- return sum;
- }
-
- /** {@inheritDoc} */
- @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
- if (res.getException() != null)
- return FAILOVER;
-
- return WAIT;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpMultiThreadedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpMultiThreadedSelfTest.java
deleted file mode 100644
index 26eabca32d0..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,46 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-
-/**
- * Runs multi-threaded tests on tcp binary protocol (ssl is disabled).
- */
-public class ClientTcpMultiThreadedSelfTest extends ClientAbstractMultiThreadedSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + REST_TCP_PORT_BASE;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return null;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslAuthenticationSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslAuthenticationSelfTest.java
deleted file mode 100644
index 94dfeb13a9d..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslAuthenticationSelfTest.java
+++ /dev/null
@@ -1,272 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.net.ssl.X509TrustManager;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer;
-import org.apache.ignite.internal.client.impl.GridClientImpl;
-import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.ssl.SslContextFactory;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Tests
- */
-public class ClientTcpSslAuthenticationSelfTest extends GridCommonAbstractTest {
- /** REST TCP port. */
- private static final int REST_TCP_PORT = 12121;
-
- /** Test trust manager for server. */
- private MockX509TrustManager srvTrustMgr = new MockX509TrustManager();
-
- /** Test trust manager for client. */
- private MockX509TrustManager clientTrustMgr = new MockX509TrustManager();
-
- /** Whether server should check clients. */
- private volatile boolean checkClient;
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- assertEquals(0, srvTrustMgr.serverCheckCallCount());
- assertEquals(0, clientTrustMgr.clientCheckCallCount());
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- srvTrustMgr.reset();
- clientTrustMgr.reset();
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
-
- c.setLocalHost(getTestResources().getLocalHost());
-
- assert c.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(REST_TCP_PORT);
- clientCfg.setSslEnabled(true);
-
- clientCfg.setSslClientAuth(checkClient);
- clientCfg.setSslClientAuth(checkClient);
-
- SslContextFactory factory = (SslContextFactory)GridTestUtils.sslFactory();
-
- factory.setTrustManagers(srvTrustMgr);
-
- clientCfg.setSslFactory(factory);
-
- c.setConnectorConfiguration(clientCfg);
-
- return c;
- }
-
- /**
- * Creates client that will try to connect to only first node in grid.
- *
- * @return Client.
- * @throws Exception If failed to create client.
- */
- private GridClientImpl createClient() throws Exception {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setServers(Arrays.asList(U.getLocalHost().getHostAddress() + ":" + REST_TCP_PORT));
- cfg.setBalancer(new GridClientRoundRobinBalancer());
-
- SslContextFactory factory = (SslContextFactory)GridTestUtils.sslFactory();
-
- factory.setTrustManagers(clientTrustMgr);
-
- cfg.setSslContextFactory(factory);
-
- return (GridClientImpl)GridClientFactory.start(cfg);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testServerAuthenticated() throws Exception {
- checkServerAuthenticatedByClient(false);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testServerNotAuthenticatedByClient() throws Exception {
- try {
- checkServerAuthenticatedByClient(true);
- }
- catch (GridClientDisconnectedException e) {
- assertTrue(X.hasCause(e, GridServerUnreachableException.class));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testClientAuthenticated() throws Exception {
- checkClientAuthenticatedByServer(false);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testClientNotAuthenticated() throws Exception {
- try {
- checkServerAuthenticatedByClient(true);
- }
- catch (GridClientDisconnectedException e) {
- assertTrue(X.hasCause(e, GridServerUnreachableException.class));
- }
- }
-
- /**
- * @param fail Should client trust manager fail.
- * @throws Exception If failed.
- */
- private void checkServerAuthenticatedByClient(boolean fail) throws Exception {
- checkClient = false;
- srvTrustMgr.shouldFail(false);
- clientTrustMgr.shouldFail(fail);
-
- startGrid();
-
- try {
- try (GridClientImpl c = createClient()) {
- c.compute().refreshTopology(false, false);
- }
- }
- finally {
- G.stopAll(false);
- }
-
- assertEquals(0, srvTrustMgr.clientCheckCallCount());
- assertEquals(1, clientTrustMgr.serverCheckCallCount());
- }
-
- /**
- * @param fail Should server trust manager fail.
- * @throws Exception If failed.
- */
- private void checkClientAuthenticatedByServer(boolean fail) throws Exception {
- checkClient = true;
- srvTrustMgr.shouldFail(fail);
- clientTrustMgr.shouldFail(false);
-
- startGrid();
-
- try {
- try (GridClientImpl c = createClient()) {
- c.compute().refreshTopology(false, false);
- }
- }
- finally {
- G.stopAll(false);
- }
-
- assertEquals(1, srvTrustMgr.clientCheckCallCount());
- assertEquals(1, clientTrustMgr.serverCheckCallCount());
- }
-
- /**
- * Test trust manager to emulate certificate check failures.
- */
- private static class MockX509TrustManager implements X509TrustManager {
- /** Empty array. */
- private static final X509Certificate[] EMPTY = new X509Certificate[0];
-
- /** Whether checks should fail. */
- private volatile boolean shouldFail;
-
- /** Client check call count. */
- private AtomicInteger clientCheckCallCnt = new AtomicInteger();
-
- /** Server check call count. */
- private AtomicInteger srvCheckCallCnt = new AtomicInteger();
-
- /**
- * @param shouldFail Whether checks should fail.
- */
- private void shouldFail(boolean shouldFail) {
- this.shouldFail = shouldFail;
- }
-
- /** {@inheritDoc} */
- @Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s)
- throws CertificateException {
- clientCheckCallCnt.incrementAndGet();
-
- if (shouldFail)
- throw new CertificateException("Client check failed.");
- }
-
- /** {@inheritDoc} */
- @Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s)
- throws CertificateException {
- srvCheckCallCnt.incrementAndGet();
-
- if (shouldFail)
- throw new CertificateException("Server check failed.");
- }
-
- /** {@inheritDoc} */
- @Override public X509Certificate[] getAcceptedIssuers() {
- return EMPTY;
- }
-
- /**
- * @return Call count to checkClientTrusted method.
- */
- public int clientCheckCallCount() {
- return clientCheckCallCnt.get();
- }
-
- /**
- * @return Call count to checkServerTrusted method.
- */
- public int serverCheckCallCount() {
- return srvCheckCallCnt.get();
- }
-
- /**
- * Clears should fail flag and resets call counters.
- */
- public void reset() {
- shouldFail = false;
- clientCheckCallCnt.set(0);
- srvCheckCallCnt.set(0);
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslMultiThreadedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslMultiThreadedSelfTest.java
deleted file mode 100644
index 1d9bd94afab..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpSslMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,47 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- * Runs multithreaded tests for client over tcp binary protocol with ssl enabled.
- */
-public class ClientTcpSslMultiThreadedSelfTest extends ClientAbstractMultiThreadedSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + REST_TCP_PORT_BASE;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
deleted file mode 100644
index 2302f09b4e5..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientTcpTaskExecutionAfterTopologyRestartSelfTest.java
+++ /dev/null
@@ -1,77 +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.
- */
-
-package org.apache.ignite.internal.client;
-
-import java.util.Collections;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Ensures
- */
-public class ClientTcpTaskExecutionAfterTopologyRestartSelfTest extends GridCommonAbstractTest {
- /** Port. */
- private static final int PORT = 11211;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setLocalHost("127.0.0.1");
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(PORT);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTaskAfterRestart() throws Exception {
- startGrids(1);
-
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setProtocol(GridClientProtocol.TCP);
- cfg.setServers(Collections.singleton("127.0.0.1:" + PORT));
-
- GridClient cli = GridClientFactory.start(cfg);
-
- cli.compute().execute(ClientTcpTask.class.getName(), Collections.singletonList("arg"));
-
- stopAllGrids();
-
- startGrid();
-
- cli.compute().execute(ClientTcpTask.class.getName(), Collections.singletonList("arg"));
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientComputeImplSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientComputeImplSelfTest.java
deleted file mode 100644
index 7a62a8ca677..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientComputeImplSelfTest.java
+++ /dev/null
@@ -1,182 +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.
- */
-
-package org.apache.ignite.internal.client.impl;
-
-import java.util.Collection;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientPredicate;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
-
-/**
- * Simple unit test for GridClientComputeImpl which checks method parameters.
- * It tests only those methods that can produce assertion underneath upon incorrect arguments.
- */
-public class ClientComputeImplSelfTest extends GridCommonAbstractTest {
- /** Mocked client compute. */
- private GridClientCompute compute = allocateInstance0(GridClientComputeImpl.class);
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testProjection_byGridClientNode() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.projection((GridClientNode)null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: node");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecute() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.execute(null, null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: taskName");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecuteAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.executeAsync(null, null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: taskName");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testAffinityExecute() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.affinityExecute(null, "cache", "key", null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: taskName");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testAffinityExecuteAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.affinityExecute(null, "cache", "key", null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: taskName");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNode() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.node(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: id");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNodesByIds() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.nodes((Collection<UUID>)null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: ids");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNodesByFilter() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.nodes((GridClientPredicate<GridClientNode>)null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: filter");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRefreshNodeById() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.refreshNode((UUID)null, false, false);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: id");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRefreshNodeByIdAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.refreshNodeAsync((UUID)null, false, false);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: id");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRefreshNodeByIp() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.refreshNode((String)null, false, false);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: ip");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRefreshNodeByIpAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return compute.refreshNode((String)null, false, false);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: ip");
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientDataImplSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientDataImplSelfTest.java
deleted file mode 100644
index cd9f4ecdb0a..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientDataImplSelfTest.java
+++ /dev/null
@@ -1,285 +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.
- */
-
-package org.apache.ignite.internal.client.impl;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.internal.client.GridClientData;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
-
-/**
- * Simple unit test for GridClientDataImpl which checks method parameters.
- */
-public class ClientDataImplSelfTest extends GridCommonAbstractTest {
- /** Mocked client data. */
- private GridClientData data = allocateInstance0(GridClientDataImpl.class);
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPut() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.put(null, "val");
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
-
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.put("key", null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: val");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPutAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.putAsync(null, "val");
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
-
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.putAsync("key", null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: val");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPutAll() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.putAll(null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: entries");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPutAllAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.putAllAsync(null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: entries");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGet() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.get(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.getAsync(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetAll() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.getAll(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: keys");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetAllAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.getAllAsync(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: keys");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemove() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.remove(null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemoveAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.removeAsync(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemoveAll() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.removeAll(null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: keys");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemoveAllAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.removeAllAsync(null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: keys");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testReplace() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.replace(null, "val");
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
-
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.replace("key", null);
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: val");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testReplaceAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.replaceAsync(null, "val");
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
-
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.replaceAsync("key", null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: val");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCas() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- data.cas(null, "val1", "val2");
-
- return null;
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCasAsync() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.casAsync(null, "val1", "val2");
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testAffinity() throws Exception {
- assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return data.affinity(null);
- }
- }, NullPointerException.class, "Ouch! Argument cannot be null: key");
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientFutureAdapterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientFutureAdapterSelfTest.java
deleted file mode 100644
index 0fd0aeb6b2e..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientFutureAdapterSelfTest.java
+++ /dev/null
@@ -1,120 +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.
- */
-
-package org.apache.ignite.internal.client.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFuture;
-import org.apache.ignite.internal.client.GridClientFutureTimeoutException;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Grid client future implementation self test.
- */
-public class ClientFutureAdapterSelfTest extends GridCommonAbstractTest {
- /**
- * Test finished futures.
- */
- @Test
- public void testFinished() {
- GridClientFutureAdapter<Integer> fut = new GridClientFutureAdapter<>();
-
- assertFalse(fut.isDone());
-
- fut.onDone(0);
-
- assertTrue(fut.isDone());
- assertTrue(new GridClientFutureAdapter<>(0).isDone());
- assertTrue(new GridClientFutureAdapter<Integer>(new GridClientException("Test grid exception.")).isDone());
- assertTrue(new GridClientFutureAdapter<Integer>(new RuntimeException("Test runtime exception.")).isDone());
- }
-
- /**
- * Test chained futures behaviour.
- *
- * @throws org.apache.ignite.internal.client.GridClientException On any exception.
- */
- @Test
- public void testChains() throws GridClientException {
- // Synchronous notifications.
- testChains(1, 100);
- testChains(10, 10);
- testChains(100, 1);
- testChains(1000, 0);
- }
-
- /**
- * Test chained future in certain conditions.
- *
- * @param chainSize Futures chain size.
- * @param waitDelay Delay to wait each future in the chain becomes done.
- * @throws GridClientException In case of any exception
- */
- private void testChains(int chainSize, long waitDelay) throws GridClientException {
- /* Base future to chain from. */
- GridClientFutureAdapter<Integer> fut = new GridClientFutureAdapter<>();
-
- /* Collection of chained futures: fut->chained[0]->chained[1]->...->chained[chainSize - 1] */
- List<GridClientFutureAdapter<Integer>> chained = new ArrayList<>();
-
- GridClientFutureAdapter<Integer> cur = fut;
-
- for (int i = 0; i < chainSize; i++) {
- cur = cur.chain(new GridClientFutureCallback<Integer, Integer>() {
- @Override public Integer onComplete(GridClientFuture<Integer> f) throws GridClientException {
- assertTrue("Expects callback future is finished.", f.isDone());
-
- return f.get() + 1;
- }
- });
-
- chained.add(cur);
- }
-
- long start;
-
- /* Validate not-finished futures in chain. */
- for (GridClientFuture<Integer> f : chained) {
- assertFalse(f.isDone());
-
- start = System.currentTimeMillis();
-
- try {
- f.get(waitDelay, TimeUnit.MILLISECONDS);
-
- fail("Expects chained future not finished yet.");
- }
- catch (GridClientFutureTimeoutException ignore) {
- /* No op: expects chained future not finished yet. */
- }
-
- assertTrue(System.currentTimeMillis() - start >= waitDelay);
- }
-
- /* Calculate 'count' chained futures time consumption. */
- start = System.currentTimeMillis();
-
- fut.onDone(0);
- assertEquals("Check chain-based increment value.", chainSize, chained.get(chainSize - 1).get().intValue());
-
- info("Time consumption for " + chainSize + " chained futures: " + (System.currentTimeMillis() - start));
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPropertiesConfigurationSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPropertiesConfigurationSelfTest.java
deleted file mode 100644
index 43b5d207387..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientPropertiesConfigurationSelfTest.java
+++ /dev/null
@@ -1,248 +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.
- */
-
-package org.apache.ignite.internal.client.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.LineIterator;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientDataConfiguration;
-import org.apache.ignite.internal.client.GridClientPartitionAffinity;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.balancer.GridClientRandomBalancer;
-import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-import static org.apache.ignite.internal.client.GridClientConfiguration.DFLT_MAX_CONN_IDLE_TIME;
-import static org.apache.ignite.internal.client.GridClientConfiguration.DFLT_TOP_REFRESH_FREQ;
-
-/**
- * Properties-based configuration self test.
- */
-public class ClientPropertiesConfigurationSelfTest extends GridCommonAbstractTest {
- /**
- * Grid client spring configuration.
- */
- private static final URL GRID_CLIENT_SPRING_CONFIG;
-
- /**
- * Grid client properties-based configuration.
- */
- private static final URL GRID_CLIENT_CONFIG;
-
- /**
- *
- */
- static {
- GRID_CLIENT_SPRING_CONFIG =
- U.resolveIgniteUrl("/modules/clients/config/grid-client-spring-config.xml");
-
- GRID_CLIENT_CONFIG = U.resolveIgniteUrl("/modules/clients/config/grid-client-config.properties");
- }
-
- /**
- * Test client configuration loaded from the properties.
- *
- * @throws Exception In case of exception.
- */
- @Test
- public void testCreation() throws Exception {
- // Validate default configuration.
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setServers(Arrays.asList("localhost:11211"));
-
- validateConfig(0, cfg);
-
- // Validate default properties-based configuration.
- cfg = new GridClientConfiguration();
-
- cfg.setServers(Arrays.asList("localhost:11211"));
-
- validateConfig(0, cfg);
-
- // Validate loaded configuration.
- Properties props = loadProperties(1, GRID_CLIENT_CONFIG);
- validateConfig(0, new GridClientConfiguration(props));
-
- // Validate loaded configuration with changed key prefixes.
- Properties props2 = new Properties();
-
- for (Map.Entry<Object, Object> e : props.entrySet())
- props2.put("new." + e.getKey(), e.getValue());
-
- validateConfig(0, new GridClientConfiguration("new.ignite.client", props2));
- validateConfig(0, new GridClientConfiguration("new.ignite.client.", props2));
-
- // Validate loaded test configuration.
- File tmp = uncommentProperties(GRID_CLIENT_CONFIG);
-
- props = loadProperties(25, tmp.toURI().toURL());
- validateConfig(2, new GridClientConfiguration(props));
-
- // Validate loaded test configuration with changed key prefixes.
- props2 = new Properties();
-
- for (Map.Entry<Object, Object> e : props.entrySet())
- props2.put("new." + e.getKey(), e.getValue());
-
- validateConfig(2, new GridClientConfiguration("new.ignite.client", props2));
- validateConfig(2, new GridClientConfiguration("new.ignite.client.", props2));
-
- // Validate loaded test configuration with empty key prefixes.
- props2 = new Properties();
-
- for (Map.Entry<Object, Object> e : props.entrySet())
- props2.put(e.getKey().toString().replace("ignite.client.", ""), e.getValue());
-
- validateConfig(2, new GridClientConfiguration("", props2));
- validateConfig(2, new GridClientConfiguration(".", props2));
- }
-
- /**
- * Validate spring client configuration.
- *
- * @throws Exception In case of any exception.
- */
- @Test
- public void testSpringConfig() throws Exception {
- GridClientConfiguration cfg = new FileSystemXmlApplicationContext(
- GRID_CLIENT_SPRING_CONFIG.toString()).getBean(GridClientConfiguration.class);
-
- assertEquals(Arrays.asList("127.0.0.1:11211"), new ArrayList<>(cfg.getServers()));
- assertNull(cfg.getSecurityCredentialsProvider());
-
- Collection<GridClientDataConfiguration> dataCfgs = cfg.getDataConfigurations();
-
- assertEquals(1, dataCfgs.size());
-
- GridClientDataConfiguration dataCfg = dataCfgs.iterator().next();
-
- assertEquals("partitioned", dataCfg.getName());
-
- assertNotNull(dataCfg.getPinnedBalancer());
- assertEquals(GridClientRandomBalancer.class, dataCfg.getPinnedBalancer().getClass());
-
- assertNotNull(dataCfg.getAffinity());
- assertEquals(GridClientPartitionAffinity.class, dataCfg.getAffinity().getClass());
- }
-
- /**
- * Uncomment properties.
- *
- * @param url Source to uncomment client properties for.
- * @return Temporary file with uncommented client properties.
- * @throws IOException In case of IO exception.
- */
- private File uncommentProperties(URL url) throws IOException {
- InputStream in = url.openStream();
-
- assertNotNull(in);
-
- LineIterator it = IOUtils.lineIterator(in, "UTF-8");
- Collection<String> lines = new ArrayList<>();
-
- while (it.hasNext())
- lines.add(it.nextLine().replace("#ignite.client.", "ignite.client."));
-
- IgniteUtils.closeQuiet(in);
-
- File tmp = File.createTempFile(UUID.randomUUID().toString(), "properties");
-
- tmp.deleteOnExit();
-
- FileUtils.writeLines(tmp, lines);
-
- return tmp;
- }
-
- /**
- * Load properties from the url.
- *
- * @param expLoaded Expected number of loaded properties.
- * @param url URL to load properties from.
- * @return Loaded properties.
- * @throws IOException In case of IO exception.
- */
- private Properties loadProperties(int expLoaded, URL url) throws IOException {
- InputStream in = url.openStream();
-
- Properties props = new Properties();
-
- assertEquals(0, props.size());
-
- props.load(in);
-
- assertEquals(expLoaded, props.size());
-
- IgniteUtils.closeQuiet(in);
-
- return props;
- }
-
- /**
- * Validate loaded configuration.
- *
- * @param expDataCfgs Expected data configurations count.
- * @param cfg Client configuration to validate.
- */
- private void validateConfig(int expDataCfgs, GridClientConfiguration cfg) {
- assertEquals(GridClientRandomBalancer.class, cfg.getBalancer().getClass());
- assertEquals(10000, cfg.getConnectTimeout());
- assertEquals(null, cfg.getSecurityCredentialsProvider());
-
- assertEquals(expDataCfgs, cfg.getDataConfigurations().size());
-
- if (expDataCfgs == 2) {
- GridClientDataConfiguration nullCfg = cfg.getDataConfiguration(null);
-
- assertEquals(null, nullCfg.getName());
- assertEquals(null, nullCfg.getAffinity());
- assertEquals(GridClientRandomBalancer.class, nullCfg.getPinnedBalancer().getClass());
-
- GridClientDataConfiguration partCfg = cfg.getDataConfiguration("partitioned");
-
- assertEquals("partitioned", partCfg.getName());
- assertEquals(GridClientPartitionAffinity.class, partCfg.getAffinity().getClass());
- assertEquals(GridClientRoundRobinBalancer.class, partCfg.getPinnedBalancer().getClass());
- }
-
- assertEquals(DFLT_MAX_CONN_IDLE_TIME, cfg.getMaxConnectionIdleTime());
- assertEquals(GridClientProtocol.TCP, cfg.getProtocol());
- assertEquals(Arrays.asList("localhost:11211"), new ArrayList<>(cfg.getServers()));
- assertEquals(true, cfg.isEnableAttributesCache());
- assertEquals(true, cfg.isEnableMetricsCache());
- assertEquals(true, cfg.isTcpNoDelay());
- assertEquals(null, cfg.getSslContextFactory(), null);
- assertEquals(DFLT_TOP_REFRESH_FREQ, cfg.getTopologyRefreshFrequency());
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
deleted file mode 100644
index 8b72774df53..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractConnectivitySelfTest.java
+++ /dev/null
@@ -1,328 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.P1;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
-/**
- * Tests the REST client-server connectivity with various configurations.
- */
-public abstract class ClientAbstractConnectivitySelfTest extends GridCommonAbstractTest {
- /** */
- private static final String WILDCARD_IP = "0.0.0.0";
-
- /** */
- private static final String LOOPBACK_IP = "127.0.0.1";
-
- /**
- * @return IP addresses.
- * @throws Exception If failed.
- */
- private static IgniteBiTuple<Collection<String>, Collection<String>> getAllIps() throws Exception {
- return U.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"));
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- GridClientFactory.stopAll();
-
- G.stopAll(true);
- }
-
- /**
- * Starts a REST-enabled node.
- *
- * @param name Node name.
- * @param addr REST address (default if null).
- * @param port REST port (default if null).
- * @return Started node.
- * @throws Exception If case of configuration or startup error.
- */
- protected abstract Ignite startRestNode(String name, @Nullable String addr, @Nullable Integer port) throws Exception;
-
- /**
- * @return Default REST port.
- */
- protected abstract int defaultRestPort();
-
- /**
- * @return REST address attribute name.
- */
- protected abstract String restAddressAttributeName();
-
- /**
- * @return REST host name attribute name.
- */
- protected abstract String restHostNameAttributeName();
-
- /**
- * @return REST port attribute name.
- */
- protected abstract String restPortAttributeName();
-
- /**
- * @return REST protocol.
- */
- protected abstract GridClientProtocol protocol();
-
- /**
- * Starts a REST client.
- *
- * @param addr REST server address.
- * @param port REST server port.
- * @return A successfully started REST client.
- * @throws GridClientException If failed to start REST client.
- */
- protected GridClient startClient(String addr, int port) throws GridClientException {
- GridClientConfiguration cliCfg = new GridClientConfiguration();
- cliCfg.setServers(Collections.singleton(addr + ":" + port));
- cliCfg.setProtocol(protocol());
-
- return GridClientFactory.start(cliCfg);
- }
-
- /**
- * Tests correct behavior in case of 1 REST-enabled node
- * with default settings.
- *
- * @throws Exception If failed.
- */
- @Test
- public void testOneNodeDefaultHostAndPort() throws Exception {
- startRestNode("grid1", null, null);
-
- checkConnectivityByIp(LOOPBACK_IP, getAllIps());
-
- String extIp = F.find(U.allLocalIps(), null, new IpV4AddressPredicate());
-
- checkConnectivityByIp(extIp, getAllIps());
- }
-
- /**
- * Simple test of address list filtering.
- * @throws Exception If failed.
- */
- @Test
- public void testResolveReachableOneAddress() throws Exception {
- InetAddress addr = InetAddress.getByAddress(new byte[] {127, 0, 0, 1} );
-
- List<InetAddress> filtered = IgniteUtils.filterReachable(Collections.singletonList(addr));
-
- assertEquals(1, filtered.size());
- assertEquals(addr, filtered.get(0));
- }
-
- /**
- * Tests correct behavior in case of 1 REST-enabled node
- * with explicitly specified loopback address setting.
- *
- * @throws Exception If error occurs.
- */
- @Test
- public void testOneNodeLoopbackHost() throws Exception {
- startRestNode("grid1", LOOPBACK_IP, defaultRestPort());
-
- checkConnectivityByIp(LOOPBACK_IP, F.t((Collection<String>)Collections.singleton(LOOPBACK_IP),
- (Collection<String>)Collections.<String>emptySet()));
- }
-
- /**
- * Tests correct behavior in case of 1 REST-enabled node
- * with explicitly specified 0.0.0.0 address.
- *
- * @throws Exception If error occurs.
- */
- @Test
- public void testOneNodeZeroIpv4Address() throws Exception {
- startRestNode("grid1", WILDCARD_IP, defaultRestPort());
-
- Collection<String> addrs = new LinkedList<>();
-
- addrs.add(LOOPBACK_IP);
-
- Collection<String> nonLoopbackAddrs = U.allLocalIps();
-
- assertNotNull(nonLoopbackAddrs);
-
- addrs.addAll(F.view(nonLoopbackAddrs, new IpV4AddressPredicate()));
-
- // The client should be able to connect through all IPv4 addresses.
- for (String addr : addrs) {
- log.info("Trying address: " + addr);
-
- GridClient cli = startClient(addr, defaultRestPort());
-
- List<GridClientNode> nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(1, nodes.size());
-
- GridClientNode node = F.first(nodes);
-
- assertNotNull(node);
-
- assertEquals(getAllIps().get1(), node.attribute(restAddressAttributeName()));
- assertEquals(getAllIps().get2(), node.attribute(restHostNameAttributeName()));
-
- List<String> nodeAddrs = node.tcpAddresses();
-
- assertTrue(nodeAddrs.contains(LOOPBACK_IP));
- assertTrue(nodeAddrs.containsAll(addrs));
- }
- }
-
- /**
- * Tests correct behavior in case of 2 REST-enabled nodes with default
- * settings.
- *
- * @throws Exception If error occurs.
- */
- @Test
- public void testTwoNodesDefaultHostAndPort() throws Exception {
- startRestNode("grid1", null, null);
- startRestNode("grid2", null, null);
-
- GridClient cli = startClient(LOOPBACK_IP, defaultRestPort());
-
- List<GridClientNode> nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(2, nodes.size());
-
- assertTrue(nodes.stream().allMatch(node -> node.tcpAddresses().contains(LOOPBACK_IP)));
-
- GridTestUtils.assertOneToOne(
- nodes,
- new P1<GridClientNode>() {
- @Override public boolean apply(GridClientNode node) {
- try {
- return eqAddresses(getAllIps(), node) &&
- Integer.valueOf(defaultRestPort()).equals(node.attribute(restPortAttributeName()));
- }
- catch (Exception ignored) {
- return false;
- }
- }
- },
- new P1<GridClientNode>() {
- @Override public boolean apply(GridClientNode node) {
- try {
- return eqAddresses(getAllIps(), node) &&
- Integer.valueOf(defaultRestPort() + 1).equals(node.attribute(restPortAttributeName()));
- }
- catch (Exception ignored) {
- return false;
- }
- }
- }
- );
- }
-
- /**
- * Tests correct behavior in case of shutdown node used to refresh topology state.
- *
- * @throws Exception If error occurs.
- */
- @Test
- public void testRefreshTopologyOnNodeLeft() throws Exception {
- startRestNode("grid1", null, null);
- startRestNode("grid2", null, null);
-
- GridClient cli = startClient(LOOPBACK_IP, defaultRestPort());
-
- List<GridClientNode> nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(2, nodes.size());
-
- stopGrid("grid1");
-
- nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(1, nodes.size());
-
- startRestNode("grid3", null, null);
-
- nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(2, nodes.size());
-
- stopGrid("grid2");
-
- nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(1, nodes.size());
- }
-
- /**
- * @param connectIp IP to test.
- * @param nodeIp Expected IP reported to client.
- * @throws GridClientException If failed.
- */
- private void checkConnectivityByIp(String connectIp, IgniteBiTuple<Collection<String>, Collection<String>> nodeIp)
- throws GridClientException {
- GridClient cli = startClient(connectIp, defaultRestPort());
-
- List<GridClientNode> nodes = cli.compute().refreshTopology(true, false);
-
- assertEquals(1, nodes.size());
-
- GridClientNode node = F.first(nodes);
-
- assertNotNull(node);
- assertTrue(eqAddresses(nodeIp, node));
- }
-
- /**
- * @param nodeIp Node ip.
- * @param node Node.
- * @return {@code True} if addresses are equal, {@code false} otherwise.
- */
- private boolean eqAddresses(IgniteBiTuple<Collection<String>, Collection<String>> nodeIp, GridClientNode node) {
- return F.eqOrdered(nodeIp.get1(), (Collection<String>)(node.attribute(restAddressAttributeName()))) &&
- F.eqOrdered(nodeIp.get2(), (Collection<String>)(node.attribute(restHostNameAttributeName())));
- }
-
- /**
- * Predicate that returns IPv4 address strings.
- */
- private static class IpV4AddressPredicate implements P1<String> {
- /** {@inheritDoc} */
- @Override public boolean apply(String s) {
- return s.matches("\\d+\\.\\d+\\.\\d+\\.\\d+");
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
deleted file mode 100644
index 67a591b4bb4..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
+++ /dev/null
@@ -1,488 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-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.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientDataConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientPartitionAffinity;
-import org.apache.ignite.internal.client.GridClientPredicate;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.GridClientTopologyListener;
-import org.apache.ignite.internal.client.balancer.GridClientLoadBalancer;
-import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer;
-import org.apache.ignite.internal.managers.communication.GridIoMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersionable;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.spi.IgniteSpiException;
-import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Tests basic client behavior with multiple nodes.
- */
-public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstractTest {
- /** Partitioned cache name. */
- private static final String PARTITIONED_CACHE_NAME = "partitioned";
-
- /** Replicated cache name. */
- private static final String REPLICATED_CACHE_NAME = "replicated";
-
- /** Replicated async cache name. */
- private static final String REPLICATED_ASYNC_CACHE_NAME = "replicated_async";
-
- /** Nodes count. */
- public static final int NODES_CNT = 5;
-
- /**
- * Topology update frequency.
- * Set it longer than router's, so we wouldn't receive failures
- * caused only by obsolete topology on router.
- */
- static final int TOP_REFRESH_FREQ = 2500;
-
- /** Path to jetty config. */
- public static final String REST_JETTY_CFG = "modules/clients/src/test/resources/jetty/rest-jetty.xml";
-
- /** Path to jetty config with SSl enabled. */
- public static final String REST_JETTY_SSL_CFG = "modules/clients/src/test/resources/jetty/rest-jetty-ssl.xml";
-
- /** Host. */
- public static final String HOST = "127.0.0.1";
-
- /** Base for tcp rest ports. */
- public static final int REST_TCP_PORT_BASE = 12345;
-
- /** Base for http rest ports, defined in {@link #REST_JETTY_CFG}. */
- public static final int REST_HTTP_PORT_BASE = 11080;
-
- /** Base for https rest ports, defined in {@link #REST_JETTY_SSL_CFG}. */
- public static final int REST_HTTPS_PORT_BASE = 11443;
-
- /** */
- private static volatile boolean commSpiEnabled;
-
- /** Flag to enable REST in node configuration. */
- private boolean restEnabled = true;
-
- /** Client instance for each test. */
- private GridClient client;
-
- /**
- * @return Client protocol that should be used.
- */
- protected abstract GridClientProtocol protocol();
-
- /**
- * @return Server address to create first connection.
- */
- protected abstract String serverAddress();
-
- /**
- * @return SSL context factory to use if SSL or {@code null} to disable SSL usage.
- */
- @Nullable protected Factory<SSLContext> sslContextFactory() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
-
- c.setLocalHost(HOST);
-
- assert c.getConnectorConfiguration() == null;
-
- if (restEnabled) {
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(REST_TCP_PORT_BASE);
-
- Factory<SSLContext> sslCtxFactory = sslContextFactory();
-
- if (sslCtxFactory != null) {
- clientCfg.setSslEnabled(true);
- clientCfg.setSslFactory(sslCtxFactory);
- }
-
- c.setConnectorConfiguration(clientCfg);
- }
-
- TestCommunicationSpi spi = new TestCommunicationSpi();
-
- spi.setLocalPort(GridTestUtils.getNextCommPort(getClass()));
-
- c.setCommunicationSpi(spi);
-
- CacheConfiguration<?, ?> ccfg1 = defaultCacheConfiguration()
- .setName(PARTITIONED_CACHE_NAME)
- .setCacheMode(PARTITIONED)
- .setBackups(0);
-
- CacheConfiguration<?, ?> ccfg2 = defaultCacheConfiguration()
- .setName(REPLICATED_CACHE_NAME)
- .setCacheMode(REPLICATED);
-
- CacheConfiguration<?, ?> ccfg3 = defaultCacheConfiguration()
- .setName(REPLICATED_ASYNC_CACHE_NAME)
- .setCacheMode(REPLICATED)
- .setWriteSynchronizationMode(FULL_ASYNC);
-
- c.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
-
- c.setPublicThreadPoolSize(40);
-
- c.setSystemThreadPoolSize(40);
-
- return c;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(NODES_CNT);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- client = GridClientFactory.start(clientConfiguration());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- if (client != null) {
- GridClientFactory.stop(client.id(), false);
-
- client = null;
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testEmptyProjections() throws Exception {
- final GridClientCompute dflt = client.compute();
-
- Collection<? extends GridClientNode> nodes = dflt.nodes();
-
- assertEquals(NODES_CNT, nodes.size());
-
- Iterator<? extends GridClientNode> iter = nodes.iterator();
-
- final GridClientCompute singleNodePrj = dflt.projection(Collections.singletonList(iter.next()));
-
- final GridClientNode second = iter.next();
-
- final GridClientPredicate<GridClientNode> targetFilter = new GridClientPredicate<GridClientNode>() {
- @Override public boolean apply(GridClientNode node) {
- return node.nodeId().equals(second.nodeId());
- }
- };
-
- GridTestUtils.assertThrows(log(), new Callable<Object>() {
- @Override public Object call() throws Exception {
- return singleNodePrj.projection(second);
- }
- }, GridClientException.class, null);
-
- GridTestUtils.assertThrows(log(), new Callable<Object>() {
- @Override public Object call() throws Exception {
- return singleNodePrj.projection(targetFilter);
- }
- }, GridClientException.class, null);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testProjectionRun() throws Exception {
- GridClientCompute dflt = client.compute();
-
- Collection<? extends GridClientNode> nodes = dflt.nodes();
-
- assertEquals(NODES_CNT, nodes.size());
-
- for (int i = 0; i < NODES_CNT; i++) {
- Ignite g = grid(i);
-
- assert g != null;
-
- GridClientNode clientNode = dflt.node(g.cluster().localNode().id());
-
- assertNotNull("Client node for " + g.cluster().localNode().id() + " was not found", clientNode);
-
- GridClientCompute prj = dflt.projection(clientNode);
-
- String res = prj.execute(TestTask.class.getName(), null);
-
- assertNotNull(res);
-
- assertEquals(g.cluster().localNode().id().toString(), res);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTopologyListener() throws Exception {
- final Collection<UUID> added = new ArrayList<>(1);
- final Collection<UUID> rmvd = new ArrayList<>(1);
-
- final CountDownLatch addedLatch = new CountDownLatch(1);
- final CountDownLatch rmvLatch = new CountDownLatch(1);
-
- assertEquals(NODES_CNT, client.compute().refreshTopology(false, false).size());
-
- GridClientTopologyListener lsnr = new GridClientTopologyListener() {
- @Override public void onNodeAdded(GridClientNode node) {
- added.add(node.nodeId());
-
- addedLatch.countDown();
- }
-
- @Override public void onNodeRemoved(GridClientNode node) {
- rmvd.add(node.nodeId());
-
- rmvLatch.countDown();
- }
- };
-
- client.addTopologyListener(lsnr);
-
- try {
- Ignite g = startGrid(NODES_CNT + 1);
-
- UUID id = g.cluster().localNode().id();
-
- assertTrue(addedLatch.await(2 * TOP_REFRESH_FREQ, MILLISECONDS));
-
- assertEquals(1, added.size());
- assertEquals(id, F.first(added));
-
- stopGrid(NODES_CNT + 1);
-
- assertTrue(rmvLatch.await(2 * TOP_REFRESH_FREQ, MILLISECONDS));
-
- assertEquals(1, rmvd.size());
- assertEquals(id, F.first(rmvd));
- }
- finally {
- client.removeTopologyListener(lsnr);
-
- stopGrid(NODES_CNT + 1);
- }
- }
-
- /**
- * @return Client configuration for the test.
- */
- protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setBalancer(getBalancer());
-
- cfg.setTopologyRefreshFrequency(TOP_REFRESH_FREQ);
-
- cfg.setProtocol(protocol());
- cfg.setServers(Arrays.asList(serverAddress()));
- cfg.setSslContextFactory(sslContextFactory());
-
- GridClientDataConfiguration loc = new GridClientDataConfiguration();
-
- GridClientDataConfiguration partitioned = new GridClientDataConfiguration();
-
- partitioned.setName(PARTITIONED_CACHE_NAME);
- partitioned.setAffinity(new GridClientPartitionAffinity());
-
- GridClientDataConfiguration replicated = new GridClientDataConfiguration();
- replicated.setName(REPLICATED_CACHE_NAME);
-
- GridClientDataConfiguration replicatedAsync = new GridClientDataConfiguration();
- replicatedAsync.setName(REPLICATED_ASYNC_CACHE_NAME);
-
- cfg.setDataConfigurations(Arrays.asList(loc, partitioned, replicated, replicatedAsync));
-
- return cfg;
- }
-
- /**
- * Gets client load balancer.
- *
- * @return Load balancer.
- */
- protected GridClientLoadBalancer getBalancer() {
- return new GridClientRoundRobinBalancer();
- }
-
- /**
- * Test task. Returns a tuple in which first component is id of node that has split the task,
- * and second component is count of nodes that executed jobs.
- */
- private static class TestTask extends ComputeTaskSplitAdapter<Object, String> {
- /** */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Count of tasks this job was split to. */
- private int gridSize;
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>(gridSize);
-
- this.gridSize = gridSize;
-
- final String locNodeId = ignite.cluster().localNode().id().toString();
-
- for (int i = 0; i < gridSize; i++) {
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
-
- return new IgniteBiTuple<>(locNodeId, 1);
- }
- });
- }
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public String reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- String locNodeId = null;
-
- for (ComputeJobResult res : results) {
- IgniteBiTuple<String, Integer> part = res.getData();
-
- if (locNodeId == null)
- locNodeId = part.get1();
-
- Integer i = part.get2();
-
- if (i != null)
- sum += i;
- }
-
- assert gridSize == sum;
-
- return locNodeId;
- }
- }
-
- /**
- * Communication SPI which checks cache flags.
- */
- private static class TestCommunicationSpi extends TcpCommunicationSpi {
- /** {@inheritDoc} */
- @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
- throws IgniteSpiException {
- checkSyncFlags((GridIoMessage)msg);
-
- super.sendMessage(node, msg, ackC);
- }
-
- /**
- * Check if flags in correct state.
- *
- * @param msg Message.
- */
- private void checkSyncFlags(GridIoMessage msg) {
- if (!commSpiEnabled)
- return;
-
- Object o = msg.message();
-
- if (!(o instanceof GridDistributedLockRequest))
- return;
-
- IgniteKernal g = (IgniteKernal)G.ignite(ignite.configuration().getNodeId());
-
- GridCacheContext<Object, Object> cacheCtx = g.internalCache(REPLICATED_ASYNC_CACHE_NAME).context();
-
- IgniteTxManager tm = cacheCtx.tm();
-
- GridCacheVersion v = ((GridCacheVersionable)o).version();
-
- IgniteInternalTx t = tm.tx(v);
-
- if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject("x1"))))
- assertEquals("Invalid tx flags: " + t, FULL_ASYNC, ((IgniteTxLocalAdapter)t).syncMode());
- else if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject("x2"))))
- assertEquals("Invalid tx flags: " + t, FULL_SYNC, ((IgniteTxLocalAdapter)t).syncMode());
- else if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject("x3"))))
- assertEquals("Invalid tx flags: " + t, FULL_ASYNC, ((IgniteTxLocalAdapter)t).syncMode());
- else if (t.hasWriteKey(cacheCtx.txKey(cacheCtx.toCacheKeyObject("x4"))))
- assertEquals("Invalid tx flags: " + t, FULL_SYNC, ((IgniteTxLocalAdapter)t).syncMode());
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
deleted file mode 100644
index 8be7ef8b664..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
+++ /dev/null
@@ -1,733 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.cache.Cache;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.ConnectorMessageInterceptor;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientClosedException;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientData;
-import org.apache.ignite.internal.client.GridClientDataConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientFuture;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientPredicate;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.GridServerUnreachableException;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-
-/**
- * Tests for Java client.
- */
-@SuppressWarnings("deprecation")
-public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
- /** */
- private static final String REPLICATED_CACHE_NAME = "replicated";
-
- /** */
- private static final String PARTITIONED_CACHE_NAME = "partitioned";
-
- /** */
- public static final String HOST = "127.0.0.1";
-
- /** */
- public static final int JETTY_PORT = 8080;
-
- /** */
- public static final int BINARY_PORT = 11212;
-
- /** Path to jetty config. */
- public static final String REST_JETTY_CFG = "modules/clients/src/test/resources/jetty/rest-jetty.xml";
-
- /** Need to be static because configuration inits only once per class. */
- private static final ConcurrentMap<Object, Object> INTERCEPTED_OBJECTS = new ConcurrentHashMap<>();
-
- /** */
- private static final Map<String, HashMapStore> cacheStores = new HashMap<>();
-
- /** */
- public static final String ROUTER_LOG_CFG = "modules/core/src/test/config/log4j2-test.xml";
-
- /** */
- private static final String INTERCEPTED_SUF = "intercepted";
-
- /** */
- private static final String[] TASK_ARGS = new String[] {"executing", "test", "task"};
-
- /** Flag indicating whether intercepted objects should be overwritten. */
- private static volatile boolean overwriteIntercepted;
-
- /** */
- private ExecutorService exec;
-
- /** */
- protected GridClient client;
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- System.setProperty(IGNITE_JETTY_PORT, Integer.toString(JETTY_PORT));
-
- startGrid();
-
- System.clearProperty(IGNITE_JETTY_PORT);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- exec = Executors.newCachedThreadPool();
-
- client = client();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- U.shutdownNow(ClientAbstractSelfTest.class, exec, log);
-
- exec = null;
-
- if (client != null)
- GridClientFactory.stop(client.id(), true);
-
- client = null;
-
- synchronized (cacheStores) {
- for (HashMapStore cacheStore : cacheStores.values())
- cacheStore.map.clear();
- }
-
- grid().cache(PARTITIONED_CACHE_NAME).clear();
- grid().cache(REPLICATED_CACHE_NAME).clear();
-
- INTERCEPTED_OBJECTS.clear();
- }
-
- /**
- * Gets protocol which should be used in client connection.
- *
- * @return Protocol.
- */
- protected abstract GridClientProtocol protocol();
-
- /**
- * Gets server address to which client should connect.
- *
- * @return Server address in format "host:port".
- */
- protected abstract String serverAddress();
-
- /**
- * @return Whether SSL should be used in test.
- */
- protected abstract boolean useSsl();
-
- /**
- * @return SSL context factory used in test.
- */
- protected abstract Factory<SSLContext> sslContextFactory();
-
- /**
- * Get task name.
- *
- * @return Task name.
- */
- protected String getTaskName() {
- return TestTask.class.getName();
- }
-
- /**
- * @return name of the sleep task for current test.
- */
- protected String getSleepTaskName() {
- return SleepTestTask.class.getName();
- }
-
- /**
- * Get task argument.
- *
- * @return Task argument.
- */
- protected Object getTaskArgument() {
- return Arrays.asList(TASK_ARGS);
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setLocalHost(HOST);
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(BINARY_PORT);
-
- if (useSsl()) {
- clientCfg.setSslEnabled(true);
-
- clientCfg.setSslFactory(sslContextFactory());
- }
-
- cfg.setConnectorConfiguration(clientCfg);
-
- cfg.setCacheConfiguration(cacheConfiguration(REPLICATED_CACHE_NAME), cacheConfiguration(PARTITIONED_CACHE_NAME));
-
- clientCfg.setMessageInterceptor(new ConnectorMessageInterceptor() {
- /** {@inheritDoc} */
- @Override public Object onReceive(@Nullable Object obj) {
- if (obj != null)
- INTERCEPTED_OBJECTS.put(obj, obj);
-
- return overwriteIntercepted && obj instanceof String ?
- obj + INTERCEPTED_SUF : obj;
- }
-
- /** {@inheritDoc} */
- @Override public Object onSend(Object obj) {
- if (obj != null)
- INTERCEPTED_OBJECTS.put(obj, obj);
-
- return obj;
- }
- });
-
- return cfg;
- }
-
- /**
- * @param cacheName Cache name.
- * @return Cache configuration.
- * @throws Exception In case of error.
- */
- @SuppressWarnings("unchecked")
- private static CacheConfiguration cacheConfiguration(@NotNull final String cacheName) throws Exception {
- CacheConfiguration cfg = defaultCacheConfiguration();
-
- cfg.setCacheMode(REPLICATED_CACHE_NAME.equals(cacheName) ? REPLICATED : PARTITIONED);
- cfg.setName(cacheName);
-
- cfg.setCacheStoreFactory(new Factory<CacheStore>() {
- @Override public CacheStore create() {
- synchronized (cacheStores) {
- HashMapStore cacheStore = cacheStores.get(cacheName);
-
- if (cacheStore == null)
- cacheStores.put(cacheName, cacheStore = new HashMapStore());
-
- return cacheStore;
- }
- }
- });
-
- cfg.setWriteThrough(true);
- cfg.setReadThrough(true);
- cfg.setLoadPreviousValue(true);
-
- if (cfg.getCacheMode() == PARTITIONED)
- cfg.setBackups(1);
-
- return cfg;
- }
-
- /**
- * @return Client.
- * @throws GridClientException In case of error.
- */
- protected GridClient client() throws GridClientException {
- return GridClientFactory.start(clientConfiguration());
- }
-
- /**
- * @return Test client configuration.
- */
- protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
-
- GridClientDataConfiguration cache = new GridClientDataConfiguration();
-
- cache.setName(PARTITIONED_CACHE_NAME);
-
- cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
-
- cfg.setProtocol(protocol());
- cfg.setServers(Collections.singleton(serverAddress()));
-
- // Setting custom executor, to avoid failures on client shutdown.
- // And applying custom naming scheme to ease debugging.
- cfg.setExecutorService(Executors.newCachedThreadPool(new ThreadFactory() {
- private AtomicInteger cntr = new AtomicInteger();
-
- /** {@inheritDoc} */
- @Override public Thread newThread(Runnable r) {
- return new Thread(r, "client-worker-thread-" + cntr.getAndIncrement());
- }
- }));
-
- if (useSsl())
- cfg.setSslContextFactory(sslContextFactory());
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testConnectable() throws Exception {
- GridClient client = client();
-
- List<GridClientNode> nodes = client.compute().refreshTopology(false, false);
-
- assertTrue(F.first(nodes).connectable());
- }
-
- /**
- * Check async API methods don't generate exceptions.
- *
- * @throws Exception If failed.
- */
- @Test
- public void testNoAsyncExceptions() throws Exception {
- GridClient client = client();
-
- GridClientData data = client.data(PARTITIONED_CACHE_NAME);
- GridClientCompute compute = client.compute().projection(new GridClientPredicate<GridClientNode>() {
- @Override public boolean apply(GridClientNode e) {
- return false;
- }
- });
-
- Map<String, GridClientFuture<?>> futs = new LinkedHashMap<>();
-
- futs.put("exec", compute.executeAsync("taskName", "taskArg"));
- futs.put("affExec", compute.affinityExecuteAsync("taskName", "cacheName", "affKey", "taskArg"));
- futs.put("refreshById", compute.refreshNodeAsync(UUID.randomUUID(), true, true));
- futs.put("refreshByIP", compute.refreshNodeAsync("nodeIP", true, true));
- futs.put("refreshTop", compute.refreshTopologyAsync(true, true));
-
- GridClientFactory.stop(client.id(), false);
-
- futs.put("put", data.putAsync("key", "val"));
- futs.put("putAll", data.putAllAsync(F.asMap("key", "val")));
- futs.put("get", data.getAsync("key"));
- futs.put("getAll", data.getAllAsync(Collections.singletonList("key")));
- futs.put("remove", data.removeAsync("key"));
- futs.put("removeAll", data.removeAllAsync(Collections.singletonList("key")));
- futs.put("replace", data.replaceAsync("key", "val"));
- futs.put("cas", data.casAsync("key", "val", "val2"));
- futs.put("metrics", data.metricsAsync());
-
- for (Map.Entry<String, GridClientFuture<?>> e : futs.entrySet()) {
- try {
- e.getValue().get();
-
- info("Expects '" + e.getKey() + "' fails with grid client exception.");
- }
- catch (GridServerUnreachableException | GridClientClosedException ignore) {
- // No op: compute projection is empty.
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGracefulShutdown() throws Exception {
- GridClientCompute compute = client.compute();
-
- Object taskArg = getTaskArgument();
- String taskName = getSleepTaskName();
-
- GridClientFuture<Object> fut = compute.executeAsync(taskName, taskArg);
- GridClientFuture<Object> fut2 = compute.executeAsync(taskName, taskArg);
-
- GridClientFactory.stop(client.id(), true);
-
- Assert.assertEquals(17, fut.get());
- Assert.assertEquals(17, fut2.get());
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testForceShutdown() throws Exception {
- GridClientCompute compute = client.compute();
-
- Object taskArg = getTaskArgument();
- String taskName = getSleepTaskName();
-
- GridClientFuture<Object> fut = compute.executeAsync(taskName, taskArg);
-
- GridClientFactory.stop(client.id(), false);
-
- try {
- fut.get();
- }
- catch (GridClientClosedException ignored) {
- return;
- }
-
- Assert.fail("Expected GridClientClosedException.");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testShutdown() throws Exception {
- GridClient c = client();
-
- GridClientCompute compute = c.compute();
-
- String taskName = getTaskName();
- Object taskArg = getTaskArgument();
-
- Collection<GridClientFuture<Object>> futs = new ArrayList<>();
-
- // Validate connection works.
- compute.execute(taskName, taskArg);
-
- info(">>> First task executed successfully, running batch.");
-
- for (int i = 0; i < 10; i++)
- futs.add(compute.executeAsync(taskName, taskArg));
-
- // Stop client.
- GridClientFactory.stop(c.id(), true);
-
- info(">>> Completed stop request.");
-
- int failed = 0;
-
- for (GridClientFuture<Object> fut : futs) {
- try {
- assertEquals(17, fut.get());
- }
- catch (GridClientException e) {
- failed++;
-
- log.warning("Task execution failed.", e);
- }
- }
-
- assertEquals(0, failed);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecute() throws Exception {
- String taskName = getTaskName();
- Object taskArg = getTaskArgument();
-
- GridClientCompute compute = client.compute();
-
- assertEquals(Integer.valueOf(17), compute.execute(taskName, taskArg));
- assertEquals(Integer.valueOf(17), compute.executeAsync(taskName, taskArg).get());
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTopology() throws Exception {
- GridClientCompute compute = client.compute();
-
- List<GridClientNode> top = compute.refreshTopology(true, true);
-
- assertNotNull(top);
- assertEquals(1, top.size());
-
- GridClientNode node = F.first(top);
-
- assertNotNull(node);
- assertFalse(node.attributes().isEmpty());
- assertNotNull(node.tcpAddresses());
- assertEquals(grid().localNode().id(), node.nodeId());
- assertNotNull(node.metrics());
-
- top = compute.refreshTopology(false, false);
-
- node = F.first(top);
-
- assertNotNull(top);
- assertEquals(1, top.size());
- assertNull(node.metrics());
- assertTrue(node.attributes().isEmpty());
-
- node = F.first(top);
-
- assertNotNull(node);
- assertTrue(node.attributes().isEmpty());
- assertNull(node.metrics());
- assertNotNull(node.tcpAddresses());
- assertEquals(grid().localNode().id(), node.nodeId());
-
- top = compute.refreshTopologyAsync(true, true).get();
-
- assertNotNull(top);
- assertEquals(1, top.size());
-
- node = F.first(top);
-
- assertNotNull(node);
- assertFalse(node.attributes().isEmpty());
- assertNotNull(node.metrics());
- assertNotNull(node.tcpAddresses());
- assertEquals(grid().localNode().id(), node.nodeId());
-
- top = compute.refreshTopologyAsync(false, false).get();
-
- assertNotNull(top);
- assertEquals(1, top.size());
-
- node = F.first(top);
-
- assertNotNull(node);
- assertTrue(node.attributes().isEmpty());
- assertNull(node.metrics());
- assertNotNull(node.tcpAddresses());
- assertEquals(grid().localNode().id(), node.nodeId());
- }
-
- /**
- * Test task.
- */
- private static class TestTask extends ComputeTaskSplitAdapter<List<String>, Integer> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, List<String> list) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>();
-
- if (list != null)
- for (final String val : list)
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(1);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
-
- return val == null ? 0 : val.length();
- }
- });
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- for (ComputeJobResult res : results)
- sum += res.<Integer>getData();
-
- return sum;
- }
- }
-
- /**
- * Test task that sleeps 5 seconds.
- */
- private static class SleepTestTask extends ComputeTaskSplitAdapter<List<String>, Integer> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, List<String> list) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>();
-
- if (list != null)
- for (final String val : list)
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(5000);
-
- return val == null ? 0 : val.length();
- }
- catch (InterruptedException ignored) {
- return -1;
- }
- }
- });
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- for (ComputeJobResult res : results)
- sum += res.<Integer>getData();
-
- return sum;
- }
- }
-
- /** JSON to java mapper. */
- private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-
- /**
- * Http test task with restriction to string arguments only.
- */
- protected static class HttpTestTask extends ComputeTaskSplitAdapter<String, Integer> {
- /** */
- private final TestTask delegate = new TestTask();
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
- if (arg.endsWith("intercepted"))
- arg = arg.substring(0, arg.length() - 11);
-
- try {
- JsonNode json = JSON_MAPPER.readTree(arg);
-
- List<String> list = null;
-
- if (json.isArray()) {
- list = new ArrayList<>();
-
- for (JsonNode child : json)
- list.add(child.asText());
- }
-
- return delegate.split(gridSize, list);
- }
- catch (IOException e) {
- throw new IgniteException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- return delegate.reduce(results);
- }
- }
-
- /**
- * Http wrapper for sleep task.
- */
- protected static class SleepHttpTestTask extends ComputeTaskSplitAdapter<String, Integer> {
- /** */
- private final SleepTestTask delegate = new SleepTestTask();
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
- try {
- JsonNode json = JSON_MAPPER.readTree(arg);
-
- List<String> list = null;
-
- if (json.isArray()) {
- list = new ArrayList<>();
-
- for (JsonNode child : json)
- list.add(child.asText());
- }
-
- return delegate.split(gridSize, list);
- }
- catch (IOException e) {
- throw new IgniteException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- return delegate.reduce(results);
- }
- }
-
- /**
- * Simple HashMap based cache store emulation.
- */
- private static class HashMapStore extends CacheStoreAdapter<Object, Object> {
- /** Map for cache store. */
- private final Map<Object, Object> map = new HashMap<>();
-
- /** {@inheritDoc} */
- @Override public void loadCache(IgniteBiInClosure<Object, Object> clo, Object... args) {
- for (Map.Entry e : map.entrySet())
- clo.apply(e.getKey(), e.getValue());
- }
-
- /** {@inheritDoc} */
- @Override public Object load(Object key) {
- return map.get(key);
- }
-
- /** {@inheritDoc} */
- @Override public void write(Cache.Entry<?, ?> e) {
- map.put(e.getKey(), e.getValue());
- }
-
- /** {@inheritDoc} */
- @Override public void delete(Object key) {
- map.remove(key);
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientPreferDirectSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientPreferDirectSelfTest.java
deleted file mode 100644
index 07acf990220..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientPreferDirectSelfTest.java
+++ /dev/null
@@ -1,190 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.balancer.GridClientLoadBalancer;
-import org.apache.ignite.internal.client.balancer.GridClientRandomBalancer;
-import org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.internal.client.integration.ClientAbstractMultiNodeSelfTest.HOST;
-import static org.apache.ignite.internal.client.integration.ClientAbstractMultiNodeSelfTest.REST_TCP_PORT_BASE;
-import static org.apache.ignite.internal.client.integration.ClientAbstractMultiNodeSelfTest.TOP_REFRESH_FREQ;
-
-/**
- *
- */
-public class ClientPreferDirectSelfTest extends GridCommonAbstractTest {
- /** */
- private static final int NODES_CNT = 6;
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrids(NODES_CNT);
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
-
- c.setLocalHost(HOST);
-
- assert c.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(REST_TCP_PORT_BASE);
-
- c.setConnectorConfiguration(clientCfg);
-
- return c;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRandomBalancer() throws Exception {
- GridClientRandomBalancer b = new GridClientRandomBalancer();
-
- b.setPreferDirectNodes(true);
-
- executeTest(b);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRoundRobinBalancer() throws Exception {
- GridClientRoundRobinBalancer b = new GridClientRoundRobinBalancer();
-
- b.setPreferDirectNodes(true);
-
- executeTest(b);
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("TypeMayBeWeakened")
- private void executeTest(GridClientLoadBalancer b) throws Exception {
- try (GridClient c = client(b)) {
- Set<String> executions = new HashSet<>();
-
- for (int i = 0; i < NODES_CNT * 10; i++)
- executions.add(
- c.compute().<String>execute(TestTask.class.getName(), null));
-
- assertEquals(NODES_CNT / 2, executions.size());
-
- for (int i = 0; i < NODES_CNT / 2; i++)
- executions.contains(grid(i).localNode().id().toString());
- }
- }
-
- /**
- * @param b Balancer.
- * @return Client.
- * @throws Exception If failed.
- */
- private GridClient client(GridClientLoadBalancer b) throws Exception {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setBalancer(b);
-
- cfg.setTopologyRefreshFrequency(TOP_REFRESH_FREQ);
-
- Collection<String> rtrs = new ArrayList<>(3);
-
- for (int i = 0; i < NODES_CNT / 2; i++)
- rtrs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
-
- cfg.setRouters(rtrs);
-
- return GridClientFactory.start(cfg);
- }
-
- /**
- * Test task. Returns Id of the node that has split the task,
- */
- private static class TestTask extends ComputeTaskSplitAdapter<Object, String> {
- /** */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Count of tasks this job was split to. */
- private int gridSize;
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
- Collection<ComputeJobAdapter> jobs = new ArrayList<>(gridSize);
-
- this.gridSize = gridSize;
-
- for (int i = 0; i < gridSize; i++) {
- jobs.add(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(100);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
-
- return "OK";
- }
- });
- }
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Override public String reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- for (ComputeJobResult res : results) {
- assertNotNull(res.getData());
-
- sum += 1;
- }
-
- assert gridSize == sum;
-
- return ignite.cluster().localNode().id().toString();
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpConnectivitySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpConnectivitySelfTest.java
deleted file mode 100644
index be58295d337..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpConnectivitySelfTest.java
+++ /dev/null
@@ -1,76 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteNodeAttributes;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.util.typedef.G;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Tests the REST client-server TCP connectivity with various configurations.
- */
-public class ClientTcpConnectivitySelfTest extends ClientAbstractConnectivitySelfTest {
- /** {@inheritDoc} */
- @Override protected Ignite startRestNode(String name, @Nullable String addr, @Nullable Integer port)
- throws Exception {
- IgniteConfiguration cfg = getConfiguration(name);
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- if (addr != null)
- clientCfg.setHost(addr);
-
- if (port != null)
- clientCfg.setPort(port);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- return G.start(cfg);
- }
-
- /** {@inheritDoc} */
- @Override protected int defaultRestPort() {
- return IgniteConfiguration.DFLT_TCP_PORT;
- }
-
- /** {@inheritDoc} */
- @Override protected String restAddressAttributeName() {
- return IgniteNodeAttributes.ATTR_REST_TCP_ADDRS;
- }
-
- /** {@inheritDoc} */
- @Override protected String restHostNameAttributeName() {
- return IgniteNodeAttributes.ATTR_REST_TCP_HOST_NAMES;
- }
-
- /** {@inheritDoc} */
- @Override protected String restPortAttributeName() {
- return IgniteNodeAttributes.ATTR_REST_TCP_PORT;
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectMultiNodeSelfTest.java
deleted file mode 100644
index a9eeeaf4348..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectMultiNodeSelfTest.java
+++ /dev/null
@@ -1,58 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientProtocol;
-
-/**
- *
- */
-public class ClientTcpDirectMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- assert NODES_CNT > 3 : "Too few nodes to execute direct multinode test";
-
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
-
- Collection<String> srvs = new ArrayList<>(3);
-
- for (int i = 0; i < NODES_CNT / 2; i++)
- srvs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
-
- cfg.setRouters(srvs);
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectSelfTest.java
deleted file mode 100644
index 46561bd32e2..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpDirectSelfTest.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientProtocol;
-
-/**
- *
- */
-public class ClientTcpDirectSelfTest extends ClientAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
- cfg.setRouters(Collections.singleton(HOST + ":" + BINARY_PORT));
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpMultiNodeSelfTest.java
deleted file mode 100644
index cc4081aca1a..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpMultiNodeSelfTest.java
+++ /dev/null
@@ -1,35 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import org.apache.ignite.internal.client.GridClientProtocol;
-
-/**
- * Test for TCP binary rest protocol.
- */
-public class ClientTcpMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + REST_TCP_PORT_BASE;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSelfTest.java
deleted file mode 100644
index 97be4085f8f..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSelfTest.java
+++ /dev/null
@@ -1,47 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientProtocol;
-
-/**
- * Tests TCP protocol.
- */
-public class ClientTcpSelfTest extends ClientAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + BINARY_PORT;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return null;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectMultiNodeSelfTest.java
deleted file mode 100644
index ac7b4bf73cd..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectMultiNodeSelfTest.java
+++ /dev/null
@@ -1,66 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class ClientTcpSslDirectMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- assert NODES_CNT > 3 : "Too few nodes to execute direct multinode test";
-
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
-
- Collection<String> srvs = new ArrayList<>(3);
-
- for (int i = 0; i < NODES_CNT / 2; i++)
- srvs.add(HOST + ':' + (REST_TCP_PORT_BASE + i));
-
- cfg.setRouters(srvs);
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectSelfTest.java
deleted file mode 100644
index 48707963d8d..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslDirectSelfTest.java
+++ /dev/null
@@ -1,61 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class ClientTcpSslDirectSelfTest extends ClientAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
- cfg.setRouters(Collections.singleton(HOST + ":" + BINARY_PORT));
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslMultiNodeSelfTest.java
deleted file mode 100644
index 939f413a985..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslMultiNodeSelfTest.java
+++ /dev/null
@@ -1,43 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- * Tests binary tcp protocol with SSL on multiple nodes.
- */
-public class ClientTcpSslMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + REST_TCP_PORT_BASE;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslSelfTest.java
deleted file mode 100644
index 7a094ff86d1..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpSslSelfTest.java
+++ /dev/null
@@ -1,48 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- * Tests TCP binary protocol with client when SSL is enabled.
- */
-public class ClientTcpSslSelfTest extends ClientAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return HOST + ":" + BINARY_PORT;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
deleted file mode 100644
index 086a7255d29..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
+++ /dev/null
@@ -1,146 +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.
- */
-
-package org.apache.ignite.internal.client.integration;
-
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.internal.client.GridClientCacheMode;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientNodeMetrics;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.GridClientTopologyListener;
-import org.apache.ignite.internal.client.balancer.GridClientLoadBalancer;
-import org.apache.ignite.internal.util.typedef.F;
-
-/**
- * Test for TCP binary rest protocol with unreachable address.
- */
-public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSelfTest {
- /** {@inheritDoc} */
- @Override protected GridClientLoadBalancer getBalancer() {
- final GridClientLoadBalancer b = super.getBalancer();
-
- return new TestGridClientLoadBalancer(b);
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = super.clientConfiguration();
-
- // Setting low connection timeout to allow multiple threads
- // pass the unavailable address quickly.
- cfg.setConnectTimeout(100);
-
- return cfg;
- }
-
- /**
- *
- */
- private class TestGridClientLoadBalancer implements GridClientLoadBalancer, GridClientTopologyListener {
- /** */
- private final GridClientLoadBalancer b;
-
- /**
- * @param b Delegating balancer.
- */
- TestGridClientLoadBalancer(GridClientLoadBalancer b) {
- this.b = b;
- }
-
- /** {@inheritDoc} */
- @Override public GridClientNode balancedNode(Collection<? extends GridClientNode> nodes)
- throws GridClientException {
- final GridClientNode node = b.balancedNode(nodes);
-
- return new GridClientNode() {
- @Override public <T> T attribute(String name) {
- return node.attribute(name);
- }
-
- @Override public Map<String, Object> attributes() {
- return node.attributes();
- }
-
- @Override public Collection<InetSocketAddress> availableAddresses(GridClientProtocol proto,
- boolean filterResolved) {
- // Fake address first.
- return F.asList(new InetSocketAddress("172.22.13.13", 65432),
- F.first(node.availableAddresses(proto, filterResolved)));
- }
-
- @Override public Map<String, GridClientCacheMode> caches() {
- return node.caches();
- }
-
- @Override public List<String> tcpAddresses() {
- return node.tcpAddresses();
- }
-
- @Override public List<String> tcpHostNames() {
- return node.tcpHostNames();
- }
-
- @Override public GridClientNodeMetrics metrics() {
- return node.metrics();
- }
-
- @Override public UUID nodeId() {
- return node.nodeId();
- }
-
- @Override public Object consistentId() {
- return node.consistentId();
- }
-
- @Override public int tcpPort() {
- return node.tcpPort();
- }
-
- @Override public boolean connectable() {
- return node.connectable();
- }
-
- @Override public long order() {
- return node.order();
- }
-
- @Override public boolean isClient() {
- return node.isClient();
- }
- };
- }
-
- /** {@inheritDoc} */
- @Override public void onNodeAdded(GridClientNode node) {
- if (b instanceof GridClientTopologyListener)
- ((GridClientTopologyListener)b).onNodeAdded(node);
- }
-
- /** {@inheritDoc} */
- @Override public void onNodeRemoved(GridClientNode node) {
- if (b instanceof GridClientTopologyListener)
- ((GridClientTopologyListener)b).onNodeRemoved(node);
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/ClientFailedInitSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/ClientFailedInitSelfTest.java
deleted file mode 100644
index 96bcad5f527..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/ClientFailedInitSelfTest.java
+++ /dev/null
@@ -1,284 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientDisconnectedException;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.GridServerUnreachableException;
-import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
-import static org.apache.ignite.internal.client.GridClientProtocol.TCP;
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.BINARY_PORT;
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.HOST;
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.JETTY_PORT;
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.REST_JETTY_CFG;
-
-/**
- *
- */
-public class ClientFailedInitSelfTest extends GridCommonAbstractTest {
- /** */
- private static final int RECONN_CNT = 3;
-
- /** */
- private static final long TOP_REFRESH_PERIOD = 5000;
-
- /** */
- private static final int ROUTER_BINARY_PORT = BINARY_PORT + 1;
-
- /** */
- private static final int ROUTER_JETTY_PORT = 8081;
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- GridClientFactory.stopAll();
- GridRouterFactory.stopAllRouters();
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- assert cfg.getConnectorConfiguration() == null;
-
- cfg.setLocalHost(HOST);
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(BINARY_PORT);
- clientCfg.setJettyPath(REST_JETTY_CFG);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- return cfg;
- }
-
- /**
- *
- */
- @Test
- public void testEmptyAddresses() {
- try {
- GridClientFactory.start(new GridClientConfiguration());
-
- assert false;
- }
- catch (GridClientException e) {
- info("Caught expected exception: " + e);
- }
- }
-
- /**
- *
- */
- @Test
- public void testRoutersAndServersAddressesProvided() {
- try {
- GridClientConfiguration c = new GridClientConfiguration();
-
- c.setRouters(Collections.singleton("127.0.0.1:10000"));
- c.setServers(Collections.singleton("127.0.0.1:10000"));
-
- GridClientFactory.start(c);
-
- assert false;
- }
- catch (GridClientException e) {
- info("Caught expected exception: " + e);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTcpClient() throws Exception {
- doTestClient(TCP);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTcpRouter() throws Exception {
- doTestRouter(TCP);
- }
-
- /**
- * @param p Protocol.
- * @throws Exception If failed.
- */
- @SuppressWarnings("BusyWait")
- private void doTestClient(GridClientProtocol p) throws Exception {
- GridClient c = client(p, false);
-
- for (int i = 0; i < RECONN_CNT; i++) {
- try {
- c.compute().nodes();
- }
- catch (GridClientDisconnectedException e) {
- assertTrue(X.hasCause(e,
- GridServerUnreachableException.class, GridClientConnectionResetException.class));
- }
-
- startGrid();
-
- try {
- Thread.sleep(TOP_REFRESH_PERIOD * 2);
-
- c.compute().nodes();
-
- assertEquals("arg", c.compute().execute(TestTask.class.getName(), "arg"));
- }
- finally {
- stopGrid();
- }
-
- Thread.sleep(TOP_REFRESH_PERIOD * 2);
- }
- }
-
- /**
- * @param p Protocol.
- * @throws Exception If failed.
- */
- @SuppressWarnings("BusyWait")
- private void doTestRouter(GridClientProtocol p) throws Exception {
- startRouters();
-
- GridClient c = client(p, true);
-
- for (int i = 0; i < RECONN_CNT; i++) {
- try {
- c.compute().nodes();
-
- fail("Nodes list should fail while grid is stopped.");
- }
- catch (GridClientDisconnectedException e) {
- assertTrue(X.hasCause(e, GridClientException.class));
- }
-
- startGrid();
-
- try {
- Thread.sleep(TOP_REFRESH_PERIOD * 2);
-
- c.compute().nodes();
-
- assertEquals("arg", c.compute().execute(TestTask.class.getName(), "arg"));
- }
- finally {
- stopGrid();
- }
-
- Thread.sleep(TOP_REFRESH_PERIOD * 2);
- }
- }
-
- /**
- * @return Grid.
- * @throws Exception If failed.
- */
- @Override protected IgniteEx startGrid() throws Exception {
- System.setProperty(IGNITE_JETTY_PORT, Integer.toString(JETTY_PORT));
-
- try {
- return super.startGrid();
- }
- finally {
- System.clearProperty(IGNITE_JETTY_PORT);
- }
- }
-
- /**
- * Starts router.
- * @throws IgniteCheckedException If failed.
- */
- private void startRouters() throws IgniteCheckedException {
- GridTcpRouterConfiguration tcpCfg = new GridTcpRouterConfiguration();
-
- tcpCfg.setHost(HOST);
- tcpCfg.setPort(ROUTER_BINARY_PORT);
- tcpCfg.setPortRange(0);
- tcpCfg.setServers(Collections.singleton(HOST + ":" + BINARY_PORT));
-
- GridRouterFactory.startTcpRouter(tcpCfg);
- }
-
- /**
- * @param p Protocol.
- * @param useRouter Use router flag.
- * @return Client instance.
- * @throws GridClientException If failed.
- */
- private GridClient client(GridClientProtocol p, boolean useRouter) throws GridClientException {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- int port = p == TCP ?
- (useRouter ? ROUTER_BINARY_PORT : BINARY_PORT) :
- (useRouter ? ROUTER_JETTY_PORT : JETTY_PORT);
-
- cfg.setProtocol(p);
- cfg.setServers(Arrays.asList(HOST + ":" + port));
- cfg.setTopologyRefreshFrequency(TOP_REFRESH_PERIOD);
-
- return GridClientFactory.start(cfg);
- }
-
- /**
- * Test task.
- */
- private static class TestTask extends ComputeTaskSplitAdapter<String, String> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, final String arg) {
- return Collections.singleton(new ComputeJobAdapter() {
- @Override public String execute() {
- return arg;
- }
- });
- }
-
- /** {@inheritDoc} */
- @Override public String reduce(List<ComputeJobResult> results) {
- assertEquals(1, results.size());
-
- return results.get(0).getData();
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/RouterFactorySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/RouterFactorySelfTest.java
deleted file mode 100644
index b0dae0ee8f4..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/RouterFactorySelfTest.java
+++ /dev/null
@@ -1,109 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
-
-/**
- * Test routers factory.
- */
-public class RouterFactorySelfTest extends GridCommonAbstractTest {
- /** */
- private static final int GRID_HTTP_PORT = 11087;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
- discoSpi.setIpFinder(sharedStaticIpFinder);
-
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- cfg.setDiscoverySpi(discoSpi);
- cfg.setIgniteInstanceName(igniteInstanceName);
-
- return cfg;
- }
-
- /**
- * Test router's start/stop.
- *
- * @throws Exception In case of any exception.
- */
- @Test
- public void testRouterFactory() throws Exception {
- try {
- System.setProperty(IGNITE_JETTY_PORT, String.valueOf(GRID_HTTP_PORT));
-
- try {
- startGrid();
- }
- finally {
- System.clearProperty(IGNITE_JETTY_PORT);
- }
-
- final int size = 20;
- final Collection<GridTcpRouter> tcpRouters = new ArrayList<>(size);
- final GridTcpRouterConfiguration tcpCfg = new GridTcpRouterConfiguration();
-
- tcpCfg.setPortRange(size);
-
- for (int i = 0; i < size; i++)
- tcpRouters.add(GridRouterFactory.startTcpRouter(tcpCfg));
-
- for (GridTcpRouter tcpRouter : tcpRouters) {
- assertEquals(tcpCfg, tcpRouter.configuration());
- assertEquals(tcpRouter, GridRouterFactory.tcpRouter(tcpRouter.id()));
- }
-
- assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
- new HashSet<>(GridRouterFactory.allTcpRouters()));
-
- for (Iterator<GridTcpRouter> it = tcpRouters.iterator(); it.hasNext(); ) {
- GridTcpRouter tcpRouter = it.next();
-
- assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
- new HashSet<>(GridRouterFactory.allTcpRouters()));
-
- it.remove();
-
- GridRouterFactory.stopTcpRouter(tcpRouter.id());
-
- assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
- new HashSet<>(GridRouterFactory.allTcpRouters()));
- }
-
- assertEquals(Collections.<GridTcpRouter>emptyList(), GridRouterFactory.allTcpRouters());
- }
- finally {
- GridRouterFactory.stopAllRouters();
-
- stopAllGrids();
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterAbstractSelfTest.java
deleted file mode 100644
index 3e6de6dd6e3..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterAbstractSelfTest.java
+++ /dev/null
@@ -1,129 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientNode;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.integration.ClientAbstractSelfTest;
-import org.apache.ignite.internal.client.router.impl.GridTcpRouterImpl;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.logger.log4j2.Log4J2Logger;
-import org.junit.Test;
-
-/**
- * Abstract base class for http routing tests.
- */
-public abstract class TcpRouterAbstractSelfTest extends ClientAbstractSelfTest {
- /** Port number to use by router. */
- private static final int ROUTER_PORT = BINARY_PORT + 1;
-
- /** TCP router instance. */
- private static GridTcpRouterImpl router;
-
- /** Send count. */
- private static long sndCnt;
-
- /** Receive count. */
- private static long rcvCnt;
-
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- sndCnt = router.getSendCount();
- rcvCnt = router.getReceivedCount();
-
- super.beforeTest();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- assert router.getSendCount() > sndCnt :
- "Failed to ensure network activity [currCnt=" + router.getSendCount() + ", oldCnt=" + sndCnt + ']';
- assert router.getReceivedCount() > rcvCnt :
- "Failed to ensure network activity [currCnt=" + router.getReceivedCount() + ", oldCnt=" + rcvCnt + ']';
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- router = new GridTcpRouterImpl(routerConfiguration());
-
- router.start();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- router.stop();
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
- cfg.setRouters(Collections.singleton(HOST + ":" + ROUTER_PORT));
-
- return cfg;
- }
-
- /**
- * @return Router configuration.
- * @throws IgniteCheckedException If failed.
- */
- public GridTcpRouterConfiguration routerConfiguration() throws IgniteCheckedException {
- GridTcpRouterConfiguration cfg = new GridTcpRouterConfiguration();
-
- cfg.setHost(HOST);
- cfg.setPort(ROUTER_PORT);
- cfg.setPortRange(0);
- cfg.setServers(Collections.singleton(HOST + ":" + BINARY_PORT));
- cfg.setLogger(new Log4J2Logger(ROUTER_LOG_CFG));
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- @Override public void testConnectable() throws Exception {
- GridClient client = client();
-
- List<GridClientNode> nodes = client.compute().refreshTopology(false, false);
-
- assertFalse(F.first(nodes).connectable());
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterMultiNodeSelfTest.java
deleted file mode 100644
index 909e26428fc..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterMultiNodeSelfTest.java
+++ /dev/null
@@ -1,111 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.internal.client.integration.ClientAbstractMultiNodeSelfTest;
-import org.apache.ignite.internal.client.router.impl.GridTcpRouterImpl;
-import org.apache.ignite.logger.log4j2.Log4J2Logger;
-
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.ROUTER_LOG_CFG;
-
-/**
- *
- */
-public class TcpRouterMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
- /** Number of routers to start in this test. */
- private static final int ROUTERS_CNT = 5;
-
- /** Where to start routers' port numeration. */
- private static final int ROUTER_TCP_PORT_BASE = REST_TCP_PORT_BASE + NODES_CNT;
-
- /** Collection of routers. */
- private static Collection<GridTcpRouterImpl> routers = new ArrayList<>(ROUTERS_CNT);
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- for (int i = 0; i < ROUTERS_CNT; i++)
- routers.add(new GridTcpRouterImpl(routerConfiguration(i++)));
-
- for (GridTcpRouterImpl r : routers)
- r.start();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- info("Stopping routers...");
-
- for (GridTcpRouterImpl r : routers)
- r.stop();
-
- info("Routers stopped.");
-
- routers.clear();
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientProtocol protocol() {
- return GridClientProtocol.TCP;
- }
-
- /** {@inheritDoc} */
- @Override protected String serverAddress() {
- return null;
- }
-
- /**
- * @param i Number of router. Used to avoid configuration conflicts.
- * @return Router configuration.
- * @throws IgniteCheckedException If failed.
- */
- private GridTcpRouterConfiguration routerConfiguration(int i) throws IgniteCheckedException {
- GridTcpRouterConfiguration cfg = new GridTcpRouterConfiguration();
-
- cfg.setHost(HOST);
- cfg.setPort(ROUTER_TCP_PORT_BASE + i);
- cfg.setPortRange(0);
- cfg.setServers(Collections.singleton(HOST + ":" + REST_TCP_PORT_BASE));
- cfg.setLogger(new Log4J2Logger(ROUTER_LOG_CFG));
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
- GridClientConfiguration cfg = super.clientConfiguration();
-
- cfg.setServers(Collections.<String>emptySet());
-
- Collection<String> rtrs = new ArrayList<>(ROUTERS_CNT);
-
- for (int i = 0; i < ROUTERS_CNT; i++)
- rtrs.add(HOST + ':' + (ROUTER_TCP_PORT_BASE + i));
-
- cfg.setRouters(rtrs);
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterSelfTest.java
deleted file mode 100644
index 33e24a8d99d..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpRouterSelfTest.java
+++ /dev/null
@@ -1,36 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-
-/**
- * Tests the simplest use case for router: singe router proxies connections to a single node.
- */
-public class TcpRouterSelfTest extends TcpRouterAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return null;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
deleted file mode 100644
index 659a3abd8bc..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/router/TcpSslRouterSelfTest.java
+++ /dev/null
@@ -1,51 +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.
- */
-
-package org.apache.ignite.internal.client.router;
-
-import javax.cache.configuration.Factory;
-import javax.net.ssl.SSLContext;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.junit.Ignore;
-
-/**
- *
- */
-@Ignore(value = "https://issues.apache.org/jira/browse/IGNITE-433")
-public class TcpSslRouterSelfTest extends TcpRouterAbstractSelfTest {
- /** {@inheritDoc} */
- @Override protected boolean useSsl() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected Factory<SSLContext> sslContextFactory() {
- return GridTestUtils.sslFactory();
- }
-
- /**
- * @return Router configuration.
- */
- @Override public GridTcpRouterConfiguration routerConfiguration() throws IgniteCheckedException {
- GridTcpRouterConfiguration cfg = super.routerConfiguration();
-
- cfg.setSslContextFactory(sslContextFactory());
-
- return cfg;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
index 5a22b91b9e1..6fa841ef06c 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java
@@ -28,37 +28,9 @@ import org.apache.ignite.common.NodeSslConnectionMetricTest;
import org.apache.ignite.common.RebalanceCacheEventSecurityContextTest;
import org.apache.ignite.internal.IgniteClientFailuresTest;
import org.apache.ignite.internal.client.ClientDefaultCacheSelfTest;
-import org.apache.ignite.internal.client.ClientReconnectionSelfTest;
-import org.apache.ignite.internal.client.ClientSslParametersTest;
-import org.apache.ignite.internal.client.ClientTcpMultiThreadedSelfTest;
-import org.apache.ignite.internal.client.ClientTcpSslAuthenticationSelfTest;
-import org.apache.ignite.internal.client.ClientTcpSslMultiThreadedSelfTest;
-import org.apache.ignite.internal.client.ClientTcpTaskExecutionAfterTopologyRestartSelfTest;
import org.apache.ignite.internal.client.impl.ClientCacheFlagsCodecTest;
-import org.apache.ignite.internal.client.impl.ClientComputeImplSelfTest;
-import org.apache.ignite.internal.client.impl.ClientDataImplSelfTest;
-import org.apache.ignite.internal.client.impl.ClientFutureAdapterSelfTest;
-import org.apache.ignite.internal.client.impl.ClientPropertiesConfigurationSelfTest;
-import org.apache.ignite.internal.client.integration.ClientPreferDirectSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpConnectivitySelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpDirectMultiNodeSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpDirectSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpMultiNodeSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpSslDirectMultiNodeSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpSslDirectSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpSslMultiNodeSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpSslSelfTest;
-import org.apache.ignite.internal.client.integration.ClientTcpUnreachableMultiNodeSelfTest;
import org.apache.ignite.internal.client.rest.GridProbeCommandTest;
-import org.apache.ignite.internal.client.router.ClientFailedInitSelfTest;
-import org.apache.ignite.internal.client.router.RouterFactorySelfTest;
-import org.apache.ignite.internal.client.router.TcpRouterMultiNodeSelfTest;
-import org.apache.ignite.internal.client.router.TcpRouterSelfTest;
-import org.apache.ignite.internal.client.router.TcpSslRouterSelfTest;
-import org.apache.ignite.internal.client.util.ClientConsistentHashSelfTest;
import org.apache.ignite.internal.client.util.ClientJavaHasherSelfTest;
-import org.apache.ignite.internal.processors.rest.ChangeStateCommandHandlerTest;
import org.apache.ignite.internal.processors.rest.ClientMemcachedProtocolSelfTest;
import org.apache.ignite.internal.processors.rest.JettyRestProcessorAuthenticationWithCredsSelfTest;
import org.apache.ignite.internal.processors.rest.JettyRestProcessorAuthenticationWithTokenSelfTest;
@@ -72,9 +44,7 @@ import org.apache.ignite.internal.processors.rest.JettyRestProcessorUnsignedSelf
import org.apache.ignite.internal.processors.rest.RestBinaryProtocolSelfTest;
import org.apache.ignite.internal.processors.rest.RestMemcacheProtocolSelfTest;
import org.apache.ignite.internal.processors.rest.RestProcessorMultiStartSelfTest;
-import org.apache.ignite.internal.processors.rest.RestProcessorStartSelfTest;
import org.apache.ignite.internal.processors.rest.RestProtocolStartTest;
-import org.apache.ignite.internal.processors.rest.TaskCommandHandlerSelfTest;
import org.apache.ignite.internal.processors.rest.TcpRestUnmarshalVulnerabilityTest;
import org.apache.ignite.internal.processors.rest.protocols.tcp.TcpRedisParserSelfTest;
import org.apache.ignite.internal.processors.rest.protocols.tcp.TcpRestParserSelfTest;
@@ -91,8 +61,6 @@ import org.junit.runners.Suite;
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- RouterFactorySelfTest.class,
-
// Parser standalone test.
TcpRestParserSelfTest.class,
TcpRedisParserSelfTest.class,
@@ -125,67 +93,20 @@ import org.junit.runners.Suite;
RedisProtocolServerSelfTest.class,
RedisProtocolStringAtomicDatastructuresSelfTest.class,
- RestProcessorStartSelfTest.class,
-
// Test cache flag conversion.
ClientCacheFlagsCodecTest.class,
// Test multi-start.
RestProcessorMultiStartSelfTest.class,
- // Test clients.
- ClientDataImplSelfTest.class,
- ClientComputeImplSelfTest.class,
- ClientTcpSelfTest.class,
- ClientTcpDirectSelfTest.class,
- ClientTcpSslSelfTest.class,
- ClientTcpSslDirectSelfTest.class,
-
- // Test client with many nodes.
- ClientTcpMultiNodeSelfTest.class,
- ClientTcpDirectMultiNodeSelfTest.class,
- ClientTcpSslMultiNodeSelfTest.class,
- ClientTcpSslDirectMultiNodeSelfTest.class,
- ClientTcpUnreachableMultiNodeSelfTest.class,
- ClientPreferDirectSelfTest.class,
-
//Test REST probe cmd
GridProbeCommandTest.class,
- // Test client with many nodes and in multithreaded scenarios
- ClientTcpMultiThreadedSelfTest.class,
- ClientTcpSslMultiThreadedSelfTest.class,
-
- // Test client authentication.
- ClientTcpSslAuthenticationSelfTest.class,
-
- ClientTcpConnectivitySelfTest.class,
- ClientReconnectionSelfTest.class,
-
- // Rest task command handler test.
- TaskCommandHandlerSelfTest.class,
- ChangeStateCommandHandlerTest.class,
-
// Default cache only test.
ClientDefaultCacheSelfTest.class,
- ClientFutureAdapterSelfTest.class,
- ClientPropertiesConfigurationSelfTest.class,
- ClientConsistentHashSelfTest.class,
ClientJavaHasherSelfTest.class,
- // Router tests.
- TcpRouterSelfTest.class,
- TcpSslRouterSelfTest.class,
- TcpRouterMultiNodeSelfTest.class,
-
- ClientFailedInitSelfTest.class,
-
- ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class,
-
- // SSL params.
- ClientSslParametersTest.class,
-
IgniteClientFailuresTest.class,
ClientSizeCacheCreationDestructionTest.class,
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/util/ClientConsistentHashSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/util/ClientConsistentHashSelfTest.java
deleted file mode 100644
index bdd28f27c79..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/util/ClientConsistentHashSelfTest.java
+++ /dev/null
@@ -1,312 +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.
- */
-
-package org.apache.ignite.internal.client.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Test for consistent hash management class.
- */
-public class ClientConsistentHashSelfTest extends GridCommonAbstractTest {
- /** Replicas count. */
- private static final int REPLICAS = 512;
-
- /**
- * Test hash codes collisions.
- *
- * @throws Exception In case of any exception.
- */
- @Test
- public void testCollisions() throws Exception {
- Map<Integer, Set<UUID>> map = new HashMap<>();
-
- // Different nodes, but collide hash codes.
- Collection<UUID> nodes = new LinkedHashSet<>();
-
- // Generate several nodes with collide hash codes.
- while (nodes.size() < 10) {
- UUID uuid = UUID.randomUUID();
- int hashCode = uuid.hashCode();
-
- Set<UUID> set = map.get(hashCode);
-
- if (set == null)
- map.put(hashCode, set = new LinkedHashSet<>());
-
- set.add(uuid);
-
- if (set.size() > 1)
- nodes.addAll(set);
- }
-
- map.clear(); // Clean up.
-
- GridClientConsistentHash<UUID> hash = new GridClientConsistentHash<>();
-
- hash.addNodes(nodes, REPLICAS);
-
- boolean fail = false;
-
- for (UUID exp : nodes) {
- UUID act = hash.node(0, Arrays.asList(exp));
-
- if (exp.equals(act))
- info("Validation succeed [exp=" + exp + ", act=" + act + ']');
- else {
- info("Validation failed [exp=" + exp + ", act=" + act + ']');
-
- fail = true;
- }
- }
-
- if (fail)
- fail("Failed to resolve consistent hash node, when node's hash codes collide: " + nodes);
- }
-
- /**
- * Test restrictions from internal {@link TreeSet} usage.
- *
- * @throws Exception In case of any exception.
- */
- @Test
- public void testTreeSetRestrictions() throws Exception {
- // Constructs hash without explicit node's comparator.
- GridClientConsistentHash<Object> hash = new GridClientConsistentHash<>();
-
- try {
- // Add several objects with the same hash without neither natural ordering nor comparator.
- hash.addNode(new Object() {
- @Override public int hashCode() {
- return 0;
- }
- }, 1);
- hash.addNode(new Object() {
- @Override public int hashCode() {
- return 0;
- }
- }, 1);
-
- fail("Expects failed due to internal TreeSet requires comparator or natural ordering.");
- }
- catch (ClassCastException e) {
- info("Expected fail due to internal TreeSet requires comparator or natural ordering: " + e.getMessage());
- }
-
- // Constructs hash with explicit node's comparator.
- hash = new GridClientConsistentHash<>(new Comparator<Object>() {
- @Override public int compare(Object o1, Object o2) {
- // Such comparator is invalid for production code, but acceptable for current test purposes.
- return System.identityHashCode(o1) - System.identityHashCode(o2);
- }
- }, null);
-
- // Add several objects with the same hash into consistent hash with explicit comparator.
- hash.addNode(new Object() {
- @Override public int hashCode() {
- return 0;
- }
- }, 1);
- hash.addNode(new Object() {
- @Override public int hashCode() {
- return 0;
- }
- }, 1);
-
- info("Expected pass due to internal TreeSet has explicit comparator.");
- }
-
- /**
- * Validate generated hashes.<p>
- * Note! This test should be ported into all supported platforms.
- */
- @Test
- public void testHashGeneraton() {
- // Validate strings.
- checkHash("", -1484017934);
- checkHash("1", -80388575);
- checkHash("a", -873690096);
- checkHash("Hadoop\u3092\u6bba\u3059", -695300527);
- checkHash("key1", -2067461682);
-
- // Validate primitives.
- checkHash(true, 1669973725);
- checkHash(false, -1900934144);
-
- checkHash(3, 386050343);
- checkHash(1000000000, -547312286);
- checkHash(0x7fffffff, 473949739);
- checkHash(0xffffffff, -1399925094);
- checkHash(0x7fffffffffffffffL, 201097861);
- checkHash(0xffffffffffffffffL, -1484017934);
- checkHash(1.4e-45f, 1262722378);
- checkHash(3.4028235e+38f, 1313755354);
- checkHash(4.9e-324, 1262722378);
- checkHash(1.7976931348623157e+308, -783615357);
-
- // Validate objects.
- checkHash(UUID.fromString("4d180911-21c9-48f2-a1e6-7bc1daf588a0"), -440525148);
-
- checkUUID("224ea4cd-f449-4dcb-869a-5317c63bd619", 806670090);
- checkUUID("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", -354375826);
- checkUUID("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", -1312538272);
- checkUUID("d8f1f916-4357-4cfe-a7df-49d4721690bf", -482944041);
- checkUUID("d67eb652-4e76-47fb-ad4e-cd902d9b868a", -449444069);
- checkUUID("c77ffeae-78a1-4ee6-a0fd-8d197a794412", -168980875);
- checkUUID("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", -383915637);
- }
-
- /**
- * Test mapping to nodes.
- */
- @Test
- public void testMappingToNodes() {
- String n1 = "node #1";
- String n2 = "node #2";
- String n3 = "node #3";
- String n4 = "node #4";
-
- List<String> nodes = Arrays.asList(n1, n2, n3, n4);
-
- GridClientConsistentHash<String> hash = new GridClientConsistentHash<>();
-
- for (String node : nodes)
- hash.addNode(node, 5);
-
- Map<Object, String> data = new LinkedHashMap<>();
-
- data.put("", n1);
- data.put("asdf", n3);
- data.put("224ea4cd-f449-4dcb-869a-5317c63bd619", n2);
- data.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", n4);
- data.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", n1);
- data.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", n3);
- data.put("c77ffeae-78a1-4ee6-a0fd-8d197a794412", n4);
- data.put("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", n4);
- data.put("d67eb652-4e76-47fb-ad4e-cd902d9b868a", n4);
-
- data.put(0, n1);
- data.put(1, n4);
- data.put(12, n3);
- data.put(123, n3);
- data.put(1234, n3);
- data.put(12345, n4);
- data.put(123456, n3);
- data.put(1234567, n4);
- data.put(12345678, n4);
- data.put(123456789, n4);
- data.put(1234567890, n3);
- data.put(1234567890L, n3);
- data.put(12345678901L, n4);
- data.put(123456789012L, n2);
- data.put(1234567890123L, n4);
- data.put(12345678901234L, n1);
- data.put(123456789012345L, n1);
- data.put(1234567890123456L, n3);
- data.put(-23456789012345L, n2);
- data.put(-2345678901234L, n1);
- data.put(-234567890123L, n4);
- data.put(-23456789012L, n3);
- data.put(-2345678901L, n3);
- data.put(-234567890L, n1);
- data.put(-234567890, n4);
- data.put(-23456789, n4);
- data.put(-2345678, n4);
- data.put(-234567, n4);
- data.put(-23456, n4);
- data.put(-2345, n1);
- data.put(-234, n4);
- data.put(-23, n3);
- data.put(-2, n4);
-
- data.put(0x80000000, n2);
- data.put(0x7fffffff, n4);
- data.put(0x8000000000000000L, n2);
- data.put(0x7fffffffffffffffL, n2);
-
- data.put(+1.1, n1);
- data.put(-10.01, n3);
- data.put(+100.001, n3);
- data.put(-1000.0001, n4);
- data.put(+1.7976931348623157E+308, n4);
- data.put(-1.7976931348623157E+308, n4);
- data.put(+4.9E-324, n4);
- data.put(-4.9E-324, n3);
-
- for (Map.Entry<Object, String> entry : data.entrySet())
- assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
-
- for (Map.Entry<Object, String> entry : data.entrySet())
- assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
-
- //
- // Change order nodes were added.
- //
-
- nodes = new ArrayList<>(nodes);
-
- Collections.reverse(nodes);
-
- // Reset consistent hash with new nodes order.
- hash = new GridClientConsistentHash<>();
-
- for (String node : nodes)
- hash.addNode(node, 5);
-
- for (Map.Entry<Object, String> entry : data.entrySet())
- assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
-
- for (Map.Entry<Object, String> entry : data.entrySet())
- assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
- }
-
- /**
- * Check unique id and generated hash code.
- *
- * @param uuid String presentation of unique id.
- * @param code Expected hash code.
- */
- private void checkUUID(String uuid, int code) {
- checkHash(UUID.fromString(uuid), code);
- }
-
- /**
- * Check hash generation for the specified object.
- *
- * @param o Object to verify hash generation for.
- * @param code Expected hash code.
- */
- private void checkHash(Object o, int code) {
- int i = GridClientConsistentHash.hash(o);
-
- assertEquals("Check affinity for object: " + o, code, i);
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
index 42e3899162e..a7523b15e5e 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
@@ -28,7 +28,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
*/
public abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest {
/** Local host. */
- protected static final String LOC_HOST = "127.0.0.1";
+ public static final String LOC_HOST = "127.0.0.1";
/**
* @return Grid count.
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/ChangeStateCommandHandlerTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/ChangeStateCommandHandlerTest.java
deleted file mode 100644
index 2fb7e742486..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/ChangeStateCommandHandlerTest.java
+++ /dev/null
@@ -1,109 +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.
- */
-
-package org.apache.ignite.internal.processors.rest;
-
-import java.util.Collections;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientClusterState;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.cluster.ClusterState.ACTIVE;
-import static org.apache.ignite.cluster.ClusterState.INACTIVE;
-import static org.apache.ignite.internal.client.GridClientProtocol.TCP;
-
-/**
- *
- */
-public class ChangeStateCommandHandlerTest extends GridCommonAbstractTest {
- /** */
- public static final String HOST = "127.0.0.1";
-
- /** */
- public static final int BINARY_PORT = 11212;
-
- /** */
- private GridClient client;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setLocalHost(HOST);
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(BINARY_PORT);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- return cfg;
- }
-
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrid(0);
- startGrid(1);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- GridClientConfiguration cfg = new GridClientConfiguration();
- cfg.setProtocol(TCP);
- cfg.setServers(Collections.singletonList("localhost:" + BINARY_PORT));
-
- client = GridClientFactory.start(cfg);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- GridClientFactory.stop(client.id());
- }
-
- /**
- *
- */
- @Test
- public void testActivateDeActivate() throws GridClientException {
- GridClientClusterState state = client.state();
-
- assertTrue(state.state().toString(), state.state().active());
-
- state.state(INACTIVE, true);
-
- IgniteEx ig1 = grid(0);
- IgniteEx ig2 = grid(1);
-
- assertFalse(ig1.cluster().state().active());
- assertFalse(ig2.cluster().state().active());
- assertEquals(INACTIVE, state.state());
-
- state.state(ACTIVE, false);
-
- assertTrue(ig1.cluster().state().active());
- assertTrue(ig2.cluster().state().active());
- assertEquals(ACTIVE, state.state());
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorStartSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorStartSelfTest.java
deleted file mode 100644
index 33d9b0a00c3..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorStartSelfTest.java
+++ /dev/null
@@ -1,165 +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.
- */
-
-package org.apache.ignite.internal.processors.rest;
-
-import java.util.Collections;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientProtocol;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.spi.IgniteSpiException;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
-/**
- *
- */
-public class RestProcessorStartSelfTest extends GridCommonAbstractTest {
- /** */
- private static final String HOST = "127.0.0.1";
-
- /** */
- public static final int TCP_PORT = 11222;
-
- /** */
- private CountDownLatch gridReady;
-
- /** */
- private CountDownLatch proceed;
-
- /** {@inheritDoc}*/
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setLocalHost(HOST);
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(TCP_PORT);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- TestDiscoverySpi disc = new TestDiscoverySpi();
-
- disc.setIpFinder(sharedStaticIpFinder);
-
- cfg.setDiscoverySpi(disc);
-
- return cfg;
- }
-
- /** {@inheritDoc}*/
- @Override protected void beforeTest() throws Exception {
- gridReady = new CountDownLatch(1);
- proceed = new CountDownLatch(1);
- }
-
- /** {@inheritDoc}*/
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTcpStart() throws Exception {
- GridClientConfiguration clCfg = new GridClientConfiguration();
-
- clCfg.setProtocol(GridClientProtocol.TCP);
- clCfg.setServers(Collections.singleton(HOST + ":" + TCP_PORT));
-
- doTest(clCfg);
- }
-
- /**
- * @param cfg Client configuration.
- * @throws Exception If failed.
- */
- private void doTest(final GridClientConfiguration cfg) throws Exception {
- GridTestUtils.runAsync(new IgniteCallable<Object>() {
- @Override public Object call() {
- try {
- startGrid();
- }
- catch (Exception e) {
- log().error("Grid start failed", e);
-
- fail();
- }
-
- return null;
- }
- });
-
- try {
- gridReady.await();
-
- IgniteInternalFuture<GridClient> c = GridTestUtils.runAsync(new Callable<GridClient>() {
- @Override public GridClient call() throws Exception {
- return GridClientFactory.start(cfg);
- }
- });
-
- try {
- proceed.countDown();
-
- c.get().compute().refreshTopology(false, false);
- }
- finally {
- GridClientFactory.stopAll();
- }
- }
- catch (Throwable e) {
- e.printStackTrace();
- }
- finally {
- proceed.countDown();
- }
- }
-
- /**
- * Test SPI.
- */
- private class TestDiscoverySpi extends TcpDiscoverySpi {
- /** {@inheritDoc} */
- @Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException {
- gridReady.countDown();
-
- try {
- proceed.await();
- }
- catch (InterruptedException e) {
- throw new IgniteSpiException("Failed to await start signal.", e);
- }
-
- super.spiStart(igniteInstanceName);
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProtocolStartTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProtocolStartTest.java
index 71b5dc860db..771b117d0d9 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProtocolStartTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProtocolStartTest.java
@@ -42,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
import org.junit.Test;
import static org.apache.ignite.configuration.ConnectorConfiguration.DFLT_TCP_PORT;
-import static org.apache.ignite.internal.client.integration.ClientAbstractSelfTest.HOST;
+import static org.apache.ignite.internal.processors.rest.AbstractRestProcessorSelfTest.LOC_HOST;
import static org.apache.ignite.internal.processors.rest.protocols.tcp.GridTcpRestProtocol.REST_CONNECTOR_METRIC_REGISTRY_NAME;
import static org.apache.ignite.internal.util.nio.GridNioServer.SESSIONS_CNT_METRIC_NAME;
import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
@@ -70,7 +70,7 @@ public class RestProtocolStartTest extends GridCommonAbstractTest {
FailingGridRestProtocol.restStarted.await();
IgniteInternalFuture<Object> cliFut = GridTestUtils.runAsync(() -> {
- try (TestBinaryClient client = new TestBinaryClient(HOST, DFLT_TCP_PORT)) {
+ try (TestBinaryClient client = new TestBinaryClient(LOC_HOST, DFLT_TCP_PORT)) {
// No-op.
}
catch (RuntimeException e) {
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
deleted file mode 100644
index 5a2d054c2b0..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
+++ /dev/null
@@ -1,203 +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.
- */
-
-package org.apache.ignite.internal.processors.rest;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.IgniteSystemProperties;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientDataConfiguration;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler;
-import org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.P1;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jsr166.ConcurrentLinkedHashMap;
-import org.junit.Test;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.internal.client.GridClientProtocol.TCP;
-
-/**
- * Test for {@code GridTaskCommandHandler}
- */
-public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
- /** */
- private static final String REPLICATED_CACHE_NAME = "replicated";
-
- /** */
- private static final String PARTITIONED_CACHE_NAME = "partitioned";
-
- /** */
- public static final String HOST = "127.0.0.1";
-
- /** */
- public static final int BINARY_PORT = 11212;
-
- /** */
- private static final int MAX_TASK_RESULTS = 10;
-
- /** */
- private GridClient client;
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- System.setProperty(IgniteSystemProperties.IGNITE_REST_MAX_TASK_RESULTS, String.valueOf(MAX_TASK_RESULTS));
-
- startGrid(0);
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- System.clearProperty(IgniteSystemProperties.IGNITE_REST_MAX_TASK_RESULTS);
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- client = GridClientFactory.start(clientConfiguration());
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- GridClientFactory.stop(client.id());
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setLocalHost(HOST);
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- clientCfg.setPort(BINARY_PORT);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- CacheConfiguration<?, ?> cfg1 = defaultCacheConfiguration()
- .setName(REPLICATED_CACHE_NAME)
- .setCacheMode(REPLICATED);
-
- CacheConfiguration<?, ?> cfg2 = defaultCacheConfiguration()
- .setName(PARTITIONED_CACHE_NAME)
- .setCacheMode(PARTITIONED);
-
- cfg.setCacheConfiguration(cfg1, cfg2);
-
- return cfg;
- }
-
- /**
- * @return Client configuration.
- */
- private GridClientConfiguration clientConfiguration() {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
-
- GridClientDataConfiguration cache = new GridClientDataConfiguration();
-
- cache.setName(PARTITIONED_CACHE_NAME);
-
- cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
-
- cfg.setProtocol(TCP);
- cfg.setServers(Collections.singletonList("localhost:" + BINARY_PORT));
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testManyTasksRun() throws Exception {
- GridClientCompute compute = client.compute();
-
- for (int i = 0; i < 1000; i++)
- assertEquals(new Integer("executing".length()), compute.execute(TestTask.class.getName(), "executing"));
-
- GridClientFactory.stop(client.id(), true);
-
- IgniteKernal g = (IgniteKernal)grid(0);
-
- Map<GridRestCommand, GridRestCommandHandler> handlers = U.field(g.context().rest(), "handlers");
-
- GridTaskCommandHandler taskHnd = (GridTaskCommandHandler)F.find(handlers.values(), null,
- new P1<GridRestCommandHandler>() {
- @Override public boolean apply(GridRestCommandHandler e) {
- return e instanceof GridTaskCommandHandler;
- }
- });
-
- assertNotNull("GridTaskCommandHandler was not found", taskHnd);
-
- ConcurrentLinkedHashMap taskDesc = U.field(taskHnd, "taskDescs");
-
- assertTrue("Task result map size exceeded max value [mapSize=" + taskDesc.sizex() + ", " +
- "maxSize=" + MAX_TASK_RESULTS + ']', taskDesc.sizex() <= MAX_TASK_RESULTS);
- }
-
- /**
- * Test task.
- */
- private static class TestTask extends ComputeTaskSplitAdapter<String, Integer> {
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, final String arg) {
- return Collections.singletonList(new ComputeJobAdapter() {
- @Override public Object execute() {
- try {
- Thread.sleep(10);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
-
- return arg.length();
- }
- });
- }
-
- /** {@inheritDoc} */
- @Override public Integer reduce(List<ComputeJobResult> results) {
- int sum = 0;
-
- for (ComputeJobResult res : results)
- sum += res.<Integer>getData();
-
- return sum;
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientCacheBenchmark.java b/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientCacheBenchmark.java
deleted file mode 100644
index 6430a860f46..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientCacheBenchmark.java
+++ /dev/null
@@ -1,271 +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.
- */
-
-package org.apache.ignite.loadtests.client;
-
-import java.io.IOException;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Random;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientData;
-import org.apache.ignite.internal.client.GridClientDataConfiguration;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientPartitionAffinity;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.GridFileLock;
-import org.apache.ignite.testframework.GridLoadTestUtils;
-
-/**
- * Use {@code modules/core/src/test/config/benchmark/spring-cache-client-benchmark-*.xml}
- * configurations for servers.
- */
-public class ClientCacheBenchmark {
- /** Number of keys, used in PUT/GET operations. */
- private static final int KEY_COUNT = 1000;
-
- /** Size of arrays used as stored values. */
- private static final int VALUE_LENGTH = 1024 * 4;
-
- /** Cached values for store. */
- private static final byte[][] values = new byte[KEY_COUNT][];
-
- /** Probability of put operation. */
- private static final double WRITE_PROB = 0.2;
-
- /** Random generator. */
- private final Random rnd = new Random();
-
- /** Number of submitting threads for current test. */
- private final int threadCnt;
-
- /** Number of operations per thread. */
- private final int iterationCnt;
-
- /** Test client. */
- private GridClient client;
-
- /** Resulting number of iterations per second. */
- private double itersPerSec;
-
- /**
- * @param threadCnt Number of submitting threads.
- * @param iterationCnt Number of operations per thread.
- */
- public ClientCacheBenchmark(int threadCnt, int iterationCnt) {
- this.threadCnt = threadCnt;
- this.iterationCnt = iterationCnt;
-
- initValues();
- }
-
- /**
- * Initiates the values cache.
- */
- private void initValues() {
- for (int i = 0; i < KEY_COUNT; i++) {
- values[i] = new byte[VALUE_LENGTH];
-
- rnd.nextBytes(values[i]);
- }
- }
-
- /**
- * Performs test,
- *
- * @param printResults Whether to print results.
- * @throws GridClientException If failed.
- */
- public void run(boolean printResults) throws GridClientException {
- Collection<TestThread> workers = new ArrayList<>(threadCnt);
-
- client = GridClientFactory.start(configuration());
-
- long startTime = System.currentTimeMillis();
-
- for (int i = 0; i < threadCnt; i++) {
- TestThread th = new TestThread();
- workers.add(th);
- th.start();
- }
-
- U.joinThreads(workers, null);
-
- if (printResults)
- countAndPrintSummary(workers, startTime);
-
- GridClientFactory.stopAll();
- }
-
- /**
- * @return Resulting iterations per second.
- */
- public double getItersPerSec() {
- return itersPerSec;
- }
-
- /**
- * Counts and prints tests summary,
- *
- * @param workers Collection of test worker threads.
- * @param startTime Time when test eas started.
- */
- private void countAndPrintSummary(Collection<TestThread> workers, long startTime) {
- long total = 0;
-
- int thCnt = workers.size();
-
- for (TestThread t : workers) {
- total += t.iters;
- }
-
- double timeSpent = ((double)(System.currentTimeMillis() - startTime)) / 1000;
-
- itersPerSec = total / timeSpent;
-
- System.out.printf("%8s, %12.0f, %12.0f, %12s\n", thCnt, itersPerSec, total / timeSpent / thCnt, total);
- }
-
- /**
- * @return Test client configuration.
- */
- private GridClientConfiguration configuration() {
- GridClientConfiguration cfg = new GridClientConfiguration();
-
- cfg.setServers(Collections.singleton("localhost:11211"));
-
- GridClientDataConfiguration cacheCfg = new GridClientDataConfiguration();
-
- cacheCfg.setName("partitioned");
-
- cacheCfg.setAffinity(new GridClientPartitionAffinity());
-
- cfg.setDataConfigurations(Collections.singletonList(cacheCfg));
-
- return cfg;
- }
-
- /**
- * Test thread.
- */
- private class TestThread extends Thread {
- /** Thread private random generator. */
- private final Random rnd = new Random();
-
- /** Number of iterations to perform. */
- private long iters;
-
- /** {@inheritDoc} */
- @Override public void run() {
- try {
- GridClientData data = client.data("partitioned");
-
- for (int i = 0; i < iterationCnt; i++)
- performIteration(data);
- }
- catch (GridClientException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Performs test iteration.
- * @param data client data to operate on.
- * @throws GridClientException If failed.
- */
- private void performIteration(GridClientData data) throws GridClientException {
- if (rnd.nextDouble() <= WRITE_PROB)
- data.put(rnd.nextInt(KEY_COUNT), values[rnd.nextInt(KEY_COUNT)]);
- else
- data.get(rnd.nextInt(KEY_COUNT));
-
- iters++;
- }
- }
-
- /**
- * Runs benchmark.
- * @param args Command-line arguments.
- * @throws GridClientException If failed.
- */
- public static void main(String[] args) throws GridClientException, IgniteCheckedException {
- GridFileLock fileLock = GridLoadTestUtils.fileLock();
-
- fileLock.lock();
-
- try {
- System.out.printf("%8s, %12s, %12s, %12s\n", "Threads", "It./s.", "It./s.*th.", "Iters.");
-
- if (args.length == 0) {
- for (int i = 1; i <= 16; i *= 2) {
- ClientCacheBenchmark benchmark = new ClientCacheBenchmark(i, 10000);
-
- benchmark.run(false);
-
- System.gc();
- }
-
- for (int i = 1; i <= 64; i *= 2) {
- ClientCacheBenchmark benchmark = new ClientCacheBenchmark(i, 10000);
-
- benchmark.run(true);
-
- System.gc();
- }
- }
- else {
- int nThreads = Integer.parseInt(args[0]);
- String outputFileName = (args.length >= 2 ? args[1] : null);
-
- ClientCacheBenchmark benchmark = null;
-
- for (int i = 0; i < 2; i++) {
- benchmark = new ClientCacheBenchmark(nThreads, 10000);
-
- benchmark.run(true);
- }
-
- if (outputFileName != null) {
- X.println("Writing test results to a file: " + outputFileName);
-
- assert benchmark != null;
-
- try {
- GridLoadTestUtils.appendLineToFile(
- outputFileName,
- "%s,%d",
- IgniteUtils.LONG_DATE_FMT.format(Instant.now()),
- Math.round(benchmark.getItersPerSec()));
- }
- catch (IOException e) {
- X.error("Failed to output to a file", e);
- }
- }
- }
- }
- finally {
- fileLock.close();
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientTcpSslLoadTest.java b/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientTcpSslLoadTest.java
deleted file mode 100644
index 0e29a105340..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/loadtests/client/ClientTcpSslLoadTest.java
+++ /dev/null
@@ -1,91 +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.
- */
-
-package org.apache.ignite.loadtests.client;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.client.ClientTcpSslMultiThreadedSelfTest;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Makes a long run to ensure stability and absence of memory leaks.
- */
-// Load test.
-@Ignore("https://issues.apache.org/jira/browse/IGNITE-13728")
-public class ClientTcpSslLoadTest extends ClientTcpSslMultiThreadedSelfTest {
- /** Test duration. */
- private static final long TEST_RUN_TIME = 8 * 60 * 60 * 1000;
-
- /** Statistics output interval. */
- private static final long STATISTICS_PRINT_INTERVAL = 5 * 60 * 1000;
-
- /** Time to let connections closed by idle. */
- private static final long RELAX_INTERVAL = 60 * 1000;
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLongRun() throws Exception {
- long start = System.currentTimeMillis();
-
- long lastPrint = start;
-
- do {
- clearCaches();
-
- testMultithreadedTaskRun();
-
- long now = System.currentTimeMillis();
-
- if (now - lastPrint > STATISTICS_PRINT_INTERVAL) {
- info(">>>>>>> Running test for " + ((now - start) / 1000) + " seconds.");
-
- lastPrint = now;
- }
-
- // Let idle check work.
- U.sleep(RELAX_INTERVAL);
- }
- while (System.currentTimeMillis() - start < TEST_RUN_TIME);
- }
-
- /** {@inheritDoc} */
- @Override protected int topologyRefreshFrequency() {
- return 5000;
- }
-
- /** {@inheritDoc} */
- @Override protected int maxConnectionIdleTime() {
- return topologyRefreshFrequency() / 5;
- }
-
- /**
- * Clears caches on all nodes.
- */
- private void clearCaches() {
- for (int i = 0; i < NODES_CNT; i++)
- try {
- grid(i).cache(PARTITIONED_CACHE_NAME).clear();
- }
- catch (IgniteException e) {
- log.error("Cache clear failed.", e);
- }
- }
-}
diff --git a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-1.xml b/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-1.xml
deleted file mode 100644
index 868f88efd4a..00000000000
--- a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-1.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Spring configuration file to startup grid cache.
-
- When starting a standalone Ignite node, you need to execute the following command:
- {IGNITE_HOME}/bin/ignite.{bat|sh} path-to-this-file/example-cache.xml
-
- When starting Ignite from Java IDE, pass path to this file into Ignition:
- Ignition.start("path-to-this-file/example-benchmark.xml");
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
- <!--
- Optional description.
- -->
- <description>
- Spring file for grid configuration with benchmark.
- </description>
-
- <!--
- Configuration below demonstrates how to setup caches within grid nodes.
- -->
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="peerClassLoadingEnabled" value="false"/>
-
- <!-- Set to local host address just for examples. -->
- <property name="localHost" value="127.0.0.1"/>
-
- <property name="connectorConfiguration">
- <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
- <property name="port" value="11211"/>
- </bean>
- </property>
-
- <!--<property name="peerClassLoadingEnabled" value="false"/>-->
-
- <property name="cacheConfiguration">
- <!--
- Specify list of cache configurations here. Any property from
- CacheConfiguration interface can be configured here.
- Note that absolutely all configuration properties are optional.
- -->
- <list>
- <!--
- Partitioned cache example configuration.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="partitioned"/>
-
- <property name="cacheMode" value="PARTITIONED"/>
-
- <property name="swapEnabled" value="false"/>
-
- <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
-
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
-
- <!--
- This shows how to configure number of backups. The below configuration
- sets the number of backups to 1 (which is default).
- -->
- <property name="backups" value="1"/>
- </bean>
- </list>
- </property>
-
- <property name="includeEventTypes">
- <list>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_MAPPED"/>
- </list>
- </property>
- <property name="includeProperties"><list/></property>
-
- <!--
- Uncomment this to provide TCP discovery SPI (predefined addresses).
- Use the addresses list to provide IP addresses of initial nodes in the grid
- (at least one address must be provided).
- -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!--
- List all IP/port configurations that potentially
- can be started first in examples. We are assuming
- grid of size 10 or less.
- -->
- <value>127.0.0.1:47500</value>
- <value>127.0.0.1:47501</value>
- <value>127.0.0.1:47502</value>
- <value>127.0.0.1:47503</value>
- <value>127.0.0.1:47504</value>
- <value>127.0.0.1:47505</value>
- <value>127.0.0.1:47506</value>
- <value>127.0.0.1:47507</value>
- <value>127.0.0.1:47508</value>
- <value>127.0.0.1:47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
diff --git a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-2.xml b/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-2.xml
deleted file mode 100644
index 543b0f5587c..00000000000
--- a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-2.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Spring configuration file to startup grid cache.
-
- When starting a standalone Ignite node, you need to execute the following command:
- {IGNITE_HOME}/bin/ignite.{bat|sh} path-to-this-file/example-cache.xml
-
- When starting Ignite from Java IDE, pass path to this file into Ignition:
- Ignition.start("path-to-this-file/example-benchmark.xml");
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <!--
- Optional description.
- -->
- <description>
- Spring file for grid configuration with benchmark.
- </description>
-
- <!--
- Configuration below demonstrates how to setup caches within grid nodes.
- -->
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="peerClassLoadingEnabled" value="false"/>
-
- <!-- Set to local host address just for examples. -->
- <property name="localHost" value="127.0.0.1"/>
-
- <property name="connectorConfiguration">
- <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
- <property name="port" value="11212"/>
- </bean>
- </property>
-
- <!--<property name="peerClassLoadingEnabled" value="false"/>-->
-
- <property name="cacheConfiguration">
- <!--
- Specify list of cache configurations here. Any property from
- CacheConfiguration interface can be configured here.
- Note that absolutely all configuration properties are optional.
- -->
- <list>
- <!--
- Partitioned cache example configuration.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="partitioned"/>
-
- <property name="cacheMode" value="PARTITIONED"/>
-
- <property name="swapEnabled" value="false"/>
-
- <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
-
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
-
- <!--
- This shows how to configure number of backups. The below configuration
- sets the number of backups to 1 (which is default).
- -->
- <property name="backups" value="1"/>
- </bean>
-
- </list>
- </property>
-
- <!--
- Uncomment this to provide TCP discovery SPI (predefined addresses).
- Use the addresses list to provide IP addresses of initial nodes in the grid
- (at least one address must be provided).
- -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!--
- List all IP/port configurations that potentially
- can be started first in examples. We are assuming
- grid of size 10 or less.
- -->
- <value>127.0.0.1:47500</value>
- <value>127.0.0.1:47501</value>
- <value>127.0.0.1:47502</value>
- <value>127.0.0.1:47503</value>
- <value>127.0.0.1:47504</value>
- <value>127.0.0.1:47505</value>
- <value>127.0.0.1:47506</value>
- <value>127.0.0.1:47507</value>
- <value>127.0.0.1:47508</value>
- <value>127.0.0.1:47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
diff --git a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-3.xml b/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-3.xml
deleted file mode 100644
index 10ebffba5a0..00000000000
--- a/modules/core/src/test/config/benchmark/spring-cache-client-benchmark-3.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Spring configuration file to startup grid cache.
-
- When starting a standalone Ignite node, you need to execute the following command:
- {IGNITE_HOME}/bin/ignite.{bat|sh} path-to-this-file/example-cache.xml
-
- When starting Ignite from Java IDE, pass path to this file into Ignition:
- Ignition.start("path-to-this-file/example-benchmark.xml");
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <!--
- Optional description.
- -->
- <description>
- Spring file for grid configuration with benchmark.
- </description>
-
- <!--
- Configuration below demonstrates how to setup caches within grid nodes.
- -->
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="peerClassLoadingEnabled" value="false"/>
-
- <!-- Set to local host address just for examples. -->
- <property name="localHost" value="127.0.0.1"/>
-
- <property name="connectorConfiguration">
- <bean class="org.apache.ignite.configuration.ConnectorConfiguration">
- <property name="port" value="11213"/>
- </bean>
- </property>
-
- <!--<property name="peerClassLoadingEnabled" value="false"/>-->
-
- <property name="cacheConfiguration">
- <!--
- Specify list of cache configurations here. Any property from
- CacheConfiguration interface can be configured here.
- Note that absolutely all configuration properties are optional.
- -->
- <list>
- <!--
- Partitioned cache example configuration.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="partitioned"/>
-
- <property name="cacheMode" value="PARTITIONED"/>
-
- <property name="swapEnabled" value="false"/>
-
- <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
-
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
-
- <!--
- This shows how to configure number of backups. The below configuration
- sets the number of backups to 1 (which is default).
- -->
- <property name="backups" value="1"/>
- </bean>
-
- </list>
- </property>
-
- <!--
- Uncomment this to provide TCP discovery SPI (predefined addresses).
- Use the addresses list to provide IP addresses of initial nodes in the grid
- (at least one address must be provided).
- -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!--
- List all IP/port configurations that potentially
- can be started first in examples. We are assuming
- grid of size 10 or less.
- -->
- <value>127.0.0.1:47500</value>
- <value>127.0.0.1:47501</value>
- <value>127.0.0.1:47502</value>
- <value>127.0.0.1:47503</value>
- <value>127.0.0.1:47504</value>
- <value>127.0.0.1:47505</value>
- <value>127.0.0.1:47506</value>
- <value>127.0.0.1:47507</value>
- <value>127.0.0.1:47508</value>
- <value>127.0.0.1:47509</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>