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

Examples of org.apache.hadoop.fs.shell.find.Exec$Ok


    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyRepeatArg() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand {} {} ;"));
    exec.initialise(options);
    assertEquals(Result.PASS, exec.apply(item));
    verify(out, times(2)).println("TestCommand.processPath:"+item.toString());
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
  }
View Full Code Here


    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyAdditionalArg() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand path1 {} path2 ;"));
    exec.initialise(options);
   
    FileStatus fstat1 = mock(FileStatus.class);
    when(fstat1.getPath()).thenReturn(new Path("path1"));
    FileStatus fstat2 = mock(FileStatus.class);
    when(fstat2.getPath()).thenReturn(new Path("path2"));
    fs.setGlobStatus("path1", new FileStatus[]{fstat1});
    fs.setGlobStatus("path2", new FileStatus[]{fstat2});

    assertEquals(Result.PASS, exec.apply(item));
    verify(out).println("TestCommand.processPath:path1");
    verify(out).println("TestCommand.processPath:"+item.toString());
    verify(out).println("TestCommand.processPath:path2");
    verifyNoMoreInteractions(out);
    verifyNoMoreInteractions(err);
View Full Code Here

    verifyNoMoreInteractions(err);
  }
 
  @Test
  public void applyBatched() throws IOException {
    Exec exec = new Exec();
    exec.addArguments(getArgs("-testCommand {} +"));
    exec.initialise(options);
    exec.setMaxArgs(2);
   
    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

TOP

Related Classes of org.apache.hadoop.fs.shell.find.Exec$Ok

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.