static String testCommandLineScript(List<String> argList, InputStream inputStream,
      OutStream streamType)
      throws Throwable {
    BeeLine beeLine = new BeeLine();
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream beelineOutputStream = new PrintStream(os);
    switch (streamType) {
    case OUT:
      beeLine.setOutputStream(beelineOutputStream);
      break;
    case ERR:
      beeLine.setErrorStream(beelineOutputStream);
      break;
    default:
      throw new RuntimeException("Unexpected outstream type " + streamType);
    }
    String[] args = argList.toArray(new String[argList.size()]);
    beeLine.begin(args, inputStream);
    beeLine.close();
    beelineOutputStream.close();
    String output = os.toString("UTF8");
    return output;
  }
Execute a script with "beeline -f or -i"
@param argList List of arguments for beeline
@param inputStream input stream if any
@param streamType if output from STDERR or STDOUT needs to be returned
@return The stderr and stdout from running the script
@throws Throwable
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java