use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_load_project_root_settings_on_branch.
@Test
public void should_load_project_root_settings_on_branch() {
project.setProperty(CoreProperties.PROJECT_BRANCH_PROPERTY, "mybranch");
Table<String, String, String> settings = HashBasedTable.create();
settings.put("struts:mybranch", "sonar.cpd.cross", "true");
settings.put("struts:mybranch", "sonar.java.coveragePlugin", "jacoco");
projectRef = new ProjectRepositories(settings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco");
}
use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_load_project_props.
@Test
public void should_load_project_props() {
project.setProperty("project.prop", "project");
projectRef = new ProjectRepositories(emptySettings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("project.prop")).isEqualTo("project");
}
use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.
the class AnalysisTempFolderProviderTest method setUp.
@Before
public void setUp() {
tempFolderProvider = new AnalysisTempFolderProvider();
projectReactor = mock(ProjectReactor.class);
ProjectDefinition projectDefinition = mock(ProjectDefinition.class);
when(projectReactor.getRoot()).thenReturn(projectDefinition);
when(projectDefinition.getWorkDir()).thenReturn(temp.getRoot());
}
use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_fail_when_accessing_secured_properties_in_issues_mode.
@Test
public void should_fail_when_accessing_secured_properties_in_issues_mode() {
Table<String, String, String> settings = HashBasedTable.create();
settings.put("struts", "sonar.foo.secured", "bar");
settings.put("struts", "sonar.foo.license.secured", "bar2");
when(mode.isIssues()).thenReturn(true);
projectRef = new ProjectRepositories(settings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
thrown.expect(MessageException.class);
thrown.expectMessage("Access to the secured property 'sonar.foo.secured' is not possible in issues mode. The SonarQube plugin which requires this property must be deactivated in issues mode.");
batchSettings.getString("sonar.foo.secured");
}
use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.
the class WorkDirectoryCleanerTest method setUp.
@Before
public void setUp() throws IOException {
// create files to clean
temp.newFile();
File newFolder = temp.newFolder();
File fileInFolder = new File(newFolder, "test");
fileInFolder.createNewFile();
File lock = new File(temp.getRoot(), DirectoryLock.LOCK_FILE_NAME);
lock.createNewFile();
// mock project
ProjectReactor projectReactor = mock(ProjectReactor.class);
ProjectDefinition projectDefinition = mock(ProjectDefinition.class);
when(projectReactor.getRoot()).thenReturn(projectDefinition);
when(projectDefinition.getWorkDir()).thenReturn(temp.getRoot());
assertThat(temp.getRoot().list().length).isGreaterThan(1);
cleaner = new WorkDirectoryCleaner(projectReactor);
}
Aggregations