YARN-32. Fix TestApplicationTokens to not depend on test order and thus pass on JDK7. Contributed by Vinod Kumar Vavilapali.

svn merge --ignore-ancestry -c 1399795 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1399796 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-10-18 19:12:53 +00:00
parent cd89989aac
commit 9b7e8c4274
2 changed files with 19 additions and 8 deletions

View File

@ -133,6 +133,9 @@ Release 0.23.5 - UNRELEASED
YARN-43. Fix TestResourceTrackerService to not depend on test order and thus YARN-43. Fix TestResourceTrackerService to not depend on test order and thus
pass on JDK7. (Thomas Graves via vinodkv) pass on JDK7. (Thomas Graves via vinodkv)
YARN-32. Fix TestApplicationTokens to not depend on test order and thus pass
on JDK7. (vinodkv)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -64,6 +64,10 @@ public class TestApplicationTokens {
final MockRM rm = new MockRMWithAMS(new Configuration(), containerManager); final MockRM rm = new MockRMWithAMS(new Configuration(), containerManager);
rm.start(); rm.start();
final Configuration conf = rm.getConfig();
final YarnRPC rpc = YarnRPC.create(conf);
AMRMProtocol rmClient = null;
try { try {
MockNM nm1 = rm.registerNode("localhost:1234", 5120); MockNM nm1 = rm.registerNode("localhost:1234", 5120);
@ -82,9 +86,6 @@ public class TestApplicationTokens {
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId(); ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
// Create a client to the RM. // Create a client to the RM.
final Configuration conf = rm.getConfig();
final YarnRPC rpc = YarnRPC.create(conf);
UserGroupInformation currentUser = UserGroupInformation currentUser =
UserGroupInformation UserGroupInformation
.createRemoteUser(applicationAttemptId.toString()); .createRemoteUser(applicationAttemptId.toString());
@ -96,7 +97,7 @@ public class TestApplicationTokens {
token.decodeFromUrlString(tokenURLEncodedStr); token.decodeFromUrlString(tokenURLEncodedStr);
currentUser.addToken(token); currentUser.addToken(token);
AMRMProtocol rmClient = createRMClient(rm, conf, rpc, currentUser); rmClient = createRMClient(rm, conf, rpc, currentUser);
RegisterApplicationMasterRequest request = RegisterApplicationMasterRequest request =
Records.newRecord(RegisterApplicationMasterRequest.class); Records.newRecord(RegisterApplicationMasterRequest.class);
@ -136,6 +137,9 @@ public class TestApplicationTokens {
} finally { } finally {
rm.stop(); rm.stop();
if (rmClient != null) {
rpc.stopProxy(rmClient, conf); // To avoid using cached client
}
} }
} }
@ -153,6 +157,10 @@ public class TestApplicationTokens {
final MockRM rm = new MockRMWithAMS(config, containerManager); final MockRM rm = new MockRMWithAMS(config, containerManager);
rm.start(); rm.start();
final Configuration conf = rm.getConfig();
final YarnRPC rpc = YarnRPC.create(conf);
AMRMProtocol rmClient = null;
try { try {
MockNM nm1 = rm.registerNode("localhost:1234", 5120); MockNM nm1 = rm.registerNode("localhost:1234", 5120);
@ -171,9 +179,6 @@ public class TestApplicationTokens {
ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId(); ApplicationAttemptId applicationAttemptId = attempt.getAppAttemptId();
// Create a client to the RM. // Create a client to the RM.
final Configuration conf = rm.getConfig();
final YarnRPC rpc = YarnRPC.create(conf);
UserGroupInformation currentUser = UserGroupInformation currentUser =
UserGroupInformation UserGroupInformation
.createRemoteUser(applicationAttemptId.toString()); .createRemoteUser(applicationAttemptId.toString());
@ -185,7 +190,7 @@ public class TestApplicationTokens {
token.decodeFromUrlString(tokenURLEncodedStr); token.decodeFromUrlString(tokenURLEncodedStr);
currentUser.addToken(token); currentUser.addToken(token);
AMRMProtocol rmClient = createRMClient(rm, conf, rpc, currentUser); rmClient = createRMClient(rm, conf, rpc, currentUser);
RegisterApplicationMasterRequest request = RegisterApplicationMasterRequest request =
Records.newRecord(RegisterApplicationMasterRequest.class); Records.newRecord(RegisterApplicationMasterRequest.class);
@ -217,6 +222,9 @@ public class TestApplicationTokens {
.getReboot()); .getReboot());
} finally { } finally {
rm.stop(); rm.stop();
if (rmClient != null) {
rpc.stopProxy(rmClient, conf); // To avoid using cached client
}
} }
} }