abstractdog commented on code in PR #474:
URL: https://github.com/apache/tez/pull/474#discussion_r3258506461
##########
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:
I see, but this is a specific unit test class, it doesn't have to be
backward compatible with anything, just has to pass at a given point in time
with a certain Hadoop version, moreover, we can also consider Hadoop 3.5.0
upgrade a breaking change
--
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]