This commit is contained in:
Zoltan Haindrich 2024-05-16 09:48:18 +00:00
parent c9638b7836
commit cab3d945be
1 changed files with 27 additions and 23 deletions

View File

@ -34,7 +34,6 @@ import com.google.inject.Provides;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.google.inject.name.Names; import com.google.inject.name.Names;
import com.google.inject.util.Modules; import com.google.inject.util.Modules;
import com.google.inject.util.Providers;
import org.apache.calcite.avatica.server.AbstractAvaticaHandler; import org.apache.calcite.avatica.server.AbstractAvaticaHandler;
import org.apache.druid.cli.CliBroker2; import org.apache.druid.cli.CliBroker2;
import org.apache.druid.curator.CuratorModule; import org.apache.druid.curator.CuratorModule;
@ -445,7 +444,7 @@ public class Launcher
Launcher.main3(null); Launcher.main3(null);
} }
private static Module propOverrideModuel() private static Module propOverrideModuel1()
{ {
Properties localProps = new Properties(); Properties localProps = new Properties();
localProps.put("druid.enableTlsPort", "false"); localProps.put("druid.enableTlsPort", "false");
@ -466,6 +465,24 @@ public class Launcher
@Override @Override
protected void configure() protected void configure()
{ {
// builder.addModule(propOverrideModuel());
}
@Provides
@LazySingleton
public BrokerSegmentMetadataCache provideCache() {
return null;
}
@Provides
@LazySingleton
public Properties getProps() {
Properties localProps = new Properties();
localProps.put("druid.enableTlsPort", "false");
localProps.put("druid.zk.service.enabled", "false");
localProps.put("druid.plaintextPort", "12345");
localProps.put("druid.host", "localhost");
return localProps;
} }
@Provides @Provides
@ -558,15 +575,6 @@ public class Launcher
}
private static DiscovertModule discoverModule()
{
// DruidNodeDiscoveryProvider instance = ;
// Module m = binder -> binder.bind(DruidNodeDiscoveryProvider.class).toInstance(instance);
return new DiscovertModule();
} }
static class CustomStartupInjectorBuilder extends StartupInjectorBuilder { static class CustomStartupInjectorBuilder extends StartupInjectorBuilder {
@ -575,8 +583,8 @@ public class Launcher
public CustomStartupInjectorBuilder() public CustomStartupInjectorBuilder()
{ {
Module m = propOverrideModuel(); // Module m = propOverrideModuel();
addOverride(m); // addOverride(m);
// addOverride(binder -> { // addOverride(binder -> {
// binder.bind(SSLClientConfig.class).toProvider(Providers.of(null)); // binder.bind(SSLClientConfig.class).toProvider(Providers.of(null));
// binder.bind(SSLClientConfig.class).annotatedWith(Global.class).toProvider(Providers.of(null)); // binder.bind(SSLClientConfig.class).annotatedWith(Global.class).toProvider(Providers.of(null));
@ -615,9 +623,7 @@ public class Launcher
SqlTestFramework framework = getCI().extracted( SqlTestFramework framework = getCI().extracted(
propOverrideModuel(), new DiscovertModule()
discoverModule(),
binder -> binder.bind(BrokerSegmentMetadataCache.class).toProvider(Providers.of(null))
) )
@ -631,8 +637,8 @@ public class Launcher
CliBroker2 c = new CliBroker2() { CliBroker2 c = new CliBroker2() {
protected List<? extends Module> getModules() { protected List<? extends Module> getModules() {
List<Module> ret = new ArrayList<>(); List<Module> ret = new ArrayList<>();
ret.add(discoverModule()); ret.add(new DiscovertModule());
ret.add(propOverrideModuel()); // ret.add(propOverrideModuel());
ret.add(framework.testSetupModule()); ret.add(framework.testSetupModule());
// ret.add(new AvaticaBasedConnectionModule()); // ret.add(new AvaticaBasedConnectionModule());
ret.add(binder -> binder.bind(RequestLogger.class).toInstance(new TestRequestLogger())); ret.add(binder -> binder.bind(RequestLogger.class).toInstance(new TestRequestLogger()));
@ -687,9 +693,7 @@ public class Launcher
TestRequestLogger testRequestLogger = new TestRequestLogger(); TestRequestLogger testRequestLogger = new TestRequestLogger();
// builder.addModule(connectionModule); // builder.addModule(connectionModule);
builder.addModule(discoverModule()); // builder.addModule(new DiscovertModule());
builder.addModule(binder -> binder.bind(BrokerSegmentMetadataCache.class).toProvider(Providers.of(null)));
// builder.addModule(propOverrideModuel());
if(false) { if(false) {
builder.addModule(new LegacyBrokerParallelMergeConfigModule()); builder.addModule(new LegacyBrokerParallelMergeConfigModule());
@ -843,8 +847,8 @@ public class Launcher
CliBroker2 c = new CliBroker2() { CliBroker2 c = new CliBroker2() {
protected List<? extends Module> getModules() { protected List<? extends Module> getModules() {
List<Module> ret = new ArrayList<>(); List<Module> ret = new ArrayList<>();
ret.add(discoverModule()); ret.add(new DiscovertModule());
ret.add(propOverrideModuel()); // ret.add(propOverrideModuel());
ret.add(framework.testSetupModule()); ret.add(framework.testSetupModule());
// ret.add(new AvaticaBasedConnectionModule()); // ret.add(new AvaticaBasedConnectionModule());
ret.add(binder -> binder.bind(RequestLogger.class).toInstance(new TestRequestLogger())); ret.add(binder -> binder.bind(RequestLogger.class).toInstance(new TestRequestLogger()));