aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-05-13 14:15:25 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-05-13 14:15:25 +0200
commit29926971d0c6a28fab96438304a7b5fc1945d135 (patch)
tree6768442057e1fff1782f184a1c2acb4743abbfed /sonar-plugin-api
parent681e6cf8078e0ff48d2953863b297c2379a0a359 (diff)
downloadsonarqube-29926971d0c6a28fab96438304a7b5fc1945d135.tar.gz
sonarqube-29926971d0c6a28fab96438304a7b5fc1945d135.zip
SONAR-6548 Remove resource key migration introduced in 4.2
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFile.java68
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFileTest.java79
2 files changed, 0 insertions, 147 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFile.java
deleted file mode 100644
index f70d4a75eea..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFile.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.fs.internal;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * @since 4.2
- */
-public class DeprecatedDefaultInputFile extends DefaultInputFile implements org.sonar.api.resources.InputFile {
-
- public DeprecatedDefaultInputFile(String moduleKey, String relativePath) {
- super(moduleKey, relativePath);
- }
-
- /**
- * @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem#baseDir()}
- */
- @Deprecated
- @Override
- public File getFileBaseDir() {
- return moduleBaseDir.toFile();
- }
-
- /**
- * @deprecated in 4.2. Use {@link #file()}
- */
- @Deprecated
- @Override
- public File getFile() {
- return file();
- }
-
- /**
- * @deprecated in 4.2. Use {@link #relativePath()}
- */
- @Deprecated
- @Override
- public String getRelativePath() {
- return relativePath();
- }
-
- @Override
- public InputStream getInputStream() throws FileNotFoundException {
- return new BufferedInputStream(new FileInputStream(file()));
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFileTest.java
deleted file mode 100644
index 2dd4cce3fe4..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DeprecatedDefaultInputFileTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.sonar.api.batch.fs.internal;
-
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.
- */
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.api.batch.fs.InputFile;
-
-import java.io.File;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DeprecatedDefaultInputFileTest {
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- @Test
- public void test() throws Exception {
- DeprecatedDefaultInputFile inputFile = (DeprecatedDefaultInputFile) new DeprecatedDefaultInputFile("ABCDE", "src/Foo.php")
- .setModuleBaseDir(temp.newFolder().toPath())
- .setLines(42)
- .setLanguage("php")
- .setStatus(InputFile.Status.ADDED)
- .setType(InputFile.Type.TEST);
-
- assertThat(inputFile.relativePath()).isEqualTo("src/Foo.php");
- // deprecated method is different -> path relative to source dir
- assertThat(inputFile.getRelativePath()).isEqualTo("src/Foo.php");
- assertThat(new File(inputFile.relativePath())).isRelative();
- assertThat(inputFile.absolutePath()).endsWith("Foo.php");
- assertThat(new File(inputFile.absolutePath())).isAbsolute();
- assertThat(inputFile.language()).isEqualTo("php");
- assertThat(inputFile.status()).isEqualTo(InputFile.Status.ADDED);
- assertThat(inputFile.type()).isEqualTo(InputFile.Type.TEST);
- assertThat(inputFile.lines()).isEqualTo(42);
- }
-
- @Test
- public void test_equals_and_hashcode() throws Exception {
- DefaultInputFile f1 = new DefaultInputFile("ABCDE", "src/Foo.php");
- DefaultInputFile f1a = new DefaultInputFile("ABCDE", "src/Foo.php");
- DefaultInputFile f2 = new DefaultInputFile("ABCDE", "src/Bar.php");
-
- assertThat(f1).isEqualTo(f1);
- assertThat(f1).isEqualTo(f1a);
- assertThat(f1).isNotEqualTo(f2);
- assertThat(f1.equals("foo")).isFalse();
- assertThat(f1.equals(null)).isFalse();
-
- assertThat(f1.hashCode()).isEqualTo(f1.hashCode());
- assertThat(f1.hashCode()).isEqualTo(f1a.hashCode());
- }
-
- @Test
- public void test_toString() throws Exception {
- DefaultInputFile file = new DefaultInputFile("ABCDE", "src/Foo.php");
- assertThat(file.toString()).isEqualTo("[moduleKey=ABCDE, relative=src/Foo.php, basedir=null]");
- }
-}