use of org.elasticsearch.env.Environment 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.env.Environment in project crate by crate.
the class PreExecutionBenchmark method setup.
@Setup
public void setup() throws Exception {
Path tempDir = Files.createTempDirectory("");
Settings settings = Settings.builder().put("path.home", tempDir.toAbsolutePath().toString()).build();
Environment environment = new Environment(settings, tempDir);
node = new Node(environment, List.of(Netty4Plugin.class), true);
node.start();
Injector injector = node.injector();
sqlOperations = injector.getInstance(SQLOperations.class);
analyzer = injector.getInstance(Analyzer.class);
planner = injector.getInstance(Planner.class);
clusterService = injector.getInstance(ClusterService.class);
nodeCtx = injector.getInstance(NodeContext.class);
String statement = "create table users (id int primary key, name string, date timestamp, text string index using fulltext)";
var resultReceiver = new BaseResultReceiver();
sqlOperations.newSystemSession().quickExec(statement, resultReceiver, Row.EMPTY);
resultReceiver.completionFuture().get(5, TimeUnit.SECONDS);
}
use of org.elasticsearch.env.Environment in project crate by crate.
the class NodeSettingsTest method doSetup.
@Before
public void doSetup() throws Exception {
tmp.create();
Path configPath = createConfigPath();
Map<String, String> settings = new HashMap<>();
settings.put("node.name", "node-test");
settings.put("node.data", "true");
settings.put(PATH_HOME_SETTING.getKey(), configPath.toString());
// Avoid connecting to other test nodes
settings.put("discovery.type", "single-node");
Environment environment = InternalSettingsPreparer.prepareEnvironment(Settings.EMPTY, settings, configPath, () -> "node-test");
node = new CrateNode(environment);
node.start();
sqlOperations = node.injector().getInstance(SQLOperations.class);
}
use of org.elasticsearch.env.Environment in project crate by crate.
the class UnsafeBootstrapAndDetachCommandIT method testBootstrapNotBootstrappedCluster.
public void testBootstrapNotBootstrappedCluster() throws Exception {
String node = internalCluster().startNode(Settings.builder().put(Node.INITIAL_STATE_TIMEOUT_SETTING.getKey(), // to ensure quick node startup
"0s").build());
assertBusy(() -> {
ClusterState state = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState();
assertTrue(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID));
});
Settings dataPathSettings = internalCluster().dataPathSettings(node);
internalCluster().stopRandomDataNode();
Environment environment = TestEnvironment.newEnvironment(Settings.builder().put(internalCluster().getDefaultSettings()).put(dataPathSettings).build());
expectThrows(() -> unsafeBootstrap(environment), UnsafeBootstrapMasterCommand.EMPTY_LAST_COMMITTED_VOTING_CONFIG_MSG);
}
use of org.elasticsearch.env.Environment in project crate by crate.
the class UnsafeBootstrapAndDetachCommandIT method testBootstrapAbortedByUser.
public void testBootstrapAbortedByUser() throws IOException {
internalCluster().setBootstrapMasterNodeIndex(0);
String node = internalCluster().startNode();
Settings dataPathSettings = internalCluster().dataPathSettings(node);
ensureStableCluster(1);
internalCluster().stopRandomDataNode();
Environment environment = TestEnvironment.newEnvironment(Settings.builder().put(internalCluster().getDefaultSettings()).put(dataPathSettings).build());
expectThrows(() -> unsafeBootstrap(environment, true), ElasticsearchNodeCommand.ABORTED_BY_USER_MSG);
}
Aggregations