Search in sources :

Example 6 with GlobalProperties

use of org.sonar.scanner.bootstrap.GlobalProperties in project sonarqube by SonarSource.

the class GlobalModeTest method createMode.

private GlobalMode createMode(String key, String value) {
    Map<String, String> map = new HashMap<>();
    if (key != null) {
        map.put(key, value);
    }
    GlobalProperties props = new GlobalProperties(map);
    return new GlobalMode(props);
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) HashMap(java.util.HashMap) GlobalMode(org.sonar.scanner.bootstrap.GlobalMode)

Example 7 with GlobalProperties

use of org.sonar.scanner.bootstrap.GlobalProperties in project sonarqube by SonarSource.

the class ProjectSettingsTest method prepare.

@Before
public void prepare() {
    emptyFileData = ImmutableTable.of();
    emptySettings = ImmutableTable.of();
    project = ProjectDefinition.create().setKey("struts");
    globalMode = mock(GlobalMode.class);
    mode = mock(DefaultAnalysisMode.class);
    bootstrapProps = new GlobalSettings(new GlobalProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(), mock(SettingsLoader.class), globalMode);
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) GlobalMode(org.sonar.scanner.bootstrap.GlobalMode) GlobalSettings(org.sonar.scanner.bootstrap.GlobalSettings) DefaultAnalysisMode(org.sonar.scanner.analysis.DefaultAnalysisMode) Before(org.junit.Before)

Example 8 with GlobalProperties

use of org.sonar.scanner.bootstrap.GlobalProperties in project sonarqube by SonarSource.

the class GlobalTempFolderProviderTest method dotWorkingDir.

@Test
public void dotWorkingDir() throws IOException {
    File sonarHome = temp.getRoot();
    String globalWorkDir = ".";
    GlobalProperties globalProperties = new GlobalProperties(ImmutableMap.of("sonar.userHome", sonarHome.getAbsolutePath(), CoreProperties.GLOBAL_WORKING_DIRECTORY, globalWorkDir));
    TempFolder tempFolder = tempFolderProvider.provide(globalProperties);
    File newFile = tempFolder.newFile();
    assertThat(newFile.getParentFile().getParentFile().getAbsolutePath()).isEqualTo(sonarHome.getAbsolutePath());
    assertThat(newFile.getParentFile().getName()).startsWith(".sonartmp_");
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) TempFolder(org.sonar.api.utils.TempFolder) File(java.io.File) Test(org.junit.Test)

Example 9 with GlobalProperties

use of org.sonar.scanner.bootstrap.GlobalProperties in project sonarqube by SonarSource.

the class GlobalTempFolderProviderTest method createTempFolderProps.

@Test
public void createTempFolderProps() throws Exception {
    File workingDir = temp.newFolder();
    TempFolder tempFolder = tempFolderProvider.provide(new GlobalProperties(ImmutableMap.of(CoreProperties.GLOBAL_WORKING_DIRECTORY, workingDir.getAbsolutePath())));
    tempFolder.newDir();
    tempFolder.newFile();
    assertThat(getCreatedTempDir(workingDir)).exists();
    assertThat(getCreatedTempDir(workingDir).list()).hasSize(2);
    FileUtils.deleteQuietly(workingDir);
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) TempFolder(org.sonar.api.utils.TempFolder) File(java.io.File) Test(org.junit.Test)

Example 10 with GlobalProperties

use of org.sonar.scanner.bootstrap.GlobalProperties in project sonarqube by SonarSource.

the class GlobalPropertiesTest method test_copy_of_properties.

@Test
public void test_copy_of_properties() {
    Map<String, String> map = Maps.newHashMap();
    map.put("foo", "bar");
    GlobalProperties wrapper = new GlobalProperties(map);
    assertThat(wrapper.properties()).containsOnly(entry("foo", "bar"));
    assertThat(wrapper.properties()).isNotSameAs(map);
    map.put("put", "after_copy");
    assertThat(wrapper.properties()).hasSize(1);
}
Also used : GlobalProperties(org.sonar.scanner.bootstrap.GlobalProperties) Test(org.junit.Test)

Aggregations

GlobalProperties (org.sonar.scanner.bootstrap.GlobalProperties)10 Test (org.junit.Test)7 File (java.io.File)5 TempFolder (org.sonar.api.utils.TempFolder)4 HashMap (java.util.HashMap)3 DefaultAnalysisMode (org.sonar.scanner.analysis.DefaultAnalysisMode)3 AnalysisProperties (org.sonar.scanner.analysis.AnalysisProperties)2 GlobalMode (org.sonar.scanner.bootstrap.GlobalMode)2 Before (org.junit.Before)1 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)1 System2 (org.sonar.api.utils.System2)1 GlobalSettings (org.sonar.scanner.bootstrap.GlobalSettings)1 GlobalTempFolderProvider (org.sonar.scanner.bootstrap.GlobalTempFolderProvider)1