Examples of Exec


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

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

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

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

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

    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

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

    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

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

    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

Examples of org.apache.hadoop.hbase.client.coprocessor.Exec

    dob.writeUTF(protocolName);

    DataInputBuffer dib = new DataInputBuffer();
    dib.reset(dob.getData(), dob.getLength());

    Exec after = new Exec();
    after.setConf(HBaseConfiguration.create());
    after.readFields(dib);
    // no error thrown
    assertEquals(after.getProtocolName(), protocolName);
    assertEquals(after.getMethodName(), methodName);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.Exec

  public Object invoke(Object instance, final Method method, final Object[] args)
      throws Throwable {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
    }
    Exec exec = new Exec(conf, protocol, method, args);
    ExecResult result = connection.getMaster().execCoprocessor(exec);
    LOG.debug("Master Result is value="+result.getValue());
    return result.getValue();
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.Exec

    if (LOG.isDebugEnabled()) {
      LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
    }

    if (row != null) {
      final Exec exec = new Exec(conf, row, protocol, method, args);
      ServerCallable<ExecResult> callable =
          new ServerCallable<ExecResult>(connection, table, row) {
            public ExecResult call() throws Exception {
              return server.execCoprocessor(location.getRegionInfo().getRegionName(),
                  exec);
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.Exec

    dob.writeUTF(protocolName);

    DataInputBuffer dib = new DataInputBuffer();
    dib.reset(dob.getData(), dob.getLength());

    Exec after = new Exec();
    after.readFields(dib);
    // no error thrown
    assertEquals(after.getProtocolName(), protocolName);
    assertEquals(after.getMethodName(), methodName);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.Exec

    if (LOG.isDebugEnabled()) {
      LOG.debug("Call: "+method.getName()+", "+(args != null ? args.length : 0));
    }

    if (row != null) {
      final Exec exec = new Exec(conf, row, protocol, method, args);
      ServerCallable<ExecResult> callable =
          new ServerCallable<ExecResult>(connection, table, row) {
            public ExecResult call() throws Exception {
              return server.execCoprocessor(location.getRegionInfo().getRegionName(),
                  exec);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.