Skip to content

Commit

Permalink
using a helper method to bind to correct property path
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankChen021 committed Dec 8, 2020
1 parent fae9a79 commit 90dfa73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void configure(Binder binder)
{
JsonConfigProvider.bind(binder, "druid.server", DruidServerConfig.class);
JsonConfigProvider.bind(binder, "druid.segmentCache", SegmentLoaderConfig.class);
JsonConfigProvider.bind(binder, "druid.segmentCache.locationSelector.strategy", StorageLocationSelectorStrategy.class);
bindLocationSelectorStrategy(binder);

binder.bind(ServerTypeConfig.class).toProvider(Providers.of(null));
binder.bind(ColumnConfig.class).to(DruidProcessingConfig.class);
Expand Down Expand Up @@ -132,4 +132,12 @@ public List<StorageLocation> provideStorageLocation(SegmentLoaderConfig config)
{
return config.toStorageLocations();
}

/**
* a helper method for both storage module and independent unit test cases
*/
public static void bindLocationSelectorStrategy(Binder binder)
{
JsonConfigProvider.bind(binder, "druid.segmentCache.locationSelector", StorageLocationSelectorStrategy.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.druid.guice.JsonConfigProvider;
import org.apache.druid.guice.JsonConfigurator;
import org.apache.druid.guice.LazySingleton;
import org.apache.druid.guice.StorageNodeModule;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.junit.Assert;
import org.junit.Rule;
Expand Down Expand Up @@ -362,7 +363,7 @@ public void configure(Binder binder)
binder.bind(Properties.class).toInstance(props);

JsonConfigProvider.bind(binder, "druid.segmentCache", SegmentLoaderConfig.class);
JsonConfigProvider.bind(binder, "druid.segmentCache.locationSelector", StorageLocationSelectorStrategy.class);
StorageNodeModule.bindLocationSelectorStrategy(binder);
}

@Provides
Expand Down

0 comments on commit 90dfa73

Please sign in to comment.