YARN-30. Fixed tests verifying web-services to work on JDK7. Contributed by Thomas Graves.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1396391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-10-09 22:54:11 +00:00
parent bca57d471f
commit a5ebccd7bc
5 changed files with 22 additions and 12 deletions

View File

@ -71,6 +71,9 @@ Release 2.0.3-alpha - Unreleased
YARN-134. ClientToAMSecretManager creates keys without checking for
validity of the appID. (Vinod Kumar Vavilapalli via sseth)
YARN-30. Fixed tests verifying web-services to work on JDK7. (Thomas Graves
via vinodkv)
Release 2.0.2-alpha - 2012-09-07
INCOMPATIBLE CHANGES

View File

@ -79,4 +79,11 @@ public static void checkStringMatch(String print, String expected, String got) {
got.matches(expected));
}
public static void checkStringContains(String print, String expected, String got) {
assertTrue(
print + " doesn't contain expected string, got: " + got + " expected: " + expected,
got.contains(expected));
}
}

View File

@ -382,7 +382,7 @@ public void testNodeAppsStateInvalid() throws JSONException, Exception {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
verifyStatInvalidException(message, type, classname);
verifyStateInvalidException(message, type, classname);
}
}
@ -412,7 +412,7 @@ public void testNodeAppsStateInvalidDefault() throws JSONException, Exception {
String message = exception.getString("message");
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
verifyStatInvalidException(message, type, classname);
verifyStateInvalidException(message, type, classname);
}
}
@ -450,16 +450,16 @@ public void testNodeAppsStateInvalidXML() throws JSONException, Exception {
String type = WebServicesTestUtils.getXmlString(element, "exception");
String classname = WebServicesTestUtils.getXmlString(element,
"javaClassName");
verifyStatInvalidException(message, type, classname);
verifyStateInvalidException(message, type, classname);
}
}
private void verifyStatInvalidException(String message, String type,
private void verifyStateInvalidException(String message, String type,
String classname) {
WebServicesTestUtils
.checkStringMatch(
.checkStringContains(
"exception message",
"No enum const class org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState.FOO_STATE",
"org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState.FOO_STATE",
message);
WebServicesTestUtils.checkStringMatch("exception type",
"IllegalArgumentException", type);

View File

@ -280,9 +280,9 @@ public void testAppsQueryStateInvalid() throws JSONException, Exception {
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils
.checkStringMatch(
.checkStringContains(
"exception message",
"No enum const class org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState.INVALID_test",
"org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState.INVALID_test",
message);
WebServicesTestUtils.checkStringMatch("exception type",
"IllegalArgumentException", type);
@ -359,9 +359,9 @@ public void testAppsQueryFinalStatusInvalid() throws JSONException, Exception {
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils
.checkStringMatch(
.checkStringContains(
"exception message",
"No enum const class org.apache.hadoop.yarn.api.records.FinalApplicationStatus.INVALID_test",
"org.apache.hadoop.yarn.api.records.FinalApplicationStatus.INVALID_test",
message);
WebServicesTestUtils.checkStringMatch("exception type",
"IllegalArgumentException", type);

View File

@ -229,9 +229,9 @@ public void testNodesQueryStateInvalid() throws JSONException, Exception {
String type = exception.getString("exception");
String classname = exception.getString("javaClassName");
WebServicesTestUtils
.checkStringMatch(
.checkStringContains(
"exception message",
"No enum const class org.apache.hadoop.yarn.api.records.NodeState.BOGUSSTATE",
"org.apache.hadoop.yarn.api.records.NodeState.BOGUSSTATE",
message);
WebServicesTestUtils.checkStringMatch("exception type",
"IllegalArgumentException", type);