Search in sources :

Example 6 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestGenerateTokenFilter method setup.

@BeforeClass
public void setup() throws Exception {
    server = new TestingPrestoServer(ImmutableList.of(new TestGenerateTokenFilterModule()));
    httpClient = (JettyHttpClient) server.getInstance(Key.get(HttpClient.class, GenerateTokenFilterTest.class));
    // extract the filter
    List<HttpRequestFilter> filters = httpClient.getRequestFilters();
    assertEquals(filters.size(), 2);
    assertInstanceOf(filters.get(1), GenerateTraceTokenRequestFilter.class);
    filter = (GenerateTraceTokenRequestFilter) filters.get(1);
}
Also used : HttpRequestFilter(com.facebook.airlift.http.client.HttpRequestFilter) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) HttpClient(com.facebook.airlift.http.client.HttpClient) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestNodeResource method setup.

@BeforeMethod
public void setup() throws Exception {
    server = new TestingPrestoServer();
    client = new JettyHttpClient();
}
Also used : JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 8 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestServer method setup.

@BeforeMethod
public void setup() throws Exception {
    server = new TestingPrestoServer();
    client = new JettyHttpClient();
}
Also used : JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 9 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestQueues method setup.

@BeforeMethod
public void setup() throws Exception {
    queryRunner = createQueryRunner();
    client = new JettyHttpClient();
    objectMapper = new JsonObjectMapperProvider().get();
    objectMapper.registerModule(new SimpleModule() {

        {
            addKeyDeserializer(VariableReferenceExpression.class, new Serialization.VariableReferenceExpressionDeserializer(createTestFunctionAndTypeManager()));
        }
    });
}
Also used : JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) JsonObjectMapperProvider(com.facebook.airlift.json.JsonObjectMapperProvider) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 10 with JettyHttpClient

use of com.facebook.airlift.http.client.jetty.JettyHttpClient in project presto by prestodb.

the class TestDistributedQueryResource method setup.

@BeforeMethod
public void setup() throws Exception {
    client = new JettyHttpClient();
    DistributedQueryRunner runner = createQueryRunner(ImmutableMap.of("query.client.timeout", "20s"), 2);
    coordinator1 = runner.getCoordinator(0);
    coordinator2 = runner.getCoordinator(1);
    Optional<TestingPrestoServer> resourceManager = runner.getResourceManager();
    checkState(resourceManager.isPresent(), "resource manager not present");
    this.resourceManager = resourceManager.get();
    coordinator1.getResourceGroupManager().get().addConfigurationManagerFactory(new FileResourceGroupConfigurationManagerFactory());
    coordinator1.getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
    coordinator2.getResourceGroupManager().get().addConfigurationManagerFactory(new FileResourceGroupConfigurationManagerFactory());
    coordinator2.getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_simple.json")));
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) JettyHttpClient(com.facebook.airlift.http.client.jetty.JettyHttpClient) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) FileResourceGroupConfigurationManagerFactory(com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

JettyHttpClient (com.facebook.airlift.http.client.jetty.JettyHttpClient)12 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)7 BeforeClass (org.testng.annotations.BeforeClass)7 FileResourceGroupConfigurationManagerFactory (com.facebook.presto.resourceGroups.FileResourceGroupConfigurationManagerFactory)6 DistributedQueryRunner (com.facebook.presto.tests.DistributedQueryRunner)6 BeforeMethod (org.testng.annotations.BeforeMethod)4 HttpClient (com.facebook.airlift.http.client.HttpClient)1 HttpClientConfig (com.facebook.airlift.http.client.HttpClientConfig)1 HttpRequestFilter (com.facebook.airlift.http.client.HttpRequestFilter)1 JsonObjectMapperProvider (com.facebook.airlift.json.JsonObjectMapperProvider)1 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 PrivateModule (com.google.inject.PrivateModule)1 Named (javax.inject.Named)1