public async Task TestGetQuery() { //ARRANGE PrestoClientSessionConfig Config = new PrestoClientSessionConfig("hive", Table) { Host = "localhost", Port = 8080 }; IPrestoClient Client = new PrestodbClient(Config); // ACT ListQueriesV1Response Res = await Client.GetQueries(); List <GetQueryV1Response> Info = new List <GetQueryV1Response>(); foreach (BasicQueryInfo Item in Res.QueryInfo) { GetQueryV1Response QRes = await Client.GetQuery(Item.QueryId); Info.Add(QRes); } // ASSERT Assert.True(Res != null && Info.All(x => x.DeserializationSucceeded == true)); }
public async Task TestListQueries() { //ARRANGE PrestoClientSessionConfig Config = new PrestoClientSessionConfig("hive", Table) { Host = "localhost", Port = 8080 }; IPrestoClient Client = new PrestodbClient(Config); // ACT ListQueriesV1Response Res = await Client.GetQueries(); // ASSERT Assert.True(Res != null && Res.DeserializationSucceeded); }
/// <summary> /// This service returns information and statistics about queries that /// are currently being executed on a Presto coordinator. /// </summary> /// <returns></returns> public async Task <ListQueriesV1Response> GetQueries() { HttpClient LocalClient = (this.Configuration.IgnoreSslErrors) ? this.IgnoreSslErrorClient : this.NormalClient; Uri Path = this.BuildUri($"/query"); HttpRequestMessage Request = this.BuildRequest(Path, HttpMethod.Get); HttpResponseMessage Response = await LocalClient.SendAsync(Request); // Expect a 200 response if (Response.StatusCode != HttpStatusCode.OK) { throw new PrestoWebException(await Response.Content.ReadAsStringAsync(), Response.StatusCode); } else { ListQueriesV1Response Results = new ListQueriesV1Response(await Response.Content.ReadAsStringAsync()); return(Results); } }