mirror of https://github.com/apache/druid.git
inline class
This commit is contained in:
parent
a1b7f981fb
commit
ee195719b7
|
@ -1,83 +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.quidem;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.google.inject.AbstractModule;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import org.apache.druid.discovery.DruidNodeDiscoveryProvider;
|
|
||||||
import org.apache.druid.guice.LazySingleton;
|
|
||||||
import org.apache.druid.guice.annotations.Json;
|
|
||||||
import org.apache.druid.query.QueryRunnerFactoryConglomerate;
|
|
||||||
import org.apache.druid.query.QuerySegmentWalker;
|
|
||||||
import org.apache.druid.server.DruidNode;
|
|
||||||
import org.apache.druid.sql.calcite.run.NativeSqlEngine;
|
|
||||||
import org.apache.druid.sql.calcite.run.SqlEngine;
|
|
||||||
import org.apache.druid.sql.calcite.schema.BrokerSegmentMetadataCache;
|
|
||||||
import org.apache.druid.sql.calcite.util.CalciteTests;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class DiscovertModule extends AbstractModule {
|
|
||||||
|
|
||||||
DiscovertModule() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@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");
|
|
||||||
localProps.put("druid.broker.segment.awaitInitializationOnStart","false");
|
|
||||||
return localProps;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@LazySingleton
|
|
||||||
public SqlEngine createMockSqlEngine(
|
|
||||||
final QuerySegmentWalker walker,
|
|
||||||
final QueryRunnerFactoryConglomerate conglomerate,
|
|
||||||
@Json ObjectMapper jsonMapper )
|
|
||||||
{
|
|
||||||
return new NativeSqlEngine(CalciteTests.createMockQueryLifecycleFactory(walker, conglomerate), jsonMapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@LazySingleton
|
|
||||||
DruidNodeDiscoveryProvider getProvider()
|
|
||||||
{
|
|
||||||
final DruidNode coordinatorNode = CalciteTests.mockCoordinatorNode();
|
|
||||||
return CalciteTests.mockDruidNodeDiscoveryProvider(coordinatorNode);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,9 +25,11 @@ import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
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 org.apache.druid.cli.CliBroker;
|
import org.apache.druid.cli.CliBroker;
|
||||||
|
@ -41,6 +43,7 @@ import org.apache.druid.client.selector.ServerSelectorStrategy;
|
||||||
import org.apache.druid.client.selector.TierSelectorStrategy;
|
import org.apache.druid.client.selector.TierSelectorStrategy;
|
||||||
import org.apache.druid.curator.CuratorModule;
|
import org.apache.druid.curator.CuratorModule;
|
||||||
import org.apache.druid.curator.discovery.DiscoveryModule;
|
import org.apache.druid.curator.discovery.DiscoveryModule;
|
||||||
|
import org.apache.druid.discovery.DruidNodeDiscoveryProvider;
|
||||||
import org.apache.druid.guice.AnnouncerModule;
|
import org.apache.druid.guice.AnnouncerModule;
|
||||||
import org.apache.druid.guice.BrokerProcessingModule;
|
import org.apache.druid.guice.BrokerProcessingModule;
|
||||||
import org.apache.druid.guice.BrokerServiceModule;
|
import org.apache.druid.guice.BrokerServiceModule;
|
||||||
|
@ -68,6 +71,7 @@ import org.apache.druid.guice.StartupLoggingModule;
|
||||||
import org.apache.druid.guice.StorageNodeModule;
|
import org.apache.druid.guice.StorageNodeModule;
|
||||||
import org.apache.druid.guice.annotations.Client;
|
import org.apache.druid.guice.annotations.Client;
|
||||||
import org.apache.druid.guice.annotations.EscalatedClient;
|
import org.apache.druid.guice.annotations.EscalatedClient;
|
||||||
|
import org.apache.druid.guice.annotations.Json;
|
||||||
import org.apache.druid.guice.http.HttpClientModule;
|
import org.apache.druid.guice.http.HttpClientModule;
|
||||||
import org.apache.druid.guice.security.AuthenticatorModule;
|
import org.apache.druid.guice.security.AuthenticatorModule;
|
||||||
import org.apache.druid.guice.security.AuthorizerModule;
|
import org.apache.druid.guice.security.AuthorizerModule;
|
||||||
|
@ -81,6 +85,7 @@ import org.apache.druid.java.util.emitter.service.ServiceEmitter;
|
||||||
import org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
|
import org.apache.druid.metadata.storage.derby.DerbyMetadataStorageDruidModule;
|
||||||
import org.apache.druid.query.DefaultQueryConfig;
|
import org.apache.druid.query.DefaultQueryConfig;
|
||||||
import org.apache.druid.query.QueryRunnerFactoryConglomerate;
|
import org.apache.druid.query.QueryRunnerFactoryConglomerate;
|
||||||
|
import org.apache.druid.query.QuerySegmentWalker;
|
||||||
import org.apache.druid.query.RetryQueryRunnerConfig;
|
import org.apache.druid.query.RetryQueryRunnerConfig;
|
||||||
import org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider;
|
import org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider;
|
||||||
import org.apache.druid.rpc.guice.ServiceClientModule;
|
import org.apache.druid.rpc.guice.ServiceClientModule;
|
||||||
|
@ -88,6 +93,7 @@ import org.apache.druid.segment.join.JoinableFactoryWrapper;
|
||||||
import org.apache.druid.segment.writeout.SegmentWriteOutMediumModule;
|
import org.apache.druid.segment.writeout.SegmentWriteOutMediumModule;
|
||||||
import org.apache.druid.server.BrokerQueryResource;
|
import org.apache.druid.server.BrokerQueryResource;
|
||||||
import org.apache.druid.server.ClientInfoResource;
|
import org.apache.druid.server.ClientInfoResource;
|
||||||
|
import org.apache.druid.server.DruidNode;
|
||||||
import org.apache.druid.server.QueryLifecycleFactory;
|
import org.apache.druid.server.QueryLifecycleFactory;
|
||||||
import org.apache.druid.server.QueryScheduler;
|
import org.apache.druid.server.QueryScheduler;
|
||||||
import org.apache.druid.server.QuerySchedulerProvider;
|
import org.apache.druid.server.QuerySchedulerProvider;
|
||||||
|
@ -113,7 +119,9 @@ import org.apache.druid.server.security.Escalator;
|
||||||
import org.apache.druid.server.security.TLSCertificateCheckerModule;
|
import org.apache.druid.server.security.TLSCertificateCheckerModule;
|
||||||
import org.apache.druid.sql.calcite.planner.CalciteRulesManager;
|
import org.apache.druid.sql.calcite.planner.CalciteRulesManager;
|
||||||
import org.apache.druid.sql.calcite.planner.CatalogResolver;
|
import org.apache.druid.sql.calcite.planner.CatalogResolver;
|
||||||
|
import org.apache.druid.sql.calcite.run.NativeSqlEngine;
|
||||||
import org.apache.druid.sql.calcite.run.SqlEngine;
|
import org.apache.druid.sql.calcite.run.SqlEngine;
|
||||||
|
import org.apache.druid.sql.calcite.schema.BrokerSegmentMetadataCache;
|
||||||
import org.apache.druid.sql.calcite.schema.DruidSchemaName;
|
import org.apache.druid.sql.calcite.schema.DruidSchemaName;
|
||||||
import org.apache.druid.sql.calcite.util.CalciteTests;
|
import org.apache.druid.sql.calcite.util.CalciteTests;
|
||||||
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
import org.apache.druid.sql.calcite.util.SqlTestFramework;
|
||||||
|
@ -184,7 +192,7 @@ public class ExposedAsBrokerQueryComponentSupplierWrapper implements QueryCompon
|
||||||
installForServerModules(builder);
|
installForServerModules(builder);
|
||||||
|
|
||||||
overrideModules.addAll(ExposedAsBrokerQueryComponentSupplierWrapper.brokerModules());
|
overrideModules.addAll(ExposedAsBrokerQueryComponentSupplierWrapper.brokerModules());
|
||||||
overrideModules.add(new DiscovertModule());
|
overrideModules.add(new BrokerTestModule());
|
||||||
builder.add(QuidemCaptureModule.class);
|
builder.add(QuidemCaptureModule.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -238,6 +246,52 @@ public class ExposedAsBrokerQueryComponentSupplierWrapper implements QueryCompon
|
||||||
return delegate.getPlannerComponentSupplier();
|
return delegate.getPlannerComponentSupplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BrokerTestModule extends AbstractModule
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void configure()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@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");
|
||||||
|
localProps.put("druid.broker.segment.awaitInitializationOnStart", "false");
|
||||||
|
return localProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
public SqlEngine createMockSqlEngine(
|
||||||
|
final QuerySegmentWalker walker,
|
||||||
|
final QueryRunnerFactoryConglomerate conglomerate,
|
||||||
|
@Json ObjectMapper jsonMapper)
|
||||||
|
{
|
||||||
|
return new NativeSqlEngine(CalciteTests.createMockQueryLifecycleFactory(walker, conglomerate), jsonMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@LazySingleton
|
||||||
|
DruidNodeDiscoveryProvider getDruidNodeDiscoveryProvider()
|
||||||
|
{
|
||||||
|
final DruidNode coordinatorNode = CalciteTests.mockCoordinatorNode();
|
||||||
|
return CalciteTests.mockDruidNodeDiscoveryProvider(coordinatorNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closely related to {@link CoreInjectorBuilder#forServer()}
|
* Closely related to {@link CoreInjectorBuilder#forServer()}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue