YARN-9397. Fix empty NMResourceInfo object test failures in branch-2

This commit is contained in:
Jonathan Hung 2019-03-18 13:44:27 -07:00
parent 86709564cb
commit e102c3d74e
1 changed files with 5 additions and 5 deletions

View File

@ -457,23 +457,23 @@ public class TestNMWebServices extends JerseyTestBase {
assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); assertEquals(MediaType.APPLICATION_JSON, response.getType().toString());
// Access resource-2 should fail (empty NMResourceInfo returned). // Access resource-2 should fail (empty NMResourceInfo returned).
JSONObject json = response.getEntity(JSONObject.class); String resp = response.getEntity(String.class);
assertEquals(0, json.length()); assertEquals("null", resp);
// Access resource-3 should fail (unknown plugin) // Access resource-3 should fail (unknown plugin)
response = r.path("ws").path("v1").path("node").path( response = r.path("ws").path("v1").path("node").path(
"resources").path("resource-3").accept(MediaType.APPLICATION_JSON).get( "resources").path("resource-3").accept(MediaType.APPLICATION_JSON).get(
ClientResponse.class); ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); assertEquals(MediaType.APPLICATION_JSON, response.getType().toString());
json = response.getEntity(JSONObject.class); resp = response.getEntity(String.class);
assertEquals(0, json.length()); assertEquals("null", resp);
// Access resource-1 should success // Access resource-1 should success
response = r.path("ws").path("v1").path("node").path( response = r.path("ws").path("v1").path("node").path(
"resources").path("resource-1").accept(MediaType.APPLICATION_JSON).get( "resources").path("resource-1").accept(MediaType.APPLICATION_JSON).get(
ClientResponse.class); ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON, response.getType().toString()); 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())); assertEquals(1000, Long.parseLong(json.get("a").toString()));
// Access resource-1 should success (encoded yarn.io/Fresource-1). // Access resource-1 should success (encoded yarn.io/Fresource-1).