]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7727 Remove deprecated stuff from Resources API
authorJulien HENRY <henryju@yahoo.fr>
Mon, 4 Jul 2016 09:58:10 +0000 (11:58 +0200)
committerJulien HENRY <henryju@yahoo.fr>
Tue, 5 Jul 2016 12:00:16 +0000 (14:00 +0200)
59 files changed:
plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/DeprecatedResourceApiSensor.java
server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilter.java
server/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java
server/sonar-server/src/main/java/org/sonar/server/ws/WsParameterBuilder.java
server/sonar-server/src/test/java/org/sonar/server/platform/DefaultServerFileSystemTest.java [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.jar [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindCheckstyleExtensions/extensions/rules/checkstyle/my-rules2.jar [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin1.jar [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldFindPlugins/extensions/plugins/plugin2.jar [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoCheckstyleExtensions/extensions/rules/pmd/pmd.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/shouldNotFailIfNoPlugins/extensions/plugins/nojar.txt [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/mysql/fake.jar [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/platform/DefaultServerFileSystemTest/testGetJdbcDriver/extensions/jdbc-driver/none/nojar.txt [deleted file]
sonar-core/src/main/java/org/sonar/core/component/DefaultResourceTypes.java
sonar-core/src/test/java/org/sonar/core/component/DefaultResourceTypesTest.java
sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java
sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java
sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml
sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml
sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml
sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml
sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/Directory.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/Java.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaPackage.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Method.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Project.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/Resource.java
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceUtils.java
sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/FileTest.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaPackageTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/MethodTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceUtilsTest.java
sonar-scanner-engine/src/main/java/org/sonar/batch/ProjectConfigurator.java
sonar-scanner-engine/src/main/java/org/sonar/batch/index/DefaultIndex.java
sonar-scanner-engine/src/main/java/org/sonar/batch/phases/AbstractPhaseExecutor.java
sonar-scanner-engine/src/main/java/org/sonar/batch/phases/IssuesPhaseExecutor.java
sonar-scanner-engine/src/main/java/org/sonar/batch/phases/ProjectInitializer.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/batch/phases/PublishPhaseExecutor.java
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java
sonar-scanner-engine/src/test/java/org/sonar/batch/FakeJava.java [new file with mode: 0644]
sonar-scanner-engine/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/cpd/deprecated/DeprecatedCpdBlockIndexerSensorTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/report/ComponentsPublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/scan/LanguageVerifierTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
sonar-scanner-engine/src/test/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactoryTest.java

index bd7cee61f44c16fdb5d3a1b27e08469b42228c9a..3e51d04671671fb2f948070fbeaf5ebddcf3c9c3 100644 (file)
@@ -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))
index ae7dcac8378b6d4d12011ad8a317c41ad7159d18..4062a8747f30a3665fb4ec470404e686fdd1bdc9 100644 (file)
@@ -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();
-    }
   }
 }
index 74c0608c9d09d314041997fd55aaea989868868b..5d6869ed555904edabeb110d18b15fcc401f9ff2 100644 (file)
@@ -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;
   }
 
index 176f533dbe3c9ae43f34c143f9fddca309b8e1e0..3afca7f9f76cccfdba6ac85416e4fc6f70791397 100644 (file)
@@ -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;
-  }
 }
index 533b4237fb22ef83893a78e26bc74baf0015e59d..7f83e1c4bd0f3988bfd315c277ac7421c0a3baa9 100644 (file)
  */
 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 (file)
index 77fab5b..0000000
+++ /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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index e69de29..0000000
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 (file)
index 904931c..0000000
+++ /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 (file)
index e69de29..0000000
index c23cf2bd59674758320355983ce038ebe0ede8f7..03fe1f5d58f319e16d70762b1f710a9e6b748c7d 100644 (file)
 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();
   }
index 801c84da141746f0eebc1efa1682d3d88572b599..8d1557b43fe13753f396fed492478ebaff34a0ea 100644 (file)
@@ -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);
   }
 
index a8a49a0ac291f866fb2927dbccbe42fe4cc70955..da0db73cd1a79a95d9c4a7929e0ba05a6da91b4e 100644 (file)
@@ -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) {
index 43faf115245d57a52cbb7259cc88be9c841d27f3..36fbe09f6974d3ced7cfe56407be6ed68473e3f3 100644 (file)
@@ -69,7 +69,7 @@ public class ResourceIndexDaoTest {
   }
 
   @Test
-  public void shouldNotIndexPackages() {
+  public void shouldNotIndexDirectories() {
     dbTester.prepareDbUnit(getClass(), "shouldNotIndexPackages.xml");
 
     underTest.indexProject("ABCD");
index 6569992d9b1e183c49283b3f9c6bcd2ed5051850..bf53a27b372e0c71fb966f7cddb697888e660d08 100644 (file)
@@ -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);
index a21482b36139c1a9f3c1b66c559ec29a811c5727..b1e6adb30fcc1e12ceabb72e9f0301eb86882f7a 100644 (file)
@@ -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"
                   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"
index 69706bb423c738c93310bf2597d4447d04966f32..78e69d56ec024a855d361d8cb0fff8cdf856d6d2 100644 (file)
@@ -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"
index ee07faf3fc8f05bf13a4fbece207d42c58ba1505..0e759d63ea9e16cb653a1dec982bd17e3a011c36 100644 (file)
@@ -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>
index 953c02f906f4f2458a6de126c49ae62f5c0a1450..1f791dc0b6402d6f36d99a50665ad744af26f2df 100644 (file)
@@ -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"
              period5_date="1317160800000"
              depth="1"
              scope="DIR"
-             qualifier="PAC"
+             qualifier="DIR"
              created_at="1228172400003"
              build_date="1317247200000"
              version="2.2-SNAPSHOT"
              period5_date="1317160800000"
              depth="1"
              scope="DIR"
-             qualifier="PAC"
+             qualifier="DIR"
              created_at="1228172400000"
              build_date="1317247200000"
              version="2.1-SNAPSHOT"
              period5_date="1317160800000"
              depth="1"
              scope="DIR"
-             qualifier="PAC"
+             qualifier="DIR"
              created_at="1228172400000"
              build_date="1317247200000"
              version="2.1-SNAPSHOT"
              period5_date="1317160800000"
              depth="1"
              scope="DIR"
-             qualifier="PAC"
+             qualifier="DIR"
              created_at="1228172400000"
              build_date="1317247200000"
              version="2.1-SNAPSHOT"
index 3ea25fc8b0e0231ef4acb682920692b962204783..06b0e1a889ed03523f6d0000113bce94cfaafa35 100644 (file)
@@ -454,15 +454,6 @@ public class Measure<G extends Serializable> implements Serializable {
     return this;
   }
 
-  /**
-   * 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
index d54049aae0e319d049a2fee8454ff6a8bdfd0f3c..334b663ea88e840c5951645a387066a8be088300 100644 (file)
@@ -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);
-
 }
index eb89b3bc3f7fde48c7ea67754cba7c26d2af240d..fdad251a589c9490b59598b7fd350626b86b22db 100644 (file)
@@ -44,22 +44,6 @@ public class Directory extends Resource {
     this.relativePathFromSourceDir = null;
   }
 
-  /**
-   * @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.
    */
index 8ce94861a68dba4fd04fb7e0094a9689113dac78..2fa8adc4767036010b2f4526f5e585380f74730e 100644 (file)
  */
 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;
 
 /**
@@ -50,50 +46,6 @@ public class File extends Resource {
     this.relativePathFromSourceDir = null;
   }
 
-  /**
-   * @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.
    */
@@ -132,39 +84,6 @@ public class File extends Resource {
     return matcher.match(getKey());
   }
 
-  /**
-  * 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}
    *
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 (file)
index 374c662..0000000
+++ /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 (file)
index 18c6235..0000000
+++ /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 (file)
index 9846257..0000000
+++ /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 (file)
index 5de0b8f..0000000
+++ /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);
-  }
-}
index 238084692a24e6ae7fa26f1bd5254189531270ed..6c88617a87eaba960d691223db51847497d42c36 100644 (file)
@@ -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.
    */
@@ -165,34 +151,6 @@ public class Project extends Resource implements Component {
     return !isRoot();
   }
 
-  /**
-   * @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.
    *
@@ -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/ProjectUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
deleted file mode 100644 (file)
index 8d92fed..0000000
+++ /dev/null
@@ -1,50 +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.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;
-  }
-}
index 6190190e9917da38e0d64e586b285379c5b1fcbb..b66930059ad65dfd29a7228bfe839d25c583f525 100644 (file)
@@ -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";
@@ -138,41 +113,10 @@ public final class Qualifiers {
     return StringUtils.equals(DIRECTORY, resource.getQualifier());
   }
 
-  /**
-   * @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());
-  }
 }
index fa9447168b38708305b5eb3d4faf4f79e10f7f5c..79454dd456be579bb79d0142f66df874255a488b 100644 (file)
@@ -80,12 +80,6 @@ public abstract class Resource implements Serializable {
   @Deprecated
   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.
    */
@@ -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;
index 8373a5f89a1f92be8958055e38f8ee4beb392f49..6f29811822ee8860e464fe3e606fc2db4be11a7a 100644 (file)
@@ -59,14 +59,6 @@ public final class ResourceUtils {
     return Qualifiers.MODULE.equals(resource.getQualifier());
   }
 
-  /**
-   * @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
    */
@@ -111,15 +103,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)}
index 6c04ad3b24f8a1a4440f924658dd59fc5f73f4d9..8133bbcc876f800e60a2934f0a9ce82b16fe4f51 100644 (file)
@@ -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);
index 648d82f637923eadb303c8fb488948a59b0edab6..f707951bb763b7da533d1645e7cf3660bf5ea4bb 100644 (file)
@@ -23,26 +23,13 @@ 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 {
 
   @Rule
   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  ");
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 (file)
index 0726a8b..0000000
+++ /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 (file)
index 7c2228f..0000000
+++ /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 (file)
index ea515f1..0000000
+++ /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 (file)
index a3e940d..0000000
+++ /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);
-    }
-  }
-}
index 248c711822d51bef26be90671d5560dffc2c8f6d..03d2c6180336d76022dc358bfc9b1a85a2cd8234 100644 (file)
@@ -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();
index aee2aab3d71645241b47fcf28eea3d8e0d54b296..a0b55e50519be99914289c8f19cc2a36ff727273 100644 (file)
@@ -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;
 
index d816ae0dd85a8b88ac41bbd4c7bf7d53082923da..2831159d8dd164ed14f5fcb424c476d48725b455 100644 (file)
@@ -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;
   }
 
index c388b75f1f300a6091d3911188a93b2ef0637acc..d3265de0aac83320fa142fdd298d36dc125aacff 100644 (file)
@@ -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();
index ba9a155962e0c8418cbc48585e9cbf393e4437f0..5d8a658e52f76f532033f114f13e74bb23a4ecbe 100644 (file)
@@ -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 (file)
index b9a4b45..0000000
+++ /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);
-    }
-  }
-}
index 33073a110b3d95e2f9d0dad031500a98e31ecd02..98741b5aaf98011aa78f2869f79d88d6cdf8b0d5 100644 (file)
@@ -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;
index 2da9c9e4967f7d4f5bd1c18b957c99bb35331aad..bca62d8b8f33d9e8c409f2c624f955a1589571d5 100644 (file)
@@ -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-scanner-engine/src/test/java/org/sonar/batch/FakeJava.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/FakeJava.java
new file mode 100644 (file)
index 0000000..95c2244
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * SonarQube\r
+ * Copyright (C) 2009-2016 SonarSource SA\r
+ * mailto:contact AT sonarsource DOT com\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 3 of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with this program; if not, write to the Free Software Foundation,\r
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
+ */\r
+package org.sonar.batch;\r
+\r
+import org.sonar.api.resources.AbstractLanguage;\r
+\r
+public class FakeJava extends AbstractLanguage {\r
+\r
+  public static final String KEY = "java";\r
+  public static final FakeJava INSTANCE = new FakeJava();\r
+\r
+  public FakeJava() {\r
+    super(KEY, "Java");\r
+  }\r
+\r
+  @Override\r
+  public String[] getFileSuffixes() {\r
+    return new String[] {".java", ".jav"};\r
+  }\r
+\r
+}\r
index 84b725007d8764289103cb0e0c285c1393f2a3df..7a4d248ca21bcaa814246af547860d048cb4125a 100644 (file)
@@ -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();
-  }
-
 }
index 4adc630247e58b877395b202082694345cfe36c2..b9f53ef76038d79c152655dfee5e4754043ce772 100644 (file)
@@ -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);
   }
 
index 8dae9e19ad032cb06d60a9a5b3d12886e9ef8598..71d560b3d7037a88c201ec48c69ea5d610b406b8 100644 (file)
@@ -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();
index 65c54c6f5c6c6683d2ff8ea2b94fd48353aab95e..d2260c3e070b8cc8eb87fdf3e74441f66c9e8706 100644 (file)
@@ -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));
index 22a4f21091f2f7a88f3206ed7ff608ea52ad6104..55d8264b3efc79e0f607a21bddc75f710a53aa9c 100644 (file)
@@ -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", "");
index 8f5459ec40ad7af53d0f76217151d68af1bca995..0122818621736857a6904491b6b353375bc87534 100644 (file)
@@ -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) {
index b30bb73036ccf513158781b2183316e2299b5254..2f7d3f01434a33dc789b890fc859287ff2ae49b6 100644 (file)
@@ -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();