You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/02/26 12:07:00 UTC
[shardingsphere] branch master updated: Refactor
YamlDataSourceConfigurationSwapper (#9522)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 e31cf78 Refactor YamlDataSourceConfigurationSwapper (#9522)
e31cf78 is described below
commit e31cf787cb7e10005de240472d402a15dbc4ba85
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Feb 26 20:06:28 2021 +0800
Refactor YamlDataSourceConfigurationSwapper (#9522)
---
.../integration/cases/assertion/IntegrationTestCase.java | 2 +-
.../engine/param/ParameterizedArrayFactory.java | 16 ++++------------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/IntegrationTestCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/IntegrationTestCase.java
index 8e25f9e..3f8e49b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/IntegrationTestCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/IntegrationTestCase.java
@@ -40,7 +40,7 @@ public final class IntegrationTestCase {
@XmlAttribute(name = "db-types")
private String dbTypes;
-
+
@XmlAttribute(name = "scenario-types")
private String scenarioTypes;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
index b48705b..2715a12 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/param/ParameterizedArrayFactory.java
@@ -35,6 +35,7 @@ import org.apache.shardingsphere.test.integration.env.IntegrationTestEnvironment
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@@ -105,18 +106,9 @@ public final class ParameterizedArrayFactory {
private static Collection<ParameterizedArray> getAssertionParameterizedArray(final IntegrationTestCaseContext testCaseContext, final IntegrationTestCaseAssertion assertion,
final String adapter, final DatabaseType databaseType,
final SQLExecuteType sqlExecuteType, final SQLCommandType sqlCommandType) {
- Collection<ParameterizedArray> result = new LinkedList<>();
- String scenarioTypes = testCaseContext.getTestCase().getScenarioTypes();
- if (scenarioTypes == null) {
- return ENV.getScenarios().stream().map(each ->
- new AssertionParameterizedArray(testCaseContext, assertion, adapter, each, databaseType, sqlExecuteType, sqlCommandType)).collect(Collectors.toList());
- }
- Collection<String> scenarios = Arrays.asList(scenarioTypes.split(","));
- Collection<String> scenariosMajor = scenarios.stream().filter(scenario -> ENV.getScenarios().contains(scenario)).collect(Collectors.toList());
- for (String scenario : scenariosMajor) {
- result.add(new AssertionParameterizedArray(testCaseContext, assertion, adapter, scenario, databaseType, sqlExecuteType, sqlCommandType));
- }
- return result;
+ Collection<String> scenarios = null == testCaseContext.getTestCase().getScenarioTypes() ? Collections.emptyList() : Arrays.asList(testCaseContext.getTestCase().getScenarioTypes().split(","));
+ return ENV.getScenarios().stream().filter(each -> scenarios.isEmpty() || scenarios.contains(each))
+ .map(each -> new AssertionParameterizedArray(testCaseContext, assertion, adapter, each, databaseType, sqlExecuteType, sqlCommandType)).collect(Collectors.toList());
}
/**