hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r641409 - in /hadoop/core/trunk: ./ src/contrib/streaming/src/test/org/apache/hadoop/streaming/ src/examples/org/apache/hadoop/examples/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/tools/ src/java/org/apache/hadoop/util/ src/...
Date Wed, 26 Mar 2008 17:07:37 GMT
Author: cutting
Date: Wed Mar 26 10:07:10 2008
New Revision: 641409

URL: http://svn.apache.org/viewvc?rev=641409&view=rev
Log:
HADOOP-2902.  Replace uses of 'fs.default.name' with calls to accessor methods.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
    hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/SecondaryNameNode.java
    hadoop/core/trunk/src/java/org/apache/hadoop/tools/Logalyzer.java
    hadoop/core/trunk/src/java/org/apache/hadoop/util/GenericOptionsParser.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DataNodeCluster.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/MiniDFSCluster.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestAbandonBlock.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBalancer.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBlockReplacement.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestGetBlocks.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestHDFSServerPorts.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestNNThroughputBenchmark.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java
    hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplicationPolicy.java
    hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
    hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestSocketFactory.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMRServerPorts.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Mar 26 10:07:10 2008
@@ -175,6 +175,9 @@
     via a single rpc to the namenode to speed up job planning. 
     (Lohit Vijaya Renu via omalley)
 
+    HADOOP-2902.  Replace uses of "fs.default.name" with calls to the
+    accessor methods added in HADOOP-1967.  (cutting)
+
   BUG FIXES
 
     HADOOP-2195. '-mkdir' behaviour is now closer to Linux shell in case of

Modified: hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java (original)
+++ hadoop/core/trunk/src/contrib/streaming/src/test/org/apache/hadoop/streaming/TestStreamedMerge.java Wed Mar 26 10:07:10 2008
@@ -221,7 +221,7 @@
         fs_ = cluster.getFileSystem();
       } else {
         System.out.println("overrideFS: " + overrideFS);
-        conf_.set("fs.default.name", overrideFS);
+        FileSystem.setDefaultUri(conf_, overrideFS);
         fs_ = FileSystem.get(conf_);
       }
       doAllTestJobs();

Modified: hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java (original)
+++ hadoop/core/trunk/src/examples/org/apache/hadoop/examples/PiEstimator.java Wed Mar 26 10:07:10 2008
@@ -162,7 +162,7 @@
 
     JobConf jobConf = new JobConf(getConf(), PiEstimator.class);
     if (jt != null) { jobConf.set("mapred.job.tracker", jt); }
-    if (dfs != null) { jobConf.set("fs.default.name", dfs); }
+    if (dfs != null) { FileSystem.setDefaultUri(jobConf, dfs); }
     jobConf.setJobName("test-mini-mr");
     
     // turn off speculative execution, because DFS doesn't handle

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/Balancer.java Wed Mar 26 10:07:10 2008
@@ -838,19 +838,17 @@
    */
   private void init(double threshold) throws IOException {
     this.threshold = threshold;
-    // get name node address 
-    InetSocketAddress nameNodeAddr = DataNode.createSocketAddr(
-        conf.get("fs.default.name", "local"));
-    // connect to name node
-    this.namenode = createNamenode(nameNodeAddr, conf);
-    this.client = DFSClient.createNamenode(nameNodeAddr, conf);
+    this.namenode = createNamenode(conf);
+    this.client = DFSClient.createNamenode(conf);
     this.fs = FileSystem.get(conf);
   }
   
   /* Build a NamenodeProtocol connection to the namenode and
    * set up the retry policy */ 
-  private static NamenodeProtocol createNamenode(
-      InetSocketAddress nameNodeAddr, Configuration conf) throws IOException {
+  private static NamenodeProtocol createNamenode(Configuration conf)
+    throws IOException {
+    InetSocketAddress nameNodeAddr =
+      DataNode.createSocketAddr(FileSystem.getDefaultUri(conf).getAuthority());
     RetryPolicy timeoutPolicy = RetryPolicies.exponentialBackoffRetry(
         5, 200, TimeUnit.MILLISECONDS);
     Map<Class<? extends Exception>,RetryPolicy> exceptionToPolicyMap =

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java Wed Mar 26 10:07:10 2008
@@ -78,6 +78,12 @@
   private TreeMap<String, OutputStream> pendingCreates =
     new TreeMap<String, OutputStream>();
  
+  static ClientProtocol createNamenode(Configuration conf) throws IOException {
+    return createNamenode(NetUtils.createSocketAddr
+                          (FileSystem.getDefaultUri(conf).getAuthority()),
+                          conf);
+  }
+
   static ClientProtocol createNamenode( InetSocketAddress nameNodeAddr,
       Configuration conf) throws IOException {
     try {
@@ -140,6 +146,15 @@
         rpcNamenode, methodNameToPolicyMap);
   }
         
+  /** 
+   * Create a new DFSClient connected to the default namenode.
+   */
+  public DFSClient(Configuration conf) throws IOException {
+    this(NetUtils.createSocketAddr(FileSystem.getDefaultUri(conf)
+                                   .getAuthority()),
+         conf);
+  }
+
   /** 
    * Create a new DFSClient connected to the given namenode server.
    */

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Wed Mar 26 10:07:10 2008
@@ -19,6 +19,7 @@
 
 import org.apache.commons.logging.*;
 
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.ChecksumException;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.io.Text;
@@ -195,8 +196,8 @@
                                      conf.get("dfs.datanode.dns.interface","default"),
                                      conf.get("dfs.datanode.dns.nameserver","default"));
     }
-    InetSocketAddress nameNodeAddr = NetUtils.createSocketAddr(
-                                     conf.get("fs.default.name", "local"));
+    InetSocketAddress nameNodeAddr =
+      NetUtils.createSocketAddr(FileSystem.getDefaultUri(conf).getAuthority());
     
     this.defaultBytesPerChecksum = 
        Math.max(conf.getInt("io.bytes.per.checksum", 512), 1); 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Wed Mar 26 10:07:10 2008
@@ -22,6 +22,7 @@
 import org.apache.hadoop.fs.ContentSummary;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.Trash;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.permission.*;
 import org.apache.hadoop.ipc.*;
 import org.apache.hadoop.conf.*;
@@ -124,7 +125,7 @@
 
     // The rpc-server port can be ephemeral... ensure we have the correct info
     this.nameNodeAddress = this.server.getListenerAddress(); 
-    conf.set("fs.default.name", nameNodeAddress.getHostName() + ":" + nameNodeAddress.getPort());
+    FileSystem.setDefaultUri(conf, "hdfs://"+nameNodeAddress.getHostName() + ":" + nameNodeAddress.getPort());
     LOG.info("Namenode up at: " + this.nameNodeAddress);
 
     myMetrics = new NameNodeMetrics(conf, this);
@@ -160,7 +161,7 @@
    * @throws IOException
    */
   public NameNode(Configuration conf) throws IOException {
-    this(conf.get("fs.default.name"), conf);
+    this(FileSystem.getDefaultUri(conf).getAuthority(), conf);
   }
 
   /**

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java Wed Mar 26 10:07:10 2008
@@ -267,8 +267,7 @@
   
   private void lostFoundMove(DFSFileInfo file, LocatedBlocks blocks)
     throws IOException {
-    DFSClient dfs = new DFSClient(NetUtils.createSocketAddr(
-                              conf.get("fs.default.name", "local")), conf);
+    DFSClient dfs = new DFSClient(conf);
     if (!lfInited) {
       lostFoundInit(dfs);
     }

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/SecondaryNameNode.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/SecondaryNameNode.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/SecondaryNameNode.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/SecondaryNameNode.java Wed Mar 26 10:07:10 2008
@@ -19,6 +19,7 @@
 
 import org.apache.commons.logging.*;
 
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.ipc.*;
 import org.apache.hadoop.conf.*;
 import org.apache.hadoop.util.StringUtils;
@@ -91,8 +92,8 @@
     // Create connection to the namenode.
     //
     shouldRun = true;
-    nameNodeAddr = NetUtils.createSocketAddr(
-                              conf.get("fs.default.name", "local"));
+    nameNodeAddr =
+      NetUtils.createSocketAddr(FileSystem.getDefaultUri(conf).getAuthority());
     this.conf = conf;
     this.namenode =
         (ClientProtocol) RPC.waitForProxy(ClientProtocol.class,
@@ -251,8 +252,8 @@
    * Returns the Jetty server that the Namenode is listening on.
    */
   private String getInfoServer() throws IOException {
-    String fsName = conf.get("fs.default.name", "local");
-    if (fsName.equals("local")) {
+    URI fsName = FileSystem.getDefaultUri(conf);
+    if (!"hdfs".equals(fsName.getScheme())) {
       throw new IOException("This is not a DFS");
     }
     return NetUtils.getServerAddress(conf, "dfs.info.bindAddress", 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/tools/Logalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/tools/Logalyzer.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/tools/Logalyzer.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/tools/Logalyzer.java Wed Mar 26 10:07:10 2008
@@ -29,6 +29,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -180,8 +181,7 @@
     doArchive(String logListURI, String archiveDirectory)
     throws IOException
   {
-    String destURL = "hdfs://" + fsConfig.get("fs.default.name", "local") + 
-                         archiveDirectory;
+    String destURL = FileSystem.getDefaultUri(fsConfig) + archiveDirectory;
     CopyFiles.copy(fsConfig, logListURI, destURL, null, true, false);
   }
   

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/util/GenericOptionsParser.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/util/GenericOptionsParser.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/util/GenericOptionsParser.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/util/GenericOptionsParser.java Wed Mar 26 10:07:10 2008
@@ -31,6 +31,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.FileSystem;
 
 /**
  * <code>GenericOptionsParser</code> is a utility to parse command line
@@ -182,7 +183,7 @@
   private void processGeneralOptions(Configuration conf,
       CommandLine line) {
     if (line.hasOption("fs")) {
-      conf.set("fs.default.name", line.getOptionValue("fs"));
+      FileSystem.setDefaultUri(conf, line.getOptionValue("fs"));
     }
 
     if (line.hasOption("jt")) {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java Wed Mar 26 10:07:10 2008
@@ -22,6 +22,7 @@
 import junit.framework.AssertionFailedError;
 
 import org.apache.commons.logging.*;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FSInputStream;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.io.UTF8;
@@ -225,7 +226,7 @@
       //        start some DataNodes
       //
       ArrayList<DataNode> listOfDataNodeDaemons = new ArrayList<DataNode>();
-      conf.set("fs.default.name", nameNodeSocketAddr);
+      FileSystem.setDefaultUri(conf, "hdfs://"+nameNodeSocketAddr);
       for (int i = 0; i < initialDNcount; i++) {
         // uniquely config real fs path for data storage for this datanode
         String dataDirs[] = new String[1];

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFSNamespaceLogging.java Wed Mar 26 10:07:10 2008
@@ -23,6 +23,7 @@
 
 import org.apache.commons.logging.*;
 
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.io.UTF8;
 import org.apache.hadoop.conf.Configuration;
@@ -344,7 +345,7 @@
     //
     //          start a NameNode
     String nameNodeSocketAddr = "localhost:" + nameNodePort;
-    conf.set("fs.default.name", nameNodeSocketAddr);
+    FileSystem.setDefaultUri(conf, "hdfs://"+nameNodeSocketAddr);
     
     String nameFSDir = baseDirSpecified + "/name";
     conf.set("dfs.name.dir", nameFSDir);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DataNodeCluster.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DataNodeCluster.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DataNodeCluster.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/DataNodeCluster.java Wed Mar 26 10:07:10 2008
@@ -25,6 +25,7 @@
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.dfs.FSConstants.StartupOption;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.net.DNS;
 
@@ -73,7 +74,7 @@
       System.out.println(usage);
       System.exit(-1);
     }
-    String nameNodeAdr = conf.get("fs.default.name");
+    String nameNodeAdr = FileSystem.getDefaultUri(conf).getAuthority();
     if (nameNodeAdr == null) {
       System.out.println("No name node address and port in config");
       System.exit(-1);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/MiniDFSCluster.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/MiniDFSCluster.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/MiniDFSCluster.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/MiniDFSCluster.java Wed Mar 26 10:07:10 2008
@@ -234,7 +234,7 @@
     data_dir = new File(base_dir, "data");
     
     // Setup the NameNode configuration
-    conf.set("fs.default.name", "localhost:"+ Integer.toString(nameNodePort));
+    FileSystem.setDefaultUri(conf, "hdfs://localhost:"+ Integer.toString(nameNodePort));
     conf.set("dfs.http.address", "0.0.0.0:0");  
     if (manageDfsDirs) {
       conf.set("dfs.name.dir", new File(base_dir, "name1").getPath()+","+
@@ -323,8 +323,9 @@
     if (nameNode != null) { // set conf from the name node
       InetSocketAddress nnAddr = nameNode.getNameNodeAddress(); 
       int nameNodePort = nnAddr.getPort(); 
-      conf.set("fs.default.name", 
-               nnAddr.getHostName()+ ":" + Integer.toString(nameNodePort));
+      FileSystem.setDefaultUri(conf, 
+                               "hdfs://"+ nnAddr.getHostName() +
+                               ":" + Integer.toString(nameNodePort));
     }
     
     if (racks != null && numDataNodes > racks.length ) {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestAbandonBlock.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestAbandonBlock.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestAbandonBlock.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestAbandonBlock.java Wed Mar 26 10:07:10 2008
@@ -48,8 +48,7 @@
       fout.flush();
   
       //try reading the block by someone
-      DFSClient dfsclient = new DFSClient(
-          NetUtils.createSocketAddr(CONF.get("fs.default.name")), CONF);
+      DFSClient dfsclient = new DFSClient(CONF);
       LocatedBlocks blocks = dfsclient.namenode.getBlockLocations(src, 0, 1);
       LocatedBlock b = blocks.get(0); 
       try {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBalancer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBalancer.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBalancer.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBalancer.java Wed Mar 26 10:07:10 2008
@@ -72,8 +72,7 @@
     cluster = new MiniDFSCluster( CONF, numNodes, true, null);
     try {
       cluster.waitActive();
-      client = DFSClient.createNamenode(
-          DataNode.createSocketAddr(CONF.get("fs.default.name")), CONF);
+      client = DFSClient.createNamenode(CONF);
 
       short replicationFactor = (short)(numNodes-1);
       long fileLen = size/replicationFactor;
@@ -157,8 +156,7 @@
     cluster = new MiniDFSCluster(0, CONF, numDatanodes,
         false, true, null, racks, capacities);
     cluster.waitActive();
-    client = DFSClient.createNamenode(
-        DataNode.createSocketAddr(CONF.get("fs.default.name")), CONF);
+    client = DFSClient.createNamenode(CONF);
 
     cluster.injectBlocks(blocksDN);
 
@@ -195,8 +193,7 @@
         racks, capacities);
     try {
       cluster.waitActive();
-      client = DFSClient.createNamenode(
-          DataNode.createSocketAddr(CONF.get("fs.default.name")), CONF);
+      client = DFSClient.createNamenode(CONF);
 
       long totalCapacity=0L;
       for(long capacity:capacities) {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBlockReplacement.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBlockReplacement.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBlockReplacement.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestBlockReplacement.java Wed Mar 26 10:07:10 2008
@@ -47,7 +47,7 @@
   MiniDFSCluster cluster;
   public void testThrottler() throws IOException {
     Configuration conf = new Configuration();
-    conf.set("fs.default.name", "localhost:0");
+    FileSystem.setDefaultUri(conf, "hdfs://localhost:0");
     long bandwidthPerSec = 1024*1024L;
     final long TOTAL_BYTES =6*bandwidthPerSec; 
     long bytesToSend = TOTAL_BYTES; 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java Wed Mar 26 10:07:10 2008
@@ -39,7 +39,7 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = conf.get("fs.default.name", "local");
+      namenode = FileSystem.getDefaultUri(conf).toString();
       String [] args = new String[4];
       args[2] = "-mkdir";
       args[3] = "/data";

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestDistributedFileSystem.java Wed Mar 26 10:07:10 2008
@@ -18,6 +18,8 @@
 
 package org.apache.hadoop.dfs;
 
+import java.net.URI;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 
@@ -25,13 +27,13 @@
   public void testFileSystemCloseAll() throws Exception {
     Configuration conf = new Configuration();
     MiniDFSCluster cluster = new MiniDFSCluster(conf, 0, true, null);
-    String address = conf.get("fs.default.name");
+    URI address = FileSystem.getDefaultUri(conf);
 
     try {
       FileSystem.closeAll();
 
       conf = new Configuration();
-      conf.set("fs.default.name", address);
+      FileSystem.setDefaultUri(conf, address);
       FileSystem.get(conf);
       FileSystem.get(conf);
       FileSystem.closeAll();
@@ -40,4 +42,4 @@
       if (cluster != null) {cluster.shutdown();}
     }
   }
-}
\ No newline at end of file
+}

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestGetBlocks.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestGetBlocks.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestGetBlocks.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestGetBlocks.java Wed Mar 26 10:07:10 2008
@@ -71,8 +71,7 @@
       DatanodeInfo[] dataNodes=null;
       boolean notWritten;
       do {
-        DFSClient dfsclient = new DFSClient(
-            NetUtils.createSocketAddr(CONF.get("fs.default.name")), CONF);
+        DFSClient dfsclient = new DFSClient(CONF);
         locatedBlocks = dfsclient.namenode.
           getBlockLocations("/tmp.txt", 0, fileLen).getLocatedBlocks();
         assertEquals(2, locatedBlocks.size());

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestHDFSServerPorts.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestHDFSServerPorts.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestHDFSServerPorts.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestHDFSServerPorts.java Wed Mar 26 10:07:10 2008
@@ -22,6 +22,7 @@
 
 import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.ipc.RPC;
 
@@ -53,7 +54,7 @@
     }
     config = new Configuration();
     config.set("dfs.name.dir", new File(hdfsDir, "name1").getPath());
-    config.set("fs.default.name", NAME_NODE_HOST + "0");
+    FileSystem.setDefaultUri(config, "hdfs://"+NAME_NODE_HOST + "0");
     config.set("dfs.http.address", NAME_NODE_HTTP_HOST + "0");
     NameNode.format(config);
 
@@ -136,12 +137,12 @@
       assertFalse(started); // should fail
 
       // start on a different main port
-      conf2.set("fs.default.name", NAME_NODE_HOST + "0");
+      FileSystem.setDefaultUri(conf2, "hdfs://"+NAME_NODE_HOST + "0");
       started = canStartNameNode(conf2);
       assertFalse(started); // should fail again
 
       // reset conf2 since NameNode modifies it
-      conf2.set("fs.default.name", NAME_NODE_HOST + "0");
+      FileSystem.setDefaultUri(conf2, "hdfs://"+NAME_NODE_HOST + "0");
       // different http port
       conf2.set("dfs.http.address", NAME_NODE_HTTP_HOST + "0");
       started = canStartNameNode(conf2);
@@ -162,7 +163,8 @@
       // start data-node on the same port as name-node
       Configuration conf2 = new Configuration(config);
       conf2.set("dfs.data.dir", new File(hdfsDir, "data").getPath());
-      conf2.set("dfs.datanode.address", config.get("fs.default.name"));
+      conf2.set("dfs.datanode.address",
+                FileSystem.getDefaultUri(config).getAuthority());
       conf2.set("dfs.datanode.http.address", NAME_NODE_HTTP_HOST + "0");
       boolean started = canStartDataNode(conf2);
       assertFalse(started); // should fail

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestNNThroughputBenchmark.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestNNThroughputBenchmark.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestNNThroughputBenchmark.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestNNThroughputBenchmark.java Wed Mar 26 10:07:10 2008
@@ -19,6 +19,7 @@
 
 import junit.framework.TestCase;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 
 public class TestNNThroughputBenchmark extends TestCase {
 
@@ -27,7 +28,7 @@
    */
   public void testNNThroughput() throws Exception {
     Configuration conf = new Configuration();
-    conf.set("fs.default.name", "localhost:" + 0);
+    FileSystem.setDefaultUri(conf, "hdfs://localhost:" + 0);
     conf.set("dfs.http.address", "0.0.0.0:0");
     NameNode.format(conf);
     NNThroughputBenchmark.runBenchmark(conf, new String[] {"-op", "all"});

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplication.java Wed Mar 26 10:07:10 2008
@@ -64,8 +64,7 @@
   private void checkFile(FileSystem fileSys, Path name, int repl)
     throws IOException {
     Configuration conf = fileSys.getConf();
-    ClientProtocol namenode = DFSClient.createNamenode(
-        NetUtils.createSocketAddr(conf.get("fs.default.name")), conf);
+    ClientProtocol namenode = DFSClient.createNamenode(conf);
       
     LocatedBlocks locations;
     boolean isReplicationDone;

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplicationPolicy.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplicationPolicy.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplicationPolicy.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/dfs/TestReplicationPolicy.java Wed Mar 26 10:07:10 2008
@@ -25,6 +25,7 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetworkTopology;
 import org.apache.hadoop.net.Node;
+import org.apache.hadoop.fs.FileSystem;
 
 import junit.framework.TestCase;
 
@@ -50,7 +51,7 @@
   
   static {
     try {
-      CONF.set("fs.default.name", "localhost:0");
+      FileSystem.setDefaultUri(CONF, "hdfs://localhost:0");
       NameNode.format(CONF);
       namenode = new NameNode(CONF);
     } catch (IOException e) {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestCopyFiles.java Wed Mar 26 10:07:10 2008
@@ -225,9 +225,9 @@
                            new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                                          "file:///"+TEST_ROOT_DIR+"/destdat"});
     assertTrue("Source and destination directories do not match.",
-               checkFiles("local", TEST_ROOT_DIR+"/destdat", files));
-    deldir("local", TEST_ROOT_DIR+"/destdat");
-    deldir("local", TEST_ROOT_DIR+"/srcdat");
+               checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
+    deldir("file:///", TEST_ROOT_DIR+"/destdat");
+    deldir("file:///", TEST_ROOT_DIR+"/srcdat");
   }
   
   /** copy files from dfs file system to dfs file system */
@@ -237,19 +237,19 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 2, true, null);
-      namenode = conf.get("fs.default.name", "local");
-      if (!"local".equals(namenode)) {
-        MyFile[] files = createFiles(URI.create("hdfs://"+namenode), "/srcdat");
+      namenode = FileSystem.getDefaultUri(conf).toString();
+      if (namenode.startsWith("hdfs://")) {
+        MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
         ToolRunner.run(new CopyFiles(conf), new String[] {
                                          "-log",
-                                         "hdfs://"+namenode+"/logs",
-                                         "hdfs://"+namenode+"/srcdat",
-                                         "hdfs://"+namenode+"/destdat"});
+                                         namenode+"/logs",
+                                         namenode+"/srcdat",
+                                         namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
                    checkFiles(namenode, "/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create("hdfs://"+namenode+"/logs"), conf);
+        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
-                    fs.exists(new Path("hdfs://"+namenode+"/logs")));
+                   fs.exists(new Path(namenode+"/logs")));
         deldir(namenode, "/destdat");
         deldir(namenode, "/srcdat");
         deldir(namenode, "/logs");
@@ -266,22 +266,22 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = conf.get("fs.default.name", "local");
-      if (!"local".equals(namenode)) {
+      namenode = FileSystem.getDefaultUri(conf).toString();
+      if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(LOCAL_FS, TEST_ROOT_DIR+"/srcdat");
         ToolRunner.run(new CopyFiles(conf), new String[] {
                                          "-log",
-                                         "hdfs://"+namenode+"/logs",
+                                         namenode+"/logs",
                                          "file:///"+TEST_ROOT_DIR+"/srcdat",
-                                         "hdfs://"+namenode+"/destdat"});
+                                         namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
                    checkFiles(namenode, "/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create("hdfs://"+namenode+"/logs"), conf);
+        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
-                    fs.exists(new Path("hdfs://"+namenode+"/logs")));
+                    fs.exists(new Path(namenode+"/logs")));
         deldir(namenode, "/destdat");
         deldir(namenode, "/logs");
-        deldir("local", TEST_ROOT_DIR+"/srcdat");
+        deldir("file:///", TEST_ROOT_DIR+"/srcdat");
       }
     } finally {
       if (cluster != null) { cluster.shutdown(); }
@@ -295,20 +295,20 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = conf.get("fs.default.name", "local");
-      if (!"local".equals(namenode)) {
-        MyFile[] files = createFiles(URI.create("hdfs://"+namenode), "/srcdat");
+      namenode = FileSystem.getDefaultUri(conf).toString();
+      if (namenode.startsWith("hdfs://")) {
+        MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
         ToolRunner.run(new CopyFiles(conf), new String[] {
                                          "-log",
                                          "/logs",
-                                         "hdfs://"+namenode+"/srcdat",
+                                         namenode+"/srcdat",
                                          "file:///"+TEST_ROOT_DIR+"/destdat"});
         assertTrue("Source and destination directories do not match.",
-                   checkFiles("local", TEST_ROOT_DIR+"/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create("hdfs://"+namenode+"/logs"), conf);
+                   checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
+        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
                     fs.exists(new Path("/logs")));
-        deldir("local", TEST_ROOT_DIR+"/destdat");
+        deldir("file:///", TEST_ROOT_DIR+"/destdat");
         deldir(namenode, "/logs");
         deldir(namenode, "/srcdat");
       }
@@ -323,20 +323,20 @@
     try {
       Configuration conf = new Configuration();
       cluster = new MiniDFSCluster(conf, 2, true, null);
-      namenode = conf.get("fs.default.name", "local");
-      if (!"local".equals(namenode)) {
-        MyFile[] files = createFiles(URI.create("hdfs://"+namenode), "/srcdat");
+      namenode = FileSystem.getDefaultUri(conf).toString();
+      if (namenode.startsWith("hdfs://")) {
+        MyFile[] files = createFiles(URI.create(namenode), "/srcdat");
         ToolRunner.run(new CopyFiles(conf), new String[] {
                                          "-p",
                                          "-log",
-                                         "hdfs://"+namenode+"/logs",
-                                         "hdfs://"+namenode+"/srcdat",
-                                         "hdfs://"+namenode+"/destdat"});
+                                         namenode+"/logs",
+                                         namenode+"/srcdat",
+                                         namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
                    checkFiles(namenode, "/destdat", files));
-        FileSystem fs = FileSystem.get(URI.create("hdfs://"+namenode+"/logs"), conf);
+        FileSystem fs = FileSystem.get(URI.create(namenode+"/logs"), conf);
         assertTrue("Log directory does not exist.",
-                    fs.exists(new Path("hdfs://"+namenode+"/logs")));
+                    fs.exists(new Path(namenode+"/logs")));
 
         FileStatus[] dchkpoint = getFileStatus(namenode, "/destdat", files);
         final int nupdate = NFILES>>2;
@@ -347,9 +347,9 @@
                                          "-p",
                                          "-update",
                                          "-log",
-                                         "hdfs://"+namenode+"/logs",
-                                         "hdfs://"+namenode+"/srcdat",
-                                         "hdfs://"+namenode+"/destdat"});
+                                         namenode+"/logs",
+                                         namenode+"/srcdat",
+                                         namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
                    checkFiles(namenode, "/destdat", files));
         assertTrue("Update failed to replicate all changes in src",
@@ -360,9 +360,9 @@
                                          "-p",
                                          "-overwrite",
                                          "-log",
-                                         "hdfs://"+namenode+"/logs",
-                                         "hdfs://"+namenode+"/srcdat",
-                                         "hdfs://"+namenode+"/destdat"});
+                                         namenode+"/logs",
+                                         namenode+"/srcdat",
+                                         namenode+"/destdat"});
         assertTrue("Source and destination directories do not match.",
                    checkFiles(namenode, "/destdat", files));
         assertTrue("-overwrite didn't.",
@@ -384,7 +384,7 @@
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                         "file:///"+TEST_ROOT_DIR+"/src2/srcdat"});
       assertTrue("Source and destination directories do not match.",
-                 checkFiles("local", TEST_ROOT_DIR+"/src2/srcdat", files));
+                 checkFiles("file:///", TEST_ROOT_DIR+"/src2/srcdat", files));
   
       assertEquals(CopyFiles.DuplicationException.ERROR_CODE,
           ToolRunner.run(new CopyFiles(new Configuration()),
@@ -393,9 +393,9 @@
                         "file:///"+TEST_ROOT_DIR+"/destdat",}));
     }
     finally {
-      deldir("local", TEST_ROOT_DIR+"/destdat");
-      deldir("local", TEST_ROOT_DIR+"/srcdat");
-      deldir("local", TEST_ROOT_DIR+"/src2");
+      deldir("file:///", TEST_ROOT_DIR+"/destdat");
+      deldir("file:///", TEST_ROOT_DIR+"/srcdat");
+      deldir("file:///", TEST_ROOT_DIR+"/src2");
     }
   }
 
@@ -409,7 +409,7 @@
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat",
                         "file:///"+TEST_ROOT_DIR+"/destdat"});
       assertTrue("Source and destination directories do not match.",
-                 checkFiles("local", TEST_ROOT_DIR+"/destdat", files));
+                 checkFiles("file:///", TEST_ROOT_DIR+"/destdat", files));
       
       //copy a single file
       String fname = files[0].getName();
@@ -419,9 +419,9 @@
           new String[] {"file:///"+TEST_ROOT_DIR+"/srcdat/"+fname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"+fname});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("local", TEST_ROOT_DIR+"/dest2", files));     
+          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files));     
       //copy single file to existing dir
-      deldir("local", TEST_ROOT_DIR+"/dest2");
+      deldir("file:///", TEST_ROOT_DIR+"/dest2");
       fs.mkdirs(new Path(TEST_ROOT_DIR+"/dest2"));
       MyFile[] files2 = {createFile(root, fs, 0)};
       String sname = files2[0].getName();
@@ -430,20 +430,20 @@
                         "file:///"+TEST_ROOT_DIR+"/srcdat/"+sname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("local", TEST_ROOT_DIR+"/dest2", files2));     
-      updateFiles("local", TEST_ROOT_DIR+"/srcdat", files2, 1);
+          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files2));     
+      updateFiles("file:///", TEST_ROOT_DIR+"/srcdat", files2, 1);
       //copy single file to existing dir w/ dst name conflict
       ToolRunner.run(new CopyFiles(new Configuration()),
           new String[] {"-update",
                         "file:///"+TEST_ROOT_DIR+"/srcdat/"+sname,
                         "file:///"+TEST_ROOT_DIR+"/dest2/"});
       assertTrue("Source and destination directories do not match.",
-          checkFiles("local", TEST_ROOT_DIR+"/dest2", files2));     
+          checkFiles("file:///", TEST_ROOT_DIR+"/dest2", files2));     
     }
     finally {
-      deldir("local", TEST_ROOT_DIR+"/destdat");
-      deldir("local", TEST_ROOT_DIR+"/dest2");
-      deldir("local", TEST_ROOT_DIR+"/srcdat");
+      deldir("file:///", TEST_ROOT_DIR+"/destdat");
+      deldir("file:///", TEST_ROOT_DIR+"/dest2");
+      deldir("file:///", TEST_ROOT_DIR+"/srcdat");
     }
   }
 }

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestSocketFactory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestSocketFactory.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestSocketFactory.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/ipc/TestSocketFactory.java Wed Mar 26 10:07:10 2008
@@ -57,7 +57,7 @@
 
     // Get another reference via network using a specific socket factory
     Configuration cconf = new Configuration();
-    cconf.set("fs.default.name", String.format("hdfs://localhost:%s/",
+    FileSystem.setDefaultUri(cconf, String.format("hdfs://localhost:%s/",
         nameNodePort + 10));
     cconf.set("hadoop.rpc.socket.factory.class.default",
         "org.apache.hadoop.ipc.DummySocketFactory");

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MRCaching.java Wed Mar 26 10:07:10 2008
@@ -187,28 +187,9 @@
     fs.copyFromLocalFile(jarPath, cachePath);
     fs.copyFromLocalFile(zipPath, cachePath);
     // setting the cached archives to zip, jar and simple text files
-    String fileSys = fs.getName();
-    String archive1;
-    String archive2;
-    String file1;
-    if (fileSys.equals("local")) {
-      archive1 = "file://" + cachePath + "/test.jar";
-      archive2 = "file://" + cachePath + "/test.zip";
-      file1 = "file://" + cachePath + "/test.txt";
-    } else {
-      archive1 = "hdfs://" + fileSys + cachePath + "/test.jar";
-      archive2 = "hdfs://" + fileSys + cachePath + "/test.zip";
-      file1 = "hdfs://" + fileSys + cachePath + "/test.txt";
-    }
-    URI uri1 = null;
-    URI uri2 = null;
-    URI uri3 = null;
-    try{
-      uri1 = new URI(archive1);
-      uri2 = new URI(archive2);
-      uri3 = new URI(file1);
-    } catch(URISyntaxException ur){
-    }
+    URI uri1 = fs.getUri().resolve(cachePath + "/test.jar");
+    URI uri2 = fs.getUri().resolve(cachePath + "/test.zip");
+    URI uri3 = fs.getUri().resolve(cachePath + "/test.txt");
     DistributedCache.addCacheArchive(uri1, conf);
     DistributedCache.addCacheArchive(uri2, conf);
     DistributedCache.addCacheFile(uri3, conf);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/MiniMRCluster.java Wed Mar 26 10:07:10 2008
@@ -26,6 +26,7 @@
 import org.apache.hadoop.net.StaticMapping;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.UnixUserGroupInformation;
+import org.apache.hadoop.fs.FileSystem;
 
 /**
  * This class creates a single-process Map-Reduce cluster for junit testing.
@@ -246,7 +247,7 @@
 
   public JobConf createJobConf() {
     JobConf result = new JobConf();
-    result.set("fs.default.name", namenode);
+    FileSystem.setDefaultUri(result, namenode);
     result.set("mapred.job.tracker", "localhost:"+jobTrackerPort);
     result.set("mapred.job.tracker.http.address", 
                         "127.0.0.1:" + jobTrackerInfoPort);
@@ -433,7 +434,7 @@
     
   public static void main(String[] args) throws IOException {
     LOG.info("Bringing up Jobtracker and tasktrackers.");
-    MiniMRCluster mr = new MiniMRCluster(4, "local", 1);
+    MiniMRCluster mr = new MiniMRCluster(4, "file:///", 1);
     LOG.info("JobTracker and TaskTrackers are up.");
     mr.shutdown();
     LOG.info("JobTracker and TaskTrackers brought down.");

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java Wed Mar 26 10:07:10 2008
@@ -67,7 +67,7 @@
     }
 
     // use WordCount example
-    conf.set("fs.default.name", fileSys);
+    FileSystem.setDefaultUri(conf, fileSys);
     conf.set("mapred.job.tracker", jobTracker);
     conf.setJobName("empty");
     // use an InputFormat which returns no split

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMRServerPorts.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMRServerPorts.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMRServerPorts.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMRServerPorts.java Wed Mar 26 10:07:10 2008
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 import org.apache.hadoop.dfs.TestHDFSServerPorts;
 import org.apache.hadoop.dfs.NameNode;
+import org.apache.hadoop.fs.FileSystem;
 
 /**
  * This test checks correctness of port usage by mapreduce components:
@@ -99,7 +100,8 @@
 
       // start job tracker on the same port as name-node
       JobConf conf2 = new JobConf(hdfs.getConfig());
-      conf2.set("mapred.job.tracker", hdfs.getConfig().get("fs.default.name"));
+      conf2.set("mapred.job.tracker",
+                FileSystem.getDefaultUri(hdfs.getConfig()).toString());
       conf2.set("mapred.job.tracker.http.address",
         TestHDFSServerPorts.NAME_NODE_HTTP_HOST + 0);
       boolean started = canStartJobTracker(conf2);
@@ -138,7 +140,7 @@
 
       // start job tracker on the same port as name-node
       conf2.set("mapred.task.tracker.report.address",
-        hdfs.getConfig().get("fs.default.name"));
+                FileSystem.getDefaultUri(hdfs.getConfig()).toString());
       conf2.set("mapred.task.tracker.http.address",
         TestHDFSServerPorts.NAME_NODE_HTTP_HOST + 0);
       boolean started = canStartTaskTracker(conf2);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRClasspath.java Wed Mar 26 10:07:10 2008
@@ -54,7 +54,7 @@
       file.writeBytes(input);
       file.close();
     }
-    conf.set("fs.default.name", fileSys);
+    FileSystem.setDefaultUri(conf, fileSys);
     conf.set("mapred.job.tracker", jobTracker);
     conf.setJobName("wordcount");
     conf.setInputFormat(TextInputFormat.class);
@@ -110,7 +110,7 @@
       file.writeBytes(input);
       file.close();
     }
-    conf.set("fs.default.name", fileSys);
+    FileSystem.setDefaultUri(conf, fileSys);
     conf.set("mapred.job.tracker", jobTracker);
     conf.setJobName("wordcount");
     conf.setInputFormat(TextInputFormat.class);

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRMapRedDebugScript.java Wed Mar 26 10:07:10 2008
@@ -148,20 +148,7 @@
     }
     debugFs.copyFromLocalFile(scriptPath,cachePath);
     
-    // add debug script as cache file 
-    String fileSys = debugFs.getName();
-    String scr = null;
-    if (fileSys.equals("local")) {
-      scr = "file://" + cachePath + "/testscript.txt#testscript";
-    } else {
-      scr = "hdfs://" + fileSys + cachePath + "/testscript.txt#testscript";
-    }
-    URI uri = null;
-    try {
-      uri = new URI(scr);
-    } catch (URISyntaxException ur) {
-      ur.printStackTrace();
-    }
+    URI uri = debugFs.getUri().resolve(cachePath+"/testscript.txt#testscript");
     DistributedCache.createSymlink(conf);
     DistributedCache.addCacheFile(uri, conf);
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java?rev=641409&r1=641408&r2=641409&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestSpecialCharactersInOutputPath.java Wed Mar 26 10:07:10 2008
@@ -64,7 +64,7 @@
     file.close();
 
     // use WordCount example
-    conf.set("fs.default.name", fileSys);
+    FileSystem.setDefaultUri(conf, fileSys);
     conf.set("mapred.job.tracker", jobTracker);
     conf.setJobName("foo");
 



Mime
View raw message