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 143dc0f add scenarioTypes feature (#9516)
143dc0f is described below
commit 143dc0f22b3925ca72ce5a15701adff5d7e2a9d0
Author: Jieker <[email protected]>
AuthorDate: Fri Feb 26 19:48:28 2021 +0800
add scenarioTypes feature (#9516)
* add scenarioTypes
* ci fixed
---
.../integration/cases/assertion/IntegrationTestCase.java | 3 +++
.../engine/param/ParameterizedArrayFactory.java | 15 +++++++++++++--
2 files changed, 16 insertions(+), 2 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 e1eb832..8e25f9e 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,6 +40,9 @@ public final class IntegrationTestCase {
@XmlAttribute(name = "db-types")
private String dbTypes;
+
+ @XmlAttribute(name = "scenario-types")
+ private String scenarioTypes;
@XmlElement(name = "assertion")
private Collection<IntegrationTestCaseAssertion> assertions = new
LinkedList<>();
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 d310763..b48705b 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
@@ -33,6 +33,7 @@ import
org.apache.shardingsphere.test.integration.engine.param.model.CaseParamet
import
org.apache.shardingsphere.test.integration.engine.param.model.ParameterizedArray;
import
org.apache.shardingsphere.test.integration.env.IntegrationTestEnvironment;
+import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -104,8 +105,18 @@ 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) {
- return ENV.getScenarios().stream().map(
- each -> new AssertionParameterizedArray(testCaseContext,
assertion, adapter, each, databaseType, sqlExecuteType,
sqlCommandType)).collect(Collectors.toList());
+ 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;
}
/**