mirror of https://github.com/apache/druid.git
remove CompositeDruidModule
This commit is contained in:
parent
6cef3eb6e8
commit
4e5d7c9c21
|
@ -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<? extends Module> getJacksonModules()
|
||||
{
|
||||
ImmutableList.Builder<Module> 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<DruidModule> subModules = Arrays.asList(new BuiltInTypesModule(), new TestSqlModule());
|
||||
|
||||
public TestSetupModule(Builder builder)
|
||||
{
|
||||
super(new BuiltInTypesModule(), new TestSqlModule());
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
|
||||
{
|
||||
ImmutableList.Builder<com.fasterxml.jackson.databind.Module> 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));
|
||||
|
|
Loading…
Reference in New Issue