]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7487 Drop support of properties sonar.skippedModules and sonar.includedModules 854/head
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 21 Mar 2016 10:34:03 +0000 (11:34 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 22 Mar 2016 09:07:05 +0000 (10:07 +0100)
it/it-tests/src/test/java/it/Category3Suite.java
it/it-tests/src/test/java/it/analysis/BatchTest.java
it/it-tests/src/test/java/it/analysis/ProjectExclusionsTest.java [deleted file]
sonar-core/src/main/java/org/sonar/core/config/ExclusionProperties.java
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ImmutableProjectReactorProvider.java
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ProjectExclusions.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
sonar-scanner-engine/src/test/java/org/sonar/batch/scan/ProjectExclusionsTest.java [deleted file]

index 8576080b5cba2f643b515924059284637d0e7b18..9a4d76d0ed38578839e6005a6a9a92096ddb51ed 100644 (file)
 package it;
 
 import com.sonar.orchestrator.Orchestrator;
-import it.analysis.*;
+import it.analysis.BatchTest;
+import it.analysis.ExtensionLifecycleTest;
+import it.analysis.IssueJsonReportTest;
+import it.analysis.IssuesModeTest;
+import it.analysis.LinksTest;
+import it.analysis.MavenTest;
+import it.analysis.MultiLanguageTest;
+import it.analysis.ProjectBuilderTest;
+import it.analysis.ProjectProvisioningTest;
+import it.analysis.ReportDumpTest;
+import it.analysis.SettingsEncryptionTest;
+import it.analysis.TempFolderTest;
 import it.measure.DecimalScaleMetricTest;
 import org.junit.ClassRule;
 import org.junit.runner.RunWith;
@@ -36,7 +47,6 @@ import static util.ItUtils.xooPlugin;
   LinksTest.class,
   MavenTest.class,
   ProjectBuilderTest.class,
-  ProjectExclusionsTest.class,
   TempFolderTest.class,
   MultiLanguageTest.class,
   IssueJsonReportTest.class,
index b69a4dd2abf782acf6583b4ccce6493ad27a9c5a..bf15ee6468f0317e10112270672e8f3852903576 100644 (file)
 package it.analysis;
 
 import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildFailureException;
 import com.sonar.orchestrator.build.BuildResult;
 import com.sonar.orchestrator.build.SonarRunner;
 import com.sonar.orchestrator.locator.FileLocation;
 import it.Category3Suite;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
 import org.apache.commons.io.FileUtils;
-import org.junit.*;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.ExpectedException;
 import org.junit.rules.TemporaryFolder;
@@ -36,10 +43,6 @@ import org.sonar.wsclient.services.PropertyUpdateQuery;
 import org.sonar.wsclient.services.Resource;
 import org.sonar.wsclient.services.ResourceQuery;
 import util.ItUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
 import util.QaOnly;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -89,34 +92,6 @@ public class BatchTest {
     assertThat(r.getMeasureIntValue("violations")).isEqualTo(61);
   }
 
-  /**
-   * SONAR-2907
-   */
-  @Test
-  public void branch_should_load_own_settings_from_database() {
-    orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
-    orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
-    scan("shared/xoo-multi-modules-sample");
-    assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNotNull();
-
-    Sonar sonar = orchestrator.getServer().getAdminWsClient();
-    // The parameter skippedModule considers key after first colon
-    sonar.update(new PropertyUpdateQuery("sonar.skippedModules", "multi-modules-sample:module_b",
-      "com.sonarsource.it.samples:multi-modules-sample"));
-
-    try {
-      scan("shared/xoo-multi-modules-sample");
-      assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b")).isNull();
-
-      scan("shared/xoo-multi-modules-sample",
-        "sonar.branch", "mybranch");
-
-      assertThat(getResource("com.sonarsource.it.samples:multi-modules-sample:module_b:mybranch")).isNotNull();
-    } finally {
-      sonar.delete(new PropertyDeleteQuery("sonar.skippedModules", "com.sonarsource.it.samples:multi-modules-sample"));
-    }
-  }
-
   // SONAR-4680
   @Test
   public void module_should_load_own_settings_from_database() {
@@ -172,20 +147,6 @@ public class BatchTest {
     assertThat(result.getLogs()).contains(moduleBKey + ":" + propKey + " = project");
   }
 
-  /**
-   * SONAR-3116
-   */
-  @Test
-  @Category(QaOnly.class)
-  public void should_not_exclude_root_module() {
-    orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
-    orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
-
-    thrown.expect(BuildFailureException.class);
-    scan("shared/xoo-multi-modules-sample",
-      "sonar.skippedModules", "multi-modules-sample");
-  }
-
   /**
    * SONAR-3024
    */
@@ -329,7 +290,7 @@ public class BatchTest {
 
     File cache = new File(userHome, "cache");
     assertThat(cache).exists().isDirectory();
-    int cachedFiles = FileUtils.listFiles(cache, new String[]{"jar"}, true).size();
+    int cachedFiles = FileUtils.listFiles(cache, new String[] {"jar"}, true).size();
     assertThat(cachedFiles).isGreaterThan(5);
     assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
     assertThat(result.getLogs()).contains("Download sonar-xoo-plugin-");
diff --git a/it/it-tests/src/test/java/it/analysis/ProjectExclusionsTest.java b/it/it-tests/src/test/java/it/analysis/ProjectExclusionsTest.java
deleted file mode 100644 (file)
index 81c5d1a..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package it.analysis;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.MavenBuild;
-import it.Category3Suite;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import util.ItUtils;
-import util.QaOnly;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-@Category(QaOnly.class)
-public class ProjectExclusionsTest {
-  @ClassRule
-  public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
-
-  @Before
-  public void deleteProjectData() {
-    orchestrator.resetData();
-  }
-
-  /**
-   * This use-case was a bug in 2.8-RC2. It failed when both the properties sonar.branch and sonar.skippedModules
-   * were set on the same multi-modules project.
-   */
-  @Test
-  public void shouldSupportMixOfBranchAndSkippedModules() {
-    MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
-      .setGoals("clean verify", "sonar:sonar")
-      .setProperty("sonar.dynamicAnalysis", "false")
-      .setProperty("sonar.branch", "mybranch")
-      .setProperty("sonar.skippedModules", "module_b");
-
-    orchestrator.executeBuild(build);
-
-    assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample:mybranch"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a:mybranch").getId());
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a1:mybranch").getId());
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a2:mybranch").getId());
-
-    assertNull(getResource("com.sonarsource.it.samples:module_b:mybranch"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b1:mybranch"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b2:mybranch"));
-  }
-
-  /**
-   * Black list
-   */
-  @Test
-  public void shouldExcludeModuleAndItsChildren() {
-    MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
-      .setGoals("clean verify", "sonar:sonar")
-      .setProperty("sonar.dynamicAnalysis", "false")
-      .setProperty("sonar.skippedModules", "module_b");
-
-    orchestrator.executeBuild(build);
-
-    assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a2"));
-
-    // excluded project and its children
-    assertNull(getResource("com.sonarsource.it.samples:module_b"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b1"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b2"));
-  }
-
-  /**
-   * Exhaustive white list
-   */
-  @Test
-  public void shouldIncludeModules() {
-    MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
-      .setGoals("clean verify", "sonar:sonar")
-      .setProperty("sonar.dynamicAnalysis", "false")
-      .setProperty("sonar.includedModules", "multi-modules-sample,module_a,module_a1");
-
-    orchestrator.executeBuild(build);
-
-    assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
-
-    assertNull(getResource("com.sonarsource.it.samples:module_a2"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b1"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b2"));
-  }
-
-  @Test
-  public void rootModuleShouldBeOptionalInListOfIncludedModules() {
-    MavenBuild build = MavenBuild.create(ItUtils.projectPom("shared/multi-modules-sample"))
-      .setCleanSonarGoals()
-      .setProperty("sonar.dynamicAnalysis", "false")
-      // the root module 'multi-modules-sample' is not declared
-      .setProperty("sonar.includedModules", "module_a,module_a1");
-
-    orchestrator.executeBuild(build);
-
-    assertNotNull(getResource("com.sonarsource.it.samples:multi-modules-sample"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a"));
-    assertNotNull(getResource("com.sonarsource.it.samples:module_a1"));
-
-    assertNull(getResource("com.sonarsource.it.samples:module_a2"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b1"));
-    assertNull(getResource("com.sonarsource.it.samples:module_b2"));
-  }
-
-  private Resource getResource(String key) {
-    return orchestrator.getServer().getWsClient().find(ResourceQuery.create(key));
-  }
-}
index cf4299bd61fa5b79b8d959e90f97801a7b96ff6f..4d8f859185dbc95cd7202a41ae636cf8de4950c3 100644 (file)
@@ -71,31 +71,13 @@ public class ExclusionProperties {
         .index(1)
         .build(),
 
-      PropertyDefinition.builder(CoreProperties.CORE_SKIPPED_MODULES_PROPERTY)
-        .name("Exclude Modules")
-        .description("Maven artifact ids of modules to exclude.")
-        .multiValues(true)
-        .category(CoreProperties.CATEGORY_EXCLUSIONS)
-        .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
-        .onlyOnQualifiers(Qualifiers.PROJECT)
-        .index(0)
-        .build(),
-      PropertyDefinition.builder(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY)
-        .name("Include Modules")
-        .description("Maven artifact ids of modules to include.")
-        .multiValues(true)
-        .category(CoreProperties.CATEGORY_EXCLUSIONS)
-        .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
-        .onlyOnQualifiers(Qualifiers.PROJECT)
-        .index(1)
-        .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY)
         .name("Source File Exclusions")
         .multiValues(true)
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
-        .index(2)
+        .index(0)
         .build(),
 
       PropertyDefinition.builder(CoreProperties.PROJECT_INCLUSIONS_PROPERTY)
@@ -104,7 +86,7 @@ public class ExclusionProperties {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
-        .index(3)
+        .index(1)
         .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY)
         .name("Test File Exclusions")
@@ -112,7 +94,7 @@ public class ExclusionProperties {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
-        .index(4)
+        .index(2)
         .build(),
       PropertyDefinition.builder(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY)
         .name("Test File Inclusions")
@@ -120,9 +102,9 @@ public class ExclusionProperties {
         .category(CoreProperties.CATEGORY_EXCLUSIONS)
         .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
         .onQualifiers(Qualifiers.PROJECT)
-        .index(5)
+        .index(3)
         .build()
 
-      );
+    );
   }
 }
index 71895ffded4e1aa1b1753cc04c4be6e2b2ece792..fc1bd8ad073554d3a4a0464142c367f72e3996f9 100644 (file)
@@ -206,19 +206,6 @@ public interface CoreProperties {
 
   String CORE_VIOLATION_LOCALE_DEFAULT_VALUE = "en";
 
-  /**
-   * @deprecated since 4.3. See http://jira.sonarsource.com/browse/SONAR-5109
-   */
-  @Deprecated
-  String CORE_SKIPPED_MODULES_PROPERTY = "sonar.skippedModules";
-
-  /**
-   * @since 4.0
-   * @deprecated since 4.3. See http://jira.sonarsource.com/browse/SONAR-5109
-   */
-  @Deprecated
-  String CORE_INCLUDED_MODULES_PROPERTY = "sonar.includedModules";
-
   String CORE_FORCE_AUTHENTICATION_PROPERTY = "sonar.forceAuthentication";
   boolean CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE = false;
   String CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY = "sonar.allowUsersToSignUp";
index ecf58a8848263c9d3cb325b25b9c47cbf39798dc..3a90eb145aedba25fc2ca4cc8980a1e0cc1ca3e0 100644 (file)
@@ -26,15 +26,12 @@ public class ImmutableProjectReactorProvider extends ProviderAdapter {
 
   private ImmutableProjectReactor singleton;
 
-  public ImmutableProjectReactor provide(ProjectReactor reactor, ProjectBuildersExecutor projectBuildersExecutor, ProjectExclusions exclusions, ProjectReactorValidator validator) {
+  public ImmutableProjectReactor provide(ProjectReactor reactor, ProjectBuildersExecutor projectBuildersExecutor, ProjectReactorValidator validator) {
     if (singleton == null) {
       // 1 Apply project builders
       projectBuildersExecutor.execute(reactor);
 
-      // 2 Apply project exclusions
-      exclusions.apply(reactor);
-
-      // 3 Validate final reactor
+      // 2 Validate final reactor
       validator.validate(reactor);
 
       singleton = new ImmutableProjectReactor(reactor.getRoot());
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ProjectExclusions.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ProjectExclusions.java
deleted file mode 100644 (file)
index 0bea9a8..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.batch.scan;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.api.config.Settings;
-
-/**
- * Exclude the sub-projects as defined by the properties sonar.skippedModules and sonar.includedModules
- *
- * @since 2.12
- */
-public class ProjectExclusions {
-
-  private static final Logger LOG = LoggerFactory.getLogger(ProjectExclusions.class);
-
-  private Settings settings;
-
-  public ProjectExclusions(Settings settings) {
-    this.settings = settings;
-  }
-
-  public void apply(ProjectReactor reactor) {
-    if (!reactor.getProjects().isEmpty() && StringUtils.isNotBlank(reactor.getProjects().get(0).getKey())) {
-      LOG.info("Apply project exclusions");
-
-      if (settings.hasKey(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY)) {
-        LOG.warn("'sonar.includedModules' property is deprecated since version 4.3 and should not be used anymore.");
-      }
-      if (settings.hasKey(CoreProperties.CORE_SKIPPED_MODULES_PROPERTY)) {
-        LOG.warn("'sonar.skippedModules' property is deprecated since version 4.3 and should not be used anymore.");
-      }
-
-      for (ProjectDefinition project : reactor.getProjects()) {
-        if (isExcluded(key(project), project == reactor.getRoot())) {
-          exclude(project);
-        }
-      }
-    }
-  }
-
-  private boolean isExcluded(String projectKey, boolean isRoot) {
-    String[] includedKeys = settings.getStringArray(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY);
-    boolean excluded = false;
-    if (!isRoot && includedKeys.length > 0) {
-      excluded = !ArrayUtils.contains(includedKeys, projectKey);
-    }
-    String skippedModulesProperty = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY;
-    if (!excluded) {
-      String[] excludedKeys = settings.getStringArray(skippedModulesProperty);
-      excluded = ArrayUtils.contains(excludedKeys, projectKey);
-    }
-    if (excluded && isRoot) {
-      throw new IllegalArgumentException("The root project can't be excluded. Please check the parameters " + skippedModulesProperty + " and sonar.includedModules.");
-    }
-    return excluded;
-  }
-
-  private void exclude(ProjectDefinition project) {
-    LOG.info(String.format("Exclude project: %s [%s]", project.getName(), project.getKey()));
-    project.remove();
-  }
-
-  static String key(ProjectDefinition project) {
-    String key = project.getKey();
-    if (key.contains(":")) {
-      return StringUtils.substringAfter(key, ":");
-    }
-    return key;
-  }
-}
index ff8108e487136c2d5b43f756a0ac22db746fa3e4..867547e0bddd5050cd7d4ca173d8474e3dcea970 100644 (file)
@@ -149,7 +149,6 @@ public class ProjectScanContainer extends ComponentContainer {
       PhasesTimeProfiler.class,
       ResourceTypes.class,
       DefaultProjectTree.class,
-      ProjectExclusions.class,
       ProjectReactorValidator.class,
       new AnalysisWSLoaderProvider(),
       CodeColorizers.class,
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/ProjectExclusionsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/ProjectExclusionsTest.java
deleted file mode 100644 (file)
index 4f9b403..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.batch.scan;
-
-import org.junit.Test;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.api.config.Settings;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectExclusionsTest {
-
-  ProjectReactor newReactor(String rootKey, String... moduleKeys) {
-    ProjectDefinition root = ProjectDefinition.create().setKey(rootKey);
-    for (String moduleKey : moduleKeys) {
-      ProjectDefinition module = ProjectDefinition.create().setKey(moduleKey);
-      root.addSubProject(module);
-    }
-    return new ProjectReactor(root);
-  }
-
-  @Test
-  public void testSkippedModules() {
-    Settings settings = new Settings();
-    settings.setProperty("sonar.skippedModules", "sub1,sub3");
-
-    ProjectReactor reactor = newReactor("root", "sub1", "sub2");
-
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-
-    assertThat(reactor.getProject("root")).isNotNull();
-    assertThat(reactor.getProject("sub1")).isNull();
-    assertThat(reactor.getProject("sub2")).isNotNull();
-  }
-
-  @Test
-  public void testNoSkippedModules() {
-    Settings settings = new Settings();
-    ProjectReactor reactor = newReactor("root", "sub1", "sub2");
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-
-    assertThat(reactor.getProject("root")).isNotNull();
-    assertThat(reactor.getProject("sub1")).isNotNull();
-    assertThat(reactor.getProject("sub2")).isNotNull();
-  }
-
-  @Test
-  public void testIncludedModules() {
-    Settings settings = new Settings();
-    settings.setProperty("sonar.includedModules", "sub1");
-    ProjectReactor reactor = newReactor("root", "sub1", "sub2");
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-
-    assertThat(reactor.getProject("root")).isNotNull();
-    assertThat(reactor.getProject("sub1")).isNotNull();
-    assertThat(reactor.getProject("sub2")).isNull();
-  }
-
-  @Test
-  public void shouldBeExcludedIfParentIsExcluded() {
-    ProjectDefinition sub11 = ProjectDefinition.create().setKey("sub11");
-    ProjectDefinition sub1 = ProjectDefinition.create().setKey("sub1").addSubProject(sub11);
-    ProjectDefinition root = ProjectDefinition.create().setKey("root").addSubProject(sub1);
-
-    Settings settings = new Settings();
-    settings.setProperty("sonar.skippedModules", "sub1");
-
-    ProjectReactor reactor = new ProjectReactor(root);
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-
-    assertThat(reactor.getProject("root")).isNotNull();
-    assertThat(reactor.getProject("sub1")).isNull();
-    assertThat(reactor.getProject("sub11")).isNull();
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void shouldFailIfExcludingRoot() {
-    Settings settings = new Settings();
-    settings.setProperty("sonar.skippedModules", "sub1,root");
-
-    ProjectReactor reactor = newReactor("root", "sub1", "sub2");
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-  }
-
-  @Test
-  public void shouldIgnoreMavenGroupId() {
-    ProjectReactor reactor = newReactor("org.apache.struts:struts", "org.apache.struts:struts-core", "org.apache.struts:struts-taglib");
-
-    Settings settings = new Settings();
-    settings.setProperty("sonar.skippedModules", "struts-taglib");
-
-    ProjectExclusions exclusions = new ProjectExclusions(settings);
-    exclusions.apply(reactor);
-
-    assertThat(reactor.getProject("org.apache.struts:struts")).isNotNull();
-    assertThat(reactor.getProject("org.apache.struts:struts-core")).isNotNull();
-    assertThat(reactor.getProject("org.apache.struts:struts-taglib")).isNull();
-  }
-}