Package org.apache.hadoop.fs.shell.find

Examples of org.apache.hadoop.fs.shell.find.Exec


    TestCommand.testConf = conf;
  }
 
  @Test
  public void addArguments() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("one two three ; four"));
    assertEquals("Exec(one,two,three;)", exec.toString());
    assertFalse(exec.isBatch());
  }
View Full Code Here


    assertFalse(exec.isBatch());
  }

  @Test
  public void addArgumentsBracket() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("one {} three ; four"));
    assertEquals("Exec(one,{},three;)", exec.toString());
    assertFalse(exec.isBatch());
  }
View Full Code Here

    assertFalse(exec.isBatch());
  }

  @Test
  public void addArgumentsPlus() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("one two three + four"));
    assertEquals("Exec(one,two,three,+,four;)", exec.toString());
    assertFalse(exec.isBatch());
  }
View Full Code Here

    assertFalse(exec.isBatch());
  }

  @Test
  public void addArgumentsBracketPlus() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("one two {} + four"));
    assertEquals("Exec(one,two,{};)", exec.toString());
    assertTrue(exec.isBatch());
  }
View Full Code Here

  }

  @Test
  public void testFsShellCommand() throws IOException {
    factory.registerCommands(FsCommand.class);
    Exec exec = new Exec();
    exec.addArguments(getArgs("-ls {} ;"));
    exec.initialise(options);
    Command cmd = exec.getCommand();
    assertEquals("org.apache.hadoop.fs.shell.Ls", cmd.getClass().getName());
  }
View Full Code Here

  }
 
  @Test
  public void testUnknownCommand() throws IOException {
    TestCommand.testErr = System.err;
    Exec exec = new Exec();
    exec.addArguments(getArgs("-invalid arg1 arg2 ;"));
    try {
      exec.initialise(options);
      fail("Invalid command not caught");
    }
    catch(IOException e) {
      assertEquals("Unknown command: -invalid", e.getMessage());
    }
View Full Code Here

    verifyNoMoreInteractions(err);
  }

  @Test
  public void testTestCommand() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand ;"));
    exec.initialise(options);
    Command cmd = exec.getCommand();
    assertEquals(TestCommand.class, cmd.getClass());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
  }
View Full Code Here

    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyOneArg() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand {} ;"));
    exec.initialise(options);
    assertEquals(Result.PASS, exec.apply(item));
    verify(out).println("TestCommand.processPath:"+item.toString());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
  }
View Full Code Here

    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyOptions() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand -option1 -option2 {} ;"));
    exec.initialise(options);
    assertEquals(Result.PASS, exec.apply(item));
    verify(out).println("TestCommand.processOptions:-option1");
    verify(out).println("TestCommand.processOptions:-option2");
    verify(out).println("TestCommand.processPath:"+item.toString());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
View Full Code Here

    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyFail() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand -fail {} ;"));
    exec.initialise(options);
    assertEquals(Result.FAIL, exec.apply(item));
    verify(out).println("TestCommand.processOptions:-fail");
    verify(out).println("TestCommand.processPath:"+item.toString());
    verifyNoMoreInteractions(out);
    verify(err).println("testCommand: failed");
    verifyNoMoreInteractions(err);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.shell.find.Exec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.