You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/01/24 04:46:19 UTC
[shardingsphere] branch master updated: Fix test error when using
same JDBC data source name with normal and calcite (#9144)
This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 5225139 Fix test error when using same JDBC data source name with normal and calcite (#9144)
5225139 is described below
commit 5225139c551674ddc02feb4f66a6bdcf6d6d752c
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jan 24 12:45:52 2021 +0800
Fix test error when using same JDBC data source name with normal and calcite (#9144)
* For test
* For test
* Fix test error when using same jdbc data source name with normal and calcite
---
.../driver/common/base/AbstractSQLCalciteTest.java | 4 ++--
.../base/AbstractShardingSphereDataSourceForCalciteTest.java | 10 +++++-----
.../src/test/resources/sql/calcite_data_0.sql | 2 +-
.../src/test/resources/sql/calcite_data_1.sql | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractSQLCalciteTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractSQLCalciteTest.java
index 3eca1fd..205d935 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractSQLCalciteTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractSQLCalciteTest.java
@@ -38,8 +38,8 @@ public abstract class AbstractSQLCalciteTest {
@BeforeClass
public static synchronized void initializeDataSource() throws SQLException {
- createDataSources("jdbc_0", INIT_CALCITE_DATABASE_0);
- createDataSources("jdbc_1", INIT_CALCITE_DATABASE_1);
+ createDataSources("calcite_jdbc_0", INIT_CALCITE_DATABASE_0);
+ createDataSources("calcite_jdbc_1", INIT_CALCITE_DATABASE_1);
}
private static void createDataSources(final String dataSourceName, final String initSql) throws SQLException {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractShardingSphereDataSourceForCalciteTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractShardingSphereDataSourceForCalciteTest.java
index d024f76..ccd8c65 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractShardingSphereDataSourceForCalciteTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/common/base/AbstractShardingSphereDataSourceForCalciteTest.java
@@ -28,8 +28,8 @@ import org.junit.Before;
import org.junit.BeforeClass;
import javax.sql.DataSource;
-import java.io.IOException;
import java.io.File;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.SQLException;
@@ -42,12 +42,12 @@ public abstract class AbstractShardingSphereDataSourceForCalciteTest extends Abs
private static ShardingSphereDataSource dataSource;
- private static final List<String> ACTUAL_DATA_SOURCE_NAMES = Arrays.asList("jdbc_0", "jdbc_1");
+ private static final List<String> ACTUAL_DATA_SOURCE_NAMES = Arrays.asList("calcite_jdbc_0", "calcite_jdbc_1");
private static final String CONFIG_CALCITE = "config/config-calcite.yaml";
@BeforeClass
- public static void initCalciteDataSource() throws SQLException, IOException {
+ public static void initCalciteDataSource() throws IOException, SQLException {
if (null != dataSource) {
return;
}
@@ -63,8 +63,8 @@ public abstract class AbstractShardingSphereDataSourceForCalciteTest extends Abs
try {
ShardingSphereConnection conn = dataSource.getConnection();
Map<String, DataSource> dataSourceMap = conn.getDataSourceMap();
- Connection database0 = dataSourceMap.get("jdbc_0").getConnection();
- Connection database1 = dataSourceMap.get("jdbc_1").getConnection();
+ Connection database0 = dataSourceMap.get("calcite_jdbc_0").getConnection();
+ Connection database1 = dataSourceMap.get("calcite_jdbc_1").getConnection();
RunScript.execute(database0, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/calcite_data_0.sql"))));
RunScript.execute(database1, new InputStreamReader(Objects.requireNonNull(AbstractSQLTest.class.getClassLoader().getResourceAsStream("sql/calcite_data_1.sql"))));
conn.close();
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_0.sql b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_0.sql
index 9549ac1..ed6470e 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_0.sql
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_0.sql
@@ -18,4 +18,4 @@
DELETE FROM t_order_calcite;
INSERT INTO t_order_calcite VALUES(1000, 10, 'init');
-INSERT INTO t_order_calcite VALUES(1001, 10, 'init');
\ No newline at end of file
+INSERT INTO t_order_calcite VALUES(1001, 10, 'init')
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_1.sql b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_1.sql
index 11679b8..92f7f6c 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_1.sql
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/resources/sql/calcite_data_1.sql
@@ -20,4 +20,4 @@ DELETE FROM t_order_item_calcite;
INSERT INTO t_order_item_calcite VALUES(100000, 1000, 10, 'init');
INSERT INTO t_order_item_calcite VALUES(100001, 1000, 10, 'init');
INSERT INTO t_order_item_calcite VALUES(100100, 1001, 10, 'init');
-INSERT INTO t_order_item_calcite VALUES(100101, 1001, 10, 'init');
\ No newline at end of file
+INSERT INTO t_order_item_calcite VALUES(100101, 1001, 10, 'init');