@Override protected void testProgram() throws Exception { WordCount.main(new String[] { "--input", textPath, "--output", resultPath }); } }
@Test public void testWordCountPlan() { try { // without arguments try { final int parallelism = 1; // some ops have DOP 1 forced JsonValidator validator = new GenericValidator(parallelism, 3); TestingExecutionEnvironment.setAsNext(validator, parallelism); WordCount.main(new String[0]); } catch (AbortError ignored) {} // with arguments try { final int parallelism = 17; JsonValidator validator = new GenericValidator(parallelism, 3); TestingExecutionEnvironment.setAsNext(validator, parallelism); String tmpDir = tempFolder.newFolder().getAbsolutePath(); WordCount.main(new String[] { "--input", tmpDir, "--output", tmpDir}); } catch (AbortError ignored) {} } catch (Exception e) { restoreStreams(); e.printStackTrace(); fail(e.getMessage()); } }
@Test public void dumpWordCount() { // prepare the test environment PreviewPlanEnvironment env = new PreviewPlanEnvironment(); env.setAsContext(); try { WordCount.main(new String[] { "--input", IN_FILE, "--output", OUT_FILE}); } catch (OptimizerPlanEnvironment.ProgramAbortException pae) { // all good. } catch (Exception e) { e.printStackTrace(); Assert.fail("WordCount failed with an exception"); } dump(env.getPlan()); }
@Test public void dumpWordCount() { // prepare the test environment PreviewPlanEnvironment env = new PreviewPlanEnvironment(); env.setAsContext(); try { WordCount.main(new String[] { "--input", IN_FILE, "--output", OUT_FILE}); } catch (OptimizerPlanEnvironment.ProgramAbortException pae) { // all good. } catch (Exception e) { e.printStackTrace(); Assert.fail("WordCount failed with an exception"); } dump(env.getPlan()); }
public static void main(String[] args) throws Exception { WordCount.main(args); }