From e102c3d74ec39ec3ba92c029e930f034356d9c48 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Mon, 18 Mar 2019 13:44:27 -0700 Subject: [PATCH] YARN-9397. Fix empty NMResourceInfo object test failures in branch-2 --- .../server/nodemanager/webapp/TestNMWebServices.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java index 2f1577f10b7..980eae95841 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java @@ -457,23 +457,23 @@ public class TestNMWebServices extends JerseyTestBase { assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); // Access resource-2 should fail (empty NMResourceInfo returned). - JSONObject json = response.getEntity(JSONObject.class); - assertEquals(0, json.length()); + String resp = response.getEntity(String.class); + assertEquals("null", resp); // Access resource-3 should fail (unknown plugin) response = r.path("ws").path("v1").path("node").path( "resources").path("resource-3").accept(MediaType.APPLICATION_JSON).get( ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); - json = response.getEntity(JSONObject.class); - assertEquals(0, json.length()); + resp = response.getEntity(String.class); + assertEquals("null", resp); // Access resource-1 should success response = r.path("ws").path("v1").path("node").path( "resources").path("resource-1").accept(MediaType.APPLICATION_JSON).get( ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); - json = response.getEntity(JSONObject.class); + JSONObject json = response.getEntity(JSONObject.class); assertEquals(1000, Long.parseLong(json.get("a").toString())); // Access resource-1 should success (encoded yarn.io/Fresource-1).