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 6ca3c6634c1 Rename SQLE2ETestContext to SQLE2EITContext and update references (#35266) 6ca3c6634c1 is described below commit 6ca3c6634c1de4b02dfc3567e112dae27e733114 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sat Apr 26 23:46:49 2025 +0800 Rename SQLE2ETestContext to SQLE2EITContext and update references (#35266) * Rename SQLE2ETestContext to SQLE2EITContext and update references * Rename SQLE2ETestContext to SQLE2EITContext and update references --- .../SQLE2EITContext.java} | 11 ++++-- .../test/e2e/engine/type/distsql/ral/RALE2EIT.java | 24 ++++++------ .../test/e2e/engine/type/distsql/rdl/RDLE2EIT.java | 22 +++++------ .../test/e2e/engine/type/distsql/rql/RQLE2EIT.java | 10 ++--- .../test/e2e/engine/type/sql/dal/DALE2EIT.java | 16 ++++---- .../test/e2e/engine/type/sql/dcl/DCLE2EIT.java | 10 ++--- .../test/e2e/engine/type/sql/ddl/DDLE2EIT.java | 24 ++++++------ .../engine/type/sql/dml/AdditionalDMLE2EIT.java | 44 +++++++++++----------- .../test/e2e/engine/type/sql/dml/BaseDMLE2EIT.java | 8 ++-- .../e2e/engine/type/sql/dml/GeneralDMLE2EIT.java | 16 ++++---- .../engine/type/sql/dql/AdditionalDQLE2EIT.java | 26 ++++++------- .../test/e2e/engine/type/sql/dql/BaseDQLE2EIT.java | 10 ++--- .../e2e/engine/type/sql/dql/GeneralDQLE2EIT.java | 34 ++++++++--------- 13 files changed, 129 insertions(+), 126 deletions(-) diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/SQLE2ETestContext.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/SQLE2EITContext.java similarity index 92% rename from test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/SQLE2ETestContext.java rename to test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/SQLE2EITContext.java index c20a168de21..c48f317bf6c 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/context/SQLE2ETestContext.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/SQLE2EITContext.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.e2e.engine.context; +package org.apache.shardingsphere.test.e2e.engine.type; import lombok.AccessLevel; import lombok.Getter; @@ -31,11 +31,14 @@ import java.util.List; import java.util.stream.Collectors; /** - * SQL E2E test context. + * SQL E2E IT context. */ @Getter -public final class SQLE2ETestContext { +public final class SQLE2EITContext { + /** + * Not verify flag. + */ public static final String NOT_VERIFY_FLAG = "NOT_VERIFY"; @Getter(AccessLevel.NONE) @@ -47,7 +50,7 @@ public final class SQLE2ETestContext { private final DataSet dataSet; - public SQLE2ETestContext(final AssertionTestParameter testParam) { + public SQLE2EITContext(final AssertionTestParameter testParam) { sql = testParam.getTestCaseContext().getTestCase().getSql(); sqlExecuteType = testParam.getSqlExecuteType(); assertion = testParam.getAssertion(); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/ral/RALE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/ral/RALE2EIT.java index d726cf096ef..a3119adfd4b 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/ral/RALE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/ral/RALE2EIT.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -65,7 +65,7 @@ class RALE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(context); try { assertExecute(context); @@ -74,7 +74,7 @@ class RALE2EIT implements SQLE2EIT { } } - private void assertExecute(final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final SQLE2EITContext context) throws SQLException { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { try (Statement statement = connection.createStatement()) { assertResultSet(context, statement); @@ -82,7 +82,7 @@ class RALE2EIT implements SQLE2EIT { } } - private void init(final SQLE2ETestContext context) throws SQLException { + private void init(final SQLE2EITContext context) throws SQLException { if (null != context.getAssertion().getInitialSQL()) { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { executeInitSQLs(context, connection); @@ -90,7 +90,7 @@ class RALE2EIT implements SQLE2EIT { } } - private void executeInitSQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeInitSQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getInitialSQL().getSql()) { return; } @@ -102,7 +102,7 @@ class RALE2EIT implements SQLE2EIT { Awaitility.await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true); } - private void tearDown(final SQLE2ETestContext context) throws SQLException { + private void tearDown(final SQLE2EITContext context) throws SQLException { if (null != context.getAssertion().getDestroySQL()) { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { executeDestroySQLs(context, connection); @@ -110,7 +110,7 @@ class RALE2EIT implements SQLE2EIT { } } - private void executeDestroySQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeDestroySQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getDestroySQL().getSql()) { return; } @@ -122,7 +122,7 @@ class RALE2EIT implements SQLE2EIT { Awaitility.await().pollDelay(1L, TimeUnit.SECONDS).until(() -> true); } - private void assertResultSet(final SQLE2ETestContext context, final Statement statement) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final Statement statement) throws SQLException { if (null == context.getAssertion().getAssertionSQL()) { assertResultSet(context, statement, context.getSQL()); } else { @@ -132,19 +132,19 @@ class RALE2EIT implements SQLE2EIT { } } - private void assertResultSet(final SQLE2ETestContext context, final Statement statement, final String sql) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final Statement statement, final String sql) throws SQLException { statement.execute(sql); try (ResultSet resultSet = statement.getResultSet()) { assertResultSet(context, resultSet); } } - private void assertResultSet(final SQLE2ETestContext context, final ResultSet resultSet) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final ResultSet resultSet) throws SQLException { assertMetaData(resultSet.getMetaData(), getExpectedColumns(context)); assertRows(resultSet, getIgnoreAssertColumns(context), context.getDataSet().getRows()); } - private Collection<DataSetColumn> getExpectedColumns(final SQLE2ETestContext context) { + private Collection<DataSetColumn> getExpectedColumns(final SQLE2EITContext context) { Collection<DataSetColumn> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns()); @@ -152,7 +152,7 @@ class RALE2EIT implements SQLE2EIT { return result; } - private Collection<String> getIgnoreAssertColumns(final SQLE2ETestContext context) { + private Collection<String> getIgnoreAssertColumns(final SQLE2EITContext context) { Collection<String> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns().stream().filter(DataSetColumn::isIgnoreAssertData).map(DataSetColumn::getName).collect(Collectors.toList())); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rdl/RDLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rdl/RDLE2EIT.java index ba13363d80c..6d6a7267efc 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rdl/RDLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rdl/RDLE2EIT.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -65,7 +65,7 @@ class RDLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(context); try { assertExecute(context); @@ -74,7 +74,7 @@ class RDLE2EIT implements SQLE2EIT { } } - private void assertExecute(final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final SQLE2EITContext context) throws SQLException { assertNotNull(context.getAssertion().getAssertionSQL(), "Assertion SQL is required"); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { try (Statement statement = connection.createStatement()) { @@ -85,17 +85,17 @@ class RDLE2EIT implements SQLE2EIT { } } - private void executeSQLCase(final SQLE2ETestContext context, final Statement statement) throws SQLException { + private void executeSQLCase(final SQLE2EITContext context, final Statement statement) throws SQLException { statement.execute(context.getSQL()); } - private void init(final SQLE2ETestContext context) throws SQLException { + private void init(final SQLE2EITContext context) throws SQLException { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { executeInitSQLs(context, connection); } } - private void tearDown(final SQLE2ETestContext context) throws SQLException { + private void tearDown(final SQLE2EITContext context) throws SQLException { if (null != context.getAssertion().getDestroySQL()) { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { executeDestroySQLs(context, connection); @@ -104,7 +104,7 @@ class RDLE2EIT implements SQLE2EIT { Awaitility.await().pollDelay(2L, TimeUnit.SECONDS).until(() -> true); } - private void executeInitSQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeInitSQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getInitialSQL() || null == context.getAssertion().getInitialSQL().getSql()) { return; } @@ -116,7 +116,7 @@ class RDLE2EIT implements SQLE2EIT { } } - private void executeDestroySQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeDestroySQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getDestroySQL().getSql()) { return; } @@ -128,18 +128,18 @@ class RDLE2EIT implements SQLE2EIT { } } - private void assertResultSet(final SQLE2ETestContext context, final Statement statement) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final Statement statement) throws SQLException { try (ResultSet resultSet = statement.executeQuery(context.getAssertion().getAssertionSQL().getSql())) { assertResultSet(context, resultSet); } } - private void assertResultSet(final SQLE2ETestContext context, final ResultSet resultSet) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final ResultSet resultSet) throws SQLException { assertMetaData(resultSet.getMetaData(), getExpectedColumns(context)); assertRows(resultSet, context.getDataSet().getRows()); } - private Collection<DataSetColumn> getExpectedColumns(final SQLE2ETestContext context) { + private Collection<DataSetColumn> getExpectedColumns(final SQLE2EITContext context) { Collection<DataSetColumn> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns()); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rql/RQLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rql/RQLE2EIT.java index f6c07968246..ee9bdb16ff0 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rql/RQLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/distsql/rql/RQLE2EIT.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -60,11 +60,11 @@ class RQLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); assertExecute(context); } - private void assertExecute(final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final SQLE2EITContext context) throws SQLException { try ( Connection connection = environmentEngine.getTargetDataSource().getConnection(); Statement statement = connection.createStatement()) { @@ -75,12 +75,12 @@ class RQLE2EIT implements SQLE2EIT { } } - private void assertResultSet(final SQLE2ETestContext context, final ResultSet resultSet) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final ResultSet resultSet) throws SQLException { assertMetaData(resultSet.getMetaData(), getExpectedColumns(context)); assertRows(resultSet, context.getDataSet().getRows()); } - private Collection<DataSetColumn> getExpectedColumns(final SQLE2ETestContext context) { + private Collection<DataSetColumn> getExpectedColumns(final SQLE2EITContext context) { Collection<DataSetColumn> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns()); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dal/DALE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dal/DALE2EIT.java index 3454162c3a2..6eb23982dde 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dal/DALE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dal/DALE2EIT.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; @@ -62,11 +62,11 @@ class DALE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); assertExecute(context); } - private void assertExecute(final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final SQLE2EITContext context) throws SQLException { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { try (Statement statement = connection.createStatement()) { statement.execute(context.getSQL()); @@ -75,7 +75,7 @@ class DALE2EIT implements SQLE2EIT { } } - private void assertExecuteResult(final SQLE2ETestContext context, final Statement statement) throws SQLException { + private void assertExecuteResult(final SQLE2EITContext context, final Statement statement) throws SQLException { try (ResultSet resultSet = statement.getResultSet()) { if (null == context.getAssertion().getAssertionSQL()) { assertResultSet(context, resultSet); @@ -88,7 +88,7 @@ class DALE2EIT implements SQLE2EIT { } } - private void assertResultSet(final SQLE2ETestContext context, final ResultSet resultSet) throws SQLException { + private void assertResultSet(final SQLE2EITContext context, final ResultSet resultSet) throws SQLException { // TODO fix wrong column label when execuete SHOW TABLES with jdbc adapter if (!"SHOW TABLES".equalsIgnoreCase(context.getSQL())) { assertMetaData(resultSet.getMetaData(), getExpectedColumns(context)); @@ -96,7 +96,7 @@ class DALE2EIT implements SQLE2EIT { assertRows(resultSet, context.getDataSet().getRows()); } - private Collection<DataSetColumn> getExpectedColumns(final SQLE2ETestContext context) { + private Collection<DataSetColumn> getExpectedColumns(final SQLE2EITContext context) { Collection<DataSetColumn> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns()); @@ -137,7 +137,7 @@ class DALE2EIT implements SQLE2EIT { } private void assertDateValue(final ResultSet actual, final int columnIndex, final String columnLabel, final String expected) throws SQLException { - if (SQLE2ETestContext.NOT_VERIFY_FLAG.equals(expected)) { + if (SQLE2EITContext.NOT_VERIFY_FLAG.equals(expected)) { return; } assertThat(DateTimeFormatterFactory.getTimeFormatter().format(actual.getDate(columnIndex).toLocalDate()), is(expected)); @@ -145,7 +145,7 @@ class DALE2EIT implements SQLE2EIT { } private void assertObjectValue(final ResultSet actual, final int columnIndex, final String columnLabel, final String expected) throws SQLException { - if (SQLE2ETestContext.NOT_VERIFY_FLAG.equals(expected)) { + if (SQLE2EITContext.NOT_VERIFY_FLAG.equals(expected)) { return; } assertThat(String.valueOf(actual.getObject(columnIndex)), is(expected)); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dcl/DCLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dcl/DCLE2EIT.java index 801c15d23b4..553398b71ca 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dcl/DCLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dcl/DCLE2EIT.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.env.runtime.scenario.authority.AuthorityEnvironmentManager; import org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioCommonPath; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; @@ -54,7 +54,7 @@ class DCLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); try ( AuthorityEnvironmentManager ignored = new AuthorityEnvironmentManager( new ScenarioCommonPath(testParam.getScenario()).getAuthorityFile(), environmentEngine.getActualDataSourceMap(), testParam.getDatabaseType())) { @@ -62,7 +62,7 @@ class DCLE2EIT implements SQLE2EIT { } } - private void assertExecuteUpdate(final SQLE2ETestContext context) throws SQLException { + private void assertExecuteUpdate(final SQLE2EITContext context) throws SQLException { String sql = context.getSQL(); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) { @@ -85,7 +85,7 @@ class DCLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); try ( AuthorityEnvironmentManager ignored = new AuthorityEnvironmentManager( new ScenarioCommonPath(testParam.getScenario()).getAuthorityFile(), environmentEngine.getActualDataSourceMap(), testParam.getDatabaseType())) { @@ -93,7 +93,7 @@ class DCLE2EIT implements SQLE2EIT { } } - private void assertExecute(final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final SQLE2EITContext context) throws SQLException { String sql = context.getSQL(); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) { diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/ddl/DDLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/ddl/DDLE2EIT.java index e42b7090f75..65caaad72c5 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/ddl/DDLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/ddl/DDLE2EIT.java @@ -28,7 +28,7 @@ import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -71,7 +71,7 @@ class DDLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(context); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) { @@ -85,14 +85,14 @@ class DDLE2EIT implements SQLE2EIT { } } - private void executeUpdateForStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeUpdateForStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.executeUpdate(context.getSQL()) > 0, "Not a DDL statement."); } waitCompleted(); } - private void executeUpdateForPreparedStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeUpdateForPreparedStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { assertFalse(preparedStatement.executeUpdate() > 0, "Not a DDL statement."); } @@ -107,7 +107,7 @@ class DDLE2EIT implements SQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(context); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { if (SQLExecuteType.LITERAL == context.getSqlExecuteType()) { @@ -121,21 +121,21 @@ class DDLE2EIT implements SQLE2EIT { } } - private void executeForStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeForStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL()), "Not a DDL statement."); } waitCompleted(); } - private void executeForPreparedStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeForPreparedStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { assertFalse(preparedStatement.execute(), "Not a DDL statement."); } waitCompleted(); } - private void init(final SQLE2ETestContext context) throws SQLException { + private void init(final SQLE2EITContext context) throws SQLException { assertNotNull(context.getAssertion().getInitialSQL(), "Init SQL is required"); assertNotNull(context.getAssertion().getInitialSQL().getAffectedTable(), "Expected affected table is required"); try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { @@ -143,7 +143,7 @@ class DDLE2EIT implements SQLE2EIT { } } - private void executeInitSQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeInitSQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getInitialSQL().getSql()) { return; } @@ -155,7 +155,7 @@ class DDLE2EIT implements SQLE2EIT { } } - private void tearDown(final SQLE2ETestContext context) throws SQLException { + private void tearDown(final SQLE2EITContext context) throws SQLException { if (null != context.getAssertion().getDestroySQL()) { try (Connection connection = environmentEngine.getTargetDataSource().getConnection()) { executeDestroySQLs(context, connection); @@ -163,7 +163,7 @@ class DDLE2EIT implements SQLE2EIT { } } - private void executeDestroySQLs(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private void executeDestroySQLs(final SQLE2EITContext context, final Connection connection) throws SQLException { if (null == context.getAssertion().getDestroySQL().getSql()) { return; } @@ -175,7 +175,7 @@ class DDLE2EIT implements SQLE2EIT { } } - private void assertTableMetaData(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertTableMetaData(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { String tableName = context.getAssertion().getInitialSQL().getAffectedTable(); DataSetMetaData expected = context.getDataSet().findMetaData(tableName); Collection<DataNode> dataNodes = InlineExpressionParserFactory.newInstance(expected.getDataNodes()).splitAndEvaluate().stream().map(DataNode::new).collect(Collectors.toList()); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/AdditionalDMLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/AdditionalDMLE2EIT.java index 56bca73c540..e7befb78c50 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/AdditionalDMLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/AdditionalDMLE2EIT.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.e2e.engine.type.sql.dml; import org.apache.shardingsphere.test.e2e.cases.value.SQLValue; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; @@ -55,7 +55,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType()) || isOracleInsertStatement(testParam.getDatabaseType().getType(), testParam.getTestCaseContext().getTestCase().getSql())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -76,7 +76,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { } private int executeUpdateForStatementWithAutoGeneratedKeys(final AssertionTestParameter testParam, - final SQLE2ETestContext context, final Connection connection) throws SQLException { + final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { int result = statement.executeUpdate(context.getSQL(), Statement.RETURN_GENERATED_KEYS); assertGeneratedKeys(testParam, statement.getGeneratedKeys(), testParam.getDatabaseType()); @@ -85,7 +85,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { } private int executeUpdateForPreparedStatementWithAutoGeneratedKeys(final AssertionTestParameter testParam, - final SQLE2ETestContext context, final Connection connection) throws SQLException { + final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), Statement.RETURN_GENERATED_KEYS)) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -105,7 +105,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -116,13 +116,13 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { assertDataSet(context, actualUpdateCount, testParam); } - private int executeUpdateForStatementWithColumnIndexes(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForStatementWithColumnIndexes(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { return statement.executeUpdate(context.getSQL(), new int[]{1}); } } - private int executeUpdateForPreparedStatementWithColumnIndexes(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForPreparedStatementWithColumnIndexes(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), new int[]{1})) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -140,7 +140,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -151,13 +151,13 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { assertDataSet(context, actualUpdateCount, testParam); } - private int executeUpdateForStatementWithColumnNames(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForStatementWithColumnNames(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { return statement.executeUpdate(context.getSQL()); } } - private int executeUpdateForPreparedStatementWithColumnNames(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForPreparedStatementWithColumnNames(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), new String[]{"TODO"})) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -177,7 +177,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -188,14 +188,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { assertDataSet(context, actualUpdateCount, testParam); } - private int executeForStatementWithoutAutoGeneratedKeys(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForStatementWithoutAutoGeneratedKeys(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL(), Statement.NO_GENERATED_KEYS), "Not a DML statement."); return statement.getUpdateCount(); } } - private int executeForPreparedStatementWithoutAutoGeneratedKeys(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForPreparedStatementWithoutAutoGeneratedKeys(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), Statement.NO_GENERATED_KEYS)) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -216,7 +216,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType()) || isOracleInsertStatement(testParam.getDatabaseType().getType(), testParam.getTestCaseContext().getTestCase().getSql())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -228,7 +228,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { } private int executeForStatementWithAutoGeneratedKeys(final AssertionTestParameter testParam, - final SQLE2ETestContext context, final Connection connection) throws SQLException { + final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL(), Statement.RETURN_GENERATED_KEYS), "Not a DML statement."); assertGeneratedKeys(testParam, statement.getGeneratedKeys(), testParam.getDatabaseType()); @@ -237,7 +237,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { } private int executeForPreparedStatementWithAutoGeneratedKeys(final AssertionTestParameter testParam, - final SQLE2ETestContext context, final Connection connection) throws SQLException { + final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), Statement.RETURN_GENERATED_KEYS)) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -257,7 +257,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -268,14 +268,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { assertDataSet(context, actualUpdateCount, testParam); } - private int executeForStatementWithColumnIndexes(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForStatementWithColumnIndexes(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL(), new int[]{1}), "Not a DML statement."); return statement.getUpdateCount(); } } - private int executeForPreparedStatementWithColumnIndexes(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForPreparedStatementWithColumnIndexes(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), new int[]{1})) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -294,7 +294,7 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); int actualUpdateCount; try (Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -305,14 +305,14 @@ class AdditionalDMLE2EIT extends BaseDMLE2EIT { assertDataSet(context, actualUpdateCount, testParam); } - private int executeForStatementWithColumnNames(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForStatementWithColumnNames(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL(), new String[]{"TODO"}), "Not a DML statement."); return statement.getUpdateCount(); } } - private int executeForPreparedStatementWithColumnNames(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForPreparedStatementWithColumnNames(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL(), new String[]{"TODO"})) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/BaseDMLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/BaseDMLE2EIT.java index 87e474c74e0..adb3d295abc 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/BaseDMLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/BaseDMLE2EIT.java @@ -32,7 +32,7 @@ import org.apache.shardingsphere.test.e2e.cases.dataset.DataSetLoader; import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn; import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData; import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.env.DataSetEnvironmentManager; import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; @@ -177,14 +177,14 @@ public abstract class BaseDMLE2EIT implements SQLE2EIT { dataSet.getRows().sort(Comparator.comparingLong(o -> Long.parseLong(o.splitValues(",").get(0)))); } - protected final void assertDataSet(final SQLE2ETestContext context, final int actualUpdateCount, final AssertionTestParameter testParam) throws SQLException { + protected final void assertDataSet(final SQLE2EITContext context, final int actualUpdateCount, final AssertionTestParameter testParam) throws SQLException { assertThat(actualUpdateCount, is(context.getDataSet().getUpdateCount())); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { assertDataSet(context, each, testParam); } } - private void assertDataSet(final SQLE2ETestContext context, final DataSetMetaData expectedDataSetMetaData, final AssertionTestParameter testParam) throws SQLException { + private void assertDataSet(final SQLE2EITContext context, final DataSetMetaData expectedDataSetMetaData, final AssertionTestParameter testParam) throws SQLException { Map<String, DatabaseType> databaseTypes = DatabaseEnvironmentManager.getDatabaseTypes(testParam.getScenario(), testParam.getDatabaseType()); for (String each : InlineExpressionParserFactory.newInstance(expectedDataSetMetaData.getDataNodes()).splitAndEvaluate()) { DataNode dataNode = new DataNode(each); @@ -262,7 +262,7 @@ public abstract class BaseDMLE2EIT implements SQLE2EIT { } private void assertValue(final ResultSet actual, final int columnIndex, final String expected, final DatabaseType databaseType) throws SQLException { - if (SQLE2ETestContext.NOT_VERIFY_FLAG.equals(expected)) { + if (SQLE2EITContext.NOT_VERIFY_FLAG.equals(expected)) { return; } if (Types.DATE == actual.getMetaData().getColumnType(columnIndex)) { diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/GeneralDMLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/GeneralDMLE2EIT.java index dfed26243af..3d585633280 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/GeneralDMLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dml/GeneralDMLE2EIT.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.e2e.engine.type.sql.dml; import org.apache.shardingsphere.test.e2e.cases.value.SQLValue; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -49,7 +49,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); try { int actualUpdateCount; @@ -69,18 +69,18 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT { executeInitSQLs(testParam.getAssertion()); } - void tearDown(final SQLE2ETestContext context) throws SQLException { + void tearDown(final SQLE2EITContext context) throws SQLException { tearDown(); executeDestroySQLs(context.getAssertion()); } - private int executeUpdateForStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { return statement.executeUpdate(context.getSQL()); } } - private int executeUpdateForPreparedStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeUpdateForPreparedStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); @@ -97,7 +97,7 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam); try { int actualUpdateCount; @@ -112,14 +112,14 @@ class GeneralDMLE2EIT extends BaseDMLE2EIT { } } - private int executeForStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { assertFalse(statement.execute(context.getSQL()), "Not a DML statement."); return statement.getUpdateCount(); } } - private int executeForPreparedStatement(final SQLE2ETestContext context, final Connection connection) throws SQLException { + private int executeForPreparedStatement(final SQLE2EITContext context, final Connection connection) throws SQLException { try (PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { for (SQLValue each : context.getAssertion().getSQLValues()) { preparedStatement.setObject(each.getIndex(), each.getValue()); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/AdditionalDQLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/AdditionalDQLE2EIT.java index b958a417448..ca39836c98e 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/AdditionalDQLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/AdditionalDQLE2EIT.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.e2e.engine.type.sql.dql; import org.apache.shardingsphere.test.e2e.cases.value.SQLValue; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; @@ -51,7 +51,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); // TODO fix e2e test blocked exception with PostgreSQL or openGauss in #23643 if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { @@ -72,7 +72,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); // TODO fix e2e test blocked exception with PostgreSQL or openGauss in #23643 if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { @@ -94,7 +94,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); // TODO fix e2e test blocked exception with PostgreSQL or openGauss in #23643 if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { @@ -115,7 +115,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); // TODO fix e2e test blocked exception with PostgreSQL or openGauss in #23643 if (isPostgreSQLOrOpenGauss(testParam.getDatabaseType().getType())) { @@ -132,7 +132,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { return "PostgreSQL".equals(databaseType) || "openGauss".equals(databaseType); } - private void assertExecuteQueryWithXMLExpected(final AssertionTestParameter testParam, final SQLE2ETestContext context, final int... resultSetTypes) throws SQLException { + private void assertExecuteQueryWithXMLExpected(final AssertionTestParameter testParam, final SQLE2EITContext context, final int... resultSetTypes) throws SQLException { // TODO Fix jdbc adapter if ("jdbc".equals(testParam.getAdapter())) { return; @@ -146,7 +146,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2ETestContext context, final int... resultSetTypes) throws SQLException { + private void assertExecuteQueryWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2EITContext context, final int... resultSetTypes) throws SQLException { try ( Connection actualConnection = getEnvironmentEngine().getTargetDataSource().getConnection(); Connection expectedConnection = getExpectedDataSource().getConnection()) { @@ -158,7 +158,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryForStatementWithResultSetTypes(final SQLE2ETestContext context, + private void assertExecuteQueryForStatementWithResultSetTypes(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam, final int... resultSetTypes) throws SQLException { try ( @@ -172,7 +172,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryForPreparedStatementWithResultSetTypes(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteQueryForPreparedStatementWithResultSetTypes(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam, final int... resultSetTypes) throws SQLException { try ( PreparedStatement actualPreparedStatement = 2 == resultSetTypes.length ? actualConnection.prepareStatement(context.getSQL(), resultSetTypes[0], resultSetTypes[1]) @@ -191,7 +191,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteWithXMLExpected(final AssertionTestParameter testParam, final SQLE2ETestContext context, final int... resultSetTypes) throws SQLException { + private void assertExecuteWithXMLExpected(final AssertionTestParameter testParam, final SQLE2EITContext context, final int... resultSetTypes) throws SQLException { // TODO Fix jdbc adapter if ("jdbc".equals(testParam.getAdapter())) { return; @@ -206,7 +206,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2ETestContext context, final int... resultSetTypes) throws SQLException { + private void assertExecuteWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2EITContext context, final int... resultSetTypes) throws SQLException { try ( Connection actualConnection = getEnvironmentEngine().getTargetDataSource().getConnection(); Connection expectedConnection = getExpectedDataSource().getConnection()) { @@ -218,7 +218,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteForStatementWithResultSetTypes(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteForStatementWithResultSetTypes(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam, final int... resultSetTypes) throws SQLException { try ( Statement actualStatement = 2 == resultSetTypes.length ? actualConnection.createStatement(resultSetTypes[0], resultSetTypes[1]) @@ -234,7 +234,7 @@ class AdditionalDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteForPreparedStatementWithResultSetTypes(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteForPreparedStatementWithResultSetTypes(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam, final int... resultSetTypes) throws SQLException { try ( PreparedStatement actualPreparedStatement = 2 == resultSetTypes.length ? actualConnection.prepareStatement(context.getSQL(), resultSetTypes[0], resultSetTypes[1]) diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/BaseDQLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/BaseDQLE2EIT.java index 5818b17cbce..a7830935527 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/BaseDQLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/BaseDQLE2EIT.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory; import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn; import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData; import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.env.DataSetEnvironmentManager; import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EIT; import org.apache.shardingsphere.test.e2e.env.SQLE2EEnvironmentEngine; @@ -69,7 +69,7 @@ public abstract class BaseDQLE2EIT implements SQLE2EIT { @Setter private SQLE2EEnvironmentEngine environmentEngine; - protected final void init(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException, IOException, JAXBException { + protected final void init(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException, IOException, JAXBException { fillDataOnlyOnce(testParam); expectedDataSource = null == context.getAssertion().getExpectedDataSourceName() || 1 == getEnvironmentEngine().getExpectedDataSourceMap().size() ? getFirstExpectedDataSource(getEnvironmentEngine().getExpectedDataSourceMap().values()) @@ -104,12 +104,12 @@ public abstract class BaseDQLE2EIT implements SQLE2EIT { assertRows(actualResultSet, expectedResultSet); } - protected final void assertResultSet(final SQLE2ETestContext context, final ResultSet resultSet) throws SQLException { + protected final void assertResultSet(final SQLE2EITContext context, final ResultSet resultSet) throws SQLException { assertMetaData(resultSet.getMetaData(), getExpectedColumns(context)); assertRows(resultSet, getIgnoreAssertColumns(context), context.getDataSet().getRows()); } - private Collection<DataSetColumn> getExpectedColumns(final SQLE2ETestContext context) { + private Collection<DataSetColumn> getExpectedColumns(final SQLE2EITContext context) { Collection<DataSetColumn> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns()); @@ -117,7 +117,7 @@ public abstract class BaseDQLE2EIT implements SQLE2EIT { return result; } - private Collection<String> getIgnoreAssertColumns(final SQLE2ETestContext context) { + private Collection<String> getIgnoreAssertColumns(final SQLE2EITContext context) { Collection<String> result = new LinkedList<>(); for (DataSetMetaData each : context.getDataSet().getMetaDataList()) { result.addAll(each.getColumns().stream().filter(DataSetColumn::isIgnoreAssertData).map(DataSetColumn::getName).collect(Collectors.toList())); diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/GeneralDQLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/GeneralDQLE2EIT.java index ac632b450ef..35ac5d175b2 100644 --- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/GeneralDQLE2EIT.java +++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/sql/dql/GeneralDQLE2EIT.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.e2e.engine.type.sql.dql; import org.apache.shardingsphere.test.e2e.cases.value.SQLValue; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITArgumentsProvider; import org.apache.shardingsphere.test.e2e.engine.framework.SQLE2EITSettings; -import org.apache.shardingsphere.test.e2e.engine.context.SQLE2ETestContext; +import org.apache.shardingsphere.test.e2e.engine.type.SQLE2EITContext; import org.apache.shardingsphere.test.e2e.engine.framework.param.array.E2ETestParameterFactory; import org.apache.shardingsphere.test.e2e.engine.framework.param.model.AssertionTestParameter; import org.apache.shardingsphere.test.e2e.engine.framework.type.SQLCommandType; @@ -50,12 +50,12 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); assertExecuteQuery(testParam, context); } - private void assertExecuteQuery(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecuteQuery(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { if (isUseXMLAsExpectedDataset()) { assertExecuteQueryWithXmlExpected(testParam, context); } else { @@ -63,7 +63,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryWithXmlExpected(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecuteQueryWithXmlExpected(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { // TODO Fix jdbc adapter and empty_storage_units proxy adapter if (isNeedSkipExecuteQueryWithXmlExcepted(testParam)) { return; @@ -80,7 +80,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { || "proxy".equals(testParam.getAdapter()) && "empty_storage_units".equalsIgnoreCase(testParam.getScenario()); } - private void assertQueryForStatementWithXmlExpected(final SQLE2ETestContext context) throws SQLException { + private void assertQueryForStatementWithXmlExpected(final SQLE2EITContext context) throws SQLException { try ( Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection(); Statement statement = connection.createStatement(); @@ -89,7 +89,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertQueryForPreparedStatementWithXmlExpected(final SQLE2ETestContext context) throws SQLException { + private void assertQueryForPreparedStatementWithXmlExpected(final SQLE2EITContext context) throws SQLException { try ( Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { @@ -102,7 +102,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecuteQueryWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { try ( Connection expectedConnection = getExpectedDataSource().getConnection(); Connection actualConnection = getEnvironmentEngine().getTargetDataSource().getConnection()) { @@ -114,7 +114,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryForStatement(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteQueryForStatement(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam) throws SQLException { try ( Statement expectedStatement = expectedConnection.createStatement(); @@ -125,7 +125,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteQueryForPreparedStatement(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteQueryForPreparedStatement(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam) throws SQLException { try ( PreparedStatement expectedPreparedStatement = expectedConnection.prepareStatement(context.getSQL()); @@ -150,12 +150,12 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { if (null == testParam.getTestCaseContext()) { return; } - SQLE2ETestContext context = new SQLE2ETestContext(testParam); + SQLE2EITContext context = new SQLE2EITContext(testParam); init(testParam, context); assertExecute(testParam, context); } - private void assertExecute(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecute(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { if (isUseXMLAsExpectedDataset()) { assertExecuteWithXmlExpected(testParam, context); } else { @@ -163,7 +163,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteWithXmlExpected(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecuteWithXmlExpected(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { // TODO Fix jdbc adapter if (isNeedSkipExecuteWithXmlExcepted(testParam)) { return; @@ -179,7 +179,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { return "jdbc".equals(testParam.getAdapter()); } - private void assertExecuteForStatementWithXmlExpected(final SQLE2ETestContext context) throws SQLException { + private void assertExecuteForStatementWithXmlExpected(final SQLE2EITContext context) throws SQLException { try ( Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection(); Statement statement = connection.createStatement()) { @@ -189,7 +189,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteForPreparedStatementWithXmlExpected(final SQLE2ETestContext context) throws SQLException { + private void assertExecuteForPreparedStatementWithXmlExpected(final SQLE2EITContext context) throws SQLException { try ( Connection connection = getEnvironmentEngine().getTargetDataSource().getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(context.getSQL())) { @@ -203,7 +203,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2ETestContext context) throws SQLException { + private void assertExecuteWithExpectedDataSource(final AssertionTestParameter testParam, final SQLE2EITContext context) throws SQLException { try ( Connection actualConnection = getEnvironmentEngine().getTargetDataSource().getConnection(); Connection expectedConnection = getExpectedDataSource().getConnection()) { @@ -215,7 +215,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteForStatement(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteForStatement(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam) throws SQLException { try ( Statement actualStatement = actualConnection.createStatement(); @@ -229,7 +229,7 @@ class GeneralDQLE2EIT extends BaseDQLE2EIT { } } - private void assertExecuteForPreparedStatement(final SQLE2ETestContext context, final Connection actualConnection, final Connection expectedConnection, + private void assertExecuteForPreparedStatement(final SQLE2EITContext context, final Connection actualConnection, final Connection expectedConnection, final AssertionTestParameter testParam) throws SQLException { try ( PreparedStatement actualPreparedStatement = actualConnection.prepareStatement(context.getSQL());