Package org.sonar.runner.api

Examples of org.sonar.runner.api.Runner


        }
        return containsSources;
    }

    public SonarRunnerResult executeRunner(UserCredentials token, ProcessMonitor processMonitor) throws MvnModelInputException {
        Runner runner = createForProject(token, processMonitor);
        try {
            runner.execute();
        } catch (Exception ex) {
            if (wrapper.isUnauthorized()) {
                throw new AuthorizationException();
            } else {
                throw new SonarRunnerException(ex);
View Full Code Here


  Properties props = new Properties();

  @Test
  public void should_create_embedded_runner_by_default() {
    props.setProperty("foo", "bar");
    Runner runner = new RunnerFactory().create(props);

    assertThat(runner).isInstanceOf(EmbeddedRunner.class);
    assertThat(runner.properties().get("foo")).isEqualTo("bar");
  }
View Full Code Here

  @Test
  public void should_create_forked_runner() {
    props.setProperty("foo", "bar");
    props.setProperty("sonarRunner.mode", "fork");
    props.setProperty("sonarRunner.fork.jvmArgs", "-Xms128m -Xmx512m");
    Runner runner = new RunnerFactory().create(props);

    assertThat(runner).isInstanceOf(ForkedRunner.class);
    assertThat(runner.properties().get("foo")).isEqualTo("bar");
    assertThat(((ForkedRunner)runner).jvmArguments()).contains("-Xms128m", "-Xmx512m");
  }
View Full Code Here

  @Test
    public void should_create_forked_runner_with_jvm_arguments() {
      props.setProperty("foo", "bar");
      props.setProperty("sonarRunner.mode", "fork");
      Runner runner = new RunnerFactory().create(props);

      assertThat(runner).isInstanceOf(ForkedRunner.class);
      assertThat(runner.properties().get("foo")).isEqualTo("bar");
      assertThat(((ForkedRunner)runner).jvmArguments()).isEmpty();
    }
View Full Code Here

    verify(exit).exit(0);
  }

  @Test
  public void should_fail_on_error() {
    Runner runner = mock(Runner.class);
    doThrow(new IllegalStateException("Error")).when(runner).execute();
    when(runnerFactory.create(any(Properties.class))).thenReturn(runner);

    Main main = new Main(exit, cli, conf, runnerFactory);
    main.execute();
View Full Code Here

import java.util.Properties;

class RunnerFactory {

  Runner create(Properties props) {
    Runner runner;
    if ("fork".equals(props.getProperty("sonarRunner.mode"))) {
      runner = ForkedRunner.create();
      String jvmArgs = props.getProperty("sonarRunner.fork.jvmArgs", "");
      if (!"".equals(jvmArgs)) {
        ((ForkedRunner)runner).addJvmArguments(jvmArgs.split(" "));
      }

    } else {
      runner = EmbeddedRunner.create();
    }
    runner.addProperties(props);
    return runner;
  }
View Full Code Here

TOP

Related Classes of org.sonar.runner.api.Runner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.