You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/02/11 16:06:39 UTC
[shardingsphere] branch master updated: Remove useless code for BaseITCase (#15369)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 e3b8ef4 Remove useless code for BaseITCase (#15369)
e3b8ef4 is described below
commit e3b8ef472626978fd5340c571a66788685dd0831
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Feb 12 00:02:35 2022 +0800
Remove useless code for BaseITCase (#15369)
* Refactor ShardingSphereProxyContainer
* Remove useless code for BaseITCase
---
.../shardingsphere/test/integration/engine/BaseITCase.java | 8 --------
.../atomic/adapter/impl/ShardingSphereProxyContainer.java | 9 +++++----
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseITCase.java
index 6d753dd..01308c3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/BaseITCase.java
@@ -78,14 +78,6 @@ public abstract class BaseITCase {
targetDataSource = composedContainer.getClientDataSource();
if (composedContainer instanceof ClusterComposedContainer) {
anotherClientDataSource = ((ClusterComposedContainer) composedContainer).getAnotherClientDataSource();
- int waitForGov = 10;
- while (waitForGov-- > 0) {
- try (Connection ignored = targetDataSource.getConnection()) {
- return;
- } catch (NullPointerException ignored) {
- Thread.sleep(2000L);
- }
- }
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
index 1745635..f1c3712 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
@@ -140,7 +140,7 @@ public final class ShardingSphereProxyContainer extends AdapterContainer {
HikariDataSource result = new HikariDataSource();
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseType));
result.setJdbcUrl(DataSourceEnvironment.getURL(databaseType, getHost(), getMappedPort(3307), getParameterizedArray().getScenario()));
- YamlUserConfiguration userConfig = loadUserConfiguration(getParameterizedArray());
+ YamlUserConfiguration userConfig = loadUserConfiguration();
result.setUsername(userConfig.getUsername());
result.setPassword(userConfig.getPassword());
result.setMaximumPoolSize(2);
@@ -152,9 +152,10 @@ public final class ShardingSphereProxyContainer extends AdapterContainer {
}
@SneakyThrows(IOException.class)
- private YamlUserConfiguration loadUserConfiguration(final ParameterizedArray parameterizedArray) {
- YamlProxyServerConfiguration serverConfig = YamlEngine.unmarshal(ByteStreams.toByteArray(Objects.requireNonNull(this.getClass().getResourceAsStream(
- "/docker/proxy/conf/" + parameterizedArray.getScenario() + "/" + parameterizedArray.getDatabaseType().getName().toLowerCase() + "/server.yaml"))), YamlProxyServerConfiguration.class);
+ private YamlUserConfiguration loadUserConfiguration() {
+ String serverFile = "/docker/proxy/conf/" + getParameterizedArray().getScenario() + "/" + getParameterizedArray().getDatabaseType().getName().toLowerCase() + "/server.yaml";
+ YamlProxyServerConfiguration serverConfig = YamlEngine.unmarshal(
+ ByteStreams.toByteArray(Objects.requireNonNull(this.getClass().getResourceAsStream(serverFile))), YamlProxyServerConfiguration.class);
return YamlUsersConfigurationConverter.convertYamlUserConfiguration(getProxyUsers(serverConfig)).stream().findFirst().orElse(new YamlUserConfiguration());
}