maheshrajus commented on code in PR #474:
URL: https://github.com/apache/tez/pull/474#discussion_r3258387933


##########
tez-plugins/tez-yarn-timeline-history-with-acls/src/test/java/org/apache/tez/dag/history/ats/acls/TestATSHistoryWithACLs.java:
##########
@@ -148,23 +150,25 @@ public static void tearDown() throws InterruptedException 
{
 
   // To be replaced after Timeline has java APIs for domains
   private <K> K getTimelineData(String url, Class<K> clazz) {
-    Client client = new Client();
-    WebResource resource = client.resource(url);
-
-    ClientResponse response = resource.accept(MediaType.APPLICATION_JSON)
-        .get(ClientResponse.class);
+    Client client = ClientBuilder.newClient();
+    WebTarget target = client.target(url);
+    Response response = target.request(MediaType.APPLICATION_JSON).get();
     assertEquals(200, response.getStatus());
-    
assertTrue(MediaType.APPLICATION_JSON_TYPE.isCompatible(response.getType()));
-
-    JSONObject entity = response.getEntity(JSONObject.class);
-    K converted = null;
+    
assertTrue(MediaType.APPLICATION_JSON_TYPE.isCompatible(response.getMediaType()));
+    String entityStr = response.readEntity(String.class);
     try {
-      converted = convertJSONObjectToTimelineObject(entity, clazz);
+      JSONObject jsonObject = new JSONObject(entityStr);
+      // Handle the nesting introduced by Jersey 2/Jackson
+      JSONObject effectiveJson = jsonObject.has("domain") ? 
jsonObject.getJSONObject("domain") : jsonObject;

Review Comment:
   With Hadoop 3.5.0 + Jersey 2.x, the response is consistently coming in the 
nested "domain" form during my testing. However, It is test code and i kept the 
fallback branch intentionally for backward compatibility because earlier ATS 
response formats and some existing tests/mocks still use the flat JSON 
structure. Thanks !



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to