Author: suresh
Date: Wed Jan 9 07:45:53 2013
New Revision: 1430720
URL: http://svn.apache.org/viewvc?rev=1430720&view=rev
Log:
HADOOP-9191. Merge change 1430717 from branch-1
Modified:
hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1430720&r1=1430719&r2=1430720&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Wed Jan 9
07:45:53 2013
@@ -334,3 +334,6 @@ Branch-hadoop-1-win (branched from branc
MAPREDUCE-4915. TestShuffleExceptionCount fails with open JDK7.
(Brandon Li via suresh)
+
+ HADOOP-9191. TestAccessControlList and TestJobHistoryConfig fail with
+ JDK7. (Arpit Agarwal via suresh)
Modified:
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java?rev=1430720&r1=1430719&r2=1430720&view=diff
==============================================================================
---
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
(original)
+++
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
Wed Jan 9 07:45:53 2013
@@ -74,6 +74,7 @@ public class TestJobHistoryConfig extend
if (mdfs != null) {
try {
mdfs.shutdown();
+ mdfs = null;
} catch (Exception e) {
}
}
@@ -93,35 +94,42 @@ public class TestJobHistoryConfig extend
}
public void testJobHistoryLogging() throws Exception {
- JobConf conf = new JobConf();
- setUpCluster(conf);
- conf.setMapperClass(MapperClass.class);
- conf.setReducerClass(IdentityReducer.class);
- conf.setNumReduceTasks(0);
- JobClient jc = new JobClient(conf);
- conf.set("hadoop.job.history.location", "/hadoop/history");
- conf = MiniMRCluster.configureJobConf(conf, namenode, 0, 0, null);
- FileSystem inFs = inDir.getFileSystem(conf);
- if (!inFs.mkdirs(inDir)) {
- throw new IOException("Mkdirs failed to create " + inDir.toString());
- }
- FileInputFormat.setInputPaths(conf, inDir);
- FileOutputFormat.setOutputPath(conf, outDir);
- conf.setSpeculativeExecution(false);
- conf.setJobName("test");
- conf.setUser("testuser");
- conf.setQueueName("default");
- String TEST_ROOT_DIR = new Path(System.getProperty("test.build.data",
- "/tmp")).toString().replace(' ', '+');
- JobTracker jt = JobTracker.startTracker(conf);
- assertTrue(jt != null);
- JobInProgress jip = new JobInProgress(new JobID("jt", 1),
- new JobConf(conf), jt);
- assertTrue(jip != null);
- jip.jobFile = "testfile";
- String historyFile = JobHistory.getHistoryFilePath(jip.getJobID());
- JobHistory.JobInfo.logSubmitted(jip.getJobID(), jip.getJobConf(),
- jip.jobFile, jip.startTime);
+ try {
+ JobConf conf = new JobConf();
+ setUpCluster(conf);
+ conf.setMapperClass(MapperClass.class);
+ conf.setReducerClass(IdentityReducer.class);
+ conf.setNumReduceTasks(0);
+ JobClient jc = new JobClient(conf);
+ conf.set("hadoop.job.history.location", "/hadoop/history");
+ conf = MiniMRCluster.configureJobConf(conf, namenode, 0, 0, null);
+ FileSystem inFs = inDir.getFileSystem(conf);
+ if (!inFs.mkdirs(inDir)) {
+ throw new IOException("Mkdirs failed to create " + inDir.toString());
+ }
+ FileInputFormat.setInputPaths(conf, inDir);
+ FileOutputFormat.setOutputPath(conf, outDir);
+ conf.setSpeculativeExecution(false);
+ conf.setJobName("test");
+ conf.setUser("testuser");
+ conf.setQueueName("default");
+ String TEST_ROOT_DIR = new Path(System.getProperty("test.build.data",
+ "/tmp")).toString().replace(' ', '+');
+ JobTracker jt = JobTracker.startTracker(conf);
+ assertTrue(jt != null);
+ JobInProgress jip = new JobInProgress(new JobID("jt", 1),
+ new JobConf(conf), jt);
+ assertTrue(jip != null);
+ jip.jobFile = "testfile";
+ String historyFile = JobHistory.getHistoryFilePath(jip.getJobID());
+ JobHistory.JobInfo.logSubmitted(jip.getJobID(), jip.getJobConf(),
+ jip.jobFile, jip.startTime);
+ } finally {
+ if (mdfs != null) {
+ mdfs.shutdown();
+ mdfs = null;
+ }
+ }
}
/**
Modified:
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java?rev=1430720&r1=1430719&r2=1430720&view=diff
==============================================================================
---
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
(original)
+++
hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
Wed Jan 9 07:45:53 2013
@@ -32,10 +32,9 @@ import junit.framework.TestCase;
public class TestAccessControlList extends TestCase {
- /**
- * test the netgroups (groups in ACL rules that start with @),
- */
- public void testNetgroups() throws Exception {
+ private static Groups testGroups = null;
+
+ public void setUp() {
// set the config for Groups (test mapping class)
// we rely on hardcoded groups and netgroups in
// ShellBasedUnixGroupsMappingTestWrapper
@@ -43,8 +42,18 @@ public class TestAccessControlList exten
conf.set("hadoop.security.group.mapping",
"org.apache.hadoop.security.ShellBasedUnixGroupsNetgroupMappingTestWrapper");
- Groups groups = Groups.getUserToGroupsMappingService(conf);
+ // Ensure that Groups.GROUPS is initialized first.
+ testGroups = Groups.getUserToGroupsMappingService(conf);
+ }
+
+ public void tearDown() {
+ testGroups = null;
+ }
+ /**
+ * test the netgroups (groups in ACL rules that start with @),
+ */
+ public void testNetgroups() throws Exception {
AccessControlList acl;
// create these ACLs to populate groups cache
@@ -53,12 +62,12 @@ public class TestAccessControlList exten
acl = new AccessControlList(" somegroups,@somenetgroup"); // no user
// check that the netgroups are working
- List<String> elvisGroups = groups.getGroups("elvis");
+ List<String> elvisGroups = testGroups.getGroups("elvis");
assertTrue(elvisGroups.contains("@lasVegas"));
// refresh cache - not testing this directly but if the results are ok
// after the refresh that means it worked fine (very likely)
- groups.refresh();
+ testGroups.refresh();
// create an ACL with netgroups (@xxx)
acl = new AccessControlList("ja ratpack,@lasVegas");