From 29d5775d61036a15063838cd80ce1349f47b2919 Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Tue, 29 Nov 2022 22:09:59 +0900 Subject: [PATCH 1/2] Rename TestMongoConnectorTest temporarily This is a preparatory commit for the next commit. --- ...tMongoConnectorTest.java => TestMongoTempConnectorTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/{TestMongoConnectorTest.java => TestMongoTempConnectorTest.java} (96%) diff --git a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java b/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java similarity index 96% rename from plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java rename to plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java index 6c77cb464fbb..b9b5fa3284b3 100644 --- a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java +++ b/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java @@ -19,7 +19,7 @@ import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoClient; import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoQueryRunner; -public class TestMongoConnectorTest +public class TestMongoTempConnectorTest extends BaseMongoConnectorTest { @Override From 6e4b8d88d469a96a276108f5dcf8bc50b7bec174 Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Tue, 29 Nov 2022 22:10:58 +0900 Subject: [PATCH 2/2] Remove redundant BaseMongoConnectorTest --- ...rTest.java => TestMongoConnectorTest.java} | 18 ++++++++-- .../mongodb/TestMongoTempConnectorTest.java | 33 ------------------- 2 files changed, 15 insertions(+), 36 deletions(-) rename plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/{BaseMongoConnectorTest.java => TestMongoConnectorTest.java} (98%) delete mode 100644 plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java diff --git a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/BaseMongoConnectorTest.java b/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java similarity index 98% rename from plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/BaseMongoConnectorTest.java rename to plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java index 38000bbcd877..5789ec44077e 100644 --- a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/BaseMongoConnectorTest.java +++ b/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoConnectorTest.java @@ -24,6 +24,7 @@ import io.trino.testing.BaseConnectorTest; import io.trino.testing.MaterializedResult; import io.trino.testing.MaterializedRow; +import io.trino.testing.QueryRunner; import io.trino.testing.TestingConnectorBehavior; import io.trino.testing.sql.TestTable; import org.bson.Document; @@ -43,6 +44,8 @@ import static com.mongodb.client.model.CollationCaseFirst.LOWER; import static com.mongodb.client.model.CollationStrength.PRIMARY; +import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoClient; +import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoQueryRunner; import static io.trino.spi.connector.ConnectorMetadata.MODIFYING_ROWS_MESSAGE; import static io.trino.testing.TestingNames.randomNameSuffix; import static java.lang.String.format; @@ -53,11 +56,20 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; -public abstract class BaseMongoConnectorTest +public class TestMongoConnectorTest extends BaseConnectorTest { - protected MongoServer server; - protected MongoClient client; + private MongoServer server; + private MongoClient client; + + @Override + protected QueryRunner createQueryRunner() + throws Exception + { + server = new MongoServer(); + client = createMongoClient(server); + return createMongoQueryRunner(server, ImmutableMap.of(), REQUIRED_TPCH_TABLES); + } @AfterClass(alwaysRun = true) public final void destroy() diff --git a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java b/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java deleted file mode 100644 index b9b5fa3284b3..000000000000 --- a/plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTempConnectorTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.plugin.mongodb; - -import com.google.common.collect.ImmutableMap; -import io.trino.testing.QueryRunner; - -import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoClient; -import static io.trino.plugin.mongodb.MongoQueryRunner.createMongoQueryRunner; - -public class TestMongoTempConnectorTest - extends BaseMongoConnectorTest -{ - @Override - protected QueryRunner createQueryRunner() - throws Exception - { - server = new MongoServer(); - client = createMongoClient(server); - return createMongoQueryRunner(server, ImmutableMap.of(), REQUIRED_TPCH_TABLES); - } -}