@Test public void countWords() throws Exception { File inputFile = getTestTempFile("temperatures.tsv"); File outputDir = getTestTempDir("output"); outputDir.delete(); writeLines(inputFile, readLines("/one/temperatures.tsv")); double minimumQuality = 0.25; Configuration conf = new Configuration(); AverageTemperaturePerMonth averageTemperaturePerMonth = new AverageTemperaturePerMonth(); averageTemperaturePerMonth.setConf(conf); averageTemperaturePerMonth.run(new String[] { "--input", inputFile.getAbsolutePath(), "--output", outputDir.getAbsolutePath(), "--minimumQuality", String.valueOf(minimumQuality) }); Map<YearAndMonth, Double> results = readResults(new File(outputDir, "part-r-00000")); assertEquals(results.get(new YearAndMonth(1990, 8)), 8, EPSILON); assertEquals(results.get(new YearAndMonth(1992, 4)), 7.888, EPSILON); assertEquals(results.get(new YearAndMonth(1994, 1)), 8.24, EPSILON); }
@Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); double minimumQuality = Double.parseDouble(parsedArgs.get("--minimumQuality")); return 0; }
AverageTemperaturePerMonth extends HadoopJob { @Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); double minimumQuality = Double.parseDouble(parsedArgs.get("--minimumQuality")); return 0; } }
AverageTemperaturePerMonth extends HadoopJob { @Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); double minimumQuality = Double.parseDouble(parsedArgs.get("--minimumQuality")); return 0; }  }
AverageTemperaturePerMonth extends HadoopJob { @Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); double minimumQuality = Double.parseDouble(parsedArgs.get("--minimumQuality")); return 0; }  @Override int run(String[] args); }
AverageTemperaturePerMonth extends HadoopJob { @Override public int run(String[] args) throws Exception { Map<String,String> parsedArgs = parseArgs(args); Path inputPath = new Path(parsedArgs.get("--input")); Path outputPath = new Path(parsedArgs.get("--output")); double minimumQuality = Double.parseDouble(parsedArgs.get("--minimumQuality")); return 0; }  @Override int run(String[] args);  }