From 13e90eea0cff6c78e0458180a7fb9a737d29f975 Mon Sep 17 00:00:00 2001 From: tangjiangling Date: Sat, 26 Feb 2022 10:00:51 +0800 Subject: [PATCH] Minor refactors to SqlServer type mapping tests - Move `sqlServer` to BaseSqlServerTypeMapping - Remove onRemoteDatabase in TestSqlServerTypeMapping - Implement onRemoteDatabase in BaseSqlServerTypeMapping --- .../trino/plugin/sqlserver/BaseSqlServerTypeMapping.java | 7 ++++++- .../trino/plugin/sqlserver/TestSqlServerTypeMapping.java | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/BaseSqlServerTypeMapping.java b/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/BaseSqlServerTypeMapping.java index 3cd94da20418..218894e10c57 100644 --- a/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/BaseSqlServerTypeMapping.java +++ b/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/BaseSqlServerTypeMapping.java @@ -73,6 +73,8 @@ public abstract class BaseSqlServerTypeMapping private final ZoneId kathmandu = ZoneId.of("Asia/Kathmandu"); private final LocalDateTime timeGapInKathmandu = LocalDateTime.of(1986, 1, 1, 0, 13, 7); + protected TestingSqlServer sqlServer; + @BeforeClass public void setUp() { @@ -756,5 +758,8 @@ private static void checkIsGap(ZoneId zone, LocalDateTime dateTime) verify(isGap(zone, dateTime), "Expected %s to be a gap in %s", dateTime, zone); } - protected abstract SqlExecutor onRemoteDatabase(); + protected SqlExecutor onRemoteDatabase() + { + return sqlServer::execute; + } } diff --git a/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/TestSqlServerTypeMapping.java b/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/TestSqlServerTypeMapping.java index cebe39071652..2adbd3cd779b 100644 --- a/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/TestSqlServerTypeMapping.java +++ b/plugin/trino-sqlserver/src/test/java/io/trino/plugin/sqlserver/TestSqlServerTypeMapping.java @@ -16,15 +16,12 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import io.trino.testing.QueryRunner; -import io.trino.testing.sql.SqlExecutor; import static io.trino.plugin.sqlserver.SqlServerQueryRunner.createSqlServerQueryRunner; public class TestSqlServerTypeMapping extends BaseSqlServerTypeMapping { - protected TestingSqlServer sqlServer; - @Override protected QueryRunner createQueryRunner() throws Exception @@ -36,10 +33,4 @@ protected QueryRunner createQueryRunner() ImmutableMap.of(), ImmutableList.of()); } - - @Override - protected SqlExecutor onRemoteDatabase() - { - return sqlServer::execute; - } }