diff options
author | Julien HENRY <henryju@yahoo.fr> | 2016-07-04 11:58:10 +0200 |
---|---|---|
committer | Julien HENRY <henryju@yahoo.fr> | 2016-07-05 14:00:16 +0200 |
commit | 103f9ca40fe6c4864aa489119c1590e0449f1b9f (patch) | |
tree | a990c8be0e88b324307c2e3163559a42b1cfa0ac /server/sonar-server | |
parent | b7fcb4dd974df546cc13faa6be6529ca6bc26688 (diff) | |
download | sonarqube-103f9ca40fe6c4864aa489119c1590e0449f1b9f.tar.gz sonarqube-103f9ca40fe6c4864aa489119c1590e0449f1b9f.zip |
SONAR-7727 Remove deprecated stuff from Resources API
Diffstat (limited to 'server/sonar-server')
13 files changed, 12 insertions, 112 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilter.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilter.java index 74c0608c9d0..5d6869ed555 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilter.java @@ -22,17 +22,14 @@ package org.sonar.server.measure; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.Lists; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.sonar.api.measures.Metric; -import org.sonar.api.resources.Qualifiers; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - import java.util.Collections; import java.util.Date; import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.sonar.api.measures.Metric; public class MeasureFilter { @@ -81,12 +78,6 @@ public class MeasureFilter { public MeasureFilter setResourceQualifiers(@Nullable List<String> list) { this.resourceQualifiers = sanitize(list); - if (resourceQualifiers.contains(Qualifiers.FILE)) { - resourceQualifiers.add(Qualifiers.CLASS); - } - if (resourceQualifiers.contains(Qualifiers.DIRECTORY)) { - resourceQualifiers.add(Qualifiers.PACKAGE); - } return this; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java b/server/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java index 176f533dbe3..3afca7f9f76 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java @@ -21,9 +21,6 @@ package org.sonar.server.platform; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import javax.annotation.CheckForNull; import org.apache.commons.io.FileUtils; import org.picocontainer.Startable; @@ -124,28 +121,4 @@ public class DefaultServerFileSystem implements ServerFileSystem, Startable { return new File(getDeployDir(), "plugins/index.txt"); } - /** - * @deprecated since 4.1 - */ - @Override - @Deprecated - public List<File> getExtensions(String dirName, String... suffixes) { - File dir = new File(getHomeDir(), "extensions/rules/" + dirName); - if (dir.exists() && dir.isDirectory()) { - return getFiles(dir, suffixes); - } - return Collections.emptyList(); - } - - private List<File> getFiles(File dir, String... fileSuffixes) { - List<File> files = new ArrayList<>(); - if (dir != null && dir.exists()) { - if (fileSuffixes != null && fileSuffixes.length > 0) { - files.addAll(FileUtils.listFiles(dir, fileSuffixes, false)); - } else { - files.addAll(FileUtils.listFiles(dir, null, false)); - } - } - return files; - } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/WsParameterBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/ws/WsParameterBuilder.java index 533b4237fb2..7f83e1c4bd0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ws/WsParameterBuilder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/WsParameterBuilder.java @@ -19,12 +19,6 @@ */ package org.sonar.server.ws; -import static com.google.common.base.Predicates.not; -import static com.google.common.collect.FluentIterable.from; -import static com.google.common.collect.Ordering.natural; -import static java.lang.String.format; -import static org.sonar.server.component.ResourceTypeFunctions.RESOURCE_TYPE_TO_QUALIFIER; - import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; import java.util.Locale; @@ -35,11 +29,16 @@ import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.ResourceTypes; import org.sonar.api.server.ws.WebService; +import static com.google.common.base.Predicates.not; +import static com.google.common.collect.FluentIterable.from; +import static com.google.common.collect.Ordering.natural; +import static java.lang.String.format; +import static org.sonar.server.component.ResourceTypeFunctions.RESOURCE_TYPE_TO_QUALIFIER; + public class WsParameterBuilder { private static final String PARAM_QUALIFIER = "qualifier"; private static final String PARAM_QUALIFIERS = "qualifiers"; - private static final Set<String> DEPRECATED_QUALIFIERS = ImmutableSet.of( - Qualifiers.CLASS, Qualifiers.PACKAGE, Qualifiers.FIELD, Qualifiers.LIBRARY, Qualifiers.METHOD, Qualifiers.PARAGRAPH); + private static final Set<String> DEPRECATED_QUALIFIERS = ImmutableSet.of(Qualifiers.LIBRARY); private WsParameterBuilder() { // static methods only diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/DefaultServerFileSystemTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/DefaultServerFileSystemTest.java deleted file mode 100644 index 77fab5bad25..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/platform/DefaultServerFileSystemTest.java +++ /dev/null @@ -1,62 +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.server.platform; - -import com.google.common.io.Resources; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.sonar.api.platform.ServerFileSystem; - -import java.io.File; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DefaultServerFileSystemTest { - - private static final String PATH = "org/sonar/server/platform/DefaultServerFileSystemTest/"; - - @Rule - public TemporaryFolder temp = new TemporaryFolder(); - - @Test - public void find_checkstyle_extensions() throws Exception { - ServerFileSystem fs = new DefaultServerFileSystem( - new File(Resources.getResource(PATH + "shouldFindCheckstyleExtensions").toURI()), temp.newFolder(), null); - - List<File> xmls = fs.getExtensions("checkstyle", "xml"); - assertThat(xmls).hasSize(1); - - List<File> all = fs.getExtensions("checkstyle"); - assertThat(all).hasSize(3); - } - - @Test - public void not_fail_if_no_checkstyle_extensions() throws Exception { - ServerFileSystem fs = new DefaultServerFileSystem( - new File(Resources.getResource(PATH + "shouldNotFailIfNoCheckstyleExtensions").toURI()), temp.newFolder(), null); - List<File> xmls = fs.getExtensions("checkstyle", "xml"); - assertThat(xmls).isEmpty(); - - List<File> jars = fs.getExtensions("checkstyle"); - assertThat(jars).isEmpty(); - } -} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.jar b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.jar +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.xml b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.xml deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.xml +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules2.jar b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules2.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules2.jar +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin1.jar b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin1.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin1.jar +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin2.jar b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin2.jar deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin2.jar +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoCheckstyleExtensions/extensions/rules/pmd/pmd.xml b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoCheckstyleExtensions/extensions/rules/pmd/pmd.xml deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoCheckstyleExtensions/extensions/rules/pmd/pmd.xml +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoPlugins/extensions/plugins/nojar.txt b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoPlugins/extensions/plugins/nojar.txt deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoPlugins/extensions/plugins/nojar.txt +++ /dev/null diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/mysql/fake.jar b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/mysql/fake.jar deleted file mode 100644 index 904931cfaf0..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/mysql/fake.jar +++ /dev/null @@ -1 +0,0 @@ -asdad
\ No newline at end of file diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/none/nojar.txt b/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/none/nojar.txt deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/none/nojar.txt +++ /dev/null |