Package org.apache.hadoop.fs.shell

Examples of org.apache.hadoop.fs.shell.PathData


    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


    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 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

public class TestPrune extends TestExpression {

  @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());
  }
View Full Code Here

  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

   
    FileStatus fourDaysStat = mock(FileStatus.class);
    when(fourDaysStat.getModificationTime()).thenReturn(NOW - (4l * DAY));
    when(fourDaysStat.toString()).thenReturn("fourDays");
    fs.setFileStatus("fourDays", fourDaysStat);
    fourDays = new PathData("fourDays", conf);

    FileStatus fiveDaysStat = mock(FileStatus.class);
    when(fiveDaysStat.getModificationTime()).thenReturn(NOW - (5l * DAY));
    when(fiveDaysStat.toString()).thenReturn("fiveDays");
    fs.setFileStatus("fiveDays", fiveDaysStat);
    fiveDays = new PathData("fiveDays", conf);

    FileStatus fiveDaysMinus1Stat = mock(FileStatus.class);
    when(fiveDaysMinus1Stat.getModificationTime()).thenReturn(NOW - ((5l * DAY) - 1));
    when(fiveDaysMinus1Stat.toString()).thenReturn("fiveDaysMinus");
    fs.setFileStatus("fiveDaysMinus", fiveDaysMinus1Stat);
    fiveDaysMinus = new PathData("fiveDaysMinus", conf);

    FileStatus sixDaysStat = mock(FileStatus.class);
    when(sixDaysStat.getModificationTime()).thenReturn(NOW - (6l * DAY));
    when(sixDaysStat.toString()).thenReturn("sixDays");
    fs.setFileStatus("sixDays", sixDaysStat);
    sixDays = new PathData("sixDays", conf);

    FileStatus sixDaysMinus1Stat = mock(FileStatus.class);
    when(sixDaysMinus1Stat.getModificationTime()).thenReturn(NOW - ((6l * DAY) - 1));
    when(sixDaysMinus1Stat.toString()).thenReturn("fiveDaysPlus");
    fs.setFileStatus("fiveDaysPlus", sixDaysMinus1Stat);
    fiveDaysPlus = new PathData("fiveDaysPlus", conf);
  }
View Full Code Here

    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));
    verify(out).println(filename);
    verifyNoMoreInteractions(out);
  }
View Full Code Here

    verifyNoMoreInteractions(expr);
  }
 
  @Test
  public void applyPass() throws IOException {
    PathData item = mock(PathData.class);
    when(expr.apply(item)).thenReturn(Result.PASS);
    test.addArguments(getArgs(TestExpression.class.getName()));
    assertEquals(Result.PASS, test.apply(item));
    verify(expr).addArguments(new LinkedList<String>());
    verify(expr).apply(item);
View Full Code Here

    verifyNoMoreInteractions(expr);
  }
 
  @Test
  public void applyFail() throws IOException {
    PathData item = mock(PathData.class);
    when(expr.apply(item)).thenReturn(Result.FAIL);
    test.addArguments(getArgs(TestExpression.class.getName()));
    assertEquals(Result.FAIL, test.apply(item));
    verify(expr).addArguments(new LinkedList<String>());
    verify(expr).apply(item);
View Full Code Here

    verifyNoMoreInteractions(expr);
  }
 
  @Test
  public void applyStop() throws IOException {
    PathData item = mock(PathData.class);
    when(expr.apply(item)).thenReturn(Result.STOP);
    test.addArguments(getArgs(TestExpression.class.getName()));
    assertEquals(Result.STOP, test.apply(item));
    verify(expr).addArguments(new LinkedList<String>());
    verify(expr).apply(item);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.shell.PathData

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.