use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.
the class TestHttpProxy method doTestConfigForUrl.
private void doTestConfigForUrl(Config config) {
HttpProxyConfig proxy = HttpProxyConfig.builder().fromConfigForURL(config, "http://google.com").build();
assertEquals(ProxyType.HTTP, proxy.type);
assertEquals("foo.com", proxy.host);
assertEquals(1234, proxy.port);
assertEquals("bob", proxy.username);
assertEquals("secret", proxy.password);
proxy = HttpProxyConfig.builder().fromConfigForURL(config, "https://google.com").build();
assertEquals(ProxyType.HTTP, proxy.type);
assertEquals("bar.com", proxy.host);
assertEquals(2345, proxy.port);
assertEquals("alice", proxy.username);
assertEquals("s3cr3t", proxy.password);
}
use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.
the class TestHttpProxy method testBasics.
@Test
public void testBasics() {
HttpProxyConfig proxy = HttpProxyConfig.builder().type("socks").host(" foo.com ").port(1234).username(" bob ").password(" secret ").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 testBlankType.
@Test
public void testBlankType() {
HttpProxyConfig proxy = HttpProxyConfig.builder().type(" ").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 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);
}
use of org.apache.drill.exec.store.http.util.HttpProxyConfig in project drill by apache.
the class TestHttpProxy method testNone.
@Test
public void testNone() {
HttpProxyConfig proxy = HttpProxyConfig.builder().type("").host("foo.com").port(1234).username("bob").password("secret").build();
assertEquals(ProxyType.NONE, proxy.type);
assertNull(proxy.host);
assertNull(proxy.username);
assertNull(proxy.password);
}
Aggregations