HadoopClusterQuantiserTool extends Configured implements Tool { public static void main(String[] args) throws Exception { try { ToolRunner.run(new HadoopClusterQuantiserTool(), args); } catch (final CmdLineException e) { System.err.print(e); } }  @Override int run(String[] args); static void main(String[] args);  }
@Test public void testBottomUp() throws Exception{ HadoopClusterQuantiserTool.main( new String[]{ "-D","mapred.child.java.opts=\"-Xmx2000M\"", "-D","mapred.job.map.memory.mb=1100","-D","mapred.job.reduce.memory.mb=1100", "-i",featureSeqFile.getAbsolutePath(), "-o",hadoopQuantisedOutput.getAbsolutePath(), "-q",codebookFile.getAbsolutePath(), "-t","BINARY_KEYPOINT" }); String[] inputImages = new String[name2File.size()]; int i = 0; for(File entry: keypointOut.listFiles()){ inputImages[i++] = entry.getAbsolutePath(); } ClusterQuantiser.main(new String[]{ "-o",normalQuantisedOutput.getAbsolutePath(), "-q",codebookFile.getAbsolutePath(), "-t","BINARY_KEYPOINT", "-k", "1", "-d", "1", inputImages[0],inputImages[1] }); Path[] sequenceFiles = SequenceFileUtility.getFilePaths(hadoopQuantisedOutput.getAbsolutePath(), "part"); for(Path path : sequenceFiles){ SequenceFileUtility<Text, BytesWritable> utility = new TextBytesSequenceFileUtility(path.toUri(), true); utility.exportData(quantisedKeypointOut.getAbsolutePath()); } Map<String,FileLocalFeatureList<QuantisedKeypoint> > UUID2QuantisedHDFS = new HashMap<String,FileLocalFeatureList<QuantisedKeypoint> >(); Map<String,FileLocalFeatureList<QuantisedKeypoint> > UUID2QuantisedNormal = new HashMap<String,FileLocalFeatureList<QuantisedKeypoint> >(); for(String key:UUID2Name.keySet()) { for(File f : normalQuantisedOutput.listFiles()){ if(f.getAbsolutePath().indexOf(key) != -1){ UUID2QuantisedNormal.put(key, FileLocalFeatureList.read(f, QuantisedKeypoint.class)); } } for(File f : quantisedKeypointOut.listFiles()){ if(f.getAbsolutePath().indexOf(key) != -1){ UUID2QuantisedHDFS.put(key, FileLocalFeatureList.read(f, QuantisedKeypoint.class)); } } int[][] qflHDFS = UUID2QuantisedHDFS.get(key).asDataArray(new int[UUID2QuantisedHDFS.get(key).size()][]); int[][] qflNormal = UUID2QuantisedNormal.get(key).asDataArray(new int[UUID2QuantisedNormal.get(key).size()][]); assertTrue(qflHDFS.length == qflNormal.length); for(int j = 0 ; j < qflNormal.length ; j++){ Integer qfNormal = qflNormal[j][0]; Integer qfHDFS = qflHDFS[j][0]; assertTrue(qfNormal == qfHDFS); } } System.out.println("Done!"); }