You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2020/12/28 14:26:55 UTC
[shardingsphere] branch master updated: Rename IT case name (#8798)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 611dfa0 Rename IT case name (#8798)
611dfa0 is described below
commit 611dfa05d7961c595db3cfe65b68550d45b6b2fe
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Dec 28 22:26:32 2020 +0800
Rename IT case name (#8798)
* Refactor BaseDDLIT
* Refactor GeneralDDLIT
* Refactor GeneralDDLIT
* Rename IT case name
---
.../assertion/root/IntegrateTestCaseAssertion.java | 7 ++-----
.../test/integration/engine/dcl/GeneralDCLIT.java | 2 +-
.../test/integration/engine/ddl/BaseDDLIT.java | 9 +++------
.../test/integration/engine/ddl/GeneralDDLIT.java | 17 +++++++----------
.../test/integration/engine/dml/AdditionalDMLIT.java | 16 ++++++++--------
.../test/integration/engine/dml/BatchDMLIT.java | 2 +-
.../test/integration/engine/dml/GeneralDMLIT.java | 6 +++---
.../test/integration/engine/dql/AdditionalDQLIT.java | 2 +-
.../test/integration/engine/dql/GeneralDQLIT.java | 14 +++++++-------
9 files changed, 33 insertions(+), 42 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/root/IntegrateTestCaseAssertion.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/root/IntegrateTestCaseAssertion.java
index 45a8e02..5bc3269 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/root/IntegrateTestCaseAssertion.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/assertion/root/IntegrateTestCaseAssertion.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.test.integration.cases.assertion.root;
import com.google.common.base.Splitter;
import lombok.Getter;
+import lombok.Setter;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -33,6 +34,7 @@ import java.util.List;
* JAXB definition of integrate test case assertion.
*/
@Getter
+@Setter
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class IntegrateTestCaseAssertion {
@@ -66,9 +68,4 @@ public abstract class IntegrateTestCaseAssertion {
}
return result;
}
-
- @Override
- public final String toString() {
- return expectedDataFile;
- }
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
index fe9477f..4c5fb54 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dcl/GeneralDCLIT.java
@@ -38,7 +38,7 @@ public final class GeneralDCLIT extends BaseDCLIT {
final String databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(parentPath, assertion, ruleType, DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
}
-
+
@Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DCL);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
index 0096aea..94b794d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
@@ -51,14 +51,11 @@ import static org.junit.Assert.assertTrue;
@Slf4j
public abstract class BaseDDLIT extends SingleIT {
- private final DDLIntegrateTestCaseAssertion assertion;
-
private final DatabaseType databaseType;
protected BaseDDLIT(final String parentPath, final DDLIntegrateTestCaseAssertion assertion, final String ruleType,
final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(parentPath, assertion, ruleType, databaseType, caseType, sql);
- this.assertion = assertion;
this.databaseType = databaseType;
}
@@ -87,11 +84,11 @@ public abstract class BaseDDLIT extends SingleIT {
}
protected final void assertMetaData(final Connection connection) throws SQLException {
- if (null == assertion.getExpectedDataFile()) {
+ if (null == getAssertion().getExpectedDataFile()) {
log.warn("Expected data file `{}` is empty", getSql());
return;
}
- String tableName = assertion.getTable();
+ String tableName = ((DDLIntegrateTestCaseAssertion) getAssertion()).getTable();
List<DataSetColumn> actualColumns = getActualColumns(connection, tableName);
List<DataSetIndex> actualIndexes = getActualIndexes(connection, tableName);
if (actualColumns.isEmpty() || actualIndexes.isEmpty()) {
@@ -184,7 +181,7 @@ public abstract class BaseDDLIT extends SingleIT {
}
protected final void dropTableIfExisted(final Connection connection) {
- try (PreparedStatement preparedStatement = connection.prepareStatement(String.format("DROP TABLE %s", assertion.getTable()))) {
+ try (PreparedStatement preparedStatement = connection.prepareStatement(String.format("DROP TABLE %s", ((DDLIntegrateTestCaseAssertion) getAssertion()).getTable()))) {
preparedStatement.executeUpdate();
} catch (final SQLException ignored) {
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
index 1cb686d..700e37e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
@@ -36,35 +36,32 @@ import java.util.Collection;
public final class GeneralDDLIT extends BaseDDLIT {
- private final DDLIntegrateTestCaseAssertion assertion;
-
public GeneralDDLIT(final String parentPath, final DDLIntegrateTestCaseAssertion assertion, final String ruleType,
final String databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(parentPath, assertion, ruleType, DatabaseTypeRegistry.getActualDatabaseType(databaseType), caseType, sql);
- this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {1} -> {5}")
+ @Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DDL);
}
@Test
- public void assertExecuteUpdate() throws JAXBException, IOException, SQLException {
+ public void assertExecuteUpdate() throws SQLException {
assertExecuteByType(true);
}
@Test
- public void assertExecute() throws JAXBException, IOException, SQLException {
+ public void assertExecute() throws SQLException {
assertExecuteByType(false);
}
- private void assertExecuteByType(final boolean isExecuteUpdate) throws JAXBException, IOException, SQLException {
+ private void assertExecuteByType(final boolean isExecuteUpdate) throws SQLException {
try (Connection connection = getDataSource().getConnection()) {
dropTableIfExisted(connection);
- if (!Strings.isNullOrEmpty(assertion.getInitSQL())) {
- for (String sql : Splitter.on(";").trimResults().splitToList(assertion.getInitSQL())) {
- connection.prepareStatement(sql).executeUpdate();
+ if (!Strings.isNullOrEmpty(((DDLIntegrateTestCaseAssertion) getAssertion()).getInitSQL())) {
+ for (String each : Splitter.on(";").trimResults().splitToList(((DDLIntegrateTestCaseAssertion) getAssertion()).getInitSQL())) {
+ connection.prepareStatement(each).executeUpdate();
}
}
if (isExecuteUpdate) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
index b9e2fdb..565ff7c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/AdditionalDMLIT.java
@@ -49,13 +49,13 @@ public final class AdditionalDMLIT extends BaseDMLIT {
this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {1} -> {5}")
+ @Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ? IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DML) : Collections.emptyList();
}
@Test
- public void executeUpdateWithAutoGeneratedKeys() throws JAXBException, IOException, SQLException, ParseException {
+ public void executeUpdateWithAutoGeneratedKeys() throws SQLException, ParseException {
// TODO fix replica_query
if ("replica_query".equals(getRuleType())) {
return;
@@ -83,7 +83,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteUpdateWithColumnIndexes() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteUpdateWithColumnIndexes() throws SQLException, ParseException {
// TODO fix replica_query
if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getRuleType())) {
return;
@@ -111,7 +111,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteUpdateWithColumnNames() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteUpdateWithColumnNames() throws SQLException, ParseException {
// TODO fix replica_query
if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getRuleType())) {
return;
@@ -139,7 +139,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteWithoutAutoGeneratedKeys() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteWithoutAutoGeneratedKeys() throws SQLException, ParseException {
// TODO fix replica_query
if ("replica_query".equals(getRuleType())) {
return;
@@ -169,7 +169,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteWithAutoGeneratedKeys() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteWithAutoGeneratedKeys() throws SQLException, ParseException {
// TODO fix replica_query
if ("replica_query".equals(getRuleType())) {
return;
@@ -201,7 +201,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteWithColumnIndexes() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteWithColumnIndexes() throws SQLException, ParseException {
// TODO fix replica_query
if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getRuleType())) {
return;
@@ -231,7 +231,7 @@ public final class AdditionalDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecuteWithColumnNames() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteWithColumnNames() throws SQLException, ParseException {
// TODO fix replica_query
if ("PostgreSQL".equals(getDatabaseType().getName()) || "replica_query".equals(getRuleType())) {
return;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
index 4833748..0121165 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/BatchDMLIT.java
@@ -54,7 +54,7 @@ public final class BatchDMLIT extends BatchIT {
}
@Test
- public void assertExecuteBatch() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteBatch() throws SQLException, ParseException {
// TODO fix replica_query
if ("replica_query".equals(getRuleType())) {
return;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
index 117e19d..43958c8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dml/GeneralDMLIT.java
@@ -51,13 +51,13 @@ public final class GeneralDMLIT extends BaseDMLIT {
this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {1} -> {5}")
+ @Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DML);
}
@Test
- public void assertExecuteUpdate() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteUpdate() throws SQLException, ParseException {
// TODO fix replica-query
if ("replica_query".equals(getRuleType())) {
return;
@@ -95,7 +95,7 @@ public final class GeneralDMLIT extends BaseDMLIT {
}
@Test
- public void assertExecute() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecute() throws SQLException, ParseException {
// TODO fix replica_query
if ("replica_query".equals(getRuleType())) {
return;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
index 15425d5..54442ed 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/AdditionalDQLIT.java
@@ -50,7 +50,7 @@ public final class AdditionalDQLIT extends BaseDQLIT {
this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {1} -> {5}")
+ @Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestEnvironment.getInstance().isRunAdditionalTestCases() ? IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DQL) : Collections.emptyList();
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
index 45a8aed..2dfa1e0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/dql/GeneralDQLIT.java
@@ -48,13 +48,13 @@ public final class GeneralDQLIT extends BaseDQLIT {
this.assertion = assertion;
}
- @Parameters(name = "{2} -> {3} -> {4} -> {1} -> {5}")
+ @Parameters(name = "{2} -> {3} -> {4} -> {5}")
public static Collection<Object[]> getParameters() {
return IntegrateTestParameters.getParametersWithAssertion(IntegrateTestCaseType.DQL);
}
@Test
- public void assertExecuteQuery() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecuteQuery() throws SQLException, ParseException {
try (Connection connection = getDataSource().getConnection()) {
if (SQLCaseType.Literal == getCaseType()) {
assertExecuteQueryForStatement(connection);
@@ -67,7 +67,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
}
}
- private void assertExecuteQueryForStatement(final Connection connection) throws SQLException, JAXBException, IOException {
+ private void assertExecuteQueryForStatement(final Connection connection) throws SQLException {
try (
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(getSql())) {
@@ -75,7 +75,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
}
}
- private void assertExecuteQueryForPreparedStatement(final Connection connection) throws SQLException, ParseException, JAXBException, IOException {
+ private void assertExecuteQueryForPreparedStatement(final Connection connection) throws SQLException, ParseException {
try (PreparedStatement preparedStatement = connection.prepareStatement(getSql())) {
for (SQLValue each : assertion.getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());
@@ -87,7 +87,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
}
@Test
- public void assertExecute() throws JAXBException, IOException, SQLException, ParseException {
+ public void assertExecute() throws SQLException, ParseException {
try (Connection connection = getDataSource().getConnection()) {
if (SQLCaseType.Literal == getCaseType()) {
assertExecuteForStatement(connection);
@@ -100,7 +100,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
}
}
- private void assertExecuteForStatement(final Connection connection) throws SQLException, JAXBException, IOException {
+ private void assertExecuteForStatement(final Connection connection) throws SQLException {
try (Statement statement = connection.createStatement()) {
assertTrue("Not a DQL statement.", statement.execute(getSql()));
try (ResultSet resultSet = statement.getResultSet()) {
@@ -109,7 +109,7 @@ public final class GeneralDQLIT extends BaseDQLIT {
}
}
- private void assertExecuteForPreparedStatement(final Connection connection) throws SQLException, ParseException, JAXBException, IOException {
+ private void assertExecuteForPreparedStatement(final Connection connection) throws SQLException, ParseException {
try (PreparedStatement preparedStatement = connection.prepareStatement(getSql())) {
for (SQLValue each : assertion.getSQLValues()) {
preparedStatement.setObject(each.getIndex(), each.getValue());