You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by co...@apache.org on 2010/07/14 20:44:12 UTC

svn commit: r964130 - in /hadoop/common/trunk: CHANGES.txt src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java

Author: cos
Date: Wed Jul 14 18:44:12 2010
New Revision: 964130

URL: http://svn.apache.org/viewvc?rev=964130&view=rev
Log:
HADOOP-6839. [Herriot] Implement a functionality for getting the user list for creating proxy users. Contributed by Vinay Thota.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=964130&r1=964129&r2=964130&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Wed Jul 14 18:44:12 2010
@@ -1032,6 +1032,9 @@ Release 0.21.0 - Unreleased
 
   BUG FIXES
 
+    HADOOP-6839. [Herriot] Implement a functionality for getting the user list
+    for creating proxy users. (Vinay Thota via cos)
+
     HADOOP-6819. [Herriot] Shell command for getting the new exceptions in
     the logs returning exitcode 1 after executing successfully. (Vinay Thota
     via cos)

Modified: hadoop/common/trunk/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java?rev=964130&r1=964129&r2=964130&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java (original)
+++ hadoop/common/trunk/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java Wed Jul 14 18:44:12 2010
@@ -21,6 +21,8 @@ package org.apache.hadoop.test.system;
 import java.io.IOException;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.FileInputStream;
+import java.io.DataInputStream;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -48,6 +50,8 @@ public abstract class AbstractDaemonClus
   private String newConfDir = null;  
   private static final  String CONF_HADOOP_LOCAL_DIR =
       "test.system.hdrc.hadoop.local.confdir"; 
+  private static final  String CONF_HADOOP_MULTI_USER_LIST =
+      "test.system.hdrc.multi-user.list.path";
   private final static Object waitLock = new Object();
   
   /**
@@ -296,6 +300,30 @@ public abstract class AbstractDaemonClus
       }
     }
   }
+
+  /**
+   * Get the multi users list.
+   * @return ArrayList - users list as a array list.
+   * @throws IOException - if an I/O error occurs.
+   */
+  public ArrayList<String> getHadoopMultiUsersList() throws
+     IOException {
+    String hadoopUserListPath = conf.get(CONF_HADOOP_MULTI_USER_LIST);
+    if (hadoopUserListPath == null || hadoopUserListPath.isEmpty()) {
+      LOG.error("Proxy user list path has not been passed for "
+          + CONF_HADOOP_MULTI_USER_LIST);
+      throw new IllegalArgumentException(
+          "Proxy user list hasn't been provided.");
+    }
+    File fileObj = new File(hadoopUserListPath);
+    DataInputStream disObj = new DataInputStream(new FileInputStream(fileObj));
+    ArrayList<String> usersList = new ArrayList<String>();
+    String strLine = null;
+    while((strLine = disObj.readLine()) != null){
+      usersList.add(strLine.substring(0,strLine.indexOf(',')));
+    }
+    return usersList;
+  }
   
   /**
    * It's a local folder where the config file stores temporarily