use of org.apache.drill.test.ConfigBuilder in project drill by axbaretto.
the class TestSSLConfig method testInvalidHadoopKeystore.
@Test
public void testInvalidHadoopKeystore() throws Exception {
Configuration hadoopConfig = new Configuration();
String hadoopSSLFileProp = MessageFormat.format(HADOOP_SSL_CONF_TPL_KEY, SSLConfig.Mode.SERVER.toString().toLowerCase());
hadoopConfig.set(hadoopSSLFileProp, "ssl-server-invalid.xml");
ConfigBuilder config = new ConfigBuilder();
config.put(ExecConstants.USER_SSL_ENABLED, true);
config.put(ExecConstants.SSL_USE_HADOOP_CONF, true);
SSLConfig sslv;
try {
sslv = new SSLConfigBuilder().config(config.build()).mode(SSLConfig.Mode.SERVER).initializeSSLContext(false).validateKeyStore(true).hadoopConfig(hadoopConfig).build();
fail();
} catch (Exception e) {
assertTrue(e instanceof DrillException);
}
}
use of org.apache.drill.test.ConfigBuilder in project drill by apache.
the class TestSSLConfig method testMissingKeystorePath.
@Test
public void testMissingKeystorePath() throws Exception {
ConfigBuilder config = new ConfigBuilder();
config.put(ExecConstants.HTTP_KEYSTORE_PATH, "");
config.put(ExecConstants.HTTP_KEYSTORE_PASSWORD, "root");
config.put(ExecConstants.SSL_USE_HADOOP_CONF, false);
config.put(ExecConstants.USER_SSL_ENABLED, true);
try {
SSLConfig sslv = new SSLConfigBuilder().config(config.build()).mode(SSLConfig.Mode.SERVER).initializeSSLContext(false).validateKeyStore(true).build();
fail();
// Expected
} catch (Exception e) {
assertTrue(e instanceof DrillException);
}
}
use of org.apache.drill.test.ConfigBuilder in project drill by apache.
the class TestSSLConfig method testForBackwardCompatability.
@Test
public void testForBackwardCompatability() throws Exception {
ConfigBuilder config = new ConfigBuilder();
config.put("javax.net.ssl.keyStore", "/root");
config.put("javax.net.ssl.keyStorePassword", "root");
SSLConfig sslv = new SSLConfigBuilder().config(config.build()).mode(SSLConfig.Mode.SERVER).initializeSSLContext(false).validateKeyStore(true).build();
assertEquals("/root", sslv.getKeyStorePath());
assertEquals("root", sslv.getKeyStorePassword());
}
use of org.apache.drill.test.ConfigBuilder in project drill by apache.
the class TestSSLConfig method testForKeystoreConfig.
@Test
public void testForKeystoreConfig() throws Exception {
ConfigBuilder config = new ConfigBuilder();
config.put(ExecConstants.HTTP_KEYSTORE_PATH, "/root");
config.put(ExecConstants.HTTP_KEYSTORE_PASSWORD, "root");
try {
SSLConfig sslv = new SSLConfigBuilder().config(config.build()).mode(SSLConfig.Mode.SERVER).initializeSSLContext(false).validateKeyStore(true).build();
assertEquals("/root", sslv.getKeyStorePath());
assertEquals("root", sslv.getKeyStorePassword());
} catch (Exception e) {
fail();
}
}
use of org.apache.drill.test.ConfigBuilder in project drill by apache.
the class TestHttpProxy method testHttpsUrlConfig.
@Test
public void testHttpsUrlConfig() {
Config config = new ConfigBuilder().put(ExecConstants.HTTPS_PROXY_URL, "https://bob:secret@foo.com:1234").build();
HttpProxyConfig proxy = HttpProxyConfig.builder().fromHttpsConfig(config).build();
assertEquals(ProxyType.HTTP, proxy.type);
assertEquals("foo.com", proxy.host);
assertEquals(1234, proxy.port);
assertEquals("bob", proxy.username);
assertEquals("secret", proxy.password);
}
Aggregations