This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 132aaac8222 Refactor AdapterMode (#36645)
132aaac8222 is described below
commit 132aaac8222c2c3095fd6b0d5c88db677ad9aa1a
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Sep 20 18:45:29 2025 +0800
Refactor AdapterMode (#36645)
* Refactor AdapterMode
* Refactor AdapterMode
---
.../test/e2e/env/container/adapter/enums/AdapterMode.java | 11 +----------
.../adapter/impl/ShardingSphereProxyEmbeddedContainer.java | 3 +--
.../param/array/ClusterTestParameterArrayGenerator.java | 4 ++--
.../sql/framework/param/array/E2ETestParameterFactory.java | 10 +++++-----
.../param/array/JdbcStandaloneTestParameterGenerator.java | 4 ++--
.../param/array/ProxyStandaloneTestParameterGenerator.java | 4 ++--
6 files changed, 13 insertions(+), 23 deletions(-)
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/enums/AdapterMode.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/enums/AdapterMode.java
index 36f71a549a4..e6fcfaef831 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/enums/AdapterMode.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/enums/AdapterMode.java
@@ -17,19 +17,10 @@
package org.apache.shardingsphere.test.e2e.env.container.adapter.enums;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
/**
* Adapter mode.
*/
-@RequiredArgsConstructor
-@Getter
public enum AdapterMode {
- STANDALONE("Standalone"),
-
- CLUSTER("Cluster");
-
- private final String value;
+ STANDALONE, CLUSTER
}
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
index cf35fc14424..fec22a9e8e3 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/adapter/impl/ShardingSphereProxyEmbeddedContainer.java
@@ -46,7 +46,6 @@ import org.testcontainers.containers.GenericContainer;
import org.testcontainers.lifecycle.Startable;
import org.testcontainers.utility.Base58;
-import javax.net.ssl.SSLException;
import javax.sql.DataSource;
import java.io.File;
import java.io.FileWriter;
@@ -105,7 +104,7 @@ public final class ShardingSphereProxyEmbeddedContainer
implements EmbeddedITCon
new JdbcConnectCheckingWaitStrategy(() ->
getTargetDataSource(null).getConnection()).waitUntilReady(null);
}
- @SneakyThrows({SQLException.class, IOException.class, SSLException.class,
InterruptedException.class})
+ @SneakyThrows({SQLException.class, IOException.class,
InterruptedException.class})
private void startProxy() {
YamlProxyConfiguration yamlConfig =
ProxyConfigurationLoader.load(getTempConfigurationDirectory().toString());
int port =
Integer.parseInt(ConfigurationPropertyKey.PROXY_DEFAULT_PORT.getDefaultValue());
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ClusterTestParameterArrayGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ClusterTestParameterArrayGenerator.java
index ac6b0773fd7..97556b752be 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ClusterTestParameterArrayGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ClusterTestParameterArrayGenerator.java
@@ -42,7 +42,7 @@ public final class ClusterTestParameterArrayGenerator {
* @return assertion test parameter
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
- return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.getValue(),
+ return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.name(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getAssertionTestParameter(sqlCommandType);
}
@@ -53,7 +53,7 @@ public final class ClusterTestParameterArrayGenerator {
* @return case parameter
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
- return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.getValue(),
+ return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), AdapterMode.CLUSTER.name(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getCaseTestParameter(sqlCommandType);
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/E2ETestParameterFactory.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/E2ETestParameterFactory.java
index 34977719288..27547d1cce5 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/E2ETestParameterFactory.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/E2ETestParameterFactory.java
@@ -45,11 +45,11 @@ public final class E2ETestParameterFactory {
public static Collection<AssertionTestParameter>
getAssertionTestParameters(final SQLCommandType sqlCommandType) {
Collection<AssertionTestParameter> result = new LinkedList<>();
for (String each : ENV.getRunModes()) {
- if (AdapterMode.STANDALONE.getValue().equalsIgnoreCase(each)) {
+ if (AdapterMode.STANDALONE.name().equalsIgnoreCase(each)) {
result.addAll(isDistSQLCommandType(sqlCommandType)
?
ProxyStandaloneTestParameterGenerator.getAssertionTestParameter(sqlCommandType)
:
JdbcStandaloneTestParameterGenerator.getAssertionTestParameter(sqlCommandType));
- } else if (AdapterMode.CLUSTER.getValue().equalsIgnoreCase(each)) {
+ } else if (AdapterMode.CLUSTER.name().equalsIgnoreCase(each)) {
result.addAll(ClusterTestParameterArrayGenerator.getAssertionTestParameter(sqlCommandType));
}
}
@@ -65,11 +65,11 @@ public final class E2ETestParameterFactory {
public static Collection<E2ETestParameter> getCaseTestParameters(final
SQLCommandType sqlCommandType) {
Collection<E2ETestParameter> result = new LinkedList<>();
for (String each : ENV.getRunModes()) {
- if (AdapterMode.STANDALONE.getValue().equalsIgnoreCase(each)) {
+ if (AdapterMode.STANDALONE.name().equalsIgnoreCase(each)) {
result.addAll(isDistSQLCommandType(sqlCommandType)
?
ProxyStandaloneTestParameterGenerator.getCaseTestParameter(sqlCommandType)
:
JdbcStandaloneTestParameterGenerator.getCaseTestParameter(sqlCommandType));
- } else if (AdapterMode.CLUSTER.getValue().equalsIgnoreCase(each)) {
+ } else if (AdapterMode.CLUSTER.name().equalsIgnoreCase(each)) {
result.addAll(ClusterTestParameterArrayGenerator.getCaseTestParameter(sqlCommandType));
}
}
@@ -87,6 +87,6 @@ public final class E2ETestParameterFactory {
*/
public static boolean containsTestParameter() {
return E2ETestEnvironment.getInstance().getRunModes().stream()
- .anyMatch(each ->
AdapterMode.STANDALONE.getValue().equalsIgnoreCase(each) ||
AdapterMode.CLUSTER.getValue().equalsIgnoreCase(each));
+ .anyMatch(each ->
AdapterMode.STANDALONE.name().equalsIgnoreCase(each) ||
AdapterMode.CLUSTER.name().equalsIgnoreCase(each));
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/JdbcStandaloneTestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/JdbcStandaloneTestParameterGenerator.java
index 0e8c6e9e56d..570ffd0956e 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/JdbcStandaloneTestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/JdbcStandaloneTestParameterGenerator.java
@@ -46,7 +46,7 @@ public final class JdbcStandaloneTestParameterGenerator {
* @return assertion test parameter
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
- return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(), ENV.isSmoke())
+ return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.name(), ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke())
.getAssertionTestParameter(sqlCommandType);
}
@@ -57,7 +57,7 @@ public final class JdbcStandaloneTestParameterGenerator {
* @return case test parameter
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
- return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(), ENV.isSmoke())
+ return new E2ETestParameterGenerator(ADAPTERS, ENV.getScenarios(),
AdapterMode.STANDALONE.name(), ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke())
.getCaseTestParameter(sqlCommandType);
}
}
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ProxyStandaloneTestParameterGenerator.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ProxyStandaloneTestParameterGenerator.java
index 981c6a79876..22a78283946 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ProxyStandaloneTestParameterGenerator.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/framework/param/array/ProxyStandaloneTestParameterGenerator.java
@@ -43,7 +43,7 @@ public final class ProxyStandaloneTestParameterGenerator {
*/
public static Collection<AssertionTestParameter>
getAssertionTestParameter(final SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getAssertionTestParameter(sqlCommandType);
+ ENV.getScenarios(), AdapterMode.STANDALONE.name(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getAssertionTestParameter(sqlCommandType);
}
/**
@@ -54,6 +54,6 @@ public final class ProxyStandaloneTestParameterGenerator {
*/
public static Collection<E2ETestParameter> getCaseTestParameter(final
SQLCommandType sqlCommandType) {
return new
E2ETestParameterGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), AdapterMode.STANDALONE.getValue(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getCaseTestParameter(sqlCommandType);
+ ENV.getScenarios(), AdapterMode.STANDALONE.name(),
ENV.getClusterEnvironment().getDatabaseTypes(),
ENV.isSmoke()).getCaseTestParameter(sqlCommandType);
}
}