Search in sources :

Example 36 with Request

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

the class TestQueues method killQuery.

private void killQuery(String path) {
    requireNonNull(path, "path is null");
    Request request = preparePut().setUri(queryRunner.getCoordinator().resolve(path)).build();
    Status status = fromStatusCode(client.execute(request, createStringResponseHandler()).getStatusCode());
    assertEquals(Status.OK, status);
}
Also used : Status(javax.ws.rs.core.Response.Status) Request(com.facebook.airlift.http.client.Request)

Example 37 with Request

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

the class TestQueryResource method getQueryResults.

private QueryResults getQueryResults(QueryResults queryResults) {
    Request request = prepareGet().setHeader(PRESTO_USER, "user").setUri(queryResults.getNextUri()).build();
    queryResults = client.execute(request, createJsonResponseHandler(jsonCodec(QueryResults.class)));
    return queryResults;
}
Also used : Request(com.facebook.airlift.http.client.Request) QueryResults(com.facebook.presto.client.QueryResults)

Example 38 with Request

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

the class TestServerInfoResource method testGetServerStateWithoutRequiredCoordinators.

@Test(timeOut = 30_000, groups = { "getServerStateWithoutRequiredCoordinators" })
public void testGetServerStateWithoutRequiredCoordinators() {
    TestingPrestoServer server = queryRunner.getCoordinator(0);
    URI uri = uriBuilderFrom(server.getBaseUrl().resolve("/v1/info/state")).build();
    Request request = prepareGet().setHeader(PRESTO_USER, "user").setUri(uri).build();
    NodeState state = client.execute(request, createJsonResponseHandler(jsonCodec(NodeState.class)));
    assertEquals(state, NodeState.INACTIVE);
}
Also used : NodeState(com.facebook.presto.spi.NodeState) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) Request(com.facebook.airlift.http.client.Request) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 39 with Request

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

the class TestServerInfoResource method testGetServerStateWithoutRequiredResourceManagers.

@Test(timeOut = 30_000, groups = { "getServerStateWithoutRequiredResourceManagers" })
public void testGetServerStateWithoutRequiredResourceManagers() {
    TestingPrestoServer server = queryRunner.getCoordinator(0);
    URI uri = uriBuilderFrom(server.getBaseUrl().resolve("/v1/info/state")).build();
    Request request = prepareGet().setHeader(PRESTO_USER, "user").setUri(uri).build();
    NodeState state = client.execute(request, createJsonResponseHandler(jsonCodec(NodeState.class)));
    assertEquals(state, NodeState.INACTIVE);
}
Also used : NodeState(com.facebook.presto.spi.NodeState) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) Request(com.facebook.airlift.http.client.Request) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 40 with Request

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

the class TestServerInfoResource method testGetServerStateWithRequiredResourceManagerCoordinators.

@Test(timeOut = 30_000, groups = { "createQueryRunner" })
public void testGetServerStateWithRequiredResourceManagerCoordinators() {
    TestingPrestoServer server = queryRunner.getCoordinator(0);
    URI uri = uriBuilderFrom(server.getBaseUrl().resolve("/v1/info/state")).build();
    Request request = prepareGet().setHeader(PRESTO_USER, "user").setUri(uri).build();
    NodeState state = client.execute(request, createJsonResponseHandler(jsonCodec(NodeState.class)));
    assertEquals(state, NodeState.ACTIVE);
}
Also used : NodeState(com.facebook.presto.spi.NodeState) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) Request(com.facebook.airlift.http.client.Request) URI(java.net.URI) Test(org.testng.annotations.Test)

Aggregations

Request (com.facebook.airlift.http.client.Request)40 URI (java.net.URI)16 Test (org.testng.annotations.Test)14 QueryResults (com.facebook.presto.client.QueryResults)7 ResponseHandler (com.facebook.airlift.http.client.ResponseHandler)5 TaskStatus (com.facebook.presto.execution.TaskStatus)5 AdaptingJsonResponseHandler.createAdaptingJsonResponseHandler (com.facebook.presto.server.smile.AdaptingJsonResponseHandler.createAdaptingJsonResponseHandler)5 FullSmileResponseHandler.createFullSmileResponseHandler (com.facebook.presto.server.smile.FullSmileResponseHandler.createFullSmileResponseHandler)5 List (java.util.List)5 HttpUriBuilder (com.facebook.airlift.http.client.HttpUriBuilder)4 Response (com.facebook.airlift.http.client.Response)4 JsonCodec (com.facebook.airlift.json.JsonCodec)4 SimpleHttpResponseHandler (com.facebook.presto.server.SimpleHttpResponseHandler)4 TaskUpdateRequest (com.facebook.presto.server.TaskUpdateRequest)4 NodeState (com.facebook.presto.spi.NodeState)4 Duration (io.airlift.units.Duration)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 SmileCodec (com.facebook.airlift.json.smile.SmileCodec)3 BaseResponse (com.facebook.presto.server.smile.BaseResponse)3 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)3