HDFS-6972. TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration doesn't decode url correctly. Contributed by Yongjun Zhang.

This commit is contained in:
Andrew Wang 2014-08-29 15:47:01 -07:00
parent 93010faf10
commit 6066b1a455
2 changed files with 11 additions and 4 deletions

View File

@ -577,6 +577,9 @@ Release 2.6.0 - UNRELEASED
HDFS-6800. Support Datanode layout changes with rolling upgrade. HDFS-6800. Support Datanode layout changes with rolling upgrade.
(James Thomas via Arpit Agarwal) (James Thomas via Arpit Agarwal)
HDFS-6972. TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration
doesn't decode url correctly. (Yongjun Zhang via wang)
BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
HDFS-6387. HDFS CLI admin tool for creating & deleting an HDFS-6387. HDFS CLI admin tool for creating & deleting an

View File

@ -30,7 +30,9 @@
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -225,15 +227,17 @@ public void testRefreshSuperUserGroupsConfiguration() throws Exception {
} }
private void addNewConfigResource(String rsrcName, String keyGroup, private void addNewConfigResource(String rsrcName, String keyGroup,
String groups, String keyHosts, String hosts) throws FileNotFoundException { String groups, String keyHosts, String hosts)
throws FileNotFoundException, UnsupportedEncodingException {
// location for temp resource should be in CLASSPATH // location for temp resource should be in CLASSPATH
Configuration conf = new Configuration(); Configuration conf = new Configuration();
URL url = conf.getResource("hdfs-site.xml"); URL url = conf.getResource("hdfs-site.xml");
Path p = new Path(url.getPath());
String urlPath = URLDecoder.decode(url.getPath().toString(), "UTF-8");
Path p = new Path(urlPath);
Path dir = p.getParent(); Path dir = p.getParent();
tempResource = dir.toString() + "/" + rsrcName; tempResource = dir.toString() + "/" + rsrcName;
String newResource = String newResource =
"<configuration>"+ "<configuration>"+
"<property><name>" + keyGroup + "</name><value>"+groups+"</value></property>" + "<property><name>" + keyGroup + "</name><value>"+groups+"</value></property>" +