diff --git a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/MongoQueryRunner.java b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/MongoQueryRunner.java index 6aebbb8af649..cb587290f5b9 100644 --- a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/MongoQueryRunner.java +++ b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/MongoQueryRunner.java @@ -13,7 +13,6 @@ */ package io.prestosql.plugin.mongodb; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mongodb.MongoClient; import io.airlift.log.Logger; @@ -36,25 +35,22 @@ public final class MongoQueryRunner private MongoQueryRunner() {} - public static DistributedQueryRunner createMongoQueryRunner(MongoServer server, TpchTable... tables) - throws Exception - { - return createMongoQueryRunner(server, ImmutableList.copyOf(tables)); - } - - public static DistributedQueryRunner createMongoQueryRunner(MongoServer server, Iterable> tables) + public static DistributedQueryRunner createMongoQueryRunner(MongoServer server, Iterable> tables, Map extraProperties) throws Exception { DistributedQueryRunner queryRunner = null; try { - queryRunner = DistributedQueryRunner.builder(createSession()).build(); + queryRunner = DistributedQueryRunner.builder(createSession()) + .setExtraProperties(extraProperties) + .build(); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); - Map properties = ImmutableMap.of( - "mongodb.seeds", server.getAddress().toString(), - "mongodb.socket-keep-alive", "true"); + Map properties = ImmutableMap.builder() + .put("mongodb.seeds", server.getAddress().toString()) + .put("mongodb.socket-keep-alive", "true") + .build(); queryRunner.installPlugin(new MongoPlugin()); queryRunner.createCatalog("mongodb", "mongodb", properties); @@ -85,7 +81,8 @@ public static void main(String[] args) throws Exception { Logging.initialize(); - DistributedQueryRunner queryRunner = createMongoQueryRunner(new MongoServer(), TpchTable.getTables()); + Map properties = ImmutableMap.of("http-server.http.port", "8080"); + DistributedQueryRunner queryRunner = createMongoQueryRunner(new MongoServer(), TpchTable.getTables(), properties); Thread.sleep(10); Logger log = Logger.get(MongoQueryRunner.class); log.info("======== SERVER STARTED ========"); diff --git a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoDistributedQueries.java b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoDistributedQueries.java index 67933167f8d0..46c4217cd535 100644 --- a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoDistributedQueries.java +++ b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoDistributedQueries.java @@ -13,6 +13,7 @@ */ package io.prestosql.plugin.mongodb; +import com.google.common.collect.ImmutableMap; import io.prestosql.testing.AbstractTestQueries; import io.prestosql.testing.QueryRunner; import io.prestosql.tpch.TpchTable; @@ -32,7 +33,7 @@ protected QueryRunner createQueryRunner() throws Exception { this.server = new MongoServer(); - return createMongoQueryRunner(server, TpchTable.getTables()); + return createMongoQueryRunner(server, TpchTable.getTables(), ImmutableMap.of()); } @AfterClass(alwaysRun = true) diff --git a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoIntegrationSmokeTest.java b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoIntegrationSmokeTest.java index 4e7d86b3cfe9..286d9bea5dd5 100644 --- a/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoIntegrationSmokeTest.java +++ b/presto-mongodb/src/test/java/io/prestosql/plugin/mongodb/TestMongoIntegrationSmokeTest.java @@ -50,7 +50,7 @@ protected QueryRunner createQueryRunner() { this.server = new MongoServer(); this.client = createMongoClient(server); - return createMongoQueryRunner(server, ORDERS); + return createMongoQueryRunner(server, ImmutableList.of(ORDERS), ImmutableMap.of()); } @AfterClass(alwaysRun = true)