예제 #1
0
 /** Constructor */
 SetQuotaCommand(String[] args, int pos, FileSystem fs) {
   super(fs);
   CommandFormat c = new CommandFormat(NAME, 2, Integer.MAX_VALUE);
   List<String> parameters = c.parse(args, pos);
   this.quota = Long.parseLong(parameters.remove(0));
   this.args = parameters.toArray(new String[parameters.size()]);
 }
예제 #2
0
 /** Constructor */
 SetSpaceQuotaCommand(String[] args, int pos, FileSystem fs) {
   super(fs);
   CommandFormat c = new CommandFormat(NAME, 2, Integer.MAX_VALUE);
   List<String> parameters = c.parse(args, pos);
   String str = parameters.remove(0).trim();
   quota = StringUtils.TraditionalBinaryPrefix.string2long(str);
   this.args = parameters.toArray(new String[parameters.size()]);
 }
 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), "-");
   try {
     cf.parse(new String[] {"-get", "file", "-ignoreCrc", "/foo"}, 1);
     fail("Expected parsing to fail as it should stop at first non-option");
   } catch (Exception e) {
     // Expected
   }
   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");
 }
예제 #4
0
 /** Constructor */
 ClearQuotaCommand(String[] args, int pos, FileSystem fs) {
   super(fs);
   CommandFormat c = new CommandFormat(NAME, 1, Integer.MAX_VALUE);
   List<String> parameters = c.parse(args, pos);
   this.args = parameters.toArray(new String[parameters.size()]);
 }