@Test public void multiple() throws Exception { Path path1 = new Path(PREFIX, "testing-1"); Path path2 = new Path(PREFIX, "testing-2"); Path path3 = new Path(PREFIX, "testing-3"); put(path1, "Hello1, world!"); put(path2, "Hello2, world!"); put(path3, "Hello3, world!"); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int result = new WindGateHadoopGet(conf).execute(buffer, path1.toString(), path2.toString(), path3.toString()); assertThat(result, is(0)); Map<String, String> contents = get(buffer.toByteArray()); assertThat(contents.size(), is(3)); assertThat(contents.get("testing-1"), is("Hello1, world!")); assertThat(contents.get("testing-2"), is("Hello2, world!")); assertThat(contents.get("testing-3"), is("Hello3, world!")); }
int execute(OutputStream out, String... args) { assert args != null; if (args.length == 0) { WGLOG.error("E20001", Arrays.toString(args)); System.err.printf("usage: java -classpath ... %s file1 [file2 ...]%n", WindGateHadoopGet.class.getName()); return 1; } List<Path> paths = new ArrayList<>(); for (String arg : args) { paths.add(new Path(arg)); } WGLOG.info("I20001", paths); try (FileList.Writer writer = FileList.createWriter(new BufferedOutputStream(out, BUFFER_SIZE))) { doGet(paths, writer); WGLOG.info("I20002", paths); writer.close(); return 0; } catch (IOException e) { WGLOG.error(e, "E20002", paths); return 1; } catch (InterruptedException e) { WGLOG.error(e, "E20003", paths); return 1; } }
WindGateHadoopGet extends WindGateHadoopBase { int execute(OutputStream out, String... args) { assert args != null; if (args.length == 0) { WGLOG.error("E20001", Arrays.toString(args)); System.err.printf("usage: java -classpath ... %s file1 [file2 ...]%n", WindGateHadoopGet.class.getName()); return 1; } List<Path> paths = new ArrayList<>(); for (String arg : args) { paths.add(new Path(arg)); } WGLOG.info("I20001", paths); try (FileList.Writer writer = FileList.createWriter(new BufferedOutputStream(out, BUFFER_SIZE))) { doGet(paths, writer); WGLOG.info("I20002", paths); writer.close(); return 0; } catch (IOException e) { WGLOG.error(e, "E20002", paths); return 1; } catch (InterruptedException e) { WGLOG.error(e, "E20003", paths); return 1; } } }
WindGateHadoopGet extends WindGateHadoopBase { int execute(OutputStream out, String... args) { assert args != null; if (args.length == 0) { WGLOG.error("E20001", Arrays.toString(args)); System.err.printf("usage: java -classpath ... %s file1 [file2 ...]%n", WindGateHadoopGet.class.getName()); return 1; } List<Path> paths = new ArrayList<>(); for (String arg : args) { paths.add(new Path(arg)); } WGLOG.info("I20001", paths); try (FileList.Writer writer = FileList.createWriter(new BufferedOutputStream(out, BUFFER_SIZE))) { doGet(paths, writer); WGLOG.info("I20002", paths); writer.close(); return 0; } catch (IOException e) { WGLOG.error(e, "E20002", paths); return 1; } catch (InterruptedException e) { WGLOG.error(e, "E20003", paths); return 1; } } WindGateHadoopGet(Configuration conf); }
WindGateHadoopGet extends WindGateHadoopBase { int execute(OutputStream out, String... args) { assert args != null; if (args.length == 0) { WGLOG.error("E20001", Arrays.toString(args)); System.err.printf("usage: java -classpath ... %s file1 [file2 ...]%n", WindGateHadoopGet.class.getName()); return 1; } List<Path> paths = new ArrayList<>(); for (String arg : args) { paths.add(new Path(arg)); } WGLOG.info("I20001", paths); try (FileList.Writer writer = FileList.createWriter(new BufferedOutputStream(out, BUFFER_SIZE))) { doGet(paths, writer); WGLOG.info("I20002", paths); writer.close(); return 0; } catch (IOException e) { WGLOG.error(e, "E20002", paths); return 1; } catch (InterruptedException e) { WGLOG.error(e, "E20003", paths); return 1; } } WindGateHadoopGet(Configuration conf); static void main(String[] args); }
WindGateHadoopGet extends WindGateHadoopBase { int execute(OutputStream out, String... args) { assert args != null; if (args.length == 0) { WGLOG.error("E20001", Arrays.toString(args)); System.err.printf("usage: java -classpath ... %s file1 [file2 ...]%n", WindGateHadoopGet.class.getName()); return 1; } List<Path> paths = new ArrayList<>(); for (String arg : args) { paths.add(new Path(arg)); } WGLOG.info("I20001", paths); try (FileList.Writer writer = FileList.createWriter(new BufferedOutputStream(out, BUFFER_SIZE))) { doGet(paths, writer); WGLOG.info("I20002", paths); writer.close(); return 0; } catch (IOException e) { WGLOG.error(e, "E20002", paths); return 1; } catch (InterruptedException e) { WGLOG.error(e, "E20003", paths); return 1; } } WindGateHadoopGet(Configuration conf); static void main(String[] args);  }