@Test public void simple() throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (FileList.Writer writer = FileList.createWriter(buffer)) { Path testing = new Path(PREFIX, "testing"); put(writer, testing, "Hello, world!"); } ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); int result = new WindGateHadoopPut(conf).execute(in); assertThat(result, is(0)); Map<String, String> contents = get(); assertThat(contents.size(), is(1)); assertThat(contents.get("testing"), is("Hello, world!")); }
int execute(InputStream in, String... args) { assert args != null; if (args.length != 0) { WGLOG.error("E21001", Arrays.asList(args)); System.err.printf("usage: java -classpath ... %s%n", WindGateHadoopPut.class.getName()); return 1; } WGLOG.info("I21001"); try (FileList.Reader reader = FileList.createReader(new BufferedInputStream(in, BUFFER_SIZE))) { doPut(reader); WGLOG.info("I21002"); reader.close(); return 0; } catch (IOException e) { WGLOG.info(e, "I21002"); return 1; } }
WindGateHadoopPut extends WindGateHadoopBase { int execute(InputStream in, String... args) { assert args != null; if (args.length != 0) { WGLOG.error("E21001", Arrays.asList(args)); System.err.printf("usage: java -classpath ... %s%n", WindGateHadoopPut.class.getName()); return 1; } WGLOG.info("I21001"); try (FileList.Reader reader = FileList.createReader(new BufferedInputStream(in, BUFFER_SIZE))) { doPut(reader); WGLOG.info("I21002"); reader.close(); return 0; } catch (IOException e) { WGLOG.info(e, "I21002"); return 1; } } }
WindGateHadoopPut extends WindGateHadoopBase { int execute(InputStream in, String... args) { assert args != null; if (args.length != 0) { WGLOG.error("E21001", Arrays.asList(args)); System.err.printf("usage: java -classpath ... %s%n", WindGateHadoopPut.class.getName()); return 1; } WGLOG.info("I21001"); try (FileList.Reader reader = FileList.createReader(new BufferedInputStream(in, BUFFER_SIZE))) { doPut(reader); WGLOG.info("I21002"); reader.close(); return 0; } catch (IOException e) { WGLOG.info(e, "I21002"); return 1; } } WindGateHadoopPut(Configuration conf); }
WindGateHadoopPut extends WindGateHadoopBase { int execute(InputStream in, String... args) { assert args != null; if (args.length != 0) { WGLOG.error("E21001", Arrays.asList(args)); System.err.printf("usage: java -classpath ... %s%n", WindGateHadoopPut.class.getName()); return 1; } WGLOG.info("I21001"); try (FileList.Reader reader = FileList.createReader(new BufferedInputStream(in, BUFFER_SIZE))) { doPut(reader); WGLOG.info("I21002"); reader.close(); return 0; } catch (IOException e) { WGLOG.info(e, "I21002"); return 1; } } WindGateHadoopPut(Configuration conf); static void main(String[] args); }
WindGateHadoopPut extends WindGateHadoopBase { int execute(InputStream in, String... args) { assert args != null; if (args.length != 0) { WGLOG.error("E21001", Arrays.asList(args)); System.err.printf("usage: java -classpath ... %s%n", WindGateHadoopPut.class.getName()); return 1; } WGLOG.info("I21001"); try (FileList.Reader reader = FileList.createReader(new BufferedInputStream(in, BUFFER_SIZE))) { doPut(reader); WGLOG.info("I21002"); reader.close(); return 0; } catch (IOException e) { WGLOG.info(e, "I21002"); return 1; } } WindGateHadoopPut(Configuration conf); static void main(String[] args);  }