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 a92fa46eef6 Refactor : refactor the integration test with code conduct
(#20893)
a92fa46eef6 is described below
commit a92fa46eef6bac3f04f4cbf76979c4ab225b433b
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Thu Sep 8 23:51:37 2022 +0800
Refactor : refactor the integration test with code conduct (#20893)
* Refactor : rename the function by code conduct
* Refactor : add exception to avoid the memory leak
* Refactor : replace the magic varibles with constants
* Refactor : refacor the constant descriptor
* Refactor : refactor the constant for transaction IT
* Format : format the code
---
...erConstants.java => AdapterContainerConstants.java} | 18 ++++--------------
...ntainerConstants.java => EnvironmentConstants.java} | 18 +++++-------------
.../atomic/constants/ProxyContainerConstants.java | 2 +-
.../atomic/constants/StorageContainerConstants.java | 2 +-
.../container/compose/DockerContainerComposer.java | 4 +++-
.../container/compose/DockerContainerComposer.java | 6 ++++--
.../container/compose/ContainerComposerRegistry.java | 12 +++++++++---
.../integration/engine/TotalSuitesCountCalculator.java | 6 ++++--
.../array/ClusterParameterizedArrayGenerator.java | 7 ++++---
.../JdbcStandaloneParameterizedArrayGenerator.java | 8 +++++---
.../param/array/ParameterizedArrayFactory.java | 15 ++++++++-------
.../ProxyStandaloneParameterizedArrayGenerator.java | 5 +++--
.../cases/alterresource/AddResourceTestCase.java | 3 ++-
.../cases/alterresource/CloseResourceTestCase.java | 3 ++-
.../cases/truncate/MySQLXATruncateTestCase.java | 3 ++-
.../transaction/engine/base/BaseITCase.java | 3 ++-
.../engine/constants/TransactionTestConstants.java | 4 ----
.../engine/mysql/MySQLProxyTransactionIT.java | 4 ++--
.../engine/opengauss/OpenGaussProxyTransactionIT.java | 4 ++--
.../postgresql/PostgreSQLProxyTransactionIT.java | 4 ++--
.../env/enums/TransactionTestCaseRegistry.java | 13 +++++++------
.../container/compose/DockerContainerComposer.java | 9 +++++----
22 files changed, 77 insertions(+), 76 deletions(-)
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/AdapterContainerConstants.java
similarity index 61%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/AdapterContainerConstants.java
index 4d0dee7e9b9..453d16cc706 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/AdapterContainerConstants.java
@@ -21,22 +21,12 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * Proxy container constants.
+ * Adapter container constants.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class ProxyContainerConstants {
+public final class AdapterContainerConstants {
- public static final String USERNAME = "proxy";
+ public static final String PROXY = "proxy";
- public static final String PASSWORD = "Proxy@123";
-
- public static final String AGENT_HOME_IN_CONTAINER =
"/usr/local/shardingsphere-agent";
-
- public static final String CONFIG_PATH_IN_CONTAINER =
"/opt/shardingsphere-proxy/conf/";
-
- public static final String PROXY_CONTAINER_NAME_PREFIX =
"ShardingSphere-Proxy";
-
- public static final String PROXY_CONTAINER_IMAGE =
"apache/shardingsphere-proxy-test";
-
- public static final String PROXY_CONTAINER_ABBREVIATION = "proxy";
+ public static final String JDBC = "jdbc";
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/EnvironmentConstants.java
similarity index 61%
copy from
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
copy to
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/EnvironmentConstants.java
index 4d0dee7e9b9..630b8fb9831 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/EnvironmentConstants.java
@@ -21,22 +21,14 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * Proxy container constants.
+ * Environment constant.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class ProxyContainerConstants {
+public final class EnvironmentConstants {
- public static final String USERNAME = "proxy";
+ public static final String CLUSTER_MODE = "Cluster";
- public static final String PASSWORD = "Proxy@123";
+ public static final String STANDALONE_MODE = "Standalone";
- public static final String AGENT_HOME_IN_CONTAINER =
"/usr/local/shardingsphere-agent";
-
- public static final String CONFIG_PATH_IN_CONTAINER =
"/opt/shardingsphere-proxy/conf/";
-
- public static final String PROXY_CONTAINER_NAME_PREFIX =
"ShardingSphere-Proxy";
-
- public static final String PROXY_CONTAINER_IMAGE =
"apache/shardingsphere-proxy-test";
-
- public static final String PROXY_CONTAINER_ABBREVIATION = "proxy";
+ public static final int DEFAULT_FULL_CONTAINER_QUANTITY = 8;
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
index 4d0dee7e9b9..20287edfd8e 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/ProxyContainerConstants.java
@@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
* Proxy container constants.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class ProxyContainerConstants {
+public final class ProxyContainerConstants {
public static final String USERNAME = "proxy";
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/StorageContainerConstants.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/StorageContainerConstants.java
index 3d49a445c85..fbd54742aee 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/StorageContainerConstants.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-env/src/test/java/org/apache/shardingsphere/test/integration/env/container/atomic/constants/StorageContainerConstants.java
@@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
* Storage container constants.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public class StorageContainerConstants {
+public final class StorageContainerConstants {
public static final int MYSQL_EXPOSED_PORT = 3306;
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
index 8683bbe1f32..360936ab7db 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-ha/src/test/java/org/apache/shardingsphere/test/integration/ha/framework/container/compose/DockerContainerComposer.java
@@ -23,6 +23,8 @@ import
org.apache.shardingsphere.infra.database.type.DatabaseType;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.StorageContainerConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
@@ -72,7 +74,7 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
AdaptorContainerConfiguration containerConfig =
ProxyClusterContainerConfigurationFactory.newInstance(scenario);
ShardingSphereProxyClusterContainer proxyClusterContainer =
(ShardingSphereProxyClusterContainer) AdapterContainerFactory
- .newInstance("Cluster", "proxy", databaseType, null, "",
containerConfig);
+ .newInstance(EnvironmentConstants.CLUSTER_MODE,
AdapterContainerConstants.PROXY, databaseType, null, "", containerConfig);
storageContainers.forEach(each ->
proxyClusterContainer.dependsOn(governanceContainer, each));
proxyContainer =
getContainers().registerContainer(proxyClusterContainer);
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerContainerComposer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerContainerComposer.java
index 310d7f807a7..26317245ea8 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerContainerComposer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerContainerComposer.java
@@ -23,6 +23,8 @@ import
org.apache.shardingsphere.integration.data.pipeline.framework.container.c
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
@@ -51,8 +53,8 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
storageContainer =
getContainers().registerContainer((DockerStorageContainer)
StorageContainerFactory.newInstance(databaseType, dockerImageName,
"",
StorageContainerConfigurationFactory.newInstance(databaseType)));
AdaptorContainerConfiguration containerConfig =
ScalingProxyClusterContainerConfigurationFactory.newInstance(databaseType,
dockerImageName);
- ShardingSphereProxyClusterContainer proxyClusterContainer =
- (ShardingSphereProxyClusterContainer)
AdapterContainerFactory.newInstance("Cluster", "proxy", databaseType,
storageContainer, "", containerConfig);
+ ShardingSphereProxyClusterContainer proxyClusterContainer =
(ShardingSphereProxyClusterContainer)
AdapterContainerFactory.newInstance(EnvironmentConstants.CLUSTER_MODE,
+ AdapterContainerConstants.PROXY, databaseType,
storageContainer, "", containerConfig);
proxyClusterContainer.dependsOn(governanceContainer, storageContainer);
proxyContainer =
getContainers().registerContainer(proxyClusterContainer);
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ContainerComposerRegistry.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ContainerComposerRegistry.java
index 42251d04d63..c14e01804eb 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ContainerComposerRegistry.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/container/compose/ContainerComposerRegistry.java
@@ -20,6 +20,8 @@ package
org.apache.shardingsphere.test.integration.container.compose;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.test.integration.container.compose.mode.ClusterContainerComposer;
import
org.apache.shardingsphere.test.integration.container.compose.mode.StandaloneContainerComposer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
import javax.sql.DataSource;
@@ -31,10 +33,10 @@ import java.util.Map;
*/
public final class ContainerComposerRegistry implements AutoCloseable {
- private final Map<String, ContainerComposer> containerComposers = new
HashMap<>();
+ private final Map<String, ContainerComposer> containerComposers = new
HashMap<>(EnvironmentConstants.DEFAULT_FULL_CONTAINER_QUANTITY, 1);
/**
- * Get composed container.
+ * Get container composer.
*
* @param parameterizedArray parameterized array
* @return composed container
@@ -58,7 +60,7 @@ public final class ContainerComposerRegistry implements
AutoCloseable {
private boolean isClusterMode(final ParameterizedArray parameterizedArray)
{
// TODO cluster mode often throw exception sometimes, issue is #15517
- return "Cluster".equalsIgnoreCase(parameterizedArray.getMode()) &&
"proxy".equalsIgnoreCase(parameterizedArray.getAdapter());
+ return
EnvironmentConstants.CLUSTER_MODE.equalsIgnoreCase(parameterizedArray.getMode())
&&
AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterizedArray.getAdapter());
}
@Override
@@ -75,6 +77,8 @@ public final class ContainerComposerRegistry implements
AutoCloseable {
private void closeTargetDataSource(final DataSource targetDataSource) {
if (targetDataSource instanceof AutoCloseable) {
((AutoCloseable) targetDataSource).close();
+ } else {
+ throw new RuntimeException("targetDataSource is not
AutoCloseable");
}
}
@@ -83,6 +87,8 @@ public final class ContainerComposerRegistry implements
AutoCloseable {
for (DataSource each : actualDataSourceMap.values()) {
if (each instanceof AutoCloseable) {
((AutoCloseable) each).close();
+ } else {
+ throw new RuntimeException("actualDataSource is not
AutoCloseable");
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/TotalSuitesCountCalculator.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/TotalSuitesCountCalculator.java
index f432eb22138..e255c636629 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/TotalSuitesCountCalculator.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/TotalSuitesCountCalculator.java
@@ -19,6 +19,8 @@ package org.apache.shardingsphere.test.integration.engine;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
/**
@@ -60,10 +62,10 @@ public final class TotalSuitesCountCalculator {
}
private static boolean isRunDCL() {
- return ENV.getRunModes().contains("Cluster");
+ return ENV.getRunModes().contains(EnvironmentConstants.CLUSTER_MODE);
}
private static boolean isRunProxy() {
- return ENV.getRunModes().contains("Cluster") &&
ENV.getClusterEnvironment().getAdapters().contains("proxy");
+ return ENV.getRunModes().contains(EnvironmentConstants.CLUSTER_MODE)
&&
ENV.getClusterEnvironment().getAdapters().contains(AdapterContainerConstants.PROXY);
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ClusterParameterizedArrayGenerator.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ClusterParameterizedArrayGenerator.java
index 83a40124975..4ac94081e3a 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ClusterParameterizedArrayGenerator.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ClusterParameterizedArrayGenerator.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.test.integration.framework.param.array;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import
org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
import
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
@@ -41,18 +42,18 @@ public final class ClusterParameterizedArrayGenerator {
* @return assertion parameterized array
*/
public static Collection<AssertionParameterizedArray>
getAssertionParameterized(final SQLCommandType sqlCommandType) {
- return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), "Cluster",
+ return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), EnvironmentConstants.CLUSTER_MODE,
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionParameterized(sqlCommandType);
}
/**
* Get case parameterized array.
*
- * @param sqlCommandType SQL command type
+ * @param sqlCommandType SQL commandEnvironmentConstants type
* @return case parameterized array
*/
public static Collection<ParameterizedArray> getCaseParameterized(final
SQLCommandType sqlCommandType) {
- return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), "Cluster",
+ return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
ENV.getScenarios(), EnvironmentConstants.CLUSTER_MODE,
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseParameterized(sqlCommandType);
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
index 3a39d05d7be..c2ad7e3f0b7 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/JdbcStandaloneParameterizedArrayGenerator.java
@@ -22,6 +22,8 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import
org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
import
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
@@ -35,7 +37,7 @@ import java.util.Collections;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class JdbcStandaloneParameterizedArrayGenerator {
- private static final Collection<String> ADAPTERS =
Collections.singleton("jdbc");
+ private static final Collection<String> ADAPTERS =
Collections.singleton(AdapterContainerConstants.JDBC);
private static final Collection<DatabaseType> DATABASE_TYPES =
Collections.singleton(DatabaseTypeFactory.getInstance("H2"));
@@ -48,7 +50,7 @@ public final class JdbcStandaloneParameterizedArrayGenerator {
* @return assertion parameterized array
*/
public static Collection<AssertionParameterizedArray>
getAssertionParameterized(final SQLCommandType sqlCommandType) {
- return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(),
"Standalone", DATABASE_TYPES).getAssertionParameterized(sqlCommandType);
+ return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(),
EnvironmentConstants.STANDALONE_MODE,
DATABASE_TYPES).getAssertionParameterized(sqlCommandType);
}
/**
@@ -58,6 +60,6 @@ public final class JdbcStandaloneParameterizedArrayGenerator {
* @return case parameterized array
*/
public static Collection<ParameterizedArray> getCaseParameterized(final
SQLCommandType sqlCommandType) {
- return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(),
"Standalone", DATABASE_TYPES).getCaseParameterized(sqlCommandType);
+ return new ParameterizedArrayGenerator(ADAPTERS, ENV.getScenarios(),
EnvironmentConstants.STANDALONE_MODE,
DATABASE_TYPES).getCaseParameterized(sqlCommandType);
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
index ac450d7b26d..48ba2fc11d3 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ParameterizedArrayFactory.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.test.integration.framework.param.array;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import
org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
import
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
@@ -44,13 +45,13 @@ public final class ParameterizedArrayFactory {
public static Collection<AssertionParameterizedArray>
getAssertionParameterized(final SQLCommandType sqlCommandType) {
Collection<AssertionParameterizedArray> result = new LinkedList<>();
for (String each : ENV.getRunModes()) {
- if ("Standalone".equalsIgnoreCase(each)) {
- if (distSQLCommandType(sqlCommandType)) {
+ if (EnvironmentConstants.STANDALONE_MODE.equalsIgnoreCase(each)) {
+ if (isDistSQLCommandType(sqlCommandType)) {
result.addAll(ProxyStandaloneParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
} else {
result.addAll(JdbcStandaloneParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
}
- } else if ("Cluster".equalsIgnoreCase(each)) {
+ } else if
(EnvironmentConstants.CLUSTER_MODE.equalsIgnoreCase(each)) {
result.addAll(ClusterParameterizedArrayGenerator.getAssertionParameterized(sqlCommandType));
}
}
@@ -66,20 +67,20 @@ public final class ParameterizedArrayFactory {
public static Collection<ParameterizedArray> getCaseParameterized(final
SQLCommandType sqlCommandType) {
Collection<ParameterizedArray> result = new LinkedList<>();
for (String each : ENV.getRunModes()) {
- if ("Standalone".equalsIgnoreCase(each)) {
- if (distSQLCommandType(sqlCommandType)) {
+ if (EnvironmentConstants.STANDALONE_MODE.equalsIgnoreCase(each)) {
+ if (isDistSQLCommandType(sqlCommandType)) {
result.addAll(ProxyStandaloneParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
} else {
result.addAll(JdbcStandaloneParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
}
- } else if ("Cluster".equalsIgnoreCase(each)) {
+ } else if
(EnvironmentConstants.CLUSTER_MODE.equalsIgnoreCase(each)) {
result.addAll(ClusterParameterizedArrayGenerator.getCaseParameterized(sqlCommandType));
}
}
return result;
}
- private static boolean distSQLCommandType(final SQLCommandType
sqlCommandType) {
+ private static boolean isDistSQLCommandType(final SQLCommandType
sqlCommandType) {
return SQLCommandType.RDL == sqlCommandType || SQLCommandType.RAL ==
sqlCommandType || SQLCommandType.RQL == sqlCommandType;
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
index ff9d31164e9..987aea68ac3 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/array/ProxyStandaloneParameterizedArrayGenerator.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.test.integration.framework.param.array;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.test.integration.cases.SQLCommandType;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.runtime.IntegrationTestEnvironment;
import
org.apache.shardingsphere.test.integration.framework.param.model.AssertionParameterizedArray;
import
org.apache.shardingsphere.test.integration.framework.param.model.ParameterizedArray;
@@ -42,7 +43,7 @@ public final class ProxyStandaloneParameterizedArrayGenerator
{
*/
public static Collection<AssertionParameterizedArray>
getAssertionParameterized(final SQLCommandType sqlCommandType) {
return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), "Standalone",
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionParameterized(sqlCommandType);
+ ENV.getScenarios(), EnvironmentConstants.STANDALONE_MODE,
ENV.getClusterEnvironment().getDatabaseTypes()).getAssertionParameterized(sqlCommandType);
}
/**
@@ -53,6 +54,6 @@ public final class ProxyStandaloneParameterizedArrayGenerator
{
*/
public static Collection<ParameterizedArray> getCaseParameterized(final
SQLCommandType sqlCommandType) {
return new
ParameterizedArrayGenerator(ENV.getClusterEnvironment().getAdapters(),
- ENV.getScenarios(), "Standalone",
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseParameterized(sqlCommandType);
+ ENV.getScenarios(), EnvironmentConstants.STANDALONE_MODE,
ENV.getClusterEnvironment().getDatabaseTypes()).getCaseParameterized(sqlCommandType);
}
}
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/AddResourceTestCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/AddResourceTestCase.java
index 4603176d3b7..e0ca9eec9ba 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/AddResourceTestCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/AddResourceTestCase.java
@@ -23,6 +23,7 @@ import
org.apache.shardingsphere.integration.transaction.cases.base.BaseTransact
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
import
org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import javax.sql.DataSource;
import java.sql.Connection;
@@ -32,7 +33,7 @@ import java.sql.SQLException;
* Integration test of add resource.
*/
@Slf4j
-@TransactionTestCase(adapters = TransactionTestConstants.PROXY, group =
"addResource")
+@TransactionTestCase(adapters = AdapterContainerConstants.PROXY, group =
"addResource")
public final class AddResourceTestCase extends BaseTransactionTestCase {
public AddResourceTestCase(final BaseTransactionITCase
baseTransactionITCase, final DataSource dataSource) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/CloseResourceTestCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/CloseResourceTestCase.java
index 4dc8da60086..829efa0e789 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/CloseResourceTestCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/alterresource/CloseResourceTestCase.java
@@ -23,6 +23,7 @@ import
org.apache.shardingsphere.integration.transaction.cases.base.BaseTransact
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
import
org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import javax.sql.DataSource;
import java.sql.Connection;
@@ -32,7 +33,7 @@ import java.sql.SQLException;
* Integration test of close resource.
*/
@Slf4j
-@TransactionTestCase(adapters = TransactionTestConstants.PROXY, group =
"closeResource")
+@TransactionTestCase(adapters = AdapterContainerConstants.PROXY, group =
"closeResource")
public final class CloseResourceTestCase extends BaseTransactionTestCase {
public CloseResourceTestCase(final BaseTransactionITCase
baseTransactionITCase, final DataSource dataSource) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
index 95f219fe486..8f1fb46c0c2 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/truncate/MySQLXATruncateTestCase.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransac
import
org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
import
org.apache.shardingsphere.dialect.exception.transaction.TableModifyInTransactionException;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import org.apache.shardingsphere.transaction.core.TransactionType;
import javax.sql.DataSource;
@@ -36,7 +37,7 @@ import static org.junit.Assert.fail;
* MySQL truncate XA transaction integration test.
*/
@Slf4j
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, adapters =
{TransactionTestConstants.PROXY}, transactionTypes = {TransactionType.XA})
+@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, adapters =
{AdapterContainerConstants.PROXY}, transactionTypes = {TransactionType.XA})
public final class MySQLXATruncateTestCase extends BaseTransactionTestCase {
public MySQLXATruncateTestCase(final BaseTransactionITCase
baseTransactionITCase, final DataSource dataSource) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
index 71f21f8a48c..6d0cc728ccc 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/base/BaseITCase.java
@@ -40,6 +40,7 @@ import
org.apache.shardingsphere.integration.transaction.framework.container.com
import
org.apache.shardingsphere.integration.transaction.framework.container.compose.NativeContainerComposer;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
import
org.apache.shardingsphere.integration.transaction.util.TestCaseClassScanner;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.DatabaseTypeUtil;
import
org.apache.shardingsphere.test.integration.env.container.atomic.util.StorageContainerUtil;
@@ -142,7 +143,7 @@ public abstract class BaseITCase {
}
protected boolean isProxyAdapter(final TransactionParameterized
parameterized) {
- return
parameterized.getAdapter().equalsIgnoreCase(TransactionTestConstants.PROXY);
+ return
parameterized.getAdapter().equalsIgnoreCase(AdapterContainerConstants.PROXY);
}
protected static Collection<TransactionParameterized>
getTransactionParameterizedList(final Class<? extends BaseTransactionITCase>
testCaseClass) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java
index 769069cd2d4..10034b13da7 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java
@@ -32,10 +32,6 @@ public final class TransactionTestConstants {
public static final String POSTGRESQL = "PostgreSQL";
- public static final String JDBC = "jdbc";
-
- public static final String PROXY = "proxy";
-
public static final String ACCOUNT = "account";
public static final String DEFAULT_TYPE = "default_type";
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
index 219cbfbea4d..e50f36b8cdb 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLProxyTransactionIT.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.integration.transaction.engine.mysql;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
-import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.After;
import org.junit.Before;
@@ -57,7 +57,7 @@ public final class MySQLProxyTransactionIT extends
BaseTransactionITCase {
@Before
@SneakyThrows(SQLException.class)
public void before() {
- if
(TransactionTestConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
+ if
(AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
if (Objects.equals(parameterized.getTransactionType(),
TransactionType.LOCAL)) {
alterLocalTransactionRule();
} else if (Objects.equals(parameterized.getTransactionType(),
TransactionType.XA)) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
index 0019711f95c..8670f0a6052 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.integration.transaction.engine.opengauss;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
-import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.After;
import org.junit.Before;
@@ -57,7 +57,7 @@ public final class OpenGaussProxyTransactionIT extends
BaseTransactionITCase {
@Before
@SneakyThrows(SQLException.class)
public void before() {
- if
(TransactionTestConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
+ if
(AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
if (Objects.equals(parameterized.getTransactionType(),
TransactionType.LOCAL)) {
alterLocalTransactionRule();
} else if (Objects.equals(parameterized.getTransactionType(),
TransactionType.XA)) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
index 3089d116681..812d8e0e761 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.integration.transaction.engine.postgresql;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
-import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.junit.After;
import org.junit.Before;
@@ -57,7 +57,7 @@ public final class PostgreSQLProxyTransactionIT extends
BaseTransactionITCase {
@Before
@SneakyThrows(SQLException.class)
public void before() {
- if
(TransactionTestConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
+ if
(AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
if (Objects.equals(parameterized.getTransactionType(),
TransactionType.LOCAL)) {
alterLocalTransactionRule();
} else if (Objects.equals(parameterized.getTransactionType(),
TransactionType.XA)) {
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/enums/TransactionTestCaseRegistry.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/enums/TransactionTestCaseRegistry.java
index 6b2033dba76..64a9f7dff74 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/enums/TransactionTestCaseRegistry.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/enums/TransactionTestCaseRegistry.java
@@ -27,6 +27,7 @@ import
org.apache.shardingsphere.integration.transaction.engine.opengauss.OpenGa
import
org.apache.shardingsphere.integration.transaction.engine.opengauss.OpenGaussProxyTransactionIT;
import
org.apache.shardingsphere.integration.transaction.engine.postgresql.PostgreSQLJdbcTransactionIT;
import
org.apache.shardingsphere.integration.transaction.engine.postgresql.PostgreSQLProxyTransactionIT;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
/**
* Transaction test case registry.
@@ -35,17 +36,17 @@ import
org.apache.shardingsphere.integration.transaction.engine.postgresql.Postg
@Getter
public enum TransactionTestCaseRegistry {
- MySQL_JDBC_IT(MySQLJdbcTransactionIT.class,
TransactionTestConstants.MYSQL, TransactionTestConstants.JDBC),
+ MySQL_JDBC_IT(MySQLJdbcTransactionIT.class,
TransactionTestConstants.MYSQL, AdapterContainerConstants.JDBC),
- MySQL_PROXY_IT(MySQLProxyTransactionIT.class,
TransactionTestConstants.MYSQL, TransactionTestConstants.PROXY),
+ MySQL_PROXY_IT(MySQLProxyTransactionIT.class,
TransactionTestConstants.MYSQL, AdapterContainerConstants.PROXY),
- OPENGAUSS_JDBC_IT(OpenGaussJdbcTransactionIT.class,
TransactionTestConstants.OPENGAUSS, TransactionTestConstants.JDBC),
+ OPENGAUSS_JDBC_IT(OpenGaussJdbcTransactionIT.class,
TransactionTestConstants.OPENGAUSS, AdapterContainerConstants.JDBC),
- OPENGAUSS_PROXY_IT(OpenGaussProxyTransactionIT.class,
TransactionTestConstants.OPENGAUSS, TransactionTestConstants.PROXY),
+ OPENGAUSS_PROXY_IT(OpenGaussProxyTransactionIT.class,
TransactionTestConstants.OPENGAUSS, AdapterContainerConstants.PROXY),
- POSTGRESQL_JDBC_IT(PostgreSQLJdbcTransactionIT.class,
TransactionTestConstants.POSTGRESQL, TransactionTestConstants.JDBC),
+ POSTGRESQL_JDBC_IT(PostgreSQLJdbcTransactionIT.class,
TransactionTestConstants.POSTGRESQL, AdapterContainerConstants.JDBC),
- POSTGRESQL_PROXY_IT(PostgreSQLProxyTransactionIT.class,
TransactionTestConstants.POSTGRESQL, TransactionTestConstants.PROXY);
+ POSTGRESQL_PROXY_IT(PostgreSQLProxyTransactionIT.class,
TransactionTestConstants.POSTGRESQL, AdapterContainerConstants.PROXY);
private final Class<? extends BaseTransactionITCase> testCaseClass;
diff --git
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
index b69075a3126..445e13238b9 100644
---
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
+++
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/compose/DockerContainerComposer.java
@@ -21,13 +21,14 @@ import com.google.common.base.Strings;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
import
org.apache.shardingsphere.integration.transaction.framework.container.config.StorageContainerConfigurationFactory;
import
org.apache.shardingsphere.integration.transaction.framework.container.config.proxy.ProxyClusterContainerConfigurationFactory;
import
org.apache.shardingsphere.integration.transaction.framework.container.jdbc.ShardingSphereJDBCContainer;
import
org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.AdapterContainerFactory;
import
org.apache.shardingsphere.test.integration.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.AdapterContainerConstants;
+import
org.apache.shardingsphere.test.integration.env.container.atomic.constants.EnvironmentConstants;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.GovernanceContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.governance.impl.ZookeeperContainer;
import
org.apache.shardingsphere.test.integration.env.container.atomic.storage.DockerStorageContainer;
@@ -58,10 +59,10 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
governanceContainer = getContainers().registerContainer(new
ZookeeperContainer());
storageContainer =
getContainers().registerContainer((DockerStorageContainer)
StorageContainerFactory.newInstance(databaseType,
parameterized.getDockerImageName(), "",
StorageContainerConfigurationFactory.newInstance(databaseType)));
- if
(TransactionTestConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
+ if
(AdapterContainerConstants.PROXY.equalsIgnoreCase(parameterized.getAdapter())) {
jdbcContainer = null;
- proxyContainer = (ShardingSphereProxyClusterContainer)
AdapterContainerFactory.newInstance("Cluster", "proxy", databaseType,
storageContainer, "",
-
ProxyClusterContainerConfigurationFactory.newInstance(databaseType));
+ proxyContainer = (ShardingSphereProxyClusterContainer)
AdapterContainerFactory.newInstance(EnvironmentConstants.CLUSTER_MODE,
AdapterContainerConstants.PROXY,
+ databaseType, storageContainer, "",
ProxyClusterContainerConfigurationFactory.newInstance(databaseType));
proxyContainer.dependsOn(governanceContainer, storageContainer);
getContainers().registerContainer(proxyContainer);
} else {