Examples of apply()


Examples of org.apache.hadoop.fs.shell.find.Depth.apply()

  @Test
  public void apply() throws IOException{
    Depth depth = new Depth();
    depth.initialise(new FindOptions());
    assertEquals(Result.PASS, depth.apply(new PathData("anything", new Configuration())));
  }
}
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Empty.apply()

    PathData item = new PathData("emptyFile", fs.getConf());
   
    Empty empty = new Empty();
    empty.initialise(new FindOptions());

    assertEquals(Result.PASS, empty.apply(item));
  }
 
  @Test
  public void applyNotEmptyFile() throws IOException {
    FileStatus fileStatus = mock(FileStatus.class);
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Exec.apply()

  @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

Examples of org.apache.hadoop.fs.shell.find.Expression.apply()

    Or or = new Or();
   
    PathData pathData = mock(PathData.class);
   
    Expression first = mock(Expression.class);
    when(first.apply(pathData)).thenReturn(Result.PASS);
   
    Expression second = mock(Expression.class);
    when(second.apply(pathData)).thenReturn(Result.PASS);
   
    Deque<Expression> children = new LinkedList<Expression>();
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Mtime.apply()

   
    FindOptions options = new FindOptions();
    options.setStartTime(NOW);
    mtime.initialise(options);
   
    assertEquals(Result.FAIL, mtime.apply(fourDays));
    assertEquals(Result.FAIL, mtime.apply(fiveDaysMinus));
    assertEquals(Result.PASS, mtime.apply(fiveDays));
    assertEquals(Result.PASS, mtime.apply(fiveDaysPlus));
    assertEquals(Result.FAIL, mtime.apply(sixDays));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Not.apply()

   
    Deque<Expression> children = new LinkedList<Expression>();
    children.add(child);
    not.addChildren(children);
   
    assertEquals(Result.FAIL, not.apply(pathData));
    verify(child).apply(pathData);
    verifyNoMoreInteractions(child);
  }

  @Test
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Or.apply()

    Deque<Expression> children = new LinkedList<Expression>();
    children.add(second);
    children.add(first);
    or.addChildren(children);
   
    assertEquals(Result.PASS, or.apply(pathData));
    verify(first).apply(pathData);
    verifyNoMoreInteractions(first);
    verifyNoMoreInteractions(second);
  }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Perm.apply()

  public void applyOctalExact() throws IOException {
    Perm perm = new Perm();
    addArgument(perm, "123");
    perm.initialise(new FindOptions());

    assertEquals(Result.FAIL, perm.apply(rwxrwxrwx));
    assertEquals(Result.FAIL, perm.apply(rwx______));
    assertEquals(Result.FAIL, perm.apply(r__r__r__));
    assertEquals(Result.FAIL, perm.apply(rwxr_____));
    assertEquals(Result.PASS, perm.apply(__x_w__wx));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Print.apply()

    options.setOut(out);
    print.initialise(options);
   
    String filename = "/one/two/test";
    PathData item = new PathData(filename, conf);
    assertEquals(Result.PASS, print.apply(item));
    verify(out).println(filename);
    verifyNoMoreInteractions(out);
  }
}
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Prune.apply()

  @Test
  public void apply() throws IOException {
    Prune prune = new Prune();
    PathData item = mock(PathData.class);
    Result result = prune.apply(item);
    assertTrue(result.isPass());
    assertFalse(result.isDescend());
  }

  // check that the prune command is ignore when doing a depth first find
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.