Search in sources :

Example 1 with SigarModule

use of io.crate.module.SigarModule 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);
}
Also used : Path(java.nio.file.Path) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) Injector(org.elasticsearch.common.inject.Injector) SettingsModule(org.elasticsearch.common.settings.SettingsModule) SigarModule(io.crate.module.SigarModule) Environment(org.elasticsearch.env.Environment) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) NodeEnvironmentModule(org.elasticsearch.env.NodeEnvironmentModule) Before(org.junit.Before)

Aggregations

SigarModule (io.crate.module.SigarModule)1 Path (java.nio.file.Path)1 Injector (org.elasticsearch.common.inject.Injector)1 ModulesBuilder (org.elasticsearch.common.inject.ModulesBuilder)1 SettingsModule (org.elasticsearch.common.settings.SettingsModule)1 Environment (org.elasticsearch.env.Environment)1 NodeEnvironment (org.elasticsearch.env.NodeEnvironment)1 NodeEnvironmentModule (org.elasticsearch.env.NodeEnvironmentModule)1 Before (org.junit.Before)1