diff options
58 files changed, 124 insertions, 1331 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/DeprecatedResourceApiSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/DeprecatedResourceApiSensor.java index bd7cee61f44..3e51d046716 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/DeprecatedResourceApiSensor.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/DeprecatedResourceApiSensor.java @@ -53,12 +53,9 @@ public class DeprecatedResourceApiSensor implements Sensor { @Override public void analyse(Project module, org.sonar.api.batch.SensorContext context) { - createIssueOnDir(new Directory("")); - File src = fileSystem.sourceDirs().get(0); - for (File f : fileSystem.files(FileQuery.onMain().onLanguage(Xoo.KEY))) { - String relativePathFromSourceDir = new PathResolver().relativePath(src, f); - org.sonar.api.resources.File sonarFile = new org.sonar.api.resources.File(relativePathFromSourceDir); + String relativePathFromSourceDir = new PathResolver().relativePath(fileSystem.baseDir(), f); + org.sonar.api.resources.File sonarFile = org.sonar.api.resources.File.create(relativePathFromSourceDir); Issuable issuable = perspectives.as(Issuable.class, sonarFile); issuable.addIssue(issuable.newIssueBuilder() .ruleKey(RuleKey.of(XooRulesDefinition.XOO_REPOSITORY, RULE_KEY)) diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java index ae7dcac8378..4062a8747f3 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java @@ -21,7 +21,6 @@ package org.sonar.ce.container; import java.io.File; import java.io.IOException; -import java.util.List; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -115,9 +114,5 @@ public class CePluginJarExploderTest { return tempDir; } - @Override - public List<File> getExtensions(String dirName, String... suffixes) { - throw new UnsupportedOperationException(); - } } } 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 diff --git a/sonar-core/src/main/java/org/sonar/core/component/DefaultResourceTypes.java b/sonar-core/src/main/java/org/sonar/core/component/DefaultResourceTypes.java index c23cf2bd596..03fe1f5d58f 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/DefaultResourceTypes.java +++ b/sonar-core/src/main/java/org/sonar/core/component/DefaultResourceTypes.java @@ -20,10 +20,10 @@ package org.sonar.core.component; import org.sonar.api.batch.ScannerSide; +import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.ResourceType; import org.sonar.api.resources.ResourceTypeTree; -import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.server.ServerSide; @ScannerSide @@ -59,24 +59,18 @@ public final class DefaultResourceTypes { .addType(ResourceType.builder(Qualifiers.DIRECTORY) .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) - .addType(ResourceType.builder(Qualifiers.PACKAGE) - .build()) .addType(ResourceType.builder(Qualifiers.FILE) .hasSourceCode() .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) - .addType(ResourceType.builder(Qualifiers.CLASS) - .hasSourceCode() - .build()) .addType(ResourceType.builder(Qualifiers.UNIT_TEST_FILE) .hasSourceCode() .setProperty(SUPPORTS_MEASURE_FILTERS, true) .build()) .addRelations(Qualifiers.PROJECT, Qualifiers.MODULE) - .addRelations(Qualifiers.MODULE, Qualifiers.DIRECTORY, Qualifiers.PACKAGE) + .addRelations(Qualifiers.MODULE, Qualifiers.DIRECTORY) .addRelations(Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE) - .addRelations(Qualifiers.PACKAGE, Qualifiers.CLASS, Qualifiers.UNIT_TEST_FILE) .build(); } diff --git a/sonar-core/src/test/java/org/sonar/core/component/DefaultResourceTypesTest.java b/sonar-core/src/test/java/org/sonar/core/component/DefaultResourceTypesTest.java index 801c84da141..8d1557b43fe 100644 --- a/sonar-core/src/test/java/org/sonar/core/component/DefaultResourceTypesTest.java +++ b/sonar-core/src/test/java/org/sonar/core/component/DefaultResourceTypesTest.java @@ -31,7 +31,7 @@ public class DefaultResourceTypesTest { public void provide_types() { ResourceTypeTree tree = DefaultResourceTypes.get(); - assertThat(tree.getTypes()).hasSize(7); + assertThat(tree.getTypes()).hasSize(5); assertThat(tree.getChildren(Qualifiers.PROJECT)).containsExactly(Qualifiers.MODULE); } diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java index a8a49a0ac29..da0db73cd1a 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java @@ -46,7 +46,7 @@ public class ResourceIndexDao extends AbstractDao { // Directories and packages are explicitly excluded. private static final String[] RENAMABLE_QUALIFIERS = {Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.VIEW, Qualifiers.SUBVIEW}; private static final String[] RENAMABLE_SCOPES = {Scopes.PROJECT}; - private static final String[] NOT_RENAMABLE_QUALIFIERS = {Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE, Qualifiers.CLASS}; + private static final String[] NOT_RENAMABLE_QUALIFIERS = {Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE}; private static final String[] NOT_RENAMABLE_SCOPES = {Scopes.FILE}; public ResourceIndexDao(MyBatis myBatis, System2 system2) { diff --git a/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java index 43faf115245..36fbe09f697 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java @@ -69,7 +69,7 @@ public class ResourceIndexDaoTest { } @Test - public void shouldNotIndexPackages() { + public void shouldNotIndexDirectories() { dbTester.prepareDbUnit(getClass(), "shouldNotIndexPackages.xml"); underTest.indexProject("ABCD"); diff --git a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java index 6569992d9b1..bf53a27b372 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java @@ -186,8 +186,9 @@ public class SnapshotDaoTest { assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setComponentUuid("ABCD").setSort(BY_DATE, ASC)).get(0).getId()).isEqualTo(1L); assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setComponentUuid("ABCD").setSort(BY_DATE, DESC)).get(0).getId()).isEqualTo(3L); - assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setScope(Scopes.PROJECT).setQualifier(Qualifiers.PACKAGE))).extracting("id").containsOnly(1L); - assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setScope(Scopes.DIRECTORY).setQualifier(Qualifiers.PACKAGE))).extracting("id").containsOnly( + assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setScope(Scopes.PROJECT).setQualifier(Qualifiers.DIRECTORY))).extracting("id") + .containsOnly(1L); + assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setScope(Scopes.DIRECTORY).setQualifier(Qualifiers.DIRECTORY))).extracting("id").containsOnly( 2L, 3L, 4L, 5L, 6L); assertThat(underTest.selectSnapshotsByQuery(db.getSession(), new SnapshotQuery().setComponentUuid("ABCD"))).hasSize(3); diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml index a21482b3613..b1e6adb30fc 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml @@ -40,7 +40,7 @@ <projects long_name="org.struts" id="3" scope="DIR" - qualifier="PAC" + qualifier="DIR" kee="org.struts:struts-core:org.struts" uuid="CDEF" uuid_path="NOT_USED" @@ -57,8 +57,8 @@ <projects long_name="org.struts.RequestContext" id="4" - scope="CLA" - qualifier="CLA" + scope="FIL" + qualifier="FIL" uuid="DEFG" uuid_path="NOT_USED" project_uuid="ABCD" @@ -106,73 +106,73 @@ name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="equestcontext" position="1" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="questcontext" position="2" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="uestcontext" position="3" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="estcontext" position="4" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="stcontext" position="5" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="tcontext" position="6" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="context" position="7" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="ontext" position="8" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="ntext" position="9" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="text" position="10" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <resource_index kee="ext" position="11" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" - qualifier="CLA"/> + qualifier="FIL"/> <!-- Struts --> <resource_index kee="struts" diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml index 69706bb423c..78e69d56ec0 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml @@ -37,7 +37,7 @@ <projects long_name="org.struts" id="3" scope="DIR" - qualifier="PAC" + qualifier="DIR" kee="org.struts:struts-core:org.struts" uuid="CDEF" uuid_path="NOT_USED" @@ -53,7 +53,7 @@ <projects long_name="org.struts.RequestContext" id="4" scope="FIL" - qualifier="CLA" + qualifier="FIL" uuid="DEFG" uuid_path="NOT_USED" project_uuid="ABCD" diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml index ee07faf3fc8..0e759d63ea9 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml @@ -21,7 +21,7 @@ <projects long_name="org.struts" id="2" scope="DIR" - qualifier="PAC" + qualifier="DIR" kee="org.struts:struts:org.struts" uuid="BCDE" uuid_path="NOT_USED" @@ -38,7 +38,7 @@ <projects long_name="org.struts.RequestContext" id="3" scope="FIL" - qualifier="CLA" + qualifier="FIL" kee="org.struts:struts:org.struts.RequestContext" uuid="CDEF" uuid_path="NOT_USED" @@ -66,7 +66,7 @@ root_component_uuid="ABCD" component_uuid="BCDE" scope="DIR" - qualifier="PAC"/> + qualifier="DIR"/> <snapshots purge_status="[null]" id="3" islast="[true]" @@ -74,5 +74,5 @@ root_component_uuid="ABCD" component_uuid="CDEF" scope="FIL" - qualifier="CLA"/> + qualifier="FIL"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml index 953c02f906f..1f791dc0b64 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml @@ -47,7 +47,7 @@ period5_date="1317160800000" depth="1" scope="PRJ" - qualifier="PAC" + qualifier="DIR" created_at="1228172400001" build_date="1317247200000" version="2.0-SNAPSHOT" @@ -78,7 +78,7 @@ period5_date="1317160800000" depth="1" scope="DIR" - qualifier="PAC" + qualifier="DIR" created_at="1228172400002" build_date="1317247200000" version="2.1-SNAPSHOT" @@ -109,7 +109,7 @@ period5_date="1317160800000" depth="1" scope="DIR" - qualifier="PAC" + qualifier="DIR" created_at="1228172400003" build_date="1317247200000" version="2.2-SNAPSHOT" @@ -161,7 +161,7 @@ period5_date="1317160800000" depth="1" scope="DIR" - qualifier="PAC" + qualifier="DIR" created_at="1228172400000" build_date="1317247200000" version="2.1-SNAPSHOT" @@ -193,7 +193,7 @@ period5_date="1317160800000" depth="1" scope="DIR" - qualifier="PAC" + qualifier="DIR" created_at="1228172400000" build_date="1317247200000" version="2.1-SNAPSHOT" @@ -245,7 +245,7 @@ period5_date="1317160800000" depth="1" scope="DIR" - qualifier="PAC" + qualifier="DIR" created_at="1228172400000" build_date="1317247200000" version="2.1-SNAPSHOT" diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java index 3ea25fc8b0e..06b0e1a889e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java @@ -455,15 +455,6 @@ public class Measure<G extends Serializable> implements Serializable { } /** - * Called by views when cloning measures - * @deprecated since 4.4 not used - */ - @Deprecated - public Measure<G> setId(Long id) { - return this; - } - - /** * @return the first variation value * @since 2.5 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java index d54049aae0e..334b663ea88 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java @@ -20,7 +20,6 @@ package org.sonar.api.platform; import java.io.File; -import java.util.List; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.server.ServerSide; @@ -35,11 +34,4 @@ public interface ServerFileSystem { File getTempDir(); - /** - * @param suffixes the file suffixes. If null, then return all the files, whatever their suffix - * @deprecated since 4.1 - */ - @Deprecated - List<File> getExtensions(String dirName, String... suffixes); - } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java index eb89b3bc3f7..fdad251a589 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java @@ -45,22 +45,6 @@ public class Directory extends Resource { } /** - * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)} - */ - @Deprecated - public Directory(String relativePathFromSourceDir) { - this(relativePathFromSourceDir, null); - } - - /** - * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)} - */ - @Deprecated - public Directory(String relativePathFromSourceDir, Language language) { - this.relativePathFromSourceDir = parseKey(relativePathFromSourceDir); - } - - /** * Internal. */ public String relativePathFromSourceDir() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java index 8ce94861a68..2fa8adc4767 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java @@ -19,14 +19,10 @@ */ package org.sonar.api.resources; -import java.util.List; -import javax.annotation.CheckForNull; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ToStringBuilder; -import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; -import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.api.utils.WildcardPattern; /** @@ -51,50 +47,6 @@ public class File extends Resource { } /** - * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)} - */ - @Deprecated - public File(String relativePathFromSourceDir) { - if (relativePathFromSourceDir == null) { - throw new IllegalArgumentException("File key is null"); - } - this.relativePathFromSourceDir = parseKey(relativePathFromSourceDir); - } - - /** - * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)} - */ - @Deprecated - public File(String relativeDirectoryPathFromSourceDir, String filename) { - this.filename = StringUtils.trim(filename); - if (StringUtils.isBlank(relativeDirectoryPathFromSourceDir)) { - this.relativePathFromSourceDir = filename; - } else { - this.relativePathFromSourceDir = new StringBuilder().append(Directory.parseKey(relativeDirectoryPathFromSourceDir)).append(Directory.SEPARATOR).append(this.filename) - .toString(); - } - } - - /** - * @deprecated since 4.2 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)} - */ - @Deprecated - public File(Language language, String relativePathFromSourceDir) { - this(relativePathFromSourceDir); - this.language = language; - } - - /** - * Creates a File from language, directory and filename - * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)} - */ - @Deprecated - public File(Language language, String relativeDirectoryPathFromSourceDir, String filename) { - this(relativeDirectoryPathFromSourceDir, filename); - this.language = language; - } - - /** * Internal. */ public String relativePathFromSourceDir() { @@ -133,39 +85,6 @@ public class File extends Resource { } /** - * Creates a File from an io.file and a list of sources directories - * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)} - */ - @Deprecated - @CheckForNull - public static File fromIOFile(java.io.File file, List<java.io.File> sourceDirs) { - PathResolver.RelativePath relativePath = new PathResolver().relativePath(sourceDirs, file); - if (relativePath != null) { - return new File(relativePath.path()); - } - return null; - } - - /** - * Creates a {@link File} from an absolute {@link java.io.File} and a module. - * The returned {@link File} can be then passed for example to - * {@link SensorContext#saveMeasure(Resource, org.sonar.api.measures.Measure)}. - * @param file absolute path to a file - * @param module - * @return null if the file is not under module basedir. - * @deprecated since 4.5 use {@link FileSystem#inputFile(org.sonar.api.batch.fs.FilePredicate)} - */ - @Deprecated - @CheckForNull - public static File fromIOFile(java.io.File file, Project module) { - String relativePathFromBasedir = new PathResolver().relativePath(module.getBaseDir(), file); - if (relativePathFromBasedir != null) { - return File.create(relativePathFromBasedir); - } - return null; - } - - /** * {@inheritDoc} * * @see Resource#getName() diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java deleted file mode 100644 index 374c662a8db..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java +++ /dev/null @@ -1,79 +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.api.resources; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; - -/** - * Java language implementation - * This class have been moved in the plugin sonar-java - * - * @since 1.10 - * @deprecated in 3.6 - */ -@Deprecated -public class Java extends AbstractLanguage { - - public static final Java INSTANCE = new Java(); - - /** - * Java key - */ - public static final String KEY = "java"; - - /** - * Java name - */ - public static final String NAME = "Java"; - - /** - * Default package name for classes without package def - */ - public static final String DEFAULT_PACKAGE_NAME = "[default]"; - - /** - * Java files knows suffixes - */ - public static final String[] SUFFIXES = {".java", ".jav"}; - - /** - * Default constructor - */ - public Java() { - super(KEY, NAME); - } - - /** - * {@inheritDoc} - * - * @see AbstractLanguage#getFileSuffixes() - */ - @Override - public String[] getFileSuffixes() { - return SUFFIXES; - } - - public static boolean isJavaFile(java.io.File file) { - String suffix = "." + StringUtils.lowerCase(StringUtils.substringAfterLast(file.getName(), ".")); - return ArrayUtils.contains(SUFFIXES, suffix); - } - -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java deleted file mode 100644 index 18c62350e53..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java +++ /dev/null @@ -1,121 +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.api.resources; - -import com.google.common.annotations.VisibleForTesting; - -import java.io.File; -import java.util.List; - -/** - * A class that represents a Java class. This class can either be a Test class or source class - * - * @since 1.10 - * @deprecated since 4.2 use {@link org.sonar.api.resources.File}. See - * http://docs.codehaus.org/display/SONAR/API+Changes for more details - */ -@Deprecated -public class JavaFile extends Resource { - - @VisibleForTesting - JavaFile() { - } - - public JavaFile(String packageName, String className) { - throw unsupported(); - } - - public JavaFile(String packageKey, String className, boolean unitTest) { - throw unsupported(); - } - - public JavaFile(String deprecatedKey) { - throw unsupported(); - } - - public JavaFile(String deprecatedKey, boolean unitTest) { - throw unsupported(); - } - - @Override - public JavaPackage getParent() { - throw unsupported(); - } - - @Override - public String getDescription() { - throw unsupported(); - } - - @Override - public Language getLanguage() { - throw unsupported(); - } - - @Override - public String getName() { - throw unsupported(); - } - - @Override - public String getLongName() { - throw unsupported(); - } - - @Override - public String getScope() { - throw unsupported(); - } - - @Override - public String getQualifier() { - throw unsupported(); - } - - public boolean isUnitTest() { - throw unsupported(); - } - - @Override - public boolean matchFilePattern(String antPattern) { - throw unsupported(); - } - - public static JavaFile fromIOFile(File file, Project module, boolean unitTest) { - throw unsupported(); - } - - public static JavaFile fromRelativePath(String relativePath, boolean unitTest) { - throw unsupported(); - } - - public static JavaFile fromIOFile(File file, List<File> sourceDirs, boolean unitTest) { - throw unsupported(); - } - - public static JavaFile fromAbsolutePath(String path, List<File> sourceDirs, boolean unitTest) { - throw unsupported(); - } - - private static UnsupportedOperationException unsupported() { - throw new UnsupportedOperationException("Not supported since v4.2. See http://redirect.sonarsource.com/doc/api-changes.html"); - } - -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java deleted file mode 100644 index 98462574b99..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java +++ /dev/null @@ -1,88 +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.api.resources; - -/** - * A class that represents a Java package in Sonar - * - * @since 1.10 - * @deprecated since 4.2 use {@link Directory} instead - */ -@Deprecated -public class JavaPackage extends Resource { - - public static final String DEFAULT_PACKAGE_NAME = "[default]"; - - public JavaPackage() { - // For testing - } - - public JavaPackage(String deprecatedKey) { - throw unsupported(); - } - - public boolean isDefault() { - throw unsupported(); - } - - @Override - public boolean matchFilePattern(String antPattern) { - throw unsupported(); - } - - @Override - public String getDescription() { - throw unsupported(); - } - - @Override - public String getScope() { - throw unsupported(); - } - - @Override - public String getQualifier() { - throw unsupported(); - } - - @Override - public String getName() { - throw unsupported(); - } - - @Override - public Resource getParent() { - throw unsupported(); - } - - @Override - public String getLongName() { - throw unsupported(); - } - - @Override - public Language getLanguage() { - throw unsupported(); - } - - private static UnsupportedOperationException unsupported() { - throw new UnsupportedOperationException("Not supported since v4.2. See http://redirect.sonarsource.com/doc/api-changes.html"); - } -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java deleted file mode 100644 index 5de0b8fed47..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java +++ /dev/null @@ -1,108 +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.api.resources; - -/** - * @deprecated in 4.2. Only file system components are managed by SQ core (files/directories). - */ -@Deprecated -public class Method extends Resource { - - public static final String SCOPE = Scopes.BLOCK_UNIT; - - protected String qualifier; - protected Language language; - - protected Method(String key, String qualifier, Language language) { - setKey(key); - this.qualifier = qualifier; - this.language = language; - } - - @Override - public String getName() { - return getKey(); - } - - @Override - public String getLongName() { - return getKey(); - } - - @Override - public String getDescription() { - return null; - } - - @Override - public final Language getLanguage() { - return language; - } - - @Override - public final String getScope() { - return SCOPE; - } - - @Override - public final String getQualifier() { - return qualifier; - } - - @Override - public Resource getParent() { - return null; - } - - @Override - public final boolean matchFilePattern(String antPattern) { - return false; - } - - @Override - public final boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Method)) { - return false; - } - Method method = (Method) o; - if (!getKey().equals(method.getKey())) { - return false; - } - if (!qualifier.equals(method.qualifier)) { - return false; - } - return true; - } - - @Override - public final int hashCode() { - int result = super.hashCode(); - result = 31 * result + qualifier.hashCode(); - result = 31 * result + getKey().hashCode(); - return result; - } - - public static Method createMethod(String key, Language language) { - return new Method(key, Qualifiers.METHOD, language); - } -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java index 238084692a2..6c88617a87e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java @@ -53,30 +53,11 @@ public class Project extends Resource implements Component { public static final String SCOPE = Scopes.PROJECT; - /** - * Enumerates the type of possible analysis - * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report. - */ - @Deprecated - public enum AnalysisType { - STATIC, DYNAMIC, REUSE_REPORTS; - - /** - * @param includeReuseReportMode whether to count report reuse as dynamic or not - * @return whether this a dynamic analysis - */ - public boolean isDynamic(boolean includeReuseReportMode) { - return equals(Project.AnalysisType.DYNAMIC) || - (equals(Project.AnalysisType.REUSE_REPORTS) && includeReuseReportMode); - } - } - private String branch; private String name; private String description; private Language language; private Date analysisDate; - private AnalysisType analysisType; private String analysisVersion; private Settings settings; @@ -139,6 +120,11 @@ public class Project extends Resource implements Component { return this; } + @Override + public Language getLanguage() { + return null; + } + /** * For internal use only. */ @@ -166,34 +152,6 @@ public class Project extends Resource implements Component { } /** - * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report. - */ - @Deprecated - public AnalysisType getAnalysisType() { - return analysisType; - } - - /** - * @deprecated since 4.4 Since 4.3 SQ will no more run tests. So basically it's always reuse report. - */ - @Deprecated - public Project setAnalysisType(AnalysisType at) { - this.analysisType = at; - return this; - } - - /** - * whether it's the latest analysis done on this project (displayed in sonar dashboard) or an analysis on a past revision. - * - * @since 2.0 - * @deprecated in 3.6. The analysis is now always the latest one (past analysis must be done in a chronological order). See http://jira.sonarsource.com/browse/SONAR-4334 - */ - @Deprecated - public boolean isLatestAnalysis() { - return true; - } - - /** * For internal use only. * * @deprecated in 3.6. It's not possible to analyze a project before the latest known quality snapshot. @@ -209,27 +167,9 @@ public class Project extends Resource implements Component { } /** - * @return the project language when there is only one language - * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()} - */ - @Deprecated - @Override - public Language getLanguage() { - return language; - } - - /** - * Internal use - */ - public Project setLanguage(Language language) { - this.language = language; - return this; - } - - /** - * @return the language key or empty if no language is specified - * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()} - */ + * @return the language key or empty if no language is specified + * @deprecated since 4.2 use {@link org.sonar.api.batch.fs.FileSystem#languages()} + */ @Deprecated public String getLanguageKey() { if (settings == null) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java index 6190190e991..b66930059ad 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java @@ -63,33 +63,8 @@ public final class Qualifiers { */ public static final String MODULE = "BRC"; - /** - * @deprecated since 4.2 now packages are considered as regular directories. Use {@link #DIRECTORY} instead. - */ - @Deprecated - public static final String PACKAGE = "PAC"; public static final String DIRECTORY = "DIR"; public static final String FILE = "FIL"; - /** - * @deprecated since 4.2 now java files are considered as regular files. Use {@link #FILE} instead. - */ - @Deprecated - public static final String CLASS = "CLA"; - /** - * @deprecated since 4.2 resources under FILE level will no more be supported. - */ - @Deprecated - public static final String PARAGRAPH = "PAR"; - /** - * @deprecated since 4.2 resources under FILE level will no more be supported. - */ - @Deprecated - public static final String METHOD = "MET"; - /** - * @deprecated since 4.2 resources under FILE level will no more be supported. - */ - @Deprecated - public static final String FIELD = "FLD"; // ugly, should be replaced by "natures" public static final String UNIT_TEST_FILE = "UTS"; @@ -139,40 +114,9 @@ public final class Qualifiers { } /** - * @deprecated since 4.2 Package is now a directory. Use {@link #isDirectory(Resource)} - */ - @Deprecated - public static boolean isPackage(final Resource resource) { - return StringUtils.equals(PACKAGE, resource.getQualifier()) || isDirectory(resource); - } - - /** * @param resource not nullable */ public static boolean isFile(final Resource resource) { return StringUtils.equals(FILE, resource.getQualifier()); } - - /** - * @param resource not nullable - * @deprecated since 4.2 CLA qualifier is deprecated - */ - @Deprecated - public static boolean isClass(final Resource resource) { - return StringUtils.equals(CLASS, resource.getQualifier()) || isFile(resource); - } - - /** - * @param resource not nullable - */ - public static boolean isMethod(final Resource resource) { - return StringUtils.equals(METHOD, resource.getQualifier()); - } - - /** - * @param resource not nullable - */ - public static boolean isParagraph(final Resource resource) { - return StringUtils.equals(PARAGRAPH, resource.getQualifier()); - } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java index fa9447168b3..79454dd456b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java @@ -81,12 +81,6 @@ public abstract class Resource implements Serializable { public static final String QUALIFIER_MODULE = Qualifiers.MODULE; /** - * @deprecated since 2.6. Use Qualifiers.PACKAGE. - */ - @Deprecated - public static final String QUALIFIER_PACKAGE = Qualifiers.PACKAGE; - - /** * @deprecated since 2.6. Use Qualifiers.DIRECTORY. */ @Deprecated @@ -98,30 +92,6 @@ public abstract class Resource implements Serializable { @Deprecated public static final String QUALIFIER_FILE = Qualifiers.FILE; - /** - * @deprecated since 2.6. Use Qualifiers.CLASS. - */ - @Deprecated - public static final String QUALIFIER_CLASS = Qualifiers.CLASS; - - /** - * @deprecated since 2.6. Use Qualifiers.FIELD. - */ - @Deprecated - public static final String QUALIFIER_FIELD = Qualifiers.FIELD; - - /** - * @deprecated since 2.6. Use Qualifiers.METHOD. - */ - @Deprecated - public static final String QUALIFIER_METHOD = Qualifiers.METHOD; - - /** - * @deprecated since 2.6. Use Qualifiers.UNIT_TEST_FILE. - */ - @Deprecated - public static final String QUALIFIER_UNIT_TEST_CLASS = Qualifiers.UNIT_TEST_FILE; - private Integer id; private String key; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java index 8373a5f89a1..6f29811822e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java @@ -60,14 +60,6 @@ public final class ResourceUtils { } /** - * @deprecated since 4.2 Package are now directory. Use {@link #isDirectory(Resource)} - */ - @Deprecated - public static boolean isPackage(Resource resource) { - return resource != null && Qualifiers.PACKAGE.equals(resource.getQualifier()); - } - - /** * @return whether a resource is a set */ public static boolean isSet(Resource resource) { @@ -112,15 +104,6 @@ public final class ResourceUtils { /* QUALIFIERS */ /** - * @return whether a resource is a class - * @deprecated since 4.2 CLA qualifier is deprecated - */ - @Deprecated - public static boolean isClass(Resource resource) { - return Qualifiers.CLASS.equals(resource.getQualifier()); - } - - /** * @return whether a resource is a unit test class * @deprecated since 5.1 use {@link #isUnitTestFile(Resource)} */ diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java index 6c04ad3b24f..8133bbcc876 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java @@ -50,7 +50,7 @@ public class PropertyDefinitionTest { .options("de", "en") .description("desc") .type(PropertyType.FLOAT) - .onlyOnQualifiers(Qualifiers.FILE, Qualifiers.CLASS) + .onlyOnQualifiers(Qualifiers.FILE) .multiValues(true) .propertySetKey("set") .build(); @@ -63,7 +63,7 @@ public class PropertyDefinitionTest { assertThat(def.description()).isEqualTo("desc"); assertThat(def.type()).isEqualTo(PropertyType.FLOAT); assertThat(def.global()).isFalse(); - assertThat(def.qualifiers()).containsOnly(Qualifiers.FILE, Qualifiers.CLASS); + assertThat(def.qualifiers()).containsOnly(Qualifiers.FILE); assertThat(def.multiValues()).isTrue(); assertThat(def.propertySetKey()).isEqualTo("set"); assertThat(def.fields()).isEmpty(); @@ -149,8 +149,7 @@ public class PropertyDefinitionTest { .name("Hello") .fields( PropertyFieldDefinition.build("first").name("First").description("Description").options("A", "B").build(), - PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build() - ) + PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build()) .build(); assertThat(def.fields()).hasSize(2); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java index 648d82f6379..f707951bb76 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java @@ -23,11 +23,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import java.io.IOException; - import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; public class FileTest { @@ -35,15 +31,6 @@ public class FileTest { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void createFromIoFileShouldComputeCorrectKey() throws IOException { - java.io.File baseDir = temp.newFolder(); - Project project = mock(Project.class); - when(project.getBaseDir()).thenReturn(baseDir); - Resource file = File.fromIOFile(new java.io.File(baseDir, "src/foo/bar/toto.sql"), project); - assertThat(file.getKey()).isEqualTo("src/foo/bar/toto.sql"); - } - - @Test public void trimKeyAndName() { File file = File.create(" foo/bar/toto.sql "); assertThat(file.getKey()).isEqualTo("foo/bar/toto.sql"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java deleted file mode 100644 index 0726a8b2c41..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java +++ /dev/null @@ -1,114 +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.api.resources; - -import org.junit.Test; - -import java.util.List; - -public class JavaFileTest { - - JavaFile javaFile = new JavaFile(); - - @Test(expected = UnsupportedOperationException.class) - public void testConstructor() { - JavaFile javaClass = new JavaFile("", ""); - } - - @Test(expected = UnsupportedOperationException.class) - public void testConstructor2() { - JavaFile javaClass = new JavaFile("", "", true); - } - - @Test(expected = UnsupportedOperationException.class) - public void testConstructor3() { - JavaFile javaClass = new JavaFile(""); - } - - @Test(expected = UnsupportedOperationException.class) - public void testConstructor4() { - JavaFile javaClass = new JavaFile("", true); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetParent() { - javaFile.getParent(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetDescription() { - javaFile.getDescription(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetLanguage() { - javaFile.getLanguage(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetName() { - javaFile.getName(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetLongName() { - javaFile.getLongName(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetScope() { - javaFile.getScope(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetQualifier() { - javaFile.getQualifier(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testIsUnitTest() { - javaFile.isUnitTest(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testMathFilePattern() { - javaFile.matchFilePattern(""); - } - - @Test(expected = UnsupportedOperationException.class) - public void fromIoFile1() { - JavaFile.fromIOFile(null, (Project) null, true); - } - - @Test(expected = UnsupportedOperationException.class) - public void fromIoFile2() { - JavaFile.fromIOFile(null, (List<java.io.File>) null, true); - } - - @Test(expected = UnsupportedOperationException.class) - public void fromRelativePath() { - JavaFile.fromRelativePath("", false); - } - - @Test(expected = UnsupportedOperationException.class) - public void fromAbsolutePath() { - JavaFile.fromAbsolutePath("", (List<java.io.File>) null, false); - } -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java deleted file mode 100644 index 7c2228f3f6e..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java +++ /dev/null @@ -1,78 +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.api.resources; - -import org.junit.Test; - -public class JavaPackageTest { - - JavaPackage javaPackage = new JavaPackage(); - - @Test(expected = UnsupportedOperationException.class) - public void testConstructor() { - new JavaPackage(""); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetParent() { - javaPackage.getParent(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetDescription() { - javaPackage.getDescription(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetLanguage() { - javaPackage.getLanguage(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetName() { - javaPackage.getName(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetLongName() { - javaPackage.getLongName(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetScope() { - javaPackage.getScope(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetQualifier() { - javaPackage.getQualifier(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testIsUnitTest() { - javaPackage.isDefault(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testMathFilePattern() { - javaPackage.matchFilePattern(""); - } - -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java deleted file mode 100644 index ea515f15d2d..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java +++ /dev/null @@ -1,40 +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.api.resources; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class JavaTest { - - @Test - public void test() { - Java language = new Java(); - assertThat(language.getFileSuffixes()).isEqualTo(new String[] {".java", ".jav"}); - - assertThat(Java.isJavaFile(new java.io.File("Example.java"))).isTrue(); - assertThat(Java.isJavaFile(new java.io.File("Example.JAVA"))).isTrue(); - assertThat(Java.isJavaFile(new java.io.File("Example.jav"))).isTrue(); - assertThat(Java.isJavaFile(new java.io.File("Example.Jav"))).isTrue(); - assertThat(Java.isJavaFile(new java.io.File("Example.notjava"))).isFalse(); - } - -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java deleted file mode 100644 index a3e940d696d..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java +++ /dev/null @@ -1,46 +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.api.resources; - -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class MethodTest { - - @Test - public void shouldAcceptOverridding() { - Method method = Method.createMethod("Foo.foo()", Java.INSTANCE); - Method fakeMethod = new FakeMethod("Foo.foo()"); - - assertThat(method.equals(fakeMethod), is(true)); - assertThat(fakeMethod.equals(method), is(true)); - - assertThat(method.hashCode(), is(fakeMethod.hashCode())); - assertThat(fakeMethod.hashCode(), is(method.hashCode())); - } - - static class FakeMethod extends Method { - protected FakeMethod(String key) { - super(key, Qualifiers.METHOD, Java.INSTANCE); - } - } -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java index 248c711822d..03d2c618033 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java @@ -30,8 +30,6 @@ public class ResourceUtilsTest { @Test public void checkFile() { File file = File.create("hello.Foo"); - assertThat(ResourceUtils.isClass(file)).isFalse(); - assertThat(ResourceUtils.isPackage(file)).isFalse(); assertThat(ResourceUtils.isModuleProject(file)).isFalse(); assertThat(ResourceUtils.isSpace(file)).isFalse(); assertThat(ResourceUtils.isEntity(file)).isTrue(); @@ -44,8 +42,6 @@ public class ResourceUtilsTest { public void checkUnitTest() { File utFile = File.create("hello.Foo"); utFile.setQualifier(Qualifiers.UNIT_TEST_FILE); - assertThat(ResourceUtils.isClass(utFile)).isFalse(); - assertThat(ResourceUtils.isPackage(utFile)).isFalse(); assertThat(ResourceUtils.isModuleProject(utFile)).isFalse(); assertThat(ResourceUtils.isSpace(utFile)).isFalse(); assertThat(ResourceUtils.isEntity(utFile)).isTrue(); @@ -57,8 +53,6 @@ public class ResourceUtilsTest { @Test public void checkDirectory() { Directory dir = Directory.create("hello"); - assertThat(ResourceUtils.isClass(dir)).isFalse(); - assertThat(ResourceUtils.isPackage(dir)).isFalse(); assertThat(ResourceUtils.isModuleProject(dir)).isFalse(); assertThat(ResourceUtils.isSpace(dir)).isTrue(); assertThat(ResourceUtils.isEntity(dir)).isFalse(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/ProjectConfigurator.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/ProjectConfigurator.java index aee2aab3d71..a0b55e50519 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/ProjectConfigurator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/ProjectConfigurator.java @@ -21,8 +21,6 @@ package org.sonar.batch; import java.util.Date; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.bootstrap.ProjectDefinition; @@ -38,7 +36,6 @@ import org.sonar.api.utils.System2; @ScannerSide public class ProjectConfigurator { - private static final Logger LOG = LoggerFactory.getLogger(ProjectConfigurator.class); private final System2 system2; private Settings settings; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/index/DefaultIndex.java index d816ae0dd85..2831159d8dd 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -312,25 +312,6 @@ public class DefaultIndex { relativePathFromSourceDir = ""; } } - if (relativePathFromSourceDir != null) { - // Resolve using deprecated key - List<String> dirs; - ProjectDefinition projectDef = projectTree.getProjectDefinition(getProject()); - if (isTest) { - dirs = projectDef.tests(); - } else { - dirs = projectDef.sources(); - } - for (String src : dirs) { - java.io.File dirOrFile = pathResolver.relativeFile(projectDef.getBaseDir(), src); - java.io.File abs = new java.io.File(dirOrFile, relativePathFromSourceDir); - Bucket b = getBucket(isDir ? Directory.fromIOFile(abs, getProject()) : File.fromIOFile(abs, getProject())); - if (b != null) { - return b; - } - } - - } return null; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/AbstractPhaseExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/AbstractPhaseExecutor.java index c388b75f1f3..d3265de0aac 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/AbstractPhaseExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/AbstractPhaseExecutor.java @@ -37,7 +37,6 @@ public abstract class AbstractPhaseExecutor { private final SensorsExecutor sensorsExecutor; private final SensorContext sensorContext; private final DefaultIndex index; - private final ProjectInitializer pi; private final FileSystemLogger fsLogger; private final DefaultModuleFileSystem fs; private final QProfileVerifier profileVerifier; @@ -45,8 +44,7 @@ public abstract class AbstractPhaseExecutor { public AbstractPhaseExecutor(InitializersExecutor initializersExecutor, PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor, SensorContext sensorContext, DefaultIndex index, - EventBus eventBus, ProjectInitializer pi, - FileSystemLogger fsLogger, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, + EventBus eventBus, FileSystemLogger fsLogger, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, IssueExclusionsLoader issueExclusionsLoader) { this.postJobsExecutor = postJobsExecutor; this.initializersExecutor = initializersExecutor; @@ -54,7 +52,6 @@ public abstract class AbstractPhaseExecutor { this.sensorContext = sensorContext; this.index = index; this.eventBus = eventBus; - this.pi = pi; this.fsLogger = fsLogger; this.fs = fs; this.profileVerifier = profileVerifier; @@ -65,8 +62,6 @@ public abstract class AbstractPhaseExecutor { * Executed on each module */ public final void execute(Project module) { - pi.execute(module); - eventBus.fireEvent(new ProjectAnalysisEvent(module, true)); executeInitializersPhase(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/IssuesPhaseExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/IssuesPhaseExecutor.java index ba9a155962e..5d8a658e52f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/IssuesPhaseExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/IssuesPhaseExecutor.java @@ -43,9 +43,9 @@ public final class IssuesPhaseExecutor extends AbstractPhaseExecutor { private final IssueCallback issueCallback; public IssuesPhaseExecutor(InitializersExecutor initializersExecutor, PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor, SensorContext sensorContext, - DefaultIndex index, EventBus eventBus, ProjectInitializer pi, FileSystemLogger fsLogger, IssuesReports jsonReport, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, + DefaultIndex index, EventBus eventBus, FileSystemLogger fsLogger, IssuesReports jsonReport, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, IssueExclusionsLoader issueExclusionsLoader, IssueTransition localIssueTracking, IssueCallback issueCallback) { - super(initializersExecutor, postJobsExecutor, sensorsExecutor, sensorContext, index, eventBus, pi, fsLogger, fs, profileVerifier, issueExclusionsLoader); + super(initializersExecutor, postJobsExecutor, sensorsExecutor, sensorContext, index, eventBus, fsLogger, fs, profileVerifier, issueExclusionsLoader); this.eventBus = eventBus; this.issuesReport = jsonReport; this.localIssueTracking = localIssueTracking; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/ProjectInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/ProjectInitializer.java deleted file mode 100644 index b9a4b45ff8a..00000000000 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/ProjectInitializer.java +++ /dev/null @@ -1,63 +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.phases; - -import org.sonar.api.batch.ScannerSide; -import org.apache.commons.lang.StringUtils; -import org.sonar.api.CoreProperties; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.Language; -import org.sonar.api.resources.Languages; -import org.sonar.api.resources.Project; -import org.sonar.api.utils.MessageException; - -/** - * Should be dropped when org.sonar.api.resources.Project is fully refactored. - */ -@ScannerSide -public class ProjectInitializer { - - private Languages languages; - private Settings settings; - - public ProjectInitializer(Settings settings, Languages languages) { - this.settings = settings; - this.languages = languages; - } - - public void execute(Project project) { - if (project.getLanguage() == null) { - initDeprecatedLanguage(project); - } - } - - private void initDeprecatedLanguage(Project project) { - String languageKey = settings.getString(CoreProperties.PROJECT_LANGUAGE_PROPERTY); - if (StringUtils.isNotBlank(languageKey)) { - Language language = languages.get(languageKey); - if (language == null) { - throw MessageException.of("Language with key '" + languageKey + "' not found"); - } - project.setLanguage(language); - } else { - project.setLanguage(Project.NONE_LANGUAGE); - } - } -} diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/PublishPhaseExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/PublishPhaseExecutor.java index 33073a110b3..98741b5aaf9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/PublishPhaseExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/phases/PublishPhaseExecutor.java @@ -37,9 +37,9 @@ public final class PublishPhaseExecutor extends AbstractPhaseExecutor { private final CpdExecutor cpdExecutor; public PublishPhaseExecutor(InitializersExecutor initializersExecutor, PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor, SensorContext sensorContext, - DefaultIndex index, EventBus eventBus, ReportPublisher reportPublisher, ProjectInitializer pi, FileSystemLogger fsLogger, DefaultModuleFileSystem fs, + DefaultIndex index, EventBus eventBus, ReportPublisher reportPublisher, FileSystemLogger fsLogger, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, IssueExclusionsLoader issueExclusionsLoader, CpdExecutor cpdExecutor) { - super(initializersExecutor, postJobsExecutor, sensorsExecutor, sensorContext, index, eventBus, pi, fsLogger, fs, profileVerifier, issueExclusionsLoader); + super(initializersExecutor, postJobsExecutor, sensorsExecutor, sensorContext, index, eventBus, fsLogger, fs, profileVerifier, issueExclusionsLoader); this.eventBus = eventBus; this.reportPublisher = reportPublisher; this.cpdExecutor = cpdExecutor; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java index 2da9c9e4967..bca62d8b8f3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java @@ -52,7 +52,6 @@ import org.sonar.batch.phases.AbstractPhaseExecutor; import org.sonar.batch.phases.InitializersExecutor; import org.sonar.batch.phases.IssuesPhaseExecutor; import org.sonar.batch.phases.PostJobsExecutor; -import org.sonar.batch.phases.ProjectInitializer; import org.sonar.batch.phases.PublishPhaseExecutor; import org.sonar.batch.phases.SensorsExecutor; import org.sonar.batch.postjob.DefaultPostJobContext; @@ -120,7 +119,6 @@ public class ModuleScanContainer extends ComponentContainer { PostJobsExecutor.class, SensorsExecutor.class, InitializersExecutor.class, - ProjectInitializer.class, // file system ModuleInputFileCache.class, diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/FakeJava.java index 8d92fed539a..95c2244ab54 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/FakeJava.java @@ -1,50 +1,38 @@ -/* - * 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.api.resources; - -import com.google.common.collect.Lists; - -import java.util.Collection; -import java.util.List; - -/** - * @since 1.10 - * @deprecated see method comments - */ -@Deprecated -public final class ProjectUtils { - - private ProjectUtils() { - // utility class with only static methods - } - - /** - * @since 2.7 - * @deprecated in 4.2. Replaced by org.sonar.api.resources.InputFileUtils#toFiles() - */ - @Deprecated - public static List<java.io.File> toIoFiles(Collection<InputFile> inputFiles) { - List<java.io.File> files = Lists.newArrayList(); - for (InputFile inputFile : inputFiles) { - files.add(inputFile.getFile()); - } - return files; - } -} +/*
+ * 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;
+
+import org.sonar.api.resources.AbstractLanguage;
+
+public class FakeJava extends AbstractLanguage {
+
+ public static final String KEY = "java";
+ public static final FakeJava INSTANCE = new FakeJava();
+
+ public FakeJava() {
+ super(KEY, "Java");
+ }
+
+ @Override
+ public String[] getFileSuffixes() {
+ return new String[] {".java", ".jav"};
+ }
+
+}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java index 84b725007d8..7a4d248ca21 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java @@ -81,23 +81,4 @@ public class ProjectConfiguratorTest { new ProjectConfigurator(configuration, system2).configure(project); } - @Test - public void default_analysis_type_is_dynamic() { - Project project = new Project("key"); - new ProjectConfigurator(new Settings(), system2).configure(project); - assertThat(project.getAnalysisType()).isEqualTo(Project.AnalysisType.DYNAMIC); - } - - @Test - public void is_dynamic_analysis() { - assertThat(Project.AnalysisType.DYNAMIC.isDynamic(false)).isTrue(); - assertThat(Project.AnalysisType.DYNAMIC.isDynamic(true)).isTrue(); - - assertThat(Project.AnalysisType.STATIC.isDynamic(false)).isFalse(); - assertThat(Project.AnalysisType.STATIC.isDynamic(true)).isFalse(); - - assertThat(Project.AnalysisType.REUSE_REPORTS.isDynamic(false)).isFalse(); - assertThat(Project.AnalysisType.REUSE_REPORTS.isDynamic(true)).isTrue(); - } - } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/cpd/deprecated/DeprecatedCpdBlockIndexerSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/cpd/deprecated/DeprecatedCpdBlockIndexerSensorTest.java index 4adc630247e..b9f53ef7603 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/cpd/deprecated/DeprecatedCpdBlockIndexerSensorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/cpd/deprecated/DeprecatedCpdBlockIndexerSensorTest.java @@ -27,7 +27,7 @@ import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.internal.DefaultFileSystem; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; -import org.sonar.api.resources.Java; +import org.sonar.batch.FakeJava; import org.sonar.batch.cpd.CpdComponents; import static org.assertj.core.api.Assertions.assertThat; @@ -55,12 +55,12 @@ public class DeprecatedCpdBlockIndexerSensorTest { @Test public void test_global_skip() { settings.setProperty("sonar.cpd.skip", true); - assertThat(sensor.isSkipped(Java.KEY)).isTrue(); + assertThat(sensor.isSkipped(FakeJava.KEY)).isTrue(); } @Test public void should_not_skip_by_default() { - assertThat(sensor.isSkipped(Java.KEY)).isFalse(); + assertThat(sensor.isSkipped(FakeJava.KEY)).isFalse(); } @Test @@ -69,12 +69,12 @@ public class DeprecatedCpdBlockIndexerSensorTest { settings.setProperty("sonar.cpd.php.skip", true); assertThat(sensor.isSkipped("php")).isTrue(); - assertThat(sensor.isSkipped(Java.KEY)).isFalse(); + assertThat(sensor.isSkipped(FakeJava.KEY)).isFalse(); } @Test public void test_engine() { - assertThat(sensor.getBlockIndexer(Java.KEY)).isSameAs(sonarEngine); + assertThat(sensor.getBlockIndexer(FakeJava.KEY)).isSameAs(sonarEngine); assertThat(sensor.getBlockIndexer("PHP")).isSameAs(sonarBridgeEngine); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/index/DefaultIndexTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/index/DefaultIndexTest.java index 8dae9e19ad0..71d560b3d70 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/index/DefaultIndexTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/index/DefaultIndexTest.java @@ -30,13 +30,13 @@ import org.sonar.api.measures.MeasuresFilters; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.resources.Directory; import org.sonar.api.resources.File; -import org.sonar.api.resources.Java; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleFinder; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.batch.DefaultProjectTree; +import org.sonar.batch.FakeJava; import org.sonar.batch.scan.measure.MeasureCache; import org.sonar.batch.sensor.DefaultSensorStorage; @@ -101,7 +101,7 @@ public class DefaultIndexTest { @Test public void shouldIndexTreeOfResources() { Directory directory = Directory.create("src/org/foo"); - File file = File.create("src/org/foo/Bar.java", Java.INSTANCE, false); + File file = File.create("src/org/foo/Bar.java", FakeJava.INSTANCE, false); assertThat(index.index(directory)).isTrue(); assertThat(index.index(file, directory)).isTrue(); @@ -118,7 +118,7 @@ public class DefaultIndexTest { @Test public void shouldGetSource() throws Exception { Directory directory = Directory.create("src/org/foo"); - File file = File.create("src/org/foo/Bar.java", Java.INSTANCE, false); + File file = File.create("src/org/foo/Bar.java", FakeJava.INSTANCE, false); FileUtils.write(new java.io.File(baseDir, "src/org/foo/Bar.java"), "Foo bar"); assertThat(index.index(directory)).isTrue(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/report/ComponentsPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/report/ComponentsPublisherTest.java index 65c54c6f5c6..d2260c3e070 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/report/ComponentsPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/report/ComponentsPublisherTest.java @@ -29,9 +29,9 @@ import org.sonar.api.batch.fs.internal.DefaultInputDir; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.resources.Directory; -import org.sonar.api.resources.Java; import org.sonar.api.resources.Project; import org.sonar.api.utils.DateUtils; +import org.sonar.batch.FakeJava; import org.sonar.batch.index.BatchComponentCache; import org.sonar.batch.scan.ImmutableProjectReactor; import org.sonar.scanner.protocol.output.FileStructure; @@ -70,7 +70,7 @@ public class ComponentsPublisherTest { dir.setId(3).setUuid("DIR_UUID"); resourceCache.add(dir, module1).setInputComponent(new DefaultInputDir("foo", "src")); - org.sonar.api.resources.File file = org.sonar.api.resources.File.create("src/Foo.java", Java.INSTANCE, false); + org.sonar.api.resources.File file = org.sonar.api.resources.File.create("src/Foo.java", FakeJava.INSTANCE, false); file.setEffectiveKey("module1:src/Foo.java"); file.setId(4).setUuid("FILE_UUID"); resourceCache.add(file, dir).setInputComponent(new DefaultInputFile("module1", "src/Foo.java").setLines(2)); @@ -80,7 +80,7 @@ public class ComponentsPublisherTest { fileWithoutLang.setId(5).setUuid("FILE_WITHOUT_LANG_UUID"); resourceCache.add(fileWithoutLang, dir).setInputComponent(new DefaultInputFile("module1", "src/make").setLines(10)); - org.sonar.api.resources.File testFile = org.sonar.api.resources.File.create("test/FooTest.java", Java.INSTANCE, true); + org.sonar.api.resources.File testFile = org.sonar.api.resources.File.create("test/FooTest.java", FakeJava.INSTANCE, true); testFile.setEffectiveKey("module1:test/FooTest.java"); testFile.setId(6).setUuid("TEST_FILE_UUID"); resourceCache.add(testFile, dir).setInputComponent(new DefaultInputFile("module1", "test/FooTest.java").setLines(4)); @@ -141,7 +141,7 @@ public class ComponentsPublisherTest { dir.setId(3).setUuid("DIR_UUID"); resourceCache.add(dir, module1).setInputComponent(new DefaultInputDir("foo", "src")); - org.sonar.api.resources.File file = org.sonar.api.resources.File.create("src/Foo.java", Java.INSTANCE, false); + org.sonar.api.resources.File file = org.sonar.api.resources.File.create("src/Foo.java", FakeJava.INSTANCE, false); file.setEffectiveKey("module1:my_branch:my_branch:src/Foo.java"); file.setId(4).setUuid("FILE_UUID"); resourceCache.add(file, dir).setInputComponent(new DefaultInputFile("module1", "src/Foo.java").setLines(2)); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java index 22a4f21091f..55d8264b3ef 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java @@ -26,9 +26,9 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.internal.DefaultFileSystem; import org.sonar.api.config.Settings; -import org.sonar.api.resources.Java; import org.sonar.api.resources.Languages; import org.sonar.api.utils.MessageException; +import org.sonar.batch.FakeJava; import org.sonar.batch.repository.language.DefaultLanguagesRepository; import org.sonar.batch.repository.language.LanguagesRepository; @@ -43,7 +43,7 @@ public class LanguageVerifierTest { public ExpectedException thrown = ExpectedException.none(); private Settings settings = new Settings(); - private LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(Java.INSTANCE)); + private LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(FakeJava.INSTANCE)); private DefaultFileSystem fs; @Before @@ -61,7 +61,7 @@ public class LanguageVerifierTest { verifier.stop(); } - + @Test public void language_is_empty() { settings.setProperty("sonar.language", ""); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java index 8f5459ec40a..01228186217 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java @@ -33,11 +33,11 @@ import org.sonar.api.batch.fs.internal.DefaultFileSystem; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.resources.AbstractLanguage; import org.sonar.api.resources.Directory; -import org.sonar.api.resources.Java; import org.sonar.api.resources.Languages; import org.sonar.api.resources.Project; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Resource; +import org.sonar.batch.FakeJava; import org.sonar.batch.analysis.DefaultAnalysisMode; import org.sonar.batch.index.BatchComponent; import org.sonar.batch.index.BatchComponentCache; @@ -81,7 +81,7 @@ public class ComponentIndexerTest { @Test public void should_index_java_files() throws IOException { - Languages languages = new Languages(Java.INSTANCE); + Languages languages = new Languages(FakeJava.INSTANCE); ComponentIndexer indexer = createIndexer(languages); DefaultModuleFileSystem fs = new DefaultModuleFileSystem(project, null, mock(FileIndexer.class), initializer, indexer, mode); fs.add(newInputFile("src/main/java/foo/bar/Foo.java", "", "foo/bar/Foo.java", "java", false, Status.ADDED)); @@ -91,8 +91,8 @@ public class ComponentIndexerTest { fs.index(); - verify(sonarIndex).index(org.sonar.api.resources.File.create("src/main/java/foo/bar/Foo.java", Java.INSTANCE, false)); - verify(sonarIndex).index(org.sonar.api.resources.File.create("src/main/java2/foo/bar/Foo.java", Java.INSTANCE, false)); + verify(sonarIndex).index(org.sonar.api.resources.File.create("src/main/java/foo/bar/Foo.java", FakeJava.INSTANCE, false)); + verify(sonarIndex).index(org.sonar.api.resources.File.create("src/main/java2/foo/bar/Foo.java", FakeJava.INSTANCE, false)); verify(sonarIndex).index(argThat(new ArgumentMatcher<org.sonar.api.resources.File>() { @Override public boolean matches(Object arg0) { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactoryTest.java index b30bb73036c..2f7d3f01434 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactoryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactoryTest.java @@ -21,8 +21,8 @@ package org.sonar.batch.scan.filesystem; import org.junit.Test; import org.sonar.api.config.Settings; -import org.sonar.api.resources.Java; import org.sonar.api.resources.Languages; +import org.sonar.batch.FakeJava; import org.sonar.batch.repository.language.DefaultLanguagesRepository; import org.sonar.batch.repository.language.LanguagesRepository; @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class LanguageDetectionFactoryTest { @Test public void testCreate() throws Exception { - LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(Java.INSTANCE)); + LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(FakeJava.INSTANCE)); LanguageDetectionFactory factory = new LanguageDetectionFactory(new Settings(), languages); LanguageDetection languageDetection = factory.create(); assertThat(languageDetection).isNotNull(); |