use of org.elasticsearch.common.settings.Settings in project crate by crate.
the class RepositoryParamValidatorTest method testS3ConfigParams.
@Test
public void testS3ConfigParams() throws Exception {
GenericProperties genericProperties = new GenericProperties();
genericProperties.add(new GenericProperty("access_key", new StringLiteral("foobar")));
genericProperties.add(new GenericProperty("base_path", new StringLiteral("/data")));
genericProperties.add(new GenericProperty("bucket", new StringLiteral("myBucket")));
genericProperties.add(new GenericProperty("buffer_size", new StringLiteral("10k")));
genericProperties.add(new GenericProperty("canned_acl", new StringLiteral("cannedACL")));
genericProperties.add(new GenericProperty("chunk_size", new StringLiteral("4g")));
genericProperties.add(new GenericProperty("compress", new StringLiteral("true")));
genericProperties.add(new GenericProperty("concurrent_streams", new StringLiteral("12")));
genericProperties.add(new GenericProperty("endpoint", new StringLiteral("myEndpoint")));
genericProperties.add(new GenericProperty("max_retries", new StringLiteral("8")));
genericProperties.add(new GenericProperty("protocol", new StringLiteral("myProtocol")));
genericProperties.add(new GenericProperty("region", new StringLiteral("Europe-1")));
genericProperties.add(new GenericProperty("secret_key", new StringLiteral("thisIsASecretKey")));
genericProperties.add(new GenericProperty("server_side_encryption", new StringLiteral("false")));
Settings settings = validator.convertAndValidate("s3", Optional.of(genericProperties), ParameterContext.EMPTY);
assertThat(settings.get("access_key"), is("foobar"));
assertThat(settings.get("base_path"), is("/data"));
assertThat(settings.get("bucket"), is("myBucket"));
assertThat(settings.get("buffer_size"), is("10240b"));
assertThat(settings.get("canned_acl"), is("cannedACL"));
assertThat(settings.get("chunk_size"), is("4294967296b"));
assertThat(settings.get("compress"), is("true"));
assertThat(settings.get("concurrent_streams"), is("12"));
assertThat(settings.get("endpoint"), is("myEndpoint"));
assertThat(settings.get("max_retries"), is("8"));
assertThat(settings.get("protocol"), is("myProtocol"));
assertThat(settings.get("region"), is("Europe-1"));
assertThat(settings.get("secret_key"), is("thisIsASecretKey"));
assertThat(settings.get("server_side_encryption"), is("false"));
}
use of org.elasticsearch.common.settings.Settings in project crate by crate.
the class ApplySettingsTest method testOnRefreshSettings.
@Test
public void testOnRefreshSettings() throws Exception {
ConcurrentHashMap<String, Object> values = new ConcurrentHashMap<>();
ClusterSettingsExpression.ApplySettings applySettings = new ClusterSettingsExpression.ApplySettings(Settings.EMPTY, values);
Settings.Builder builder = Settings.builder().put(CrateSettings.STATS_JOBS_LOG_SIZE.settingName(), 1).put(CrateSettings.STATS_ENABLED.settingName(), false).put(CrateSettings.GRACEFUL_STOP_MIN_AVAILABILITY.settingName(), "full").put(CrateSettings.GRACEFUL_STOP_TIMEOUT.settingName(), "1m").put(CrateSettings.DISCOVERY_ZEN_MIN_MASTER_NODES.settingName(), 2);
Settings settings = builder.build();
applySettings.onRefreshSettings(settings);
String name = CrateSettings.STATS_JOBS_LOG_SIZE.settingName();
assertEquals(values.get(name), settings.getAsInt(name, 0));
name = CrateSettings.STATS_ENABLED.settingName();
assertEquals(values.get(name), settings.getAsBoolean(name, true));
name = CrateSettings.GRACEFUL_STOP_MIN_AVAILABILITY.settingName();
assertEquals(values.get(name), settings.get(name, "none"));
name = CrateSettings.GRACEFUL_STOP_TIMEOUT.settingName();
assertEquals(values.get(name), settings.get(name, "1h"));
name = CrateSettings.DISCOVERY_ZEN_MIN_MASTER_NODES.settingName();
assertEquals(values.get(name), settings.getAsInt(name, 2));
}
use of org.elasticsearch.common.settings.Settings in project crate by crate.
the class JobsLogsTest method testEnableStats.
@Test
public void testEnableStats() throws Exception {
Settings settings = Settings.builder().put(CrateSettings.STATS_ENABLED.settingName(), false).put(CrateSettings.STATS_JOBS_LOG_SIZE.settingName(), 100).put(CrateSettings.STATS_OPERATIONS_LOG_SIZE.settingName(), 100).build();
JobsLogService stats = new JobsLogService(settings, nodeSettingsService, scheduler, breakerService);
stats.listener.onRefreshSettings(Settings.builder().put(CrateSettings.STATS_ENABLED.settingName(), true).build());
assertThat(stats.isEnabled(), is(true));
assertThat(stats.lastJobsLogSize, is(100));
assertThat(stats.jobsLogSink, Matchers.instanceOf(QueueSink.class));
assertThat(stats.lastOperationsLogSize, is(100));
assertThat(stats.operationsLogSink, Matchers.instanceOf(QueueSink.class));
}
use of org.elasticsearch.common.settings.Settings in project crate by crate.
the class DocLevelExpressionsTest method prepare.
@Before
public void prepare() throws Exception {
Settings settings = Settings.builder().put("index.fielddata.cache", "none").build();
IndexService indexService = createIndex("test", settings);
ifd = indexService.fieldData();
writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(new StandardAnalyzer()).setMergePolicy(new LogByteSizeMergePolicy()));
insertValues(writer);
DirectoryReader directoryReader = DirectoryReader.open(writer, true);
readerContext = directoryReader.leaves().get(0);
ctx = new CollectorContext(ifd, null);
}
use of org.elasticsearch.common.settings.Settings in project crate by crate.
the class ESClusterUpdateSettingsTaskTest method testUpdateMultipleSettingsWithParameters.
@Test
public void testUpdateMultipleSettingsWithParameters() throws Exception {
Map<String, List<Expression>> settings = new HashMap<String, List<Expression>>() {
{
put("stats.operations_log_size", ImmutableList.<Expression>of(new ParameterExpression(1)));
put("stats.jobs_log_size", ImmutableList.<Expression>of(new ParameterExpression(2)));
}
};
Settings expected = Settings.builder().put("stats.operations_log_size", 10).put("stats.jobs_log_size", 25).build();
assertThat(ESClusterUpdateSettingsTask.buildSettingsFrom(settings, new RowN(new Object[] { 10, 25 })), is(expected));
}
Aggregations