use of org.apache.drill.exec.ssl.SSLConfig in project drill by axbaretto.
the class TestSSLConfig method testForTrustStore.
@Test
public void testForTrustStore() throws Exception {
ConfigBuilder config = new ConfigBuilder();
config.put(ExecConstants.HTTP_TRUSTSTORE_PATH, "/root");
config.put(ExecConstants.HTTP_TRUSTSTORE_PASSWORD, "root");
config.put(ExecConstants.SSL_USE_HADOOP_CONF, false);
SSLConfig sslv = new SSLConfigBuilder().config(config.build()).mode(SSLConfig.Mode.SERVER).initializeSSLContext(false).validateKeyStore(true).build();
assertEquals(true, sslv.hasTrustStorePath());
assertEquals(true, sslv.hasTrustStorePassword());
assertEquals("/root", sslv.getTrustStorePath());
assertEquals("root", sslv.getTrustStorePassword());
}
use of org.apache.drill.exec.ssl.SSLConfig in project drill by axbaretto.
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.exec.ssl.SSLConfig in project drill by axbaretto.
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.exec.ssl.SSLConfig in project drill by axbaretto.
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.exec.ssl.SSLConfig in project drill by axbaretto.
the class TestSSLConfig method testMissingKeystorePassword.
@Test
public void testMissingKeystorePassword() throws Exception {
ConfigBuilder config = new ConfigBuilder();
config.put(ExecConstants.HTTP_KEYSTORE_PATH, "/root");
config.put(ExecConstants.HTTP_KEYSTORE_PASSWORD, "");
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);
}
}
Aggregations