Search in sources :

Example 1 with ProjectReactor

use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.

the class ProjectReactorBuilder method execute.

public ProjectReactor execute() {
    Profiler profiler = Profiler.create(LOG).startInfo("Process project properties");
    new DroppedPropertyChecker(analysisProps.properties(), DROPPED_PROPERTIES).checkDroppedProperties();
    Map<String, Map<String, String>> propertiesByModuleIdPath = new HashMap<>();
    extractPropertiesByModule(propertiesByModuleIdPath, "", "", analysisProps.properties());
    ProjectDefinition rootProject = defineRootProject(propertiesByModuleIdPath.get(""), null);
    rootProjectWorkDir = rootProject.getWorkDir();
    defineChildren(rootProject, propertiesByModuleIdPath, "");
    cleanAndCheckProjectDefinitions(rootProject);
    // Since task properties are now empty we should add root module properties
    analysisProps.properties().putAll(propertiesByModuleIdPath.get(""));
    profiler.stopDebug();
    return new ProjectReactor(rootProject);
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) ProjectDefinition(org.sonar.api.batch.bootstrap.ProjectDefinition)

Example 2 with ProjectReactor

use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.

the class ProjectReactorValidatorTest method should_not_fail_with_dot_key.

@Test
public void should_not_fail_with_dot_key() {
    ProjectReactor reactor = createProjectReactor("foo.bar");
    validator.validate(reactor);
}
Also used : ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) Test(org.junit.Test)

Example 3 with ProjectReactor

use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.

the class ProjectReactorValidatorTest method not_fail_with_alphanumeric_key.

@Test
public void not_fail_with_alphanumeric_key() {
    ProjectReactor reactor = createProjectReactor("Foobar2");
    validator.validate(reactor);
}
Also used : ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) Test(org.junit.Test)

Example 4 with ProjectReactor

use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.

the class ProjectReactorValidatorTest method fail_with_invalid_key.

@Test
public void fail_with_invalid_key() {
    ProjectReactor reactor = createProjectReactor("foo$bar");
    thrown.expect(MessageException.class);
    thrown.expectMessage("\"foo$bar\" is not a valid project or module key");
    validator.validate(reactor);
}
Also used : ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) Test(org.junit.Test)

Example 5 with ProjectReactor

use of org.sonar.api.batch.bootstrap.ProjectReactor in project sonarqube by SonarSource.

the class ProjectReactorValidatorTest method not_fail_with_colon_key.

@Test
public void not_fail_with_colon_key() {
    ProjectReactor reactor = createProjectReactor("foo:bar");
    validator.validate(reactor);
}
Also used : ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) Test(org.junit.Test)

Aggregations

ProjectReactor (org.sonar.api.batch.bootstrap.ProjectReactor)22 Test (org.junit.Test)16 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)5 ProjectRepositories (org.sonar.scanner.repository.ProjectRepositories)5 Before (org.junit.Before)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Profiler (org.sonar.api.utils.log.Profiler)1 AnalysisProperties (org.sonar.scanner.analysis.AnalysisProperties)1 AnalysisTempFolderProvider (org.sonar.scanner.analysis.AnalysisTempFolderProvider)1 DroppedPropertyChecker (org.sonar.scanner.bootstrap.DroppedPropertyChecker)1 ProjectLock (org.sonar.scanner.scan.ProjectLock)1 WorkDirectoryCleaner (org.sonar.scanner.scan.WorkDirectoryCleaner)1