deniskuzZ commented on code in PR #6002:
URL: https://github.com/apache/hive/pull/6002#discussion_r2275925440


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/properties/HMSServletTest1.java:
##########
@@ -167,4 +185,90 @@ public Map<String, String> getProperties(List<String> 
selection) throws IOExcept
     }
   }
 
+  @Test
+  public void testPropertiesFilter() throws Exception {
+    HttpClient httpClient = createHttpClient(conf);
+    String jwt = generateJWT();
+    NameValuePair[] nvp = new NameValuePair[]{
+            new BasicNameValuePair("key", "db0.table01.fillFactor"),
+            new BasicNameValuePair("key", "db0.table04.fillFactor")
+    };
+    String scheme = getScheme(conf);
+    URI uri = new URIBuilder()
+            .setScheme(scheme)
+            .setUserInfo("hive")
+            .setHost("localhost")
+            .setPort(servletPort)
+            .setPath("/" + path + "/" + NS)
+            .setParameters(nvp)
+            .build();
+    HttpGet get = new HttpGet(uri);
+    get.addHeader("Authorization", "Bearer " + jwt);
+    get.addHeader("Content-Type", "application/json");
+    get.addHeader("Accept", "application/json");
+    get.addHeader(MetaStoreUtils.USER_NAME_HTTP_HEADER, "hive");
+
+    Map<String,String> result = null;
+    HttpResponse response = httpClient.execute(get);
+    try {
+      Assert.assertEquals(HttpServletResponse.SC_OK, 
response.getStatusLine().getStatusCode());
+      HttpEntity entity = response.getEntity();
+      if (entity != null) {
+        Gson gson = new GsonBuilder().create();
+        ContentType contentType = ContentType.getOrDefault(entity);
+        Charset charset = contentType.getCharset();
+        Reader reader = new InputStreamReader(entity.getContent(), charset);
+        result = (Map<String, String>) gson.fromJson(reader, Object.class);
+      }
+      Assert.assertNotNull(result);
+      Assert.assertEquals(2, result.size());
+    } finally {
+      if (response instanceof AutoCloseable) {

Review Comment:
   not sure why Sonar suggests these: 
https://sonarcloud.io/project/issues?impactSeverities=HIGH&sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&pullRequest=6002&id=apache_hive.
 
   As I understand it might not always be Closeable.
   @henrib, could you please double-check and let's merge



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to