Search in sources :

Example 16 with ConfigBuilder

use of org.apache.drill.test.ConfigBuilder in project drill by apache.

the class TestHttpProxy method testHttpsConfig.

@Test
public void testHttpsConfig() {
    Config config = new ConfigBuilder().put(ExecConstants.HTTPS_PROXY_URL, "").put(ExecConstants.HTTPS_PROXY_TYPE, "socks").put(ExecConstants.HTTPS_PROXY_HOST, "foo.com").put(ExecConstants.HTTPS_PROXY_PORT, 1234).put(ExecConstants.HTTPS_PROXY_USER_NAME, "bob").put(ExecConstants.HTTPS_PROXY_PASSWORD, "secret").build();
    HttpProxyConfig proxy = HttpProxyConfig.builder().fromHttpsConfig(config).build();
    assertEquals(ProxyType.SOCKS, proxy.type);
    assertEquals("foo.com", proxy.host);
    assertEquals(1234, proxy.port);
    assertEquals("bob", proxy.username);
    assertEquals("secret", proxy.password);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) Config(com.typesafe.config.Config) ConfigBuilder(org.apache.drill.test.ConfigBuilder) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 17 with ConfigBuilder

use of org.apache.drill.test.ConfigBuilder in project drill by apache.

the class TestHttpProxy method testHttpConfig.

@Test
public void testHttpConfig() {
    Config config = new ConfigBuilder().put(ExecConstants.HTTP_PROXY_URL, "http://bob:secret@foo.com:1234").build();
    HttpProxyConfig proxy = HttpProxyConfig.builder().fromHttpConfig(config).build();
    assertEquals(ProxyType.HTTP, proxy.type);
    assertEquals("foo.com", proxy.host);
    assertEquals(1234, proxy.port);
    assertEquals("bob", proxy.username);
    assertEquals("secret", proxy.password);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) Config(com.typesafe.config.Config) ConfigBuilder(org.apache.drill.test.ConfigBuilder) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 18 with ConfigBuilder

use of org.apache.drill.test.ConfigBuilder in project drill by apache.

the class TestHttpProxy method testEnvVar.

// To run this test, set two env vars in your run/debug
// configuration, then comment out the @Ignore:
// http_proxy=http://bob:secret@foo.com:1234
// https_proxy=http://alice:s3cr3t@bar.com:2345
@Test
@Ignore("Requires manual setup")
public void testEnvVar() {
    Config config = new ConfigBuilder().build();
    doTestConfigForUrl(config);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) Config(com.typesafe.config.Config) ConfigBuilder(org.apache.drill.test.ConfigBuilder) Ignore(org.junit.Ignore) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Aggregations

ConfigBuilder (org.apache.drill.test.ConfigBuilder)18 Test (org.junit.Test)18 SecurityTest (org.apache.drill.categories.SecurityTest)12 SSLConfig (org.apache.drill.exec.ssl.SSLConfig)12 SSLConfigBuilder (org.apache.drill.exec.ssl.SSLConfigBuilder)12 BaseTest (org.apache.drill.test.BaseTest)12 DrillException (org.apache.drill.common.exceptions.DrillException)8 Config (com.typesafe.config.Config)6 HttpProxyConfig (org.apache.drill.exec.store.http.util.HttpProxyConfig)6 Configuration (org.apache.hadoop.conf.Configuration)2 Ignore (org.junit.Ignore)1