Пример #1
0
        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));
        }
Пример #2
0
        /// <summary>
        /// If you are looking to gather very detailed statistics about a
        /// query, this is the service you would call.
        /// </summary>
        /// <param name="queryId">The id of the query to retrieve details about.</param>
        /// <returns>Information about the specified query.</returns>
        public async Task <GetQueryV1Response> GetQuery(string queryId)
        {
            HttpClient LocalClient = (this.Configuration.IgnoreSslErrors) ? this.IgnoreSslErrorClient : this.NormalClient;

            Uri Path = this.BuildUri($"/query/{queryId}");

            HttpRequestMessage Request = this.BuildRequest(Path, HttpMethod.Get);

            HttpResponseMessage Response = await LocalClient.GetAsync(Path);

            // Expect a 200 response
            if (Response.StatusCode != HttpStatusCode.OK)
            {
                throw new PrestoWebException(await Response.Content.ReadAsStringAsync(), Response.StatusCode);
            }
            else
            {
                GetQueryV1Response Result = new GetQueryV1Response(await Response.Content.ReadAsStringAsync());
                return(Result);
            }
        }