use of org.elasticsearch.common.inject.ModulesBuilder in project crate by crate.
the class SysNodesExpressionsTest method prepare.
@Before
public void prepare() throws Exception {
MonitorModule monitorModule = new MonitorModule(NODE_SETTINGS);
monitorModule.addExtendedNodeInfoType("dummy", DummyExtendedNodeInfo.class);
injector = new ModulesBuilder().add(new TestModule(true), monitorModule, new SysNodeExpressionModule()).createInjector();
resolver = injector.getInstance(NodeSysExpression.class);
}
use of org.elasticsearch.common.inject.ModulesBuilder in project crate by crate.
the class GroupingBytesRefCollectorBenchmark method createGroupingCollector.
@Setup
public void createGroupingCollector() {
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
groupByMinCollector = createGroupByMinBytesRefCollector(functions);
List<BytesRef> keys = new ArrayList<>(Locale.getISOCountries().length);
for (String s : Locale.getISOCountries()) {
keys.add(new BytesRef(s));
}
rows = new ArrayList<>(20_000_000);
for (int i = 0; i < 20_000_000; i++) {
rows.add(new Row1(keys.get(i % keys.size())));
}
}
use of org.elasticsearch.common.inject.ModulesBuilder in project crate by crate.
the class SigarExtendedNodeInfoTest method prepare.
@Before
public void prepare() throws Exception {
NodeEnvironment nodeEnvironment = mock(NodeEnvironment.class);
when(nodeEnvironment.hasNodeFile()).thenReturn(true);
Path tempDir = createTempDir();
NodeEnvironment.NodePath[] dataLocations = new NodeEnvironment.NodePath[] { new NodeEnvironment.NodePath(tempDir, mock(Environment.class)) };
when(nodeEnvironment.nodePaths()).thenReturn(dataLocations);
NodeEnvironmentModule nodeEnvironmentModule = new NodeEnvironmentModule(nodeEnvironment);
MonitorModule monitorModule = new MonitorModule(NODE_SETTINGS);
monitorModule.addExtendedNodeInfoType(SigarPlugin.NODE_INFO_EXTENDED_TYPE, SigarExtendedNodeInfo.class);
Injector injector = new ModulesBuilder().add(new SettingsModule(NODE_SETTINGS), monitorModule, nodeEnvironmentModule, new SigarModule(new SigarService(NODE_SETTINGS))).createInjector();
extendedNodeInfo = injector.getInstance(ExtendedNodeInfo.class);
}
use of org.elasticsearch.common.inject.ModulesBuilder in project elasticsearch-skywalker by jprante.
the class SkywalkerTests method test.
@Test
public void test() {
Settings settings = ImmutableSettings.settingsBuilder().build();
Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings), new EnvironmentModule(new Environment(settings)), new IndicesAnalysisModule()).createInjector();
ActionModule actionModule = new ActionModule(true);
RestModule restModule = new RestModule(settings);
SkywalkerPlugin plugin = new SkywalkerPlugin();
plugin.onModule(actionModule);
plugin.onModule(restModule);
}
use of org.elasticsearch.common.inject.ModulesBuilder in project crate by crate.
the class AggregateCollectorBenchmark method setup.
@Setup
public void setup() {
InputCollectExpression inExpr0 = new InputCollectExpression(0);
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
SumAggregation<?> sumAggregation = (SumAggregation<?>) functions.getQualified(Signature.aggregate(SumAggregation.NAME, DataTypes.INTEGER.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
var memoryManager = new OnHeapMemoryManager(bytes -> {
});
collector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { sumAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
}
Aggregations