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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations