hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From naganarasimha...@apache.org
Subject hadoop git commit: YARN-5114. Add additional tests in TestRMWebServicesApps and rectify testInvalidAppAttempts failure in 2.8. Contributed by Bibin A Chundatt
Date Tue, 24 May 2016 22:14:29 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 02d4e478a -> edd716e99


YARN-5114. Add additional tests in TestRMWebServicesApps and rectify testInvalidAppAttempts
failure in 2.8. Contributed by Bibin A Chundatt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/edd716e9
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/edd716e9
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/edd716e9

Branch: refs/heads/trunk
Commit: edd716e99cb57e7804eb7d699b9456372f65c6bc
Parents: 02d4e47
Author: Naganarasimha <naganarasimha_gr@apache.org>
Authored: Wed May 25 06:11:38 2016 +0800
Committer: Naganarasimha <naganarasimha_gr@apache.org>
Committed: Wed May 25 06:11:38 2016 +0800

----------------------------------------------------------------------
 .../webapp/TestRMWebServicesApps.java           | 44 ++++++++++++++++++--
 1 file changed, 41 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/edd716e9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesApps.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesApps.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesApps.java
index 9f1d160..d2efd20 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesApps.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesApps.java
@@ -1499,7 +1499,7 @@ public class TestRMWebServicesApps extends JerseyTestBase {
   }
 
   @Test
-  public void testInvalidAppAttempts() throws JSONException, Exception {
+  public void testInvalidAppIdGetAttempts() throws JSONException, Exception {
     rm.start();
     MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
     RMApp app = rm.submitApp(CONTAINER_MB);
@@ -1508,8 +1508,7 @@ public class TestRMWebServicesApps extends JerseyTestBase {
 
     try {
       r.path("ws").path("v1").path("cluster").path("apps")
-          .path(app.getApplicationId().toString()).path("appattempts")
-          .path("appattempt_invalid_12_000001")
+          .path("application_invalid_12").path("appattempts")
           .accept(MediaType.APPLICATION_JSON)
           .get(JSONObject.class);
       fail("should have thrown exception on invalid appAttempt");
@@ -1525,6 +1524,45 @@ public class TestRMWebServicesApps extends JerseyTestBase {
       String type = exception.getString("exception");
       String classname = exception.getString("javaClassName");
       WebServicesTestUtils.checkStringMatch("exception message",
+          "java.lang.IllegalArgumentException: Invalid ApplicationId:"
+              + " application_invalid_12",
+          message);
+      WebServicesTestUtils.checkStringMatch("exception type",
+          "BadRequestException", type);
+      WebServicesTestUtils.checkStringMatch("exception classname",
+          "org.apache.hadoop.yarn.webapp.BadRequestException", classname);
+
+    } finally {
+      rm.stop();
+    }
+  }
+
+  @Test
+  public void testInvalidAppAttemptId() throws JSONException, Exception {
+    rm.start();
+    MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
+    RMApp app = rm.submitApp(CONTAINER_MB);
+    amNodeManager.nodeHeartbeat(true);
+    WebResource r = resource();
+
+    try {
+      r.path("ws").path("v1").path("cluster").path("apps")
+          .path(app.getApplicationId().toString()).path("appattempts")
+          .path("appattempt_invalid_12_000001")
+          .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
+      fail("should have thrown exception on invalid appAttempt");
+    } catch (UniformInterfaceException ue) {
+      ClientResponse response = ue.getResponse();
+
+      assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
+      assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
+      JSONObject msg = response.getEntity(JSONObject.class);
+      JSONObject exception = msg.getJSONObject("RemoteException");
+      assertEquals("incorrect number of elements", 3, exception.length());
+      String message = exception.getString("message");
+      String type = exception.getString("exception");
+      String classname = exception.getString("javaClassName");
+      WebServicesTestUtils.checkStringMatch("exception message",
           "java.lang.IllegalArgumentException: Invalid AppAttemptId:"
               + " appattempt_invalid_12_000001",
           message);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message