public static void main(String[] argv) {
    try {
      YarnConfiguration conf = new YarnConfiguration();
      GenericOptionsParser hParser = new GenericOptionsParser(conf, argv);
      argv = hParser.getRemainingArgs();
      if (argv.length > 1) {
        if (argv[0].equals("-format-policy-store")) {
          handFormatPolicyStateStore(conf);
        } else {
          printUsage(System.err);
        }
      } else {
        startGPG(argv, conf);
      }
    } catch (Throwable t) {
      LOG.error("Error starting global policy generator", t);
      System.exit(-1);
    }
  }
@Test
  public void testGPGCLI() {
    ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
    ByteArrayOutputStream dataErr = new ByteArrayOutputStream();
    System.setOut(new PrintStream(dataOut));
    System.setErr(new PrintStream(dataErr));
    GlobalPolicyGenerator.main(new String[]{"-help", "-format-policy-store"});
    assertTrue(dataErr.toString().contains(
        "Usage: yarn gpg [-format-policy-store]"));
  }