use of io.crate.sql.tree.GenericProperty 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 io.crate.sql.tree.GenericProperty in project crate by crate.
the class RepositoryParamValidatorTest method testInvalidSetting.
@Test
public void testInvalidSetting() throws Exception {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("setting 'yay' not supported");
GenericProperties genericProperties = new GenericProperties();
genericProperties.add(new GenericProperty("location", new StringLiteral("foo")));
genericProperties.add(new GenericProperty("yay", new StringLiteral("invalid")));
validator.convertAndValidate("fs", Optional.of(genericProperties), ParameterContext.EMPTY);
}
use of io.crate.sql.tree.GenericProperty in project crate by crate.
the class RepositoryParamValidatorTest method testHdfsDynamicConfParam.
@Test
public void testHdfsDynamicConfParam() throws Exception {
GenericProperties genericProperties = new GenericProperties();
genericProperties.add(new GenericProperty("path", new StringLiteral("/data")));
genericProperties.add(new GenericProperty("conf.foobar", new StringLiteral("bar")));
Settings settings = validator.convertAndValidate("hdfs", Optional.of(genericProperties), ParameterContext.EMPTY);
assertThat(settings.get("conf.foobar"), is("bar"));
}
Aggregations