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

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


 
  @Test
  public void testPrint() throws IOException{
    Print print = new Print();
    PrintStream out = mock(PrintStream.class);
    FindOptions options = new FindOptions();
    options.setOut(out);
    print.initialise(options);
   
    String filename = "/one/two/test";
    PathData item = new PathData(filename, conf);
    assertEquals(Result.PASS, print.apply(item));
View Full Code Here


    verifyNoMoreInteractions(children);
  }

  @Test
  public void initialise() throws IOException {
    FindOptions options = new FindOptions();
    test.addArguments(getArgs(TestExpression.class.getName()));
    test.initialise(options);
    verify(expr).addArguments(new LinkedList<String>());
    verify(expr).initialise(options);
    verifyNoMoreInteractions(expr);
View Full Code Here

    when(fileStatus.getLen()).thenReturn(0l);
    fs.setFileStatus("emptyFile", fileStatus);
    PathData item = new PathData("emptyFile", fs.getConf());
   
    Empty empty = new Empty();
    empty.initialise(new FindOptions());

    assertEquals(Result.PASS, empty.apply(item));
  }
View Full Code Here

    when(fileStatus.getLen()).thenReturn(1l);
    fs.setFileStatus("notEmptyFile", fileStatus);
    PathData item = new PathData("notEmptyFile", fs.getConf());
   
    Empty empty = new Empty();
    empty.initialise(new FindOptions());

    assertEquals(Result.FAIL, empty.apply(item));
  }
View Full Code Here

    fs.setFileStatus("emptyDirectory", fileStatus);
    fs.setListStatus("emptyDirectory", new FileStatus[0]);
    PathData item = new PathData("emptyDirectory", fs.getConf());
   
    Empty empty = new Empty();
    empty.initialise(new FindOptions());

    assertEquals(Result.PASS, empty.apply(item));
  }
View Full Code Here

    fs.setFileStatus("notEmptyDirectory", fileStatus);
    fs.setListStatus("notEmptyDirectory", new FileStatus[] {mock(FileStatus.class)});
    PathData item = new PathData("notEmptyDirectory", fs.getConf());
   
    Empty empty = new Empty();
    empty.initialise(new FindOptions());

    assertEquals(Result.PASS, empty.apply(item));
  }
View Full Code Here

 
  @Test
  public void testPrint() throws IOException{
    Print.Print0 print = new Print.Print0();
    PrintStream out = mock(PrintStream.class);
    FindOptions options = new FindOptions();
    options.setOut(out);
    print.initialise(options);
   
    String filename = "/one/two/test";
    PathData item = new PathData(filename, conf);
    assertEquals(Result.PASS, print.apply(item));
View Full Code Here

    err = mock(PrintStream.class);
    in = new ByteArrayInputStream("yes\n".getBytes());

    factory = new CommandFactory(conf);
    factory.registerCommands(TestCommand.class);
    options = new FindOptions();
    options.setCommandFactory(factory);
    options.setOut(out);
    options.setErr(err);
    options.setIn(in);
   
View Full Code Here

  @Test
  public void applyNumberEquals() throws IOException {
    NumberExpression numberExpr = new NumberExpression(){};
    addArgument(numberExpr, "5");
    numberExpr.initialise(new FindOptions());
    assertEquals(Result.PASS, numberExpr.applyNumber(5));
    assertEquals(Result.FAIL, numberExpr.applyNumber(4));
    assertEquals(Result.FAIL, numberExpr.applyNumber(6));
  }
View Full Code Here

  @Test
  public void applyNumberGreaterThan() throws IOException {
    NumberExpression numberExpr = new NumberExpression(){};
    addArgument(numberExpr, "+5");
    numberExpr.initialise(new FindOptions());
    assertEquals(Result.FAIL, numberExpr.applyNumber(5));
    assertEquals(Result.FAIL, numberExpr.applyNumber(4));
    assertEquals(Result.PASS, numberExpr.applyNumber(6));
  }
View Full Code Here

TOP

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

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.