Ejemplo n.º 1
0
  @Test
  public void shouldExecuteStashReview() throws Exception {
    // given
    String[] args = toArgs("-conf %s -pullRequestId %s", SAMPLE_CONFIG, SAMPLE_PULL_REQUEST_ID);

    // when
    CommandLine commandLine = fixture.parse(args);

    // then
    cliAssert(commandLine)
        .hasOption(CliOption.PULL_REQUEST_ID.getCommandLineParam())
        .withValue(SAMPLE_PULL_REQUEST_ID);
  }
Ejemplo n.º 2
0
  @Test
  public void shouldExecuteGerritReview() throws Exception {
    // given
    String[] args =
        toArgs(
            "-conf %s -changeId %s -revisionId %s",
            SAMPLE_CONFIG, SAMPLE_CHANGE_ID, SAMPLE_REVISION_ID);

    // when
    CommandLine commandLine = fixture.parse(args);

    // then
    cliAssert(commandLine).hasOption(CliOption.CONF.getCommandLineParam()).withValue(SAMPLE_CONFIG);
    cliAssert(commandLine)
        .hasOption(CliOption.CHANGE_ID.getCommandLineParam())
        .withValue(SAMPLE_CHANGE_ID);
    cliAssert(commandLine)
        .hasOption(CliOption.REVISION_ID.getCommandLineParam())
        .withValue(SAMPLE_REVISION_ID);
  }
Ejemplo n.º 3
0
  public static void main(String[] args) {
    printWelcomeMessage();
    CliWrapper cliWrapper = new CliWrapper();
    CommandLine commandLine = null;
    try {
      commandLine = cliWrapper.parse(args);
    } catch (ParseException e) {
      printUsage(cliWrapper);
      System.out.println(e.getMessage());
      System.exit(1);
    }

    Configuration configuration =
        ConfigurationBuilder.initFromFile(
            commandLine.getOptionValue(CliOption.CONF.getCommandLineParam()));
    configuration.updateWithCliOptions(commandLine);

    ConnectorFacade facade = getConnectorFacade(configuration);
    new Engine(facade, facade, configuration).run();
  }