@Override protected String run(final String... args) throws IOException { try { final ArrayOutput ao = new ArrayOutput(); System.setOut(new PrintStream(ao)); System.setErr(NULL); new BaseX(args); return ao.toString(); } finally { System.setOut(OUT); System.setErr(ERR); } }
/** * Runs a request with the specified arguments and server arguments. * * @param args command-line arguments * @param sargs server arguments * @return result * @throws IOException I/O exception */ private static String run(final String[] args, final String[] sargs) throws IOException { final BaseXServer server = createServer(sargs); final ArrayOutput ao = new ArrayOutput(); System.setOut(new PrintStream(ao)); System.setErr(NULL); final StringList sl = new StringList(); sl.add("-p9999").add("-U" + Text.S_ADMIN).add("-P" + Text.S_ADMIN).add(args); try { new BaseXClient(sl.finish()); return ao.toString(); } finally { System.setErr(ERR); stopServer(server); } }
@Before public void init() { alist.add(a1); alist.add(a2); alist.add(a3); alist.add(a4); alist.add(a5); alist.add(a6); alist.add(a7); alist.add(a8); alist.add(a9); System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); }
@After public void cleanUpStreams() { System.setOut(null); System.setErr(null); }