5151@ TestInstance (PER_CLASS )
5252final class TestProxyRequestHandler
5353{
54+ private static final String OK = "OK" ;
55+ private static final int NOT_FOUND = 404 ;
56+ private static final MediaType MEDIA_TYPE = MediaType .parse ("application/json; charset=utf-8" );
57+
5458 private final OkHttpClient httpClient = new OkHttpClient ();
5559 private final MockWebServer mockTrinoServer = new MockWebServer ();
5660 private final PostgreSQLContainer postgresql = createPostgreSqlContainer ();
5761
5862 private final int routerPort = 21001 + (int ) (Math .random () * 1000 );
5963 private final int customBackendPort = 21000 + (int ) (Math .random () * 1000 );
6064
61- private static final String OK = "OK" ;
62- private static final int NOT_FOUND = 404 ;
63- private static final MediaType MEDIA_TYPE = MediaType .parse ("application/json; charset=utf-8" );
64-
6565 private final String customPutEndpoint = "/v1/custom" ; // this is enabled in test-config-template.yml
6666 private final String healthCheckEndpoint = "/v1/info" ;
6767
@@ -70,7 +70,8 @@ void setup()
7070 throws Exception
7171 {
7272 prepareMockBackend (mockTrinoServer , customBackendPort , "default custom response" );
73- mockTrinoServer .setDispatcher (new Dispatcher () {
73+ mockTrinoServer .setDispatcher (new Dispatcher ()
74+ {
7475 @ Override
7576 public MockResponse dispatch (RecordedRequest request )
7677 {
@@ -131,18 +132,18 @@ void testGetQueryDetailsFromRequest()
131132 {
132133 // A sample query longer than 200 characters to test against truncation.
133134 String longQuery = """
134- SELECT
135- c.customer_name,
136- c.customer_region,
137- COUNT(o.order_id) AS total_orders,
138- SUM(o.order_value) AS total_revenue
139- FROM
140- hive.sales_data.customers AS c
141- JOIN
142- hive.sales_data.orders AS o
143- ON c.customer_id = o.customer_id
144- WHERE
145- o.order_date >= date '2023-01-01'""" ;
135+ SELECT
136+ c.customer_name,
137+ c.customer_region,
138+ COUNT(o.order_id) AS total_orders,
139+ SUM(o.order_value) AS total_revenue
140+ FROM
141+ hive.sales_data.customers AS c
142+ JOIN
143+ hive.sales_data.orders AS o
144+ ON c.customer_id = o.customer_id
145+ WHERE
146+ o.order_date >= date '2023-01-01'""" ;
146147
147148 io .airlift .http .client .Request request = preparePost ()
148149 .setUri (URI .create ("http://localhost:" + routerPort + V1_STATEMENT_PATH ))
0 commit comments