Search in sources :

Example 1 with HttpProxyConfig

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);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig)

Example 2 with HttpProxyConfig

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);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 3 with HttpProxyConfig

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);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 4 with HttpProxyConfig

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);
}
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 5 with HttpProxyConfig

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);
}
Also used : HttpProxyConfig(org.apache.drill.exec.store.http.util.HttpProxyConfig) 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