FSConfigToCSConfigConverterMain { public static void main(String[] args) { try { FSConfigToCSConfigArgumentHandler fsConfigConversionArgumentHandler = new FSConfigToCSConfigArgumentHandler(); int exitCode = fsConfigConversionArgumentHandler.parseAndConvert(args); if (exitCode != 0) { LOG.error(FATAL, "Error while starting FS configuration conversion, " + "see previous error messages for details!"); } System.exit(exitCode); } catch (Throwable t) { LOG.error(FATAL, "Error while starting FS configuration conversion!", t); System.exit(-1); } }  static void main(String[] args);  }
@Test public void testConvertFSConfigurationDefaults() throws Exception { setupFSConfigConversionFiles(); exit.expectSystemExitWithStatus(0); FSConfigToCSConfigConverterMain.main(new String[] { "-o", OUTPUT_DIR, "-y", YARN_SITE_XML, "-f", FS_ALLOC_FILE, "-r", CONVERSION_RULES_FILE}); boolean csConfigExists = new File(OUTPUT_DIR, "capacity-scheduler.xml").exists(); boolean yarnSiteConfigExists = new File(OUTPUT_DIR, "yarn-site.xml").exists(); assertTrue("capacity-scheduler.xml was not generated", csConfigExists); assertTrue("yarn-site.xml was not generated", yarnSiteConfigExists); }
@Test public void testConvertFSConfigurationWithConsoleParam() throws Exception { setupFSConfigConversionFiles(); exit.expectSystemExitWithStatus(0); FSConfigToCSConfigConverterMain.main(new String[] { "-p", "-m", "-y", YARN_SITE_XML, "-f", FS_ALLOC_FILE, "-r", CONVERSION_RULES_FILE}); String stdout = converterTestCommons.getStdOutContent().toString(); assertTrue("Stdout doesn't contain yarn-site.xml", stdout.contains("======= yarn-site.xml =======")); assertTrue("Stdout doesn't contain capacity-scheduler.xml", stdout.contains("======= capacity-scheduler.xml =======")); assertTrue("Stdout doesn't contain mapping-rules.json", stdout.contains("======= mapping-rules.json =======")); }
@Test public void testShortHelpSwitch() { exit.expectSystemExitWithStatus(0); FSConfigToCSConfigConverterMain.main(new String[] {"-h"}); verifyHelpText(); }
@Test public void testLongHelpSwitch() { exit.expectSystemExitWithStatus(0); FSConfigToCSConfigConverterMain.main(new String[] {"--help"}); verifyHelpText(); }
@Test public void testConvertFSConfigurationWithLongSwitches() throws IOException { exit.expectSystemExitWithStatus(0); setupFSConfigConversionFiles(); FSConfigToCSConfigConverterMain.main(new String[] { "--print", "--convert-placement-rules", "--yarnsiteconfig", YARN_SITE_XML, "--fsconfig", FS_ALLOC_FILE, "--rulesconfig", CONVERSION_RULES_FILE}); String stdout = converterTestCommons.getStdOutContent().toString(); assertTrue("Stdout doesn't contain yarn-site.xml", stdout.contains("======= yarn-site.xml =======")); assertTrue("Stdout doesn't contain capacity-scheduler.xml", stdout.contains("======= capacity-scheduler.xml =======")); assertTrue("Stdout doesn't contain mapping-rules.json", stdout.contains("======= mapping-rules.json =======")); }