Package org.sonar.api.utils

Examples of org.sonar.api.utils.System2


  @Before
  public void setUp() throws Exception {
    db.executeUpdateSql("truncate table active_rule_changes");
    db.executeUpdateSql("truncate table active_rule_param_changes");
    DbClient dbClient = new DbClient(db.database(), db.myBatis());
    System2 system = mock(System2.class);
    when(system.now()).thenReturn(UtcDateUtils.parseDateTime("2014-07-03T12:00:00+0000").getTime());
    migration = new FeedQProfileDatesMigration(dbClient, system);
  }
View Full Code Here


    assertThat(command.getEnvironmentVariables()).isNotEmpty();
  }

  @Test
  public void override_env_variables() {
    System2 system = mock(System2.class);
    when(system.envVariables()).thenReturn(ImmutableMap.of("JAVA_HOME", "/default/path/to/java"));

    Command command = new Command("java", system);
    command.setEnvironmentVariable("JAVA_HOME", "/new/path/to/java");
    assertThat(command.getEnvironmentVariables().get("JAVA_HOME")).isEqualTo("/new/path/to/java");
  }
View Full Code Here

    assertThat(command.getEnvironmentVariables().get("JAVA_HOME")).isEqualTo("/new/path/to/java");
  }

  @Test
  public void should_use_cmd_for_new_shell_on_windows() {
    System2 system = mock(System2.class);
    when(system.isOsWindows()).thenReturn(true);
    Command command = new Command("foo.bat", system);
    command.setNewShell(true);
    assertThat(command.toCommandLine()).isEqualTo("cmd /C call foo.bat");
    assertThat(command.isNewShell()).isTrue();
View Full Code Here

  }

  @Test
  public void should_use_sh_for_new_shell_on_unix() {
    System2 system = mock(System2.class);
    when(system.isOsWindows()).thenReturn(false);
    Command command = new Command("foo.sh", system);

    command.setNewShell(true);
    assertThat(command.toCommandLine()).isEqualTo("sh foo.sh");
    assertThat(command.isNewShell()).isTrue();
View Full Code Here

  @Before
  public void before() {
    this.session = db.myBatis().openSession(false);

    System2 system2 = mock(System2.class);
    when(system2.now()).thenReturn(DateUtils.parseDate("2011-09-29").getTime());
    this.sut = new SwitchSnapshotStep(new SnapshotDao(system2));
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.utils.System2

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.