Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.apache.shardingsphere.test.e2e.env.container.governance.GovernanceContainer;
import org.apache.shardingsphere.test.e2e.env.container.governance.GovernanceContainerFactory;
import org.apache.shardingsphere.test.e2e.env.container.storage.StorageContainer;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import org.awaitility.Awaitility;
import org.testcontainers.containers.output.OutputFrame;
Expand Down Expand Up @@ -117,7 +117,7 @@ private void createProxyEnvironment(final DockerITContainer agentPluginContainer
containers = new ITContainers(null);
ShardingSphereProxyClusterContainer proxyContainer = new ShardingSphereProxyClusterContainer(databaseType, getAdaptorContainerConfiguration());
proxyContainer.withLogConsumer(testConfig.isLogEnabled() ? this::collectLogs : null);
StorageContainer storageContainer = new DockerStorageContainer(imageConfig.getMysqlImage(), DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, databaseType), null);
StorageContainer storageContainer = new DockerStorageContainer(imageConfig.getMysqlImage(), DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType), null);
proxyContainer.dependsOn(storageContainer);
containers.registerContainer(storageContainer);
GovernanceContainer governanceContainer = GovernanceContainerFactory.newInstance("ZooKeeper");
Expand Down Expand Up @@ -148,7 +148,7 @@ private AdaptorContainerConfiguration getAdaptorContainerConfiguration() {

private void createJDBCEnvironment(final DockerITContainer agentPluginContainer) {
containers = new ITContainers(null);
StorageContainer storageContainer = new DockerStorageContainer(imageConfig.getMysqlImage(), DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, databaseType), null);
StorageContainer storageContainer = new DockerStorageContainer(imageConfig.getMysqlImage(), DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType), null);
ShardingSphereJdbcAgentContainer jdbcAgentContainer = new ShardingSphereJdbcAgentContainer(
imageConfig.getJdbcProjectImage(), testConfig.getPluginType(), testConfig.isLogEnabled() ? this::collectLogs : null);
jdbcAgentContainer.dependsOn(storageContainer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.env.container.storage.mount;

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;

import java.io.File;
import java.util.Collection;
Expand All @@ -31,7 +31,7 @@
@RequiredArgsConstructor
public final class MountConfigurationResourceGenerator {

private final StorageContainerConfigurationOption option;
private final StorageContainerOption option;

/**
* Generate mount configuration resource map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.env.container.storage.mount;

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath;
import org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath.Type;

Expand All @@ -44,7 +44,7 @@ public final class MountSQLResourceGenerator {

private static final String TO_BE_MOUNTED_EXPECTED_SCENARIO_SQL_FILE = "60-scenario-expected-init.sql";

private final StorageContainerConfigurationOption option;
private final StorageContainerOption option;

/**
* Generate mount SQL resource map.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import java.util.Optional;

/**
* Storage container configuration option.
* Storage container option.
*/
@SingletonSPI
public interface StorageContainerConfigurationOption extends DatabaseTypedSPI {
public interface StorageContainerOption extends DatabaseTypedSPI {

/**
* Get container port.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect;

import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;

import java.util.Collection;
import java.util.Collections;
Expand All @@ -27,9 +27,9 @@
import java.util.Optional;

/**
* Storage container configuration option for Hive.
* Storage container option for Hive.
*/
public final class HiveStorageContainerConfigurationOption implements StorageContainerConfigurationOption {
public final class HiveStorageContainerOption implements StorageContainerOption {

@Override
public int getPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect;

import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.util.ContainerUtils;

import java.util.Collection;
Expand All @@ -28,9 +28,9 @@
import java.util.Optional;

/**
* Storage container configuration option for MariaDB.
* Storage container option for MariaDB.
*/
public final class MariaDBStorageContainerConfigurationOption implements StorageContainerConfigurationOption {
public final class MariaDBStorageContainerOption implements StorageContainerOption {

@Override
public int getPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect;

import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.util.ContainerUtils;

import java.util.Arrays;
Expand All @@ -30,9 +30,9 @@
import java.util.Optional;

/**
* Storage container configuration option for MySQL.
* Storage container option for MySQL.
*/
public final class MySQLStorageContainerConfigurationOption implements StorageContainerConfigurationOption {
public final class MySQLStorageContainerOption implements StorageContainerOption {

@Override
public int getPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect;

import org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;

import java.util.Arrays;
import java.util.Collection;
Expand All @@ -28,9 +28,9 @@
import java.util.Optional;

/**
* Storage container configuration option for openGauss.
* Storage container option for openGauss.
*/
public final class OpenGaussStorageContainerConfigurationOption implements StorageContainerConfigurationOption {
public final class OpenGaussStorageContainerOption implements StorageContainerOption {

@Override
public int getPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect;

import org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;

import java.util.Collection;
import java.util.Collections;
Expand All @@ -28,9 +28,9 @@
import java.util.Optional;

/**
* Storage container configuration option for PostgreSQL.
* Storage container option for PostgreSQL.
*/
public final class PostgreSQLStorageContainerConfigurationOption implements StorageContainerConfigurationOption {
public final class PostgreSQLStorageContainerOption implements StorageContainerOption {

@Override
public int getPort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.shardingsphere.test.e2e.env.container.storage.StorageContainer;
import org.apache.shardingsphere.test.e2e.env.container.storage.mount.MountConfigurationResourceGenerator;
import org.apache.shardingsphere.test.e2e.env.container.storage.mount.MountSQLResourceGenerator;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.util.DockerImageVersion;
import org.apache.shardingsphere.test.e2e.env.container.util.JdbcConnectCheckingWaitStrategy;
import org.apache.shardingsphere.test.e2e.env.container.util.SQLScriptUtils;
Expand Down Expand Up @@ -57,7 +57,7 @@
*/
public final class DockerStorageContainer extends DockerITContainer implements StorageContainer {

private final StorageContainerConfigurationOption option;
private final StorageContainerOption option;

private final String scenario;

Expand All @@ -71,15 +71,15 @@ public final class DockerStorageContainer extends DockerITContainer implements S
@Getter
private final Map<String, DataSource> expectedDataSourceMap = new LinkedHashMap<>();

public DockerStorageContainer(final String containerImage, final StorageContainerConfigurationOption option, final String scenario) {
public DockerStorageContainer(final String containerImage, final StorageContainerOption option, final String scenario) {
super(option.getDatabaseType().toLowerCase(), getContainerImage(containerImage, option));
this.option = option;
this.scenario = scenario;
majorVersion = new DockerImageVersion(getContainerImage(containerImage, option)).getMajorVersion();
dataSourceEnvironment = DatabaseTypedSPILoader.getService(DataSourceEnvironment.class, option.getType());
}

private static String getContainerImage(final String containerImage, final StorageContainerConfigurationOption option) {
private static String getContainerImage(final String containerImage, final StorageContainerOption option) {
Preconditions.checkNotNull(option, "Can not support database type `%s`", option.getDatabaseType());
return Strings.isNullOrEmpty(containerImage) ? option.getDefaultImageName() : containerImage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
import org.apache.shardingsphere.test.e2e.env.container.storage.StorageContainer;
import org.apache.shardingsphere.test.e2e.env.container.storage.mount.MountSQLResourceGenerator;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.util.SQLScriptUtils;
import org.apache.shardingsphere.test.e2e.env.container.util.StorageContainerUtils;
import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
Expand Down Expand Up @@ -52,7 +52,7 @@ public final class NativeStorageContainer implements StorageContainer {

private final String scenario;

private final StorageContainerConfigurationOption option;
private final StorageContainerOption option;

@Getter
private final Map<String, DataSource> actualDataSourceMap;
Expand All @@ -68,7 +68,7 @@ public NativeStorageContainer(final DatabaseType databaseType, final String scen
env = E2ETestEnvironment.getInstance();
this.databaseType = databaseType;
this.scenario = scenario;
option = DatabaseTypedSPILoader.findService(StorageContainerConfigurationOption.class, databaseType).orElse(null);
option = DatabaseTypedSPILoader.findService(StorageContainerOption.class, databaseType).orElse(null);
initDatabase();
actualDataSourceMap = createDataSourceMap(Type.ACTUAL);
expectedDataSourceMap = createDataSourceMap(Type.EXPECTED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.
#

org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.MySQLStorageContainerConfigurationOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.PostgreSQLStorageContainerConfigurationOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.MariaDBStorageContainerConfigurationOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.OpenGaussStorageContainerConfigurationOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.HiveStorageContainerConfigurationOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.MySQLStorageContainerOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.PostgreSQLStorageContainerOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.MariaDBStorageContainerOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.OpenGaussStorageContainerOption
org.apache.shardingsphere.test.e2e.env.container.storage.option.dialect.HiveStorageContainerOption
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import org.apache.shardingsphere.test.e2e.operation.pipeline.entity.CreateTableSQLGeneratorAssertionEntity;
import org.apache.shardingsphere.test.e2e.operation.pipeline.entity.CreateTableSQLGeneratorAssertionsRootEntity;
Expand Down Expand Up @@ -91,7 +91,7 @@ void assertGenerateCreateTableSQL(final PipelineTestParameter testParam) throws
}

private void startStorageContainer(final DatabaseType databaseType, final String storageContainerImage) {
storageContainer = new DockerStorageContainer(storageContainerImage, DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, databaseType), null);
storageContainer = new DockerStorageContainer(storageContainerImage, DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType), null);
storageContainer.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
import org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;

Expand Down Expand Up @@ -71,7 +71,7 @@ private Properties loadProperties() {
* @return actual database port
*/
public int getActualDatabasePort(final DatabaseType databaseType) {
int defaultPort = DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, databaseType).getPort();
int defaultPort = DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType).getPort();
return Integer.parseInt(props.getProperty(String.format("pipeline.it.native.%s.port", databaseType.getType().toLowerCase()), String.valueOf(defaultPort)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.shardingsphere.test.e2e.env.container.adapter.impl.ShardingSphereProxyEmbeddedContainer;
import org.apache.shardingsphere.test.e2e.env.container.governance.GovernanceContainer;
import org.apache.shardingsphere.test.e2e.env.container.governance.impl.ZookeeperContainer;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import org.apache.shardingsphere.test.e2e.env.runtime.datasource.DataSourceEnvironment;
import org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
Expand Down Expand Up @@ -58,7 +58,7 @@ public PipelineDockerContainerComposer(final DatabaseType databaseType, final St
GovernanceContainer governanceContainer = getContainers().registerContainer(new ZookeeperContainer());
for (int i = 0; i < storageContainerCount; i++) {
DockerStorageContainer storageContainer = getContainers().registerContainer(
new DockerStorageContainer(storageContainerImage, DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, databaseType), null));
new DockerStorageContainer(storageContainerImage, DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType), null));
storageContainer.setNetworkAliases(Collections.singletonList(String.join(".", databaseType.getType().toLowerCase() + "_" + i, "host")));
storageContainers.add(storageContainer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.shardingsphere.test.e2e.env.container.governance.GovernanceContainer;
import org.apache.shardingsphere.test.e2e.env.container.governance.GovernanceContainerFactory;
import org.apache.shardingsphere.test.e2e.env.container.storage.StorageContainer;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConfigurationOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import org.apache.shardingsphere.test.e2e.env.container.util.AdapterContainerUtils;
import org.apache.shardingsphere.test.e2e.operation.showprocesslist.env.ShowProcessListEnvironment;
Expand Down Expand Up @@ -58,7 +58,7 @@ public ClusterShowProcessListContainerComposer(final ShowProcessListTestParamete
containers = new ITContainers(testParam.getScenario());
governanceContainer = isClusterMode(testParam.getRunMode()) ? containers.registerContainer(GovernanceContainerFactory.newInstance("ZooKeeper")) : null;
StorageContainer storageContainer = containers.registerContainer(
new DockerStorageContainer("", DatabaseTypedSPILoader.getService(StorageContainerConfigurationOption.class, testParam.getDatabaseType()), testParam.getScenario()));
new DockerStorageContainer("", DatabaseTypedSPILoader.getService(StorageContainerOption.class, testParam.getDatabaseType()), testParam.getScenario()));
AdaptorContainerConfiguration containerConfig = new AdaptorContainerConfiguration(testParam.getScenario(), new LinkedList<>(),
getMountedResources(testParam.getScenario(), testParam.getDatabaseType(), testParam.getRunMode(), testParam.getGovernanceCenter()), AdapterContainerUtils.getAdapterContainerImage(),
"");
Expand Down
Loading