Examples of FindOptions


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

  @Test
  public void testLess() throws IOException {
    Mtime mtime = new Mtime();
    addArgument(mtime, "-5");
   
    FindOptions options = new FindOptions();
    options.setStartTime(NOW);
    mtime.initialise(options);
    assertEquals(Result.PASS, mtime.apply(fourDays));
    assertEquals(Result.PASS, mtime.apply(fiveDaysMinus));
    assertEquals(Result.FAIL, mtime.apply(fiveDays));
View Full Code Here

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

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

    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

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

    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

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

    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

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

    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

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

    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

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

 
  @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

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

    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

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

  @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
TOP
Copyright © 2018 www.massapi.com. 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.