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

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


  @Test
  public void testIsNotSymlink() throws IOException{
    Type type = new Type();
    addArgument(type, "l");
    type.initialise(new FindOptions());
   
    when(mockFstat.isSymlink()).thenReturn(false);
    PathData item = new PathData("/one/two/test", conf);

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


  @Test
  public void testIsFile() throws IOException{
    Type type = new Type();
    addArgument(type, "f");
    type.initialise(new FindOptions());
   
    when(mockFstat.isFile()).thenReturn(true);
    PathData item = new PathData("/one/two/test", conf);

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

  @Test
  public void testIsNotFile() throws IOException{
    Type type = new Type();
    addArgument(type, "f");
    type.initialise(new FindOptions());
   
    when(mockFstat.isFile()).thenReturn(false);
    PathData item = new PathData("/one/two/test", conf);

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

  @Test
  public void testInvalidType() throws IOException {
    Type type = new Type();
    addArgument(type, "a");
    try {
      type.initialise(new FindOptions());
      fail("Invalid file type not caught");
    }
    catch (IOException e) {}
  }
View Full Code Here

import org.junit.Test;

public class TestDepth extends TestExpression {
  @Test
  public void initialise() throws IOException{
    FindOptions options = new FindOptions();
    Depth depth = new Depth();
   
    assertFalse(options.isDepth());
    depth.initialise(options);
    assertTrue(options.isDepth());
  }
View Full Code Here

  }

  @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

  // check that the prune command is ignore when doing a depth first find
  @Test
  public void applyDepth() throws IOException {
    Prune prune = new Prune();
    FindOptions options = new FindOptions();
    options.setDepth(true);
    prune.initialise(options);
    PathData item = mock(PathData.class);
    assertEquals(Result.PASS, prune.apply(item));
  }
View Full Code Here

  @Test
  public void testExact() throws IOException {
    Mtime mtime = new Mtime();
    addArgument(mtime, "5");
   
    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));
View Full Code Here

  @Test
  public void testGreater() throws IOException {
    Mtime mtime = new Mtime();
    addArgument(mtime, "+5");

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

  @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

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.