Skip to content

Commit

Permalink
there - with 1 boot
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed May 16, 2024
1 parent 28ea884 commit 118eb61
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.inject.util.Modules;
import org.apache.calcite.avatica.server.AbstractAvaticaHandler;
import org.apache.druid.cli.CliBroker2;
import org.apache.druid.cli.GuiceRunnable;
import org.apache.druid.curator.CuratorModule;
import org.apache.druid.curator.discovery.DiscoveryModule;
import org.apache.druid.guice.AnnouncerModule;
Expand All @@ -42,6 +43,7 @@
import org.apache.druid.guice.CoordinatorDiscoveryModule;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.guice.ExpressionModule;
import org.apache.druid.guice.ExtensionsModule;
import org.apache.druid.guice.FirehoseModule;
import org.apache.druid.guice.JacksonConfigManagerModule;
import org.apache.druid.guice.JavaScriptModule;
Expand All @@ -68,10 +70,13 @@
import org.apache.druid.initialization.CoreInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.initialization.Log4jShutterDownerModule;
import org.apache.druid.initialization.ServerInjectorBuilder;
import org.apache.druid.initialization.TombstoneDataStorageModule;
import org.apache.druid.java.util.common.FileUtils;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.io.Closer;
import org.apache.druid.java.util.common.lifecycle.Lifecycle;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.java.util.emitter.service.ServiceEmitter;
import org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
import org.apache.druid.query.DefaultQueryConfig;
Expand All @@ -93,6 +98,7 @@
import org.apache.druid.server.security.AuthenticatorMapper;
import org.apache.druid.server.security.AuthorizerMapper;
import org.apache.druid.server.security.Escalator;
import org.apache.druid.server.security.TLSCertificateCheckerModule;
import org.apache.druid.sql.avatica.AvaticaMonitor;
import org.apache.druid.sql.avatica.DruidAvaticaJsonHandler;
import org.apache.druid.sql.avatica.DruidMeta;
Expand Down Expand Up @@ -141,6 +147,7 @@ public class Launcher
public static final String DEFAULT_URI = URI_PREFIX + "/";

static final SqlTestFrameworkConfigStore CONFIG_STORE = new SqlTestFrameworkConfigStore();
private static Logger log = new Logger(Launcher.class);

public Launcher()
{
Expand Down Expand Up @@ -429,16 +436,22 @@ public void runIt() throws Exception
}

private static Module propOverrideModuel1()
{
Properties localProps = makeLocalProps();


Module m = binder -> binder.bind(Properties.class).toInstance(localProps);
return m;
}

private static Properties makeLocalProps()
{
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");


Module m = binder -> binder.bind(Properties.class).toInstance(localProps);
return m;
return localProps;
}

static class CustomStartupInjectorBuilder extends StartupInjectorBuilder {
Expand Down Expand Up @@ -578,10 +591,12 @@ public void configureGuice(CoreInjectorBuilder builder, List<Module> overrideMod

// builder.addModule(new StorageNodeModule());

// builder.addModules(new CliBroker2().getmodules2().toArray(new Module[0]));


builder.addModule(
binder -> {
// why need to add this?
// binder.bind(ResponseContextConfig.class).toInstance(ResponseContextConfig.newConfig(false));
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test");
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0);
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1);
Expand All @@ -607,12 +622,13 @@ public void configureGuice(CoreInjectorBuilder builder, List<Module> overrideMod
);

if(true) {
builder.addModules(

builder.add(
new Log4jShutterDownerModule(),
new LifecycleModule(),
// ExtensionsModule.SecondaryModule.class,
ExtensionsModule.SecondaryModule.class,
new DruidAuthModule(),
// TLSCertificateCheckerModule.class,
TLSCertificateCheckerModule.class,
// EmitterModule.class,
HttpClientModule.global(),
HttpClientModule.escalatedGlobal(),
Expand Down Expand Up @@ -647,7 +663,17 @@ public void configureGuice(CoreInjectorBuilder builder, List<Module> overrideMod
new ServiceClientModule(),
new StorageConnectorModule()
);
// builder.addModules();
// builder.addModules(new CliBroker2().getmodules2().toArray(new Module[0]));

CliBroker2 cliBroker2 = new CliBroker2();
cliBroker2.configure(makeLocalProps(), null);
overrideModules.addAll(cliBroker2.getmodules2());

builder.add(ServerInjectorBuilder.registerNodeRoleModule(ImmutableSet.of()));

}

}

@Override
Expand Down Expand Up @@ -713,7 +739,10 @@ private static void main3(Object object) throws Exception
// SSLContextProvider u = injector.getInstance(SSLContextProvider.class);
// System.out.println(u);


if(true) {
Lifecycle lifecycle = GuiceRunnable.initLifecycle(framework.injector(), log);
lifecycle.join();
}else {
CliBroker2 c = new CliBroker2() {
protected List<? extends Module> getModules() {
List<Module> ret = new ArrayList<>();
Expand All @@ -735,6 +764,7 @@ protected List<? extends Module> getModules() {
// c.configure(new Properties());

c.run2();
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected List<? extends Module> getModules()
LifecycleModule.registerKey(binder, Key.get(SelfDiscoveryResource.class));
},
// new LookupModule(),
new LookylooModule(),
// new LookylooModule(),
new SqlModule()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
*/
public class LookylooModule implements DruidModule
{
public LookylooModule() {
int asd1=1;
}
private static final String LOOKYLOO_INJECTIVE = "lookyloo121";
private static final String LOOKYLOO_CHAINED = "lookyloo-chain";

Expand Down

0 comments on commit 118eb61

Please sign in to comment.