]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5192 Remove support of deprecated SQ Runner properties
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 2 Apr 2014 13:25:32 +0000 (15:25 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 2 Apr 2014 13:26:12 +0000 (15:26 +0200)
sonar-batch/src/main/java/org/sonar/batch/scan/ProjectReactorBuilder.java
sonar-batch/src/test/java/org/sonar/batch/scan/ProjectReactorBuilderTest.java
sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt [deleted file]
sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt [deleted file]
sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sonar-project.properties [deleted file]
sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sources/Fake.java [deleted file]

index 5bf0455cfd40442697a807858a340169e6438c56..e1a6fd31e538de991ac2ce276fe356f56493c172 100644 (file)
@@ -20,7 +20,6 @@
 package org.sonar.batch.scan;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.filefilter.AndFileFilter;
@@ -78,20 +77,6 @@ public class ProjectReactorBuilder {
   private static final String PROPERTY_BINARIES = "sonar.binaries";
   private static final String PROPERTY_LIBRARIES = "sonar.libraries";
 
-  /**
-   * Old deprecated properties, replaced by the same ones preceded by "sonar."
-   */
-  private static final String PROPERTY_OLD_SOURCES = "sources";
-  private static final String PROPERTY_OLD_TESTS = "tests";
-  private static final String PROPERTY_OLD_BINARIES = "binaries";
-  private static final String PROPERTY_OLD_LIBRARIES = "libraries";
-  private static final Map<String, String> DEPRECATED_PROPS_TO_NEW_PROPS = ImmutableMap.of(
-    PROPERTY_OLD_SOURCES, PROPERTY_SOURCES,
-    PROPERTY_OLD_TESTS, PROPERTY_TESTS,
-    PROPERTY_OLD_BINARIES, PROPERTY_BINARIES,
-    PROPERTY_OLD_LIBRARIES, PROPERTY_LIBRARIES
-    );
-
   /**
    * Array of all mandatory properties required for a project without child.
    */
@@ -368,7 +353,6 @@ public class ProjectReactorBuilder {
 
   @VisibleForTesting
   protected static void checkMandatoryProperties(Properties props, String[] mandatoryProps) {
-    replaceDeprecatedProperties(props);
     StringBuilder missing = new StringBuilder();
     for (String mandatoryProperty : mandatoryProps) {
       if (!props.containsKey(mandatoryProperty)) {
@@ -472,24 +456,6 @@ public class ProjectReactorBuilder {
     }
   }
 
-  /**
-   * Replaces the deprecated properties by the new ones, and logs a message to warn the users.
-   */
-  @VisibleForTesting
-  protected static void replaceDeprecatedProperties(Properties props) {
-    for (Entry<String, String> entry : DEPRECATED_PROPS_TO_NEW_PROPS.entrySet()) {
-      String key = entry.getKey();
-      if (props.containsKey(key)) {
-        String newKey = entry.getValue();
-        LOG.warn("/!\\ The '{}' property is deprecated and is replaced by '{}'. Don't forget to update your files.", key, newKey);
-        String value = props.getProperty(key);
-        props.remove(key);
-        props.put(newKey, value);
-      }
-    }
-
-  }
-
   @VisibleForTesting
   protected static void mergeParentProperties(Properties childProps, Properties parentProps) {
     List<String> moduleIds = Lists.newArrayList(getListFromProperty(parentProps, PROPERTY_MODULES));
index 1ea32a24d0b016d6e2da92ad4471363be312d210..a427a5da6894e0b64b561db034f2f0c9e8853184 100644 (file)
@@ -58,16 +58,6 @@ public class ProjectReactorBuilderTest {
       TestUtils.getResource(this.getClass(), "simple-project/libs/lib2.txt").getAbsolutePath());
   }
 
-  @Test
-  public void shouldDefineSimpleProjectWithDeprecatedProperties() throws IOException {
-    ProjectDefinition projectDefinition = loadProjectDefinition("simple-project-with-deprecated-props");
-
-    assertThat(projectDefinition.getSourceDirs()).contains("sources");
-    assertThat(projectDefinition.getLibraries()).contains(
-      TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath(),
-      TestUtils.getResource(this.getClass(), "simple-project-with-deprecated-props/libs/lib2.txt").getAbsolutePath());
-  }
-
   @Test
   public void shouldFailOnInvalidProjectKey() throws IOException {
     thrown.expect(IllegalStateException.class);
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib1.txt
deleted file mode 100644 (file)
index 81d4e95..0000000
+++ /dev/null
@@ -1 +0,0 @@
-lib1
\ No newline at end of file
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/libs/lib2.txt
deleted file mode 100644 (file)
index 7dacac0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-lib2
\ No newline at end of file
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sonar-project.properties b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sonar-project.properties
deleted file mode 100644 (file)
index 1b2b596..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-sonar.projectKey=com.foo.project
-sonar.projectName=Foo Project
-sonar.projectVersion=1.0-SNAPSHOT
-sonar.projectDescription=Description of Foo Project
-
-# Those are the deprecated properties
-sources=sources
-libraries=libs/*.txt
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sources/Fake.java b/sonar-batch/src/test/resources/org/sonar/batch/scan/ProjectReactorBuilderTest/simple-project-with-deprecated-props/sources/Fake.java
deleted file mode 100644 (file)
index b2e6462..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Fake