use of org.apache.druid.server.DruidNode in project druid by druid-io.
the class BaseJettyTest method setup.
@Before
public void setup() throws Exception {
setProperties();
Injector injector = setupInjector();
final DruidNode node = injector.getInstance(Key.get(DruidNode.class, Self.class));
port = node.getPlaintextPort();
tlsPort = node.getTlsPort();
lifecycle = injector.getInstance(Lifecycle.class);
lifecycle.start();
ClientHolder holder = injector.getInstance(ClientHolder.class);
server = injector.getInstance(Server.class);
client = holder.getClient();
}
use of org.apache.druid.server.DruidNode in project druid by druid-io.
the class CreateTables method getModules.
@Override
protected List<? extends Module> getModules() {
return ImmutableList.of(// See https://github.com/apache/druid/pull/4429#discussion_r123602930
new DruidProcessingModule(), new QueryableModule(), new QueryRunnerFactoryModule(), binder -> {
JsonConfigProvider.bindInstance(binder, Key.get(MetadataStorageConnectorConfig.class), new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return connectURI;
}
@Override
public String getUser() {
return user;
}
@Override
public String getPassword() {
return password;
}
});
JsonConfigProvider.bindInstance(binder, Key.get(MetadataStorageTablesConfig.class), MetadataStorageTablesConfig.fromBase(base));
JsonConfigProvider.bindInstance(binder, Key.get(DruidNode.class, Self.class), new DruidNode("tools", "localhost", false, -1, null, true, false));
});
}
use of org.apache.druid.server.DruidNode in project druid by druid-io.
the class MetricsModuleTest method testSimpleInjectionWithValues.
@Test
public void testSimpleInjectionWithValues() {
final String dataSource = "some datasource";
final String taskId = "some task";
final Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
JsonConfigProvider.bindInstance(binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false));
binder.bind(Key.get(String.class, Names.named(DataSourceTaskIdHolder.DATA_SOURCE_BINDING))).toInstance(dataSource);
binder.bind(Key.get(String.class, Names.named(DataSourceTaskIdHolder.TASK_ID_BINDING))).toInstance(taskId);
}
}));
final DataSourceTaskIdHolder dimensionIdHolder = new DataSourceTaskIdHolder();
injector.injectMembers(dimensionIdHolder);
Assert.assertEquals(dataSource, dimensionIdHolder.getDataSource());
Assert.assertEquals(taskId, dimensionIdHolder.getTaskId());
}
use of org.apache.druid.server.DruidNode in project druid by druid-io.
the class MetricsModuleTest method testSimpleInjection.
@Test
public void testSimpleInjection() {
final Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
JsonConfigProvider.bindInstance(binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false));
}
}));
final DataSourceTaskIdHolder dimensionIdHolder = new DataSourceTaskIdHolder();
injector.injectMembers(dimensionIdHolder);
Assert.assertNull(dimensionIdHolder.getDataSource());
Assert.assertNull(dimensionIdHolder.getTaskId());
}
use of org.apache.druid.server.DruidNode in project druid by druid-io.
the class LookupNodeDiscoveryTest method setup.
@Before
public void setup() {
druidNodeDiscoveryProvider = EasyMock.createStrictMock(DruidNodeDiscoveryProvider.class);
druidNodeDiscovery = EasyMock.createStrictMock(DruidNodeDiscovery.class);
EasyMock.expect(druidNodeDiscoveryProvider.getForService(LookupNodeService.DISCOVERY_SERVICE_KEY)).andReturn(druidNodeDiscovery);
DiscoveryDruidNode node1 = new DiscoveryDruidNode(new DruidNode("s1", "h1", false, 8080, null, true, false), NodeRole.HISTORICAL, ImmutableMap.of(LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1")));
DiscoveryDruidNode node2 = new DiscoveryDruidNode(new DruidNode("s2", "h2", false, 8080, null, true, false), NodeRole.PEON, ImmutableMap.of(LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1")));
DiscoveryDruidNode node3 = new DiscoveryDruidNode(new DruidNode("s3", "h3", false, 8080, null, true, false), NodeRole.PEON, ImmutableMap.of(LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier2")));
EasyMock.expect(druidNodeDiscovery.getAllNodes()).andReturn(ImmutableSet.of(node1, node2, node3)).anyTimes();
EasyMock.replay(druidNodeDiscoveryProvider, druidNodeDiscovery);
lookupNodeDiscovery = new LookupNodeDiscovery(druidNodeDiscoveryProvider);
}
Aggregations