hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1430717 - in /hadoop/common/branches/branch-1: CHANGES.txt src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
Date Wed, 09 Jan 2013 07:40:48 GMT
Author: suresh
Date: Wed Jan  9 07:40:47 2013
New Revision: 1430717

URL: http://svn.apache.org/viewvc?rev=1430717&view=rev
Log:
HADOOP-9191. TestAccessControlList and TestJobHistoryConfig fail with JDK7. Contributed by
Arpit Agarwal.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1430717&r1=1430716&r2=1430717&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Jan  9 07:40:47 2013
@@ -410,6 +410,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-4278. Cannot run two local jobs in parallel from the same
     gateway. (Sandy Ryza via tomwhite)
 
+    HADOOP-9191. TestAccessControlList and TestJobHistoryConfig fail with
+    JDK7. (Arpit Agarwal via suresh)
+
 Release 1.1.2 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java?rev=1430717&r1=1430716&r2=1430717&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
Wed Jan  9 07:40:47 2013
@@ -76,6 +76,7 @@ public class TestJobHistoryConfig extend
       if (mdfs != null) {
         try {
           mdfs.shutdown();
+          mdfs = null;
         } catch (Exception e) {
         }
       }
@@ -95,36 +96,43 @@ 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(' ', '+');
-    String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
-    JobTracker jt = JobTracker.startTracker(conf, uniqid, true);
-    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(' ', '+');
+      String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
+      JobTracker jt = JobTracker.startTracker(conf, uniqid, true);
+      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/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java?rev=1430717&r1=1430716&r2=1430717&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/security/authorize/TestAccessControlList.java
Wed Jan  9 07:40:47 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");



Mime
View raw message