Package org.apache.hadoop.fs.shell

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


  /** {@inheritDoc} */
  @Override
  public void initialise(FindOptions options) throws IOException{
    super.initialise(options);
    String pathname = getArgument(1);
    PathData pathData = new PathData(pathname, getConf());
    filetime = getFileStatus(pathData).getModificationTime();
  }
View Full Code Here


  }
 
  @Override
  protected void recursePath(PathData item) throws IOException {
    if(item.stat.isSymlink() && getOptions().isFollowLink()) {
      PathData linkedItem = new PathData(item.stat.getSymlink().toString(), getConf());
      if(linksFollowed.contains(item)) {
        getOptions().getErr().println("Infinite loop ignored: " + item.toString() + " -> " + linkedItem.toString());
        return;
      }
      linksFollowed.add(item);
      item = linkedItem;
    }
View Full Code Here

 
  /** {@inheritDoc} */
  @Override
  protected void processPathArgument(PathData item) throws IOException {
    if(item.stat.isSymlink() && (getOptions().isFollowArgLink() || getOptions().isFollowLink())) {
      item = new PathData(item.stat.getSymlink().toString(), getConf());
    }
    super.processPathArgument(item);
  }
View Full Code Here

    FileStatus fileStatus;
   
    fileStatus = mock(FileStatus.class);
    when(fileStatus.getReplication()).thenReturn((short) 1);
    fs.setFileStatus("one", fileStatus);
    one = new PathData("one", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getReplication()).thenReturn((short)2);
    fs.setFileStatus("two", fileStatus);
    two = new PathData("two", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getReplication()).thenReturn((short)3);
    fs.setFileStatus("three", fileStatus);
    three = new PathData("three", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getReplication()).thenReturn((short)4);
    fs.setFileStatus("four", fileStatus);
    four = new PathData("four", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getReplication()).thenReturn((short)5);
    fs.setFileStatus("five", fileStatus);
    five = new PathData("five", fs.getConf());
  }
View Full Code Here

    verifyNoMoreInteractions(expr);
  }
 
  @Test
  public void apply() throws IOException {
    PathData item = mock(PathData.class);
    when(expr.apply(item)).thenReturn(Result.PASS).thenReturn(Result.FAIL);
    assertEquals(Result.PASS, test.apply(item));
    assertEquals(Result.FAIL, test.apply(item));
    verify(expr, times(2)).apply(item);
    verifyNoMoreInteractions(expr);
View Full Code Here

   
    FileStatus fourDaysStat = mock(FileStatus.class);
    when(fourDaysStat.getModificationTime()).thenReturn(NOW - (4l * MIN));
    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 * MIN));
    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 * MIN) - 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 * MIN));
    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 * MIN) - 1));
    when(sixDaysMinus1Stat.toString()).thenReturn("fiveDaysPlus");
    fs.setFileStatus("fiveDaysPlus", sixDaysMinus1Stat);
    fiveDaysPlus = new PathData("fiveDaysPlus", conf);
  }
View Full Code Here

    Type type = new Type();
    addArgument(type, "d");
    type.initialise(new FindOptions());
   
    when(mockFstat.isDirectory()).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, "d");
    type.initialise(new FindOptions());
   
    when(mockFstat.isDirectory()).thenReturn(false);
    PathData item = new PathData("/one/two/test", conf);

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

    Type type = new Type();
    addArgument(type, "l");
    type.initialise(new FindOptions());
   
    when(mockFstat.isSymlink()).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, "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

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.