Search in sources :

Example 6 with HttpProxyConfig

use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.

the class TestHttpProxy method testHttpUrlConfig.

@Test
public void testHttpUrlConfig() {
    Config config = new ConfigBuilder().put(ExecConstants.HTTP_PROXY_URL, "").put(ExecConstants.HTTP_PROXY_TYPE, "socks").put(ExecConstants.HTTP_PROXY_HOST, "foo.com").put(ExecConstants.HTTP_PROXY_PORT, 1234).put(ExecConstants.HTTP_PROXY_USER_NAME, "bob").put(ExecConstants.HTTP_PROXY_PASSWORD, "secret").build();
    HttpProxyConfig proxy = HttpProxyConfig.builder().fromHttpConfig(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 7 with HttpProxyConfig

use of org.apache.drill.exec.store.http.util.HttpProxyConfig 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 8 with HttpProxyConfig

use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.

the class TestHttpProxy method testBadType.

@Test
public void testBadType() {
    HttpProxyConfig proxy = HttpProxyConfig.builder().type("bogus").host("foo.com").port(1234).username("bob").password("secret").build();
    assertEquals(ProxyType.NONE, proxy.type);
    assertNull(proxy.host);
    assertNull(proxy.username);
    assertNull(proxy.password);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 9 with HttpProxyConfig

use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.

the class TestHttpProxy method testURLAndConfig.

@Test
public void testURLAndConfig() {
    HttpProxyConfig proxy = HttpProxyConfig.builder().url("http://foo.com:1234").username("bob").password("secret").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) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 10 with HttpProxyConfig

use of org.apache.drill.exec.store.http.util.HttpProxyConfig 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)

Aggregations

HttpProxyConfig (org.apache.drill.exec.store.http.util.HttpProxyConfig)11 BaseTest (org.apache.drill.test.BaseTest)10 Test (org.junit.Test)10 Config (com.typesafe.config.Config)4 ConfigBuilder (org.apache.drill.test.ConfigBuilder)4