diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/CompositeDruidModule.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/CompositeDruidModule.java deleted file mode 100644 index 54834c5ec61..00000000000 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/CompositeDruidModule.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.druid.sql.calcite.util; - -import com.fasterxml.jackson.databind.Module; -import com.google.common.collect.ImmutableList; -import com.google.inject.Binder; -import org.apache.druid.initialization.DruidModule; - -import java.util.List; - -public class CompositeDruidModule implements DruidModule -{ - protected final DruidModule[] modules; - - public CompositeDruidModule(DruidModule... modules) - { - this.modules = modules; - } - - @Override - public List getJacksonModules() - { - ImmutableList.Builder builder = ImmutableList.builder(); - for (DruidModule druidModule : modules) { - builder.addAll(druidModule.getJacksonModules()); - } - return builder.build(); - } - - @Override - public void configure(Binder binder) - { - for (DruidModule druidModule : modules) { - binder.install(druidModule); - } - } -} diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java index 2d608178437..0f355b2f1b9 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java @@ -20,6 +20,7 @@ package org.apache.druid.sql.calcite.util; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.inject.Binder; @@ -33,6 +34,7 @@ import org.apache.druid.guice.LazySingleton; import org.apache.druid.guice.SegmentWranglerModule; import org.apache.druid.guice.StartupInjectorBuilder; import org.apache.druid.initialization.CoreInjectorBuilder; +import org.apache.druid.initialization.DruidModule; import org.apache.druid.initialization.ServiceInjectorBuilder; import org.apache.druid.java.util.common.RE; import org.apache.druid.java.util.common.io.Closer; @@ -78,6 +80,7 @@ import java.io.Closeable; import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.Set; @@ -545,20 +548,32 @@ public class SqlTestFramework * This is an intermediate solution: the ultimate solution is to create things * in Guice itself. */ - private class TestSetupModule extends CompositeDruidModule + private class TestSetupModule implements DruidModule { private final Builder builder; + private final List subModules = Arrays.asList(new BuiltInTypesModule(), new TestSqlModule()); public TestSetupModule(Builder builder) { - super(new BuiltInTypesModule(), new TestSqlModule()); this.builder = builder; } + @Override + public List getJacksonModules() + { + ImmutableList.Builder builder = ImmutableList.builder(); + for (DruidModule druidModule : subModules) { + builder.addAll(druidModule.getJacksonModules()); + } + return builder.build(); + } + @Override public void configure(Binder binder) { - super.configure(binder); + for (DruidModule module : subModules) { + binder.install(module); + } binder.bind(DruidOperatorTable.class).in(LazySingleton.class); binder.bind(DataSegment.PruneSpecsHolder.class).toInstance(DataSegment.PruneSpecsHolder.DEFAULT); binder.bind(DefaultColumnFormatConfig.class).toInstance(new DefaultColumnFormatConfig(null, null));