Package org.apache.hadoop.fs.shell

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


    FileStatus fileStatus;
   
    fileStatus = mock(FileStatus.class);
    when(fileStatus.getLen()).thenReturn(5l * 512l);
    fs.setFileStatus("fiveBlocks", fileStatus);
    fiveBlocks = new PathData("fiveBlocks", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getLen()).thenReturn(6l * 512l);
    fs.setFileStatus("sixBlocks", fileStatus);
    sixBlocks = new PathData("sixBlocks", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getLen()).thenReturn(4l * 512l);
    fs.setFileStatus("fourBlocks", fileStatus);
    fourBlocks = new PathData("fourBlocks", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getLen()).thenReturn((5l * 512l) + 511);
    fs.setFileStatus("fiveBlocksPlus", fileStatus);
    fiveBlocksPlus = new PathData("fiveBlocksPlus", fs.getConf());

    fileStatus = mock(FileStatus.class);
    when(fileStatus.getLen()).thenReturn((5l * 512l) - 1);
    fs.setFileStatus("fiveBlocksMinus", fileStatus);
    fiveBlocksMinus = new PathData("fiveBlocksMinus", fs.getConf());
  }
View Full Code Here


    name.initialise(new FindOptions());
  }
 
  @Test
  public void applyPass() throws IOException{
    PathData item = new PathData("/directory/path/name", conf);
    assertEquals(Result.PASS, name.apply(item));
  }
View Full Code Here

    assertEquals(Result.PASS, name.apply(item));
  }

  @Test
  public void applyFail() throws IOException{
    PathData item = new PathData("/directory/path/notname", conf);
    assertEquals(Result.FAIL, name.apply(item));
  }
View Full Code Here

    PathData item = new PathData("/directory/path/notname", conf);
    assertEquals(Result.FAIL, name.apply(item));
  }
  @Test
  public void applyMixedCase() throws IOException{
    PathData item = new PathData("/directory/path/NaMe", conf);
    assertEquals(Result.PASS, name.apply(item));
  }
View Full Code Here

    FileStatus fileStatus = mock(FileStatus.class);
    when(fileStatus.getPath()).thenReturn(new Path(pathname));
   
    fs.setFileStatus("test", fileStatus);
    fs.setGlobStatus("test", new FileStatus[]{fileStatus});
    item = new PathData(pathname, fs.getConf());
   
    TestCommand.testOut = out;
    TestCommand.testErr = err;
    TestCommand.testConf = conf;
  }
View Full Code Here

    FileStatus fstat1 = mock(FileStatus.class);
    when(fstat1.getPath()).thenReturn(new Path("test1"));
    when(fstat1.toString()).thenReturn("test1");
    fs.setFileStatus("test1", fstat1);
    fs.setGlobStatus("test1", new FileStatus[]{fstat1});
    PathData item1 = new PathData("test1", fs.getConf());

    FileStatus fstat2 = mock(FileStatus.class);
    when(fstat2.getPath()).thenReturn(new Path("test2"));
    when(fstat2.toString()).thenReturn("test2");
    fs.setFileStatus("test2", fstat2);
    fs.setGlobStatus("test2", new FileStatus[]{fstat2});
    PathData item2 = new PathData("test2", fs.getConf());

    FileStatus fstat3 = mock(FileStatus.class);
    when(fstat3.getPath()).thenReturn(new Path("test3"));
    when(fstat3.toString()).thenReturn("test3");
    fs.setFileStatus("test3", fstat3);
    fs.setGlobStatus("test3", new FileStatus[]{fstat3});
    PathData item3 = new PathData("test3", fs.getConf());
   
    assertEquals(Result.PASS, exec.apply(item1));
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
   
    assertEquals(Result.PASS, exec.apply(item2));
    verify(out).println("TestCommand.processPath:"+item1.toString());
    verify(out).println("TestCommand.processPath:"+item2.toString());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
   
    assertEquals(Result.PASS, exec.apply(item3));
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);

    exec.finish();
    verify(out).println("TestCommand.processPath:"+item3.toString());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
  }
View Full Code Here

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

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

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

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

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

    name.initialise(new FindOptions());
  }
 
  @Test
  public void applyPass() throws IOException{
    PathData item = new PathData("/directory/path/name", conf);
    assertEquals(Result.PASS, name.apply(item));
  }
View Full Code Here

    assertEquals(Result.PASS, name.apply(item));
  }

  @Test
  public void applyFail() throws IOException{
    PathData item = new PathData("/directory/path/notname", conf);
    assertEquals(Result.FAIL, name.apply(item));
  }
View Full Code Here

    PathData item = new PathData("/directory/path/notname", conf);
    assertEquals(Result.FAIL, name.apply(item));
  }
  @Test
  public void applyMixedCase() throws IOException{
    PathData item = new PathData("/directory/path/NaMe", conf);
    assertEquals(Result.FAIL, name.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.