diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java index 65edc9264e2c..66a9101f5bf4 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/HiveQueryRunner.java @@ -20,7 +20,6 @@ import io.airlift.log.Logging; import io.trino.Session; import io.trino.metadata.QualifiedObjectName; -import io.trino.plugin.exchange.FileSystemExchangePlugin; import io.trino.plugin.hive.metastore.Database; import io.trino.plugin.hive.metastore.HiveMetastore; import io.trino.plugin.hive.metastore.MetastoreConfig; @@ -100,7 +99,6 @@ public static class Builder> { private boolean skipTimezoneSetup; private ImmutableMap.Builder hiveProperties = ImmutableMap.builder(); - private Map exchangeManagerProperties = ImmutableMap.of(); private List> initialTables = ImmutableList.of(); private Optional initialSchemasLocationBase = Optional.empty(); private Function initialTablesSessionMutator = Function.identity(); @@ -150,12 +148,6 @@ public SELF addHiveProperty(String key, String value) return self(); } - public SELF setExchangeManagerProperties(Map exchangeManagerProperties) - { - this.exchangeManagerProperties = ImmutableMap.copyOf(requireNonNull(exchangeManagerProperties, "exchangeManagerProperties is null")); - return self(); - } - public SELF setInitialTables(Iterable> initialTables) { this.initialTables = ImmutableList.copyOf(requireNonNull(initialTables, "initialTables is null")); @@ -240,11 +232,6 @@ public DistributedQueryRunner build() HiveMetastore metastore = this.metastore.apply(queryRunner); queryRunner.installPlugin(new TestingHivePlugin(metastore, module, cachingDirectoryLister)); - if (!exchangeManagerProperties.isEmpty()) { - queryRunner.installPlugin(new FileSystemExchangePlugin()); - queryRunner.loadExchangeManager("filesystem", exchangeManagerProperties); - } - Map hiveProperties = new HashMap<>(); if (!skipTimezoneSetup) { assertEquals(DateTimeZone.getDefault(), TIME_ZONE, "Timezone not configured correctly. Add -Duser.timezone=America/Bahia_Banderas to your JVM arguments"); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergQueryRunner.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergQueryRunner.java index 060219161c79..7413219511a2 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergQueryRunner.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/IcebergQueryRunner.java @@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableMap; import io.airlift.log.Logger; import io.airlift.log.Logging; -import io.trino.plugin.exchange.FileSystemExchangePlugin; import io.trino.plugin.tpch.TpchPlugin; import io.trino.testing.DistributedQueryRunner; import io.trino.tpch.TpchTable; @@ -91,7 +90,6 @@ public static class Builder { private Optional metastoreDirectory = Optional.empty(); private ImmutableMap.Builder icebergProperties = ImmutableMap.builder(); - private Map exchangeManagerProperties = ImmutableMap.of(); private List> initialTables = ImmutableList.of(); protected Builder() @@ -121,12 +119,6 @@ public Builder addIcebergProperty(String key, String value) return self(); } - public Builder setExchangeManagerProperties(Map exchangeManagerProperties) - { - this.exchangeManagerProperties = ImmutableMap.copyOf(requireNonNull(exchangeManagerProperties, "exchangeManagerProperties is null")); - return self(); - } - public Builder setInitialTables(Iterable> initialTables) { this.initialTables = ImmutableList.copyOf(requireNonNull(initialTables, "initialTables is null")); @@ -142,11 +134,6 @@ public DistributedQueryRunner build() queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); - if (!exchangeManagerProperties.isEmpty()) { - queryRunner.installPlugin(new FileSystemExchangePlugin()); - queryRunner.loadExchangeManager("filesystem", exchangeManagerProperties); - } - Path dataDir = metastoreDirectory.map(File::toPath).orElseGet(() -> queryRunner.getCoordinator().getBaseDataDir().resolve("iceberg_data")); queryRunner.installPlugin(new IcebergPlugin()); diff --git a/testing/trino-testing/pom.xml b/testing/trino-testing/pom.xml index edaa27d25994..7a42993bbc6b 100644 --- a/testing/trino-testing/pom.xml +++ b/testing/trino-testing/pom.xml @@ -22,6 +22,11 @@ trino-client + + io.trino + trino-exchange + + io.trino trino-main diff --git a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java index 01410fd54af7..4287c2e5981c 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java @@ -34,6 +34,7 @@ import io.trino.metadata.QualifiedObjectName; import io.trino.metadata.SessionPropertyManager; import io.trino.metadata.SqlFunction; +import io.trino.plugin.exchange.FileSystemExchangePlugin; import io.trino.server.BasicQueryInfo; import io.trino.server.SessionPropertyDefaults; import io.trino.server.testing.TestingTrinoServer; @@ -625,6 +626,7 @@ public static class Builder> private Map extraProperties = new HashMap<>(); private Map coordinatorProperties = ImmutableMap.of(); private Optional> backupCoordinatorProperties = Optional.empty(); + private Map exchangeManagerProperties = ImmutableMap.of(); private String environment = ENVIRONMENT; private Module additionalModule = EMPTY_MODULE; private Optional baseDataDir = Optional.empty(); @@ -673,6 +675,12 @@ public SELF setBackupCoordinatorProperties(Map backupCoordinator return self(); } + public SELF setExchangeManagerProperties(Map exchangeManagerProperties) + { + this.exchangeManagerProperties = ImmutableMap.copyOf(requireNonNull(exchangeManagerProperties, "exchangeManagerProperties is null")); + return self(); + } + /** * Sets coordinator properties being equal to a map containing given key and value. * Note, that calling this method OVERWRITES previously set property values. @@ -744,7 +752,7 @@ protected SELF self() public DistributedQueryRunner build() throws Exception { - return new DistributedQueryRunner( + DistributedQueryRunner queryRunner = new DistributedQueryRunner( defaultSession, nodeCount, extraProperties, @@ -755,6 +763,13 @@ public DistributedQueryRunner build() baseDataDir, systemAccessControls, eventListeners); + + if (!exchangeManagerProperties.isEmpty()) { + queryRunner.installPlugin(new FileSystemExchangePlugin()); + queryRunner.loadExchangeManager("filesystem", exchangeManagerProperties); + } + + return queryRunner; } } }