Source:
public static void main(String[] args) { if (args.length == 0 || (!args[0].equalsIgnoreCase("list") && !args[0].equalsIgnoreCase("dump") && !args[0] .equalsIgnoreCase("mktest"))) printHelp(); if (args.length <= 1) printHelp(); String jobId = args[1]; if (args[0].equalsIgnoreCase("list")) { try { FileSystem fs = ServerUtils.getFileSystem(); String jobTracePath = ServerUtils.getTraceFileRoot(jobId, DebugTrace.REGULAR); Path traceFilePath = new Path(jobTracePath); FileStatus[] fileStatuses = fs.listStatus(traceFilePath); for (FileStatus status : fileStatuses) { System.out.println(status.getPath().getName()); } } catch (IOException e) { e.printStackTrace(System.err); } } else { if (args.length <= 3) printHelp(); Long superstepNo = Long.parseLong(args[2]); String vertexId = args[3]; try { @SuppressWarnings("rawtypes") GiraphVertexScenarioWrapper scenarioWrapper = ServerUtils.readScenarioFromTrace(jobId, superstepNo, vertexId); if (scenarioWrapper == null) { System.err.println("The trace file does not exist."); System.exit(0); } if (args[0].equalsIgnoreCase("dump")) { System.out.println(scenarioWrapper); } else if (args[0].equalsIgnoreCase("mktest")) { String outputPrefix = null; String testClass = null; if (args.length > 4) { outputPrefix = args[4].trim(); testClass = outputPrefix.substring(outputPrefix.lastIndexOf('/') + 1, outputPrefix.length()); } TestCaseGenerator generator = new TestCaseGenerator(); String generatedTestCase = generator.generateTest(scenarioWrapper, null, testClass); if (outputPrefix != null) { try (PrintWriter writer = new PrintWriter(new FileWriter(new File(outputPrefix + ".java")))) { writer.append(generatedTestCase); } } System.out.println(generatedTestCase); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException e) { System.err.println(e.getMessage()); } } }

Target:
public static void main(String[] args) { if (args.length == 0 || (!args[0].equalsIgnoreCase("list") && !args[0].equalsIgnoreCase("dump") && !args[0].equalsIgnoreCase("mktest"))) printHelp(); if (args.length <= 1) printHelp(); String jobId = args[1]; if (args[0].equalsIgnoreCase("list")) { try { FileSystem fs = ServerUtils.getFileSystem(); String jobTracePath = ServerUtils.getTraceFileRoot(jobId, DebugTrace.REGULAR); Path traceFilePath = new Path(jobTracePath); FileStatus[] fileStatuses = fs.listStatus(traceFilePath); for (FileStatus status : fileStatuses) { LOG.info(status.getPath().getName()); } } catch (IOException e) { LOG.error(e.getMessage(), e); } } else { if (args.length <= 3) printHelp(); Long superstepNo = Long.parseLong(args[2]); String vertexId = args[3]; try { @SuppressWarnings("rawtypes") GiraphVertexScenarioWrapper scenarioWrapper = ServerUtils.readScenarioFromTrace(jobId, superstepNo, vertexId); if (scenarioWrapper == null) { LOG.error("The trace file does not exist."); System.exit(0); } if (args[0].equalsIgnoreCase("dump")) { LOG.info(scenarioWrapper); } else if (args[0].equalsIgnoreCase("mktest")) { String outputPrefix = null; String testClass = null; if (args.length > 4) { outputPrefix = args[4].trim(); testClass = outputPrefix.substring(outputPrefix.lastIndexOf('/') + 1, outputPrefix.length()); } ComputationComputeTestGenerator generator = new ComputationComputeTestGenerator(); String generatedTestCase = generator.generateTest(scenarioWrapper, null, testClass); if (outputPrefix != null) { try (PrintWriter writer = new PrintWriter(new FileWriter(new File(outputPrefix + ".java")))) { writer.append(generatedTestCase); } } LOG.info(generatedTestCase); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException e) { LOG.error(e.getMessage(), e); } } }