|
@@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.conf.Configured;
|
|
|
import org.apache.hadoop.dfs.MiniDFSCluster;
|
|
|
+import org.apache.hadoop.fs.FsShell.CommandFormat;
|
|
|
import org.apache.hadoop.io.LongWritable;
|
|
|
import org.apache.hadoop.io.SequenceFile;
|
|
|
import org.apache.hadoop.io.UTF8;
|
|
@@ -85,6 +86,21 @@ public class TestFileSystem extends TestCase {
|
|
|
fs.delete(READ_DIR, true);
|
|
|
}
|
|
|
|
|
|
+ public static void testCommandFormat() throws Exception {
|
|
|
+ // This should go to TestFsShell.java when it is added.
|
|
|
+ CommandFormat cf;
|
|
|
+ cf= new CommandFormat("copyToLocal", 2,2,"crc","ignoreCrc");
|
|
|
+ assertEquals(cf.parse(new String[] {"-get","file", "-"}, 1).get(1), "-");
|
|
|
+ assertEquals(cf.parse(new String[] {"-get","file","-ignoreCrc","/foo"}, 1).get(1),"/foo");
|
|
|
+ cf = new CommandFormat("tail", 1, 1, "f");
|
|
|
+ assertEquals(cf.parse(new String[] {"-tail","fileName"}, 1).get(0),"fileName");
|
|
|
+ assertEquals(cf.parse(new String[] {"-tail","-f","fileName"}, 1).get(0),"fileName");
|
|
|
+ cf = new CommandFormat("setrep", 2, 2, "R", "w");
|
|
|
+ assertEquals(cf.parse(new String[] {"-setrep","-R","2","/foo/bar"}, 1).get(1), "/foo/bar");
|
|
|
+ cf = new CommandFormat("put", 2, 10000);
|
|
|
+ assertEquals(cf.parse(new String[] {"-put", "-", "dest"}, 1).get(1), "dest");
|
|
|
+ }
|
|
|
+
|
|
|
public static void createControlFile(FileSystem fs,
|
|
|
long megaBytes, int numFiles,
|
|
|
long seed) throws Exception {
|