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 4763a658495 Fix sonar. (#32374)
4763a658495 is described below

commit 4763a65849519e524355c13cb4da15ab84f4c6b2
Author: Cong Hu <iamhuc...@gmail.com>
AuthorDate: Mon Aug 5 19:34:41 2024 +0800

    Fix sonar. (#32374)
---
 .../test/e2e/engine/type/dml/BaseDMLE2EIT.java       |  3 ++-
 .../test/e2e/engine/type/dml/BatchDMLE2EIT.java      | 20 ++------------------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
index fad91e6bcb2..b8d272db66f 100644
--- 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
+++ 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
@@ -39,6 +39,7 @@ import 
org.apache.shardingsphere.test.e2e.framework.database.DatabaseAssertionMe
 import 
org.apache.shardingsphere.test.e2e.framework.database.DatabaseAssertionMetaDataFactory;
 import 
org.apache.shardingsphere.test.e2e.framework.param.model.AssertionTestParameter;
 import 
org.apache.shardingsphere.test.e2e.framework.param.model.CaseTestParameter;
+import 
org.apache.shardingsphere.test.e2e.framework.param.model.E2ETestParameter;
 import org.junit.jupiter.api.AfterEach;
 
 import javax.sql.DataSource;
@@ -87,7 +88,7 @@ public abstract class BaseDMLE2EIT implements 
E2EEnvironmentAware {
      * @throws IOException IO exception
      * @throws JAXBException JAXB exception
      */
-    public final void init(final AssertionTestParameter testParam) throws 
SQLException, IOException, JAXBException {
+    public final void init(final E2ETestParameter testParam) throws 
SQLException, IOException, JAXBException {
         dataSetEnvironmentManager =
                 new DataSetEnvironmentManager(new 
ScenarioDataPath(testParam.getScenario()).getDataSetFile(Type.ACTUAL), 
getEnvironmentEngine().getActualDataSourceMap(), testParam.getDatabaseType());
         dataSetEnvironmentManager.fillData();
diff --git 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
index d67b16403cc..9a5347420a7 100644
--- 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
+++ 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BatchDMLE2EIT.java
@@ -21,12 +21,9 @@ import 
org.apache.shardingsphere.test.e2e.cases.casse.assertion.E2ETestCaseAsser
 import org.apache.shardingsphere.test.e2e.cases.value.SQLValue;
 import 
org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseArgumentsProvider;
 import org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseSettings;
-import org.apache.shardingsphere.test.e2e.env.DataSetEnvironmentManager;
-import 
org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath;
 import 
org.apache.shardingsphere.test.e2e.framework.param.array.E2ETestParameterFactory;
 import 
org.apache.shardingsphere.test.e2e.framework.param.model.CaseTestParameter;
 import org.apache.shardingsphere.test.e2e.framework.type.SQLCommandType;
-import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.condition.EnabledIf;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -43,15 +40,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 @E2ETestCaseSettings(value = SQLCommandType.DML, batch = true)
 class BatchDMLE2EIT extends BaseDMLE2EIT {
     
-    private DataSetEnvironmentManager dataSetEnvironmentManager;
-    
-    @AfterEach
-    void tearDown() {
-        if (null != dataSetEnvironmentManager) {
-            dataSetEnvironmentManager.cleanData();
-        }
-    }
-    
     @ParameterizedTest(name = "{0}")
     @EnabledIf("isEnabled")
     @ArgumentsSource(E2ETestCaseArgumentsProvider.class)
@@ -60,9 +48,7 @@ class BatchDMLE2EIT extends BaseDMLE2EIT {
         if (null == testParam.getTestCaseContext()) {
             return;
         }
-        dataSetEnvironmentManager = new DataSetEnvironmentManager(new 
ScenarioDataPath(testParam.getScenario()).getDataSetFile(ScenarioDataPath.Type.ACTUAL),
-                getEnvironmentEngine().getActualDataSourceMap(), 
testParam.getDatabaseType());
-        dataSetEnvironmentManager.fillData();
+        init(testParam);
         int[] actualUpdateCounts;
         try (Connection connection = 
getEnvironmentEngine().getTargetDataSource().getConnection()) {
             actualUpdateCounts = executeBatchForPreparedStatement(testParam, 
connection);
@@ -94,9 +80,7 @@ class BatchDMLE2EIT extends BaseDMLE2EIT {
         if (null == testParam.getTestCaseContext()) {
             return;
         }
-        dataSetEnvironmentManager = new DataSetEnvironmentManager(new 
ScenarioDataPath(testParam.getScenario()).getDataSetFile(ScenarioDataPath.Type.ACTUAL),
-                getEnvironmentEngine().getActualDataSourceMap(), 
testParam.getDatabaseType());
-        dataSetEnvironmentManager.fillData();
+        init(testParam);
         try (
                 Connection connection = 
getEnvironmentEngine().getTargetDataSource().getConnection();
                 PreparedStatement preparedStatement = 
connection.prepareStatement(testParam.getTestCaseContext().getTestCase().getSql()))
 {

Reply via email to