Prechádzať zdrojové kódy

HADOOP-1006. Remove obsolete '-local' option from test code. Contributed by Gautam Kowshik.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@510211 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 rokov pred
rodič
commit
931e51bf52

+ 3 - 0
CHANGES.txt

@@ -86,6 +86,9 @@ Trunk (unreleased changes)
     directly, so that user code is no longer required in the
     directly, so that user code is no longer required in the
     JobTracker.  (omalley via cutting)
     JobTracker.  (omalley via cutting)
 
 
+26. HAOOP-1006.  Remove obsolete '-local' option from test code.
+    (Gautam Kowshik via cutting)
+
 
 
 Release 0.11.2 - 2007-02-16
 Release 0.11.2 - 2007-02-16
 
 

+ 7 - 3
src/test/org/apache/hadoop/io/TestArrayFile.java

@@ -104,7 +104,7 @@ public class TestArrayFile extends TestCase {
     boolean create = true;
     boolean create = true;
     boolean check = true;
     boolean check = true;
     String file = FILE;
     String file = FILE;
-    String usage = "Usage: TestArrayFile (-local | -dfs <namenode:port>) [-count N] [-nocreate] [-nocheck] file";
+    String usage = "Usage: TestArrayFile [-count N] [-nocreate] [-nocheck] file";
       
       
     if (args.length == 0) {
     if (args.length == 0) {
       System.err.println(usage);
       System.err.println(usage);
@@ -113,7 +113,8 @@ public class TestArrayFile extends TestCase {
 
 
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     int i = 0;
     int i = 0;
-    FileSystem fs = FileSystem.parseArgs(args, i, conf);
+    Path fpath = null;
+    FileSystem fs = null;
     try {
     try {
         for (; i < args.length; i++) {       // parse command line
         for (; i < args.length; i++) {       // parse command line
             if (args[i] == null) {
             if (args[i] == null) {
@@ -127,9 +128,12 @@ public class TestArrayFile extends TestCase {
             } else {                                       
             } else {                                       
                 // file is required parameter
                 // file is required parameter
                 file = args[i];
                 file = args[i];
+                fpath=new Path(file);
             }
             }
         }
         }
-
+        
+        fs = fpath.getFileSystem(conf);
+        
         LOG.info("count = " + count);
         LOG.info("count = " + count);
         LOG.info("create = " + create);
         LOG.info("create = " + create);
         LOG.info("check = " + check);
         LOG.info("check = " + check);

+ 5 - 2
src/test/org/apache/hadoop/io/TestSequenceFile.java

@@ -417,7 +417,7 @@ public class TestSequenceFile extends TestCase {
     Path file = null;
     Path file = null;
     int seed = new Random().nextInt();
     int seed = new Random().nextInt();
 
 
-    String usage = "Usage: SequenceFile (-local | -dfs <namenode:port>) " +
+    String usage = "Usage: SequenceFile " +
         "[-count N] " + 
         "[-count N] " + 
         "[-seed #] [-check] [-compressType <NONE|RECORD|BLOCK>] " + 
         "[-seed #] [-check] [-compressType <NONE|RECORD|BLOCK>] " + 
         "-codec <compressionCodec> " + 
         "-codec <compressionCodec> " + 
@@ -428,7 +428,7 @@ public class TestSequenceFile extends TestCase {
         System.exit(-1);
         System.exit(-1);
     }
     }
     
     
-    FileSystem fs = FileSystem.parseArgs(args, 0, conf);      
+    FileSystem fs = null;
     try {
     try {
       for (int i=0; i < args.length; ++i) {       // parse command line
       for (int i=0; i < args.length; ++i) {       // parse command line
           if (args[i] == null) {
           if (args[i] == null) {
@@ -460,6 +460,9 @@ public class TestSequenceFile extends TestCase {
               file = new Path(args[i]);
               file = new Path(args[i]);
           }
           }
         }
         }
+        
+      	fs = file.getFileSystem(conf);
+
         LOG.info("count = " + count);
         LOG.info("count = " + count);
         LOG.info("megabytes = " + megabytes);
         LOG.info("megabytes = " + megabytes);
         LOG.info("factor = " + factor);
         LOG.info("factor = " + factor);

+ 7 - 3
src/test/org/apache/hadoop/io/TestSetFile.java

@@ -103,7 +103,7 @@ public class TestSetFile extends TestCase {
     String file = FILE;
     String file = FILE;
     String compress = "NONE";
     String compress = "NONE";
 
 
-    String usage = "Usage: TestSetFile (-local | -dfs <namenode:port>) [-count N] [-nocreate] [-nocheck] [-compress type] file";
+    String usage = "Usage: TestSetFile [-count N] [-nocreate] [-nocheck] [-compress type] file";
       
       
     if (args.length == 0) {
     if (args.length == 0) {
       System.err.println(usage);
       System.err.println(usage);
@@ -111,7 +111,8 @@ public class TestSetFile extends TestCase {
     }
     }
       
       
     int i = 0;
     int i = 0;
-    FileSystem fs = FileSystem.parseArgs(args, i, conf);      
+    Path fpath=null;
+    FileSystem fs = null;    
     try {
     try {
       for (; i < args.length; i++) {       // parse command line
       for (; i < args.length; i++) {       // parse command line
         if (args[i] == null) {
         if (args[i] == null) {
@@ -127,9 +128,12 @@ public class TestSetFile extends TestCase {
         } else {
         } else {
           // file is required parameter
           // file is required parameter
           file = args[i];
           file = args[i];
+          fpath=new Path(file);
         }
         }
       }
       }
-
+      
+      fs = fpath.getFileSystem(conf);
+      
       LOG.info("count = " + count);
       LOG.info("count = " + count);
       LOG.info("create = " + create);
       LOG.info("create = " + create);
       LOG.info("check = " + check);
       LOG.info("check = " + check);