@@ -78,8 +78,6 @@ import org.sonar.xoo.rule.XooSonarWayProfile; | |||
import org.sonar.xoo.scm.XooBlameCommand; | |||
import org.sonar.xoo.scm.XooIgnoreCommand; | |||
import org.sonar.xoo.scm.XooScmProvider; | |||
import org.sonar.xoo.test.CoveragePerTestSensor; | |||
import org.sonar.xoo.test.TestExecutionSensor; | |||
/** | |||
* Plugin entry-point, as declared in pom.xml. | |||
@@ -172,10 +170,6 @@ public class XooPlugin implements Plugin { | |||
// Analysis errors | |||
AnalysisErrorSensor.class, | |||
// Tests | |||
TestExecutionSensor.class, | |||
CoveragePerTestSensor.class, | |||
// Other | |||
XooProjectBuilder.class, | |||
XooPostJob.class, |
@@ -30,7 +30,6 @@ import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.sensor.Sensor; | |||
import org.sonar.api.batch.sensor.SensorContext; | |||
import org.sonar.api.batch.sensor.SensorDescriptor; | |||
import org.sonar.api.batch.sensor.coverage.CoverageType; | |||
import org.sonar.api.batch.sensor.coverage.NewCoverage; | |||
import org.sonar.api.utils.log.Logger; | |||
import org.sonar.api.utils.log.Loggers; | |||
@@ -46,8 +45,7 @@ public abstract class AbstractCoverageSensor implements Sensor { | |||
try { | |||
List<String> lines = FileUtils.readLines(coverageFile, context.fileSystem().encoding().name()); | |||
NewCoverage coverageBuilder = context.newCoverage() | |||
.onFile(inputFile) | |||
.ofType(getCoverageType()); | |||
.onFile(inputFile); | |||
int lineNumber = 0; | |||
for (String line : lines) { | |||
lineNumber++; | |||
@@ -80,8 +78,6 @@ public abstract class AbstractCoverageSensor implements Sensor { | |||
protected abstract String getCoverageExtension(); | |||
protected abstract CoverageType getCoverageType(); | |||
@Override | |||
public void describe(SensorDescriptor descriptor) { | |||
descriptor |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.xoo.coverage; | |||
import org.sonar.api.batch.sensor.coverage.CoverageType; | |||
/** | |||
* Parse files *.xoo.itcoverage | |||
*/ | |||
@@ -31,11 +29,6 @@ public class ItCoverageSensor extends AbstractCoverageSensor { | |||
return ".itcoverage"; | |||
} | |||
@Override | |||
protected CoverageType getCoverageType() { | |||
return CoverageType.IT; | |||
} | |||
@Override | |||
protected String getSensorName() { | |||
return "Xoo IT Coverage Sensor"; |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.xoo.coverage; | |||
import org.sonar.api.batch.sensor.coverage.CoverageType; | |||
/** | |||
* Parse files *.xoo.overallcoverage | |||
*/ | |||
@@ -31,11 +29,6 @@ public class OverallCoverageSensor extends AbstractCoverageSensor { | |||
return ".overallcoverage"; | |||
} | |||
@Override | |||
protected CoverageType getCoverageType() { | |||
return CoverageType.OVERALL; | |||
} | |||
@Override | |||
protected String getSensorName() { | |||
return "Xoo Overall Coverage Sensor"; |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.xoo.coverage; | |||
import org.sonar.api.batch.sensor.coverage.CoverageType; | |||
/** | |||
* Parse files *.xoo.coverage | |||
*/ | |||
@@ -31,11 +29,6 @@ public class UtCoverageSensor extends AbstractCoverageSensor { | |||
return ".coverage"; | |||
} | |||
@Override | |||
protected CoverageType getCoverageType() { | |||
return CoverageType.UNIT; | |||
} | |||
@Override | |||
protected String getSensorName() { | |||
return "Xoo UT Coverage Sensor"; |
@@ -19,7 +19,6 @@ | |||
*/ | |||
package org.sonar.xoo.extensions; | |||
import com.google.common.collect.Iterables; | |||
import org.sonar.api.batch.postjob.PostJob; | |||
import org.sonar.api.batch.postjob.PostJobContext; | |||
import org.sonar.api.batch.postjob.PostJobDescriptor; | |||
@@ -34,13 +33,11 @@ public class XooPostJob implements PostJob { | |||
public void describe(PostJobDescriptor descriptor) { | |||
descriptor.name("Xoo Post Job") | |||
.requireProperty("sonar.xoo.enablePostJob"); | |||
} | |||
@Override | |||
public void execute(PostJobContext context) { | |||
LOG.info("Resolved issues: " + Iterables.size(context.resolvedIssues())); | |||
LOG.info("Open issues: " + Iterables.size(context.issues())); | |||
LOG.info("Running Xoo PostJob"); | |||
} | |||
} |
@@ -24,7 +24,6 @@ import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.batch.fs.InputFile; | |||
@@ -77,54 +76,38 @@ public class SymbolReferencesSensor implements Sensor { | |||
Iterator<String> split = Splitter.on(",").split(line).iterator(); | |||
String[] symbolOffsets = split.next().split(":"); | |||
if (symbolOffsets.length == 2) { | |||
int startOffset = parseInt(symbolOffsets[0]); | |||
int endOffset = parseInt(symbolOffsets[1]); | |||
NewSymbol s = symbolTable.newSymbol(startOffset, endOffset); | |||
parseReferences(s, split, endOffset - startOffset); | |||
} else if (symbolOffsets.length == 4) { | |||
if (symbolOffsets.length == 4) { | |||
int startLine = parseInt(symbolOffsets[0]); | |||
int startLineOffset = parseInt(symbolOffsets[1]); | |||
int endLine = parseInt(symbolOffsets[2]); | |||
int endLineOffset = parseInt(symbolOffsets[3]); | |||
NewSymbol s = symbolTable.newSymbol(startLine, startLineOffset, endLine, endLineOffset); | |||
parseReferences(s, split, null); | |||
parseReferences(s, split); | |||
} else { | |||
throw new IllegalStateException("Illegal number of elements separated by ':'. " + | |||
"Must either be startOffset:endOffset (offset in whole file) or startLine:startLineOffset:endLine:endLineOffset"); | |||
"Must be startLine:startLineOffset:endLine:endLineOffset"); | |||
} | |||
} catch (Exception e) { | |||
throw new IllegalStateException("Error processing line " + lineNumber + " of file " + symbolFile.getAbsolutePath(), e); | |||
} | |||
} | |||
private static void parseReferences(NewSymbol s, Iterator<String> split, @Nullable Integer defaultLen) { | |||
private static void parseReferences(NewSymbol s, Iterator<String> split) { | |||
while (split.hasNext()) { | |||
addReference(s, split.next(), defaultLen); | |||
addReference(s, split.next()); | |||
} | |||
} | |||
private static void addReference(NewSymbol s, String str, @Nullable Integer defaultLen) { | |||
if (str.contains(":")) { | |||
String[] split = str.split(":"); | |||
if (split.length == 2) { | |||
int startOffset = parseInt(split[0]); | |||
int endOffset = parseInt(split[1]); | |||
s.newReference(startOffset, endOffset); | |||
} else if (split.length == 4) { | |||
int startLine = parseInt(split[0]); | |||
int startLineOffset = parseInt(split[1]); | |||
int endLine = parseInt(split[2]); | |||
int endLineOffset = parseInt(split[3]); | |||
s.newReference(startLine, startLineOffset, endLine, endLineOffset); | |||
} else { | |||
throw new IllegalStateException("Illegal number of elements separated by ':'"); | |||
} | |||
} else if (defaultLen == null) { | |||
throw new IllegalStateException("Mix of new and old format. Use startLine:startLineOffset:endLine:endLineOffset for references too"); | |||
private static void addReference(NewSymbol s, String str) { | |||
String[] split = str.split(":"); | |||
if (split.length == 4) { | |||
int startLine = parseInt(split[0]); | |||
int startLineOffset = parseInt(split[1]); | |||
int endLine = parseInt(split[2]); | |||
int endLineOffset = parseInt(split[3]); | |||
s.newReference(startLine, startLineOffset, endLine, endLineOffset); | |||
} else { | |||
int startOffset = parseInt(str); | |||
s.newReference(startOffset, startOffset + defaultLen); | |||
throw new IllegalStateException("Illegal number of elements separated by ':'"); | |||
} | |||
} | |||
@@ -71,11 +71,7 @@ public class SyntaxHighlightingSensor implements Sensor { | |||
private static void processLine(File highlightingFile, int lineNumber, NewHighlighting highlighting, String line) { | |||
try { | |||
String[] split = line.split(":"); | |||
if (split.length == 3) { | |||
int startOffset = parseInt(split[0]); | |||
int endOffset = parseInt(split[1]); | |||
highlighting.highlight(startOffset, endOffset, TypeOfText.forCssClass(split[2])); | |||
} else if (split.length == 5) { | |||
if (split.length == 5) { | |||
int startLine = parseInt(split[0]); | |||
int startLineOffset = parseInt(split[1]); | |||
int endLine = parseInt(split[2]); | |||
@@ -83,7 +79,7 @@ public class SyntaxHighlightingSensor implements Sensor { | |||
highlighting.highlight(startLine, startLineOffset, endLine, endLineOffset, TypeOfText.forCssClass(split[4])); | |||
} else { | |||
throw new IllegalStateException("Illegal number of elements separated by ':'. " + | |||
"Must either be startOffset:endOffset:class (offset in whole file) or startLine:startLineOffset:endLine:endLineOffset:class"); | |||
"Must be startLine:startLineOffset:endLine:endLineOffset:class"); | |||
} | |||
} catch (Exception e) { | |||
throw new IllegalStateException("Error processing line " + lineNumber + " of file " + highlightingFile.getAbsolutePath(), e); |
@@ -19,23 +19,15 @@ | |||
*/ | |||
package org.sonar.xoo.rule; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.xoo.Xoo2; | |||
public class Xoo2BasicProfile extends ProfileDefinition { | |||
public class Xoo2BasicProfile implements BuiltInQualityProfilesDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages messages) { | |||
RulesProfile profile = RulesProfile.create("Basic", Xoo2.KEY); | |||
profile.setDefaultProfile(true); | |||
// so UGLY | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO2_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR); | |||
return profile; | |||
public void define(Context context) { | |||
NewBuiltInQualityProfile qProfile = context.createBuiltInQualityProfile("Basic", Xoo2.KEY); | |||
qProfile.setDefault(true); | |||
qProfile.activateRule(XooRulesDefinition.XOO2_REPOSITORY, HasTagSensor.RULE_KEY); | |||
qProfile.done(); | |||
} | |||
} |
@@ -19,22 +19,15 @@ | |||
*/ | |||
package org.sonar.xoo.rule; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.xoo.Xoo2; | |||
public class Xoo2SonarWayProfile extends ProfileDefinition { | |||
public class Xoo2SonarWayProfile implements BuiltInQualityProfilesDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages messages) { | |||
RulesProfile profile = RulesProfile.create("Sonar way", Xoo2.KEY); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO2_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO2_REPOSITORY, OneIssuePerLineSensor.RULE_KEY), RulePriority.MINOR); | |||
return profile; | |||
public void define(Context context) { | |||
NewBuiltInQualityProfile qProfile = context.createBuiltInQualityProfile("Sonar way", Xoo2.KEY); | |||
qProfile.activateRule(XooRulesDefinition.XOO2_REPOSITORY, HasTagSensor.RULE_KEY); | |||
qProfile.activateRule(XooRulesDefinition.XOO2_REPOSITORY, OneIssuePerLineSensor.RULE_KEY); | |||
qProfile.done(); | |||
} | |||
} |
@@ -19,22 +19,15 @@ | |||
*/ | |||
package org.sonar.xoo.rule; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.xoo.Xoo; | |||
public class XooBasicProfile extends ProfileDefinition { | |||
public class XooBasicProfile implements BuiltInQualityProfilesDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
final RulesProfile profile = RulesProfile.create("Basic", Xoo.KEY); | |||
profile.setDefaultProfile(true); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR); | |||
return profile; | |||
public void define(Context context) { | |||
NewBuiltInQualityProfile qProfile = context.createBuiltInQualityProfile("Basic", Xoo.KEY); | |||
qProfile.setDefault(true); | |||
qProfile.activateRule(XooRulesDefinition.XOO_REPOSITORY, HasTagSensor.RULE_KEY); | |||
qProfile.done(); | |||
} | |||
} |
@@ -19,15 +19,13 @@ | |||
*/ | |||
package org.sonar.xoo.rule; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.xoo.Xoo; | |||
public class XooEmptyProfile extends ProfileDefinition { | |||
public class XooEmptyProfile implements BuiltInQualityProfilesDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
return RulesProfile.create("empty", Xoo.KEY); | |||
public void define(Context context) { | |||
context.createBuiltInQualityProfile("empty", Xoo.KEY) | |||
.done(); | |||
} | |||
} |
@@ -19,24 +19,18 @@ | |||
*/ | |||
package org.sonar.xoo.rule; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.rule.Severity; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.xoo.Xoo; | |||
public class XooSonarWayProfile extends ProfileDefinition { | |||
public class XooSonarWayProfile implements BuiltInQualityProfilesDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
final RulesProfile profile = RulesProfile.create("Sonar way", Xoo.KEY); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, HasTagSensor.RULE_KEY), RulePriority.MAJOR); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerLineSensor.RULE_KEY), RulePriority.INFO); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerFileSensor.RULE_KEY), RulePriority.CRITICAL); | |||
profile.activateRule(Rule.create(XooRulesDefinition.XOO_REPOSITORY, HotspotSensor.RULE_KEY), RulePriority.CRITICAL); | |||
return profile; | |||
public void define(Context context) { | |||
NewBuiltInQualityProfile qProfile = context.createBuiltInQualityProfile("Sonar way", Xoo.KEY); | |||
qProfile.activateRule(XooRulesDefinition.XOO_REPOSITORY, HasTagSensor.RULE_KEY).overrideSeverity(Severity.MAJOR); | |||
qProfile.activateRule(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerLineSensor.RULE_KEY).overrideSeverity(Severity.INFO); | |||
qProfile.activateRule(XooRulesDefinition.XOO_REPOSITORY, OneIssuePerFileSensor.RULE_KEY).overrideSeverity(Severity.CRITICAL); | |||
qProfile.activateRule(XooRulesDefinition.XOO_REPOSITORY, HotspotSensor.RULE_KEY).overrideSeverity(Severity.CRITICAL); | |||
qProfile.done(); | |||
} | |||
} |
@@ -1,121 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.xoo.test; | |||
import com.google.common.base.Splitter; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.batch.DependsUpon; | |||
import org.sonar.api.batch.fs.FilePredicates; | |||
import org.sonar.api.batch.fs.FileSystem; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.fs.InputFile.Type; | |||
import org.sonar.api.batch.sensor.Sensor; | |||
import org.sonar.api.batch.sensor.SensorContext; | |||
import org.sonar.api.batch.sensor.SensorDescriptor; | |||
import org.sonar.api.component.ResourcePerspectives; | |||
import org.sonar.api.test.MutableTestCase; | |||
import org.sonar.api.test.MutableTestPlan; | |||
import org.sonar.api.test.MutableTestable; | |||
import org.sonar.api.utils.log.Logger; | |||
import org.sonar.api.utils.log.Loggers; | |||
import org.sonar.xoo.Xoo; | |||
/** | |||
* Parse files *.xoo.testcoverage | |||
*/ | |||
@DependsUpon("test-exec") | |||
public class CoveragePerTestSensor implements Sensor { | |||
private static final Logger LOG = Loggers.get(CoveragePerTestSensor.class); | |||
private static final String TEST_EXTENSION = ".testcoverage"; | |||
private final FileSystem fs; | |||
private final ResourcePerspectives perspectives; | |||
public CoveragePerTestSensor(FileSystem fileSystem, ResourcePerspectives perspectives) { | |||
this.fs = fileSystem; | |||
this.perspectives = perspectives; | |||
} | |||
private void processTestFile(InputFile inputFile, SensorContext context) { | |||
File testExecutionFile = new File(inputFile.file().getParentFile(), inputFile.file().getName() + TEST_EXTENSION); | |||
if (testExecutionFile.exists()) { | |||
LOG.debug("Processing " + testExecutionFile.getAbsolutePath()); | |||
try { | |||
List<String> lines = FileUtils.readLines(testExecutionFile, fs.encoding().name()); | |||
int lineNumber = 0; | |||
MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, inputFile); | |||
for (String line : lines) { | |||
lineNumber++; | |||
if (StringUtils.isBlank(line)) { | |||
continue; | |||
} | |||
if (line.startsWith("#")) { | |||
continue; | |||
} | |||
try { | |||
Iterator<String> split = Splitter.on(";").split(line).iterator(); | |||
String name = split.next(); | |||
while (split.hasNext()) { | |||
String coveredBlockStr = split.next(); | |||
Iterator<String> splitCoveredBlock = Splitter.on(",").split(coveredBlockStr).iterator(); | |||
String componentPath = splitCoveredBlock.next(); | |||
InputFile coveredFile = context.fileSystem().inputFile(context.fileSystem().predicates().hasPath(componentPath)); | |||
MutableTestable testable = perspectives.as(MutableTestable.class, coveredFile); | |||
List<Integer> coveredLines = new ArrayList<>(); | |||
while (splitCoveredBlock.hasNext()) { | |||
coveredLines.add(Integer.parseInt(splitCoveredBlock.next())); | |||
} | |||
for (MutableTestCase testCase : testPlan.testCasesByName(name)) { | |||
testCase.setCoverageBlock(testable, coveredLines); | |||
} | |||
} | |||
} catch (Exception e) { | |||
throw new IllegalStateException("Error processing line " + lineNumber + " of file " + testExecutionFile.getAbsolutePath(), e); | |||
} | |||
} | |||
} catch (IOException e) { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
} | |||
@Override | |||
public void describe(SensorDescriptor descriptor) { | |||
descriptor | |||
.name("Xoo Coverage Per Test Sensor") | |||
.onlyOnLanguages(Xoo.KEY); | |||
} | |||
@Override | |||
public void execute(SensorContext context) { | |||
FilePredicates p = context.fileSystem().predicates(); | |||
for (InputFile file : context.fileSystem().inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.TEST)))) { | |||
processTestFile(file, context); | |||
} | |||
} | |||
} |
@@ -1,119 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.xoo.test; | |||
import com.google.common.base.Splitter; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.batch.DependedUpon; | |||
import org.sonar.api.batch.fs.FilePredicates; | |||
import org.sonar.api.batch.fs.FileSystem; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.fs.InputFile.Type; | |||
import org.sonar.api.batch.sensor.Sensor; | |||
import org.sonar.api.batch.sensor.SensorContext; | |||
import org.sonar.api.batch.sensor.SensorDescriptor; | |||
import org.sonar.api.component.ResourcePerspectives; | |||
import org.sonar.api.test.MutableTestCase; | |||
import org.sonar.api.test.MutableTestPlan; | |||
import org.sonar.api.test.TestCase; | |||
import org.sonar.api.utils.log.Logger; | |||
import org.sonar.api.utils.log.Loggers; | |||
import org.sonar.xoo.Xoo; | |||
/** | |||
* Parse files *.xoo.test | |||
*/ | |||
@DependedUpon("test-exec") | |||
public class TestExecutionSensor implements Sensor { | |||
private static final Logger LOG = Loggers.get(TestExecutionSensor.class); | |||
private static final String TEST_EXTENSION = ".test"; | |||
private final FileSystem fs; | |||
private final ResourcePerspectives perspectives; | |||
public TestExecutionSensor(FileSystem fileSystem, ResourcePerspectives perspectives) { | |||
this.fs = fileSystem; | |||
this.perspectives = perspectives; | |||
} | |||
private void processTestFile(InputFile inputFile, SensorContext context) { | |||
File testExecutionFile = new File(inputFile.file().getParentFile(), inputFile.file().getName() + TEST_EXTENSION); | |||
if (testExecutionFile.exists()) { | |||
LOG.debug("Processing " + testExecutionFile.getAbsolutePath()); | |||
try { | |||
List<String> lines = FileUtils.readLines(testExecutionFile, fs.encoding().name()); | |||
int lineNumber = 0; | |||
MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, inputFile); | |||
for (String line : lines) { | |||
lineNumber++; | |||
if (StringUtils.isBlank(line)) { | |||
continue; | |||
} | |||
if (line.startsWith("#")) { | |||
continue; | |||
} | |||
try { | |||
Iterator<String> split = Splitter.on(":").split(line).iterator(); | |||
String name = split.next(); | |||
String durationStr = split.next(); | |||
Long duration = StringUtils.isNotBlank(durationStr) ? Long.parseLong(durationStr) : null; | |||
String msg = split.next(); | |||
String stack = split.next(); | |||
String status = split.next(); | |||
String type = split.next(); | |||
MutableTestCase testCase = testPlan.addTestCase(name); | |||
testCase.setDurationInMs(duration); | |||
testCase.setMessage(msg); | |||
testCase.setStackTrace(stack); | |||
testCase.setStatus(TestCase.Status.valueOf(status)); | |||
testCase.setType(type); | |||
} catch (Exception e) { | |||
throw new IllegalStateException("Error processing line " + lineNumber + " of file " + testExecutionFile.getAbsolutePath(), e); | |||
} | |||
} | |||
} catch (IOException e) { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
} | |||
@Override | |||
public void describe(SensorDescriptor descriptor) { | |||
descriptor | |||
.name("Xoo Test Execution Sensor") | |||
.onlyOnLanguages(Xoo.KEY); | |||
} | |||
@Override | |||
public void execute(SensorContext context) { | |||
FilePredicates p = context.fileSystem().predicates(); | |||
for (InputFile file : context.fileSystem().inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.TEST)))) { | |||
processTestFile(file, context); | |||
} | |||
} | |||
} |
@@ -1,23 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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. | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.xoo.test; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -19,16 +19,14 @@ | |||
*/ | |||
package org.sonar.xoo.extensions; | |||
import java.util.Arrays; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonar.api.batch.postjob.PostJobContext; | |||
import org.sonar.api.utils.log.LogTester; | |||
import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor; | |||
import org.sonar.api.utils.log.LogTester; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public class XooPostJobTest { | |||
@@ -39,9 +37,7 @@ public class XooPostJobTest { | |||
public void increaseCoverage() { | |||
new XooPostJob().describe(new DefaultPostJobDescriptor()); | |||
PostJobContext context = mock(PostJobContext.class); | |||
when(context.issues()).thenReturn(Arrays.asList()); | |||
when(context.resolvedIssues()).thenReturn(Arrays.asList()); | |||
new XooPostJob().execute(context); | |||
assertThat(logTester.logs()).contains("Resolved issues: 0", "Open issues: 0"); | |||
assertThat(logTester.logs()).contains("Running Xoo PostJob"); | |||
} | |||
} |
@@ -66,7 +66,7 @@ public class SymbolReferencesSensorTest { | |||
@Test | |||
public void testExecution() throws IOException { | |||
File symbol = new File(baseDir, "src/foo.xoo.symbol"); | |||
FileUtils.write(symbol, "1:4,7\n12:15,23:33\n\n#comment"); | |||
FileUtils.write(symbol, "1:1:1:4,1:7:1:10\n1:11:1:13,1:14:1:33\n\n#comment"); | |||
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo") | |||
.initMetadata("xoo file with some source code and length over 33") | |||
.setLanguage(Xoo.KEY) | |||
@@ -78,8 +78,8 @@ public class SymbolReferencesSensorTest { | |||
assertThat(context.referencesForSymbolAt("foo:src/foo.xoo", 1, 2)) | |||
.containsOnly(new DefaultTextRange(new DefaultTextPointer(1, 7), new DefaultTextPointer(1, 10))); | |||
assertThat(context.referencesForSymbolAt("foo:src/foo.xoo", 1, 13)) | |||
.containsOnly(new DefaultTextRange(new DefaultTextPointer(1, 23), new DefaultTextPointer(1, 33))); | |||
assertThat(context.referencesForSymbolAt("foo:src/foo.xoo", 1, 12)) | |||
.containsOnly(new DefaultTextRange(new DefaultTextPointer(1, 14), new DefaultTextPointer(1, 33))); | |||
} | |||
} |
@@ -68,7 +68,7 @@ public class SyntaxHighlightingSensorTest { | |||
@Test | |||
public void testExecution() throws IOException { | |||
File symbol = new File(baseDir, "src/foo.xoo.highlighting"); | |||
FileUtils.write(symbol, "1:4:k\n12:15:cd\n\n#comment"); | |||
FileUtils.write(symbol, "1:1:1:4:k\n2:7:2:10:cd\n\n#comment"); | |||
DefaultInputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo") | |||
.setLanguage("xoo") | |||
.setModuleBaseDir(baseDir.toPath()) |
@@ -25,12 +25,13 @@ import org.junit.Test; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.sonar.api.SonarEdition; | |||
import org.sonar.api.SonarQubeSide; | |||
import org.sonar.api.batch.rule.Severity; | |||
import org.sonar.api.batch.sensor.issue.Issue; | |||
import org.sonar.api.batch.fs.internal.DefaultInputFile; | |||
import org.sonar.api.batch.fs.internal.TestInputFileBuilder; | |||
import org.sonar.api.batch.rule.Severity; | |||
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor; | |||
import org.sonar.api.batch.sensor.internal.SensorContextTester; | |||
import org.sonar.api.batch.sensor.issue.Issue; | |||
import org.sonar.api.config.internal.MapSettings; | |||
import org.sonar.api.internal.SonarRuntimeImpl; | |||
import org.sonar.api.utils.Version; | |||
import org.sonar.xoo.Xoo; | |||
@@ -77,7 +78,7 @@ public class OneIssuePerLineSensorTest { | |||
SensorContextTester context = SensorContextTester.create(temp.newFolder()); | |||
context.fileSystem().add(inputFile); | |||
context.settings().setProperty(OneIssuePerLineSensor.FORCE_SEVERITY_PROPERTY, "MINOR"); | |||
context.setSettings(new MapSettings().setProperty(OneIssuePerLineSensor.FORCE_SEVERITY_PROPERTY, "MINOR")); | |||
sensor.execute(context); | |||
@@ -96,7 +97,7 @@ public class OneIssuePerLineSensorTest { | |||
SensorContextTester context = SensorContextTester.create(temp.newFolder()); | |||
context.fileSystem().add(inputFile); | |||
context.settings().setProperty(OneIssuePerLineSensor.EFFORT_TO_FIX_PROPERTY, "1.2"); | |||
context.setSettings(new MapSettings().setProperty(OneIssuePerLineSensor.EFFORT_TO_FIX_PROPERTY, "1.2")); | |||
sensor.execute(context); | |||
@@ -115,7 +116,7 @@ public class OneIssuePerLineSensorTest { | |||
SensorContextTester context = SensorContextTester.create(temp.newFolder()); | |||
context.fileSystem().add(inputFile); | |||
context.settings().setProperty(OneIssuePerLineSensor.EFFORT_TO_FIX_PROPERTY, "1.2"); | |||
context.setSettings(new MapSettings().setProperty(OneIssuePerLineSensor.EFFORT_TO_FIX_PROPERTY, "1.2")); | |||
context.setRuntime(SonarRuntimeImpl.forSonarQube(Version.parse("5.4"), SonarQubeSide.SCANNER, SonarEdition.COMMUNITY)); | |||
sensor.execute(context); |
@@ -49,7 +49,6 @@ public class HighlightingLineReader implements LineReader { | |||
.put(HighlightingType.ANNOTATION, "a") | |||
.put(HighlightingType.CONSTANT, "c") | |||
.put(HighlightingType.COMMENT, "cd") | |||
.put(HighlightingType.CPP_DOC, "cppd") | |||
.put(HighlightingType.STRUCTURED_COMMENT, "j") | |||
.put(HighlightingType.KEYWORD, "k") | |||
.put(HighlightingType.KEYWORD_LIGHT, "h") |
@@ -46,7 +46,6 @@ import static org.sonar.db.protobuf.DbFileSources.Data.newBuilder; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.ANNOTATION; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.COMMENT; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.CONSTANT; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.CPP_DOC; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.HIGHLIGHTING_STRING; | |||
import static org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType.KEYWORD; | |||
@@ -119,7 +118,7 @@ public class HighlightingLineReaderTest { | |||
public void supports_highlighting_over_multiple_lines_including_an_empty_one() { | |||
List<ScannerReport.SyntaxHighlightingRule> syntaxHighlightingList = new ArrayList<>(); | |||
addHighlighting(syntaxHighlightingList, 1, 0, 1, 7, KEYWORD); // package | |||
addHighlighting(syntaxHighlightingList, 2, 0, 4, 6, CPP_DOC); // comment over 3 lines | |||
addHighlighting(syntaxHighlightingList, 2, 0, 4, 6, COMMENT); // comment over 3 lines | |||
addHighlighting(syntaxHighlightingList, 5, 0, 5, 6, KEYWORD); // public | |||
addHighlighting(syntaxHighlightingList, 5, 7, 5, 12, KEYWORD); // class | |||
HighlightingLineReader highlightingLineReader = new HighlightingLineReader(FILE, syntaxHighlightingList.iterator(), new RangeOffsetConverter()); | |||
@@ -137,9 +136,9 @@ public class HighlightingLineReaderTest { | |||
.extracting("highlighting") | |||
.containsExactly( | |||
"0,7,k", | |||
"0,2,cppd", | |||
"0,2,cd", | |||
"", | |||
"0,6,cppd", | |||
"0,6,cd", | |||
"0,6,k;7,12,k", | |||
""); | |||
} |
@@ -29,7 +29,6 @@ import org.sonar.api.SonarQubeVersion; | |||
import org.sonar.api.config.EmailSettings; | |||
import org.sonar.api.internal.MetadataLoader; | |||
import org.sonar.api.internal.SonarRuntimeImpl; | |||
import org.sonar.api.profiles.AnnotationProfileParser; | |||
import org.sonar.api.profiles.XMLProfileParser; | |||
import org.sonar.api.profiles.XMLProfileSerializer; | |||
import org.sonar.api.resources.Languages; | |||
@@ -109,7 +108,7 @@ import org.sonar.server.l18n.ServerI18n; | |||
import org.sonar.server.log.ServerLogging; | |||
import org.sonar.server.measure.index.ProjectMeasuresIndexer; | |||
import org.sonar.server.metric.CoreCustomMetrics; | |||
import org.sonar.server.metric.DefaultMetricFinder; | |||
import org.sonar.server.metric.MetricFinder; | |||
import org.sonar.server.metric.UnanalyzedLanguageMetrics; | |||
import org.sonar.server.notification.DefaultNotificationManager; | |||
import org.sonar.server.notification.NotificationService; | |||
@@ -362,7 +361,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { | |||
ActiveRuleIndexer.class, | |||
XMLProfileParser.class, | |||
XMLProfileSerializer.class, | |||
AnnotationProfileParser.class, | |||
BuiltInQualityProfileAnnotationLoader.class, | |||
Rules.QProfiles.class, | |||
@@ -378,7 +376,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { | |||
// measure | |||
CoreCustomMetrics.class, | |||
DefaultMetricFinder.class, | |||
MetricFinder.class, | |||
UnanalyzedLanguageMetrics.class, | |||
UserIndexer.class, |
@@ -26,22 +26,20 @@ import java.util.Collection; | |||
import java.util.List; | |||
import javax.annotation.Nonnull; | |||
import org.sonar.api.measures.Metric; | |||
import org.sonar.api.measures.MetricFinder; | |||
import org.sonar.db.DbClient; | |||
import org.sonar.db.DbSession; | |||
import org.sonar.db.metric.MetricDto; | |||
import static com.google.common.collect.FluentIterable.from; | |||
public class DefaultMetricFinder implements MetricFinder { | |||
public class MetricFinder { | |||
private final DbClient dbClient; | |||
public DefaultMetricFinder(DbClient dbClient) { | |||
public MetricFinder(DbClient dbClient) { | |||
this.dbClient = dbClient; | |||
} | |||
@Override | |||
public Metric findByUuid(String uuid) { | |||
try (DbSession session = dbClient.openSession(false)) { | |||
MetricDto dto = dbClient.metricDao().selectByUuid(session, uuid); | |||
@@ -52,7 +50,6 @@ public class DefaultMetricFinder implements MetricFinder { | |||
} | |||
} | |||
@Override | |||
public Metric findByKey(String key) { | |||
try (DbSession session = dbClient.openSession(false)) { | |||
MetricDto dto = dbClient.metricDao().selectByKey(session, key); | |||
@@ -63,7 +60,6 @@ public class DefaultMetricFinder implements MetricFinder { | |||
} | |||
} | |||
@Override | |||
public Collection<Metric> findAll(List<String> metricKeys) { | |||
try (DbSession session = dbClient.openSession(false)) { | |||
List<MetricDto> dtos = dbClient.metricDao().selectByKeys(session, metricKeys); | |||
@@ -71,7 +67,6 @@ public class DefaultMetricFinder implements MetricFinder { | |||
} | |||
} | |||
@Override | |||
public Collection<Metric> findAll() { | |||
try (DbSession session = dbClient.openSession(false)) { | |||
List<MetricDto> dtos = dbClient.metricDao().selectEnabled(session); |
@@ -71,11 +71,6 @@ public class ServerImpl extends Server { | |||
return new Date(state.getStartedAt()); | |||
} | |||
@Override | |||
public File getRootDir() { | |||
return fs.getHomeDir(); | |||
} | |||
@Override | |||
public String getContextPath() { | |||
return urlSettings.getContextPath(); | |||
@@ -86,19 +81,9 @@ public class ServerImpl extends Server { | |||
return urlSettings.getBaseUrl(); | |||
} | |||
@Override | |||
public boolean isDev() { | |||
return false; | |||
} | |||
@Override | |||
public boolean isSecured() { | |||
return urlSettings.isSecured(); | |||
} | |||
@Override | |||
public String getURL() { | |||
return urlSettings.getBaseUrl(); | |||
} | |||
} |
@@ -24,9 +24,7 @@ import com.google.common.collect.ImmutableSet; | |||
import com.google.common.collect.ListMultimap; | |||
import java.lang.annotation.Annotation; | |||
import java.util.Collection; | |||
import java.util.Map; | |||
import java.util.Set; | |||
import org.sonar.api.ExtensionProvider; | |||
import org.sonar.api.Plugin; | |||
import org.sonar.api.SonarRuntime; | |||
import org.sonar.api.config.Configuration; | |||
@@ -38,7 +36,6 @@ import org.sonar.core.platform.PluginRepository; | |||
import static java.lang.String.format; | |||
import static java.util.Objects.requireNonNull; | |||
import static org.sonar.core.extension.ExtensionProviderSupport.isExtensionProvider; | |||
/** | |||
* Loads the plugins server extensions and injects them to DI container | |||
@@ -69,7 +66,7 @@ public abstract class ServerExtensionInstaller { | |||
.build(); | |||
plugin.define(context); | |||
for (Object extension : context.getExtensions()) { | |||
if (installExtension(container, pluginInfo, extension, true) != null) { | |||
if (installExtension(container, pluginInfo, extension) != null) { | |||
installedExtensionsByPlugin.put(pluginInfo, extension); | |||
} else { | |||
container.declareExtension(pluginInfo, extension); | |||
@@ -80,40 +77,11 @@ public abstract class ServerExtensionInstaller { | |||
throw new IllegalStateException(format("Fail to load plugin %s [%s]", pluginInfo.getName(), pluginInfo.getKey()), e); | |||
} | |||
} | |||
for (Map.Entry<PluginInfo, Object> entry : installedExtensionsByPlugin.entries()) { | |||
PluginInfo pluginInfo = entry.getKey(); | |||
try { | |||
Object extension = entry.getValue(); | |||
if (isExtensionProvider(extension)) { | |||
ExtensionProvider provider = (ExtensionProvider) container.getComponentByKey(extension); | |||
installProvider(container, pluginInfo, provider); | |||
} | |||
} catch (Throwable e) { | |||
// catch Throwable because we want to catch Error too (IncompatibleClassChangeError, ...) | |||
throw new IllegalStateException(format("Fail to load plugin %s [%s]", pluginInfo.getName(), pluginInfo.getKey()), e); | |||
} | |||
} | |||
} | |||
private void installProvider(ComponentContainer container, PluginInfo pluginInfo, ExtensionProvider provider) { | |||
Object obj = provider.provide(); | |||
if (obj != null) { | |||
if (obj instanceof Iterable) { | |||
for (Object ext : (Iterable) obj) { | |||
installExtension(container, pluginInfo, ext, false); | |||
} | |||
} else { | |||
installExtension(container, pluginInfo, obj, false); | |||
} | |||
} | |||
} | |||
private Object installExtension(ComponentContainer container, PluginInfo pluginInfo, Object extension, boolean acceptProvider) { | |||
private Object installExtension(ComponentContainer container, PluginInfo pluginInfo, Object extension) { | |||
for (Class<? extends Annotation> supportedAnnotationType : supportedAnnotationTypes) { | |||
if (AnnotationUtils.getAnnotation(extension, supportedAnnotationType) != null) { | |||
if (!acceptProvider && isExtensionProvider(extension)) { | |||
throw new IllegalStateException("ExtensionProvider can not include providers itself: " + extension); | |||
} | |||
container.addExtension(pluginInfo, extension); | |||
return extension; | |||
} |
@@ -30,13 +30,12 @@ import org.sonar.db.metric.MetricDto; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.sonar.db.metric.MetricTesting.newMetricDto; | |||
public class DefaultMetricFinderTest { | |||
public class MetricFinderTest { | |||
@Rule | |||
public DbTester db = DbTester.create(System2.INSTANCE); | |||
private DefaultMetricFinder underTest = new DefaultMetricFinder(db.getDbClient()); | |||
private final MetricFinder underTest = new MetricFinder(db.getDbClient()); | |||
@Test | |||
public void findAll_enabled() { | |||
@@ -69,6 +68,24 @@ public class DefaultMetricFinderTest { | |||
assertThat(underTest.findByUuid(firstMetric.getUuid())).extracting(Metric::getKey).isEqualTo(firstMetric.getKey()); | |||
} | |||
@Test | |||
public void findById_filters_out_disabled() { | |||
MetricDto firstMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
MetricDto secondMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto().setEnabled(false)); | |||
db.commit(); | |||
assertThat(underTest.findByUuid(secondMetric.getUuid())).isNull(); | |||
} | |||
@Test | |||
public void findById_doesnt_find_anything() { | |||
MetricDto firstMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
MetricDto secondMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
db.commit(); | |||
assertThat(underTest.findByUuid("non existing")).isNull(); | |||
} | |||
@Test | |||
public void findByKey() { | |||
MetricDto firstMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
@@ -77,4 +94,22 @@ public class DefaultMetricFinderTest { | |||
assertThat(underTest.findByKey(secondMetric.getKey())).extracting(Metric::getKey).isEqualTo(secondMetric.getKey()); | |||
} | |||
@Test | |||
public void findByKey_filters_out_disabled() { | |||
MetricDto firstMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
MetricDto secondMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto().setEnabled(false)); | |||
db.commit(); | |||
assertThat(underTest.findByKey(secondMetric.getKey())).isNull(); | |||
} | |||
@Test | |||
public void findByKey_doesnt_find_anything() { | |||
MetricDto firstMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
MetricDto secondMetric = db.getDbClient().metricDao().insert(db.getSession(), newMetricDto()); | |||
db.commit(); | |||
assertThat(underTest.findByKey("doesnt exist")).isNull(); | |||
} | |||
} |
@@ -45,11 +45,6 @@ public class ServerImplTest { | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); | |||
@Test | |||
public void isDev_always_returns_false() { | |||
assertThat(underTest.isDev()).isFalse(); | |||
} | |||
@Test | |||
public void test_url_information() { | |||
when(urlSettings.getContextPath()).thenReturn("/foo"); | |||
@@ -57,9 +52,7 @@ public class ServerImplTest { | |||
when(urlSettings.isSecured()).thenReturn(false); | |||
assertThat(underTest.getContextPath()).isEqualTo("/foo"); | |||
assertThat(underTest.getURL()).isEqualTo("http://localhost:9000/foo"); | |||
assertThat(underTest.getPublicRootUrl()).isEqualTo("http://localhost:9000/foo"); | |||
assertThat(underTest.isDev()).isFalse(); | |||
assertThat(underTest.isSecured()).isFalse(); | |||
} | |||
@@ -67,8 +60,6 @@ public class ServerImplTest { | |||
public void test_file_system_information() throws IOException { | |||
File home = temp.newFolder(); | |||
when(fs.getHomeDir()).thenReturn(home); | |||
assertThat(underTest.getRootDir()).isEqualTo(home); | |||
} | |||
@Test |
@@ -101,11 +101,6 @@ class FakeServer extends Server { | |||
return null; | |||
} | |||
@Override | |||
public File getRootDir() { | |||
return null; | |||
} | |||
@Override | |||
public String getContextPath() { | |||
return null; | |||
@@ -116,21 +111,11 @@ class FakeServer extends Server { | |||
return null; | |||
} | |||
@Override | |||
public boolean isDev() { | |||
return false; | |||
} | |||
@Override | |||
public boolean isSecured() { | |||
return false; | |||
} | |||
@Override | |||
public String getURL() { | |||
return null; | |||
} | |||
@Override | |||
public String getPermanentServerId() { | |||
return null; |
@@ -1,91 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.qualityprofile; | |||
import com.google.common.collect.ImmutableList; | |||
import java.util.List; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rules.ActiveRuleParam; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.api.utils.log.Logger; | |||
import org.sonar.api.utils.log.Loggers; | |||
import org.sonar.api.utils.log.Profiler; | |||
import static java.lang.String.format; | |||
/** | |||
* Bridge between deprecated {@link ProfileDefinition} API and new {@link BuiltInQualityProfilesDefinition} | |||
*/ | |||
public class BuiltInQProfileDefinitionsBridge implements BuiltInQualityProfilesDefinition { | |||
private static final Logger LOGGER = Loggers.get(BuiltInQProfileDefinitionsBridge.class); | |||
private final List<ProfileDefinition> definitions; | |||
/** | |||
* Requires for pico container when no {@link ProfileDefinition} is defined at all | |||
*/ | |||
public BuiltInQProfileDefinitionsBridge() { | |||
this(new ProfileDefinition[0]); | |||
} | |||
public BuiltInQProfileDefinitionsBridge(ProfileDefinition... definitions) { | |||
this.definitions = ImmutableList.copyOf(definitions); | |||
} | |||
@Override | |||
public void define(Context context) { | |||
Profiler profiler = Profiler.create(Loggers.get(getClass())); | |||
for (ProfileDefinition definition : definitions) { | |||
profiler.start(); | |||
ValidationMessages validation = ValidationMessages.create(); | |||
RulesProfile profile = definition.createProfile(validation); | |||
validation.log(LOGGER); | |||
if (profile == null) { | |||
profiler.stopDebug(format("Loaded definition %s that return no profile", definition)); | |||
} else { | |||
if (!validation.hasErrors()) { | |||
define(context, profile); | |||
} | |||
profiler.stopDebug(format("Loaded deprecated profile definition %s for language %s", profile.getName(), profile.getLanguage())); | |||
} | |||
} | |||
} | |||
private static void define(Context context, RulesProfile profile) { | |||
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile(profile.getName(), profile.getLanguage()) | |||
.setDefault(profile.getDefaultProfile()); | |||
for (org.sonar.api.rules.ActiveRule ar : profile.getActiveRules()) { | |||
NewBuiltInActiveRule newActiveRule = newQp.activateRule(ar.getRepositoryKey(), ar.getRuleKey()); | |||
RulePriority overriddenSeverity = ar.getOverriddenSeverity(); | |||
if (overriddenSeverity != null) { | |||
newActiveRule.overrideSeverity(overriddenSeverity.name()); | |||
} | |||
for (ActiveRuleParam param : ar.getActiveRuleParams()) { | |||
newActiveRule.overrideParam(param.getKey(), param.getValue()); | |||
} | |||
} | |||
newQp.done(); | |||
} | |||
} |
@@ -1,106 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.qualityprofile; | |||
import java.util.Arrays; | |||
import org.junit.Test; | |||
import org.sonar.api.profiles.ProfileDefinition; | |||
import org.sonar.api.profiles.RulesProfile; | |||
import org.sonar.api.rule.RuleKey; | |||
import org.sonar.api.rule.Severity; | |||
import org.sonar.api.rules.ActiveRule; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RuleParam; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInActiveRule; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.assertj.core.groups.Tuple.tuple; | |||
public class BuiltInQProfileDefinitionsBridgeTest { | |||
@Test | |||
public void noProfileDefinitions() { | |||
BuiltInQProfileDefinitionsBridge bridge = new BuiltInQProfileDefinitionsBridge(); | |||
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context(); | |||
bridge.define(context); | |||
assertThat(context.profilesByLanguageAndName()).isEmpty(); | |||
} | |||
@Test | |||
public void bridgeProfileDefinitions() { | |||
BuiltInQProfileDefinitionsBridge bridge = new BuiltInQProfileDefinitionsBridge(new Profile1(), new NullProfile(), new ProfileWithError()); | |||
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context(); | |||
bridge.define(context); | |||
assertThat(context.profilesByLanguageAndName()).hasSize(1); | |||
assertThat(context.profilesByLanguageAndName().get("xoo")).hasSize(1); | |||
BuiltInQualityProfile profile1 = context.profile("xoo", "Profile 1"); | |||
assertThat(profile1).isNotNull(); | |||
assertThat(profile1.rules()).hasSize(3); | |||
BuiltInActiveRule defaultSeverity = profile1.rule(RuleKey.of("repo1", "defaultSeverity")); | |||
assertThat(defaultSeverity).isNotNull(); | |||
assertThat(defaultSeverity.overriddenSeverity()).isNull(); | |||
assertThat(defaultSeverity.overriddenParams()).isEmpty(); | |||
assertThat(profile1.rule(RuleKey.of("repo1", "overrideSeverity")).overriddenSeverity()).isEqualTo(Severity.CRITICAL); | |||
assertThat(profile1.rule(RuleKey.of("repo1", "overrideParam")).overriddenParams()) | |||
.extracting(BuiltInQualityProfilesDefinition.OverriddenParam::key, BuiltInQualityProfilesDefinition.OverriddenParam::overriddenValue).containsOnly(tuple("param", "value")); | |||
} | |||
private static class Profile1 extends ProfileDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
RulesProfile profile1 = RulesProfile.create("Profile 1", "xoo"); | |||
profile1.activateRule(Rule.create("repo1", "defaultSeverity"), null); | |||
profile1.activateRule(Rule.create("repo1", "overrideSeverity"), RulePriority.CRITICAL); | |||
Rule ruleWithParam = Rule.create("repo1", "overrideParam"); | |||
ruleWithParam.setParams(Arrays.asList(new RuleParam(ruleWithParam, "param", "", ""))); | |||
ActiveRule arWithParam = profile1.activateRule(ruleWithParam, null); | |||
arWithParam.setParameter("param", "value"); | |||
return profile1; | |||
} | |||
} | |||
private static class NullProfile extends ProfileDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
return null; | |||
} | |||
} | |||
private static class ProfileWithError extends ProfileDefinition { | |||
@Override | |||
public RulesProfile createProfile(ValidationMessages validation) { | |||
validation.addErrorText("Foo"); | |||
return RulesProfile.create("Profile with errors", "xoo"); | |||
} | |||
} | |||
} |
@@ -115,7 +115,7 @@ public class RegisterRules implements Startable { | |||
Profiler profiler = Profiler.create(LOG).startInfo("Register rules"); | |||
try (DbSession dbSession = dbClient.openSession(false)) { | |||
RulesDefinition.Context ruleDefinitionContext = defLoader.load(); | |||
List<RulesDefinition.ExtendedRepository> repositories = getRepositories(ruleDefinitionContext); | |||
List<RulesDefinition.Repository> repositories = ruleDefinitionContext.repositories(); | |||
RegisterRulesContext registerRulesContext = createRegisterRulesContext(dbSession); | |||
verifyRuleKeyConsistency(repositories, registerRulesContext); | |||
@@ -149,18 +149,6 @@ public class RegisterRules implements Startable { | |||
} | |||
} | |||
private static List<RulesDefinition.ExtendedRepository> getRepositories(RulesDefinition.Context context) { | |||
List<RulesDefinition.ExtendedRepository> repositories = new ArrayList<>(context.repositories()); | |||
for (RulesDefinition.ExtendedRepository extendedRepoDef : context.extendedRepositories()) { | |||
if (context.repository(extendedRepoDef.key()) == null) { | |||
LOG.warn(format("Extension is ignored, repository %s does not exist", extendedRepoDef.key())); | |||
} else { | |||
repositories.add(extendedRepoDef); | |||
} | |||
} | |||
return repositories; | |||
} | |||
private RegisterRulesContext createRegisterRulesContext(DbSession dbSession) { | |||
Map<RuleKey, RuleDefinitionDto> allRules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream() | |||
.collect(uniqueIndex(RuleDefinitionDto::getKey)); | |||
@@ -736,7 +724,7 @@ public class RegisterRules implements Startable { | |||
* If an extended repository do not exists anymore, then related active rules will be removed. | |||
*/ | |||
private List<ActiveRuleChange> removeActiveRulesOnStillExistingRepositories(DbSession dbSession, RegisterRulesContext recorder, | |||
List<RulesDefinition.ExtendedRepository> context) { | |||
List<RulesDefinition.Repository> context) { | |||
List<String> repositoryKeys = context.stream() | |||
.map(RulesDefinition.ExtendedRepository::key) | |||
.collect(MoreCollectors.toList(context.size())); | |||
@@ -759,7 +747,7 @@ public class RegisterRules implements Startable { | |||
dbClient.ruleDao().update(session, rule); | |||
} | |||
private static void verifyRuleKeyConsistency(List<RulesDefinition.ExtendedRepository> repositories, RegisterRulesContext registerRulesContext) { | |||
private static void verifyRuleKeyConsistency(List<RulesDefinition.Repository> repositories, RegisterRulesContext registerRulesContext) { | |||
List<RulesDefinition.Rule> definedRules = repositories.stream() | |||
.flatMap(r -> r.rules().stream()) | |||
.collect(toList()); |
@@ -1151,7 +1151,7 @@ public class RegisterRulesTest { | |||
static class FbContribRepository implements RulesDefinition { | |||
@Override | |||
public void define(Context context) { | |||
NewExtendedRepository repo = context.extendRepository("findbugs", "java"); | |||
NewExtendedRepository repo = context.createRepository("findbugs", "java"); | |||
repo.createRule("rule2") | |||
.setName("Rule Two") | |||
.setHtmlDescription("Description of Rule Two"); |
@@ -19,7 +19,6 @@ | |||
*/ | |||
package org.sonar.server.telemetry; | |||
import java.io.File; | |||
import java.util.Date; | |||
import javax.annotation.CheckForNull; | |||
import org.sonar.api.platform.Server; | |||
@@ -66,11 +65,6 @@ class FakeServer extends Server { | |||
return null; | |||
} | |||
@Override | |||
public File getRootDir() { | |||
return null; | |||
} | |||
@Override | |||
public String getContextPath() { | |||
return null; | |||
@@ -81,18 +75,9 @@ class FakeServer extends Server { | |||
return null; | |||
} | |||
@Override | |||
public boolean isDev() { | |||
return false; | |||
} | |||
@Override | |||
public boolean isSecured() { | |||
return false; | |||
} | |||
@Override | |||
public String getURL() { | |||
return null; | |||
} | |||
} |
@@ -22,11 +22,11 @@ package org.sonar.server.metric.ws; | |||
import java.util.Collection; | |||
import org.sonar.api.measures.Metric; | |||
import org.sonar.api.measures.Metric.ValueType; | |||
import org.sonar.api.measures.MetricFinder; | |||
import org.sonar.api.server.ws.Request; | |||
import org.sonar.api.server.ws.Response; | |||
import org.sonar.api.server.ws.WebService; | |||
import org.sonar.api.utils.text.JsonWriter; | |||
import org.sonar.server.metric.MetricFinder; | |||
public class UserMetricsAction implements MetricsWsAction { | |||
@@ -23,7 +23,7 @@ import com.google.common.collect.Lists; | |||
import org.junit.Test; | |||
import org.sonar.api.measures.Metric; | |||
import org.sonar.api.measures.Metric.ValueType; | |||
import org.sonar.api.measures.MetricFinder; | |||
import org.sonar.server.metric.MetricFinder; | |||
import org.sonar.server.ws.WsActionTester; | |||
import static org.assertj.core.api.Assertions.assertThat; |
@@ -19,7 +19,6 @@ | |||
*/ | |||
package org.sonar.server.platform.ws; | |||
import java.io.File; | |||
import java.util.Date; | |||
import java.util.Set; | |||
import org.junit.Test; | |||
@@ -186,11 +185,6 @@ public class StatusActionTest { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public File getRootDir() { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public String getContextPath() { | |||
throw new UnsupportedOperationException(); | |||
@@ -201,21 +195,11 @@ public class StatusActionTest { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public boolean isDev() { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public boolean isSecured() { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public String getURL() { | |||
throw new UnsupportedOperationException(); | |||
} | |||
@Override | |||
public String getPermanentServerId() { | |||
throw new UnsupportedOperationException(); |
@@ -28,7 +28,6 @@ import org.sonar.alm.client.github.GithubApplicationClientImpl; | |||
import org.sonar.alm.client.github.GithubApplicationHttpClientImpl; | |||
import org.sonar.alm.client.github.security.GithubAppSecurityImpl; | |||
import org.sonar.alm.client.gitlab.GitlabHttpClient; | |||
import org.sonar.api.profiles.AnnotationProfileParser; | |||
import org.sonar.api.profiles.XMLProfileParser; | |||
import org.sonar.api.profiles.XMLProfileSerializer; | |||
import org.sonar.api.resources.Languages; | |||
@@ -117,7 +116,7 @@ import org.sonar.server.measure.index.ProjectsEsModule; | |||
import org.sonar.server.measure.live.LiveMeasureModule; | |||
import org.sonar.server.measure.ws.MeasuresWsModule; | |||
import org.sonar.server.metric.CoreCustomMetrics; | |||
import org.sonar.server.metric.DefaultMetricFinder; | |||
import org.sonar.server.metric.MetricFinder; | |||
import org.sonar.server.metric.UnanalyzedLanguageMetrics; | |||
import org.sonar.server.metric.ws.MetricsWsModule; | |||
import org.sonar.server.newcodeperiod.ws.NewCodePeriodsWsModule; | |||
@@ -168,7 +167,6 @@ import org.sonar.server.qualitygate.notification.QGChangeNotificationHandler; | |||
import org.sonar.server.qualitygate.ws.QualityGateWsModule; | |||
import org.sonar.server.qualityprofile.BuiltInQPChangeNotificationHandler; | |||
import org.sonar.server.qualityprofile.BuiltInQPChangeNotificationTemplate; | |||
import org.sonar.server.qualityprofile.BuiltInQProfileDefinitionsBridge; | |||
import org.sonar.server.qualityprofile.BuiltInQProfileRepositoryImpl; | |||
import org.sonar.server.qualityprofile.QProfileBackuperImpl; | |||
import org.sonar.server.qualityprofile.QProfileComparison; | |||
@@ -276,12 +274,10 @@ public class PlatformLevel4 extends PlatformLevel { | |||
UpdateCenterModule.class, | |||
// quality profile | |||
BuiltInQProfileDefinitionsBridge.class, | |||
BuiltInQProfileRepositoryImpl.class, | |||
ActiveRuleIndexer.class, | |||
XMLProfileParser.class, | |||
XMLProfileSerializer.class, | |||
AnnotationProfileParser.class, | |||
QProfileComparison.class, | |||
QProfileTreeImpl.class, | |||
QProfileRulesImpl.class, | |||
@@ -330,7 +326,7 @@ public class PlatformLevel4 extends PlatformLevel { | |||
MeasuresWsModule.class, | |||
CustomMeasuresWsModule.class, | |||
CoreCustomMetrics.class, | |||
DefaultMetricFinder.class, | |||
MetricFinder.class, | |||
UnanalyzedLanguageMetrics.class, | |||
QualityGateModule.class, |
@@ -74,13 +74,11 @@ public final class IssueExclusionProperties { | |||
.name(PROPERTY_RULE_KEY_PATTERN) | |||
.description("Pattern to match rules which should be ignored.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build(), | |||
PropertyFieldDefinition.build(RESOURCE_KEY) | |||
.name(PROPERTY_FILE_PATH_PATTERN) | |||
.description("Pattern to match files which should be ignored.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build() | |||
) | |||
.build(), | |||
@@ -97,13 +95,11 @@ public final class IssueExclusionProperties { | |||
.name("Regular Expression for Start of Block") | |||
.description("If this regular expression is found in a file, then following lines are ignored until end of block.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build(), | |||
PropertyFieldDefinition.build(END_BLOCK_REGEXP) | |||
.name("Regular Expression for End of Block") | |||
.description("If specified, this regular expression is used to determine the end of code blocks to ignore. If not, then block ends at the end of file.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build() | |||
) | |||
.build(), | |||
@@ -119,7 +115,6 @@ public final class IssueExclusionProperties { | |||
.name("Regular Expression") | |||
.description("If this regular expression is found in a file, then the whole file is ignored.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build() | |||
) | |||
.build(), | |||
@@ -135,16 +130,14 @@ public final class IssueExclusionProperties { | |||
.name(PROPERTY_RULE_KEY_PATTERN) | |||
.description("Pattern used to match rules which should be restricted.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build(), | |||
PropertyFieldDefinition.build(RESOURCE_KEY) | |||
.name(PROPERTY_FILE_PATH_PATTERN) | |||
.description("Pattern used to match files to which the rules should be restricted.") | |||
.type(PropertyType.STRING) | |||
.indicativeSize(LARGE_SIZE) | |||
.build() | |||
) | |||
.build() | |||
); | |||
); | |||
} | |||
} |
@@ -20,13 +20,10 @@ | |||
package org.sonar.core.extension; | |||
import java.lang.annotation.Annotation; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.Optional; | |||
import java.util.function.Predicate; | |||
import org.sonar.api.ExtensionProvider; | |||
import org.sonar.api.SonarRuntime; | |||
import org.sonar.api.config.Configuration; | |||
import org.sonar.api.config.internal.MapSettings; | |||
@@ -74,8 +71,7 @@ public abstract class CoreExtensionsInstaller { | |||
private void install(ComponentContainer container, Predicate<Object> extensionFilter, Predicate<Object> additionalSideFilter, CoreExtension coreExtension) { | |||
String coreExtensionName = coreExtension.getName(); | |||
try { | |||
List<Object> providerKeys = addDeclaredExtensions(container, extensionFilter, additionalSideFilter, coreExtension); | |||
addProvidedExtensions(container, additionalSideFilter, coreExtensionName, providerKeys); | |||
addDeclaredExtensions(container, extensionFilter, additionalSideFilter, coreExtension); | |||
LOG.debug("Installed core extension: " + coreExtensionName); | |||
coreExtensionRepository.installed(coreExtension); | |||
@@ -84,32 +80,10 @@ public abstract class CoreExtensionsInstaller { | |||
} | |||
} | |||
private List<Object> addDeclaredExtensions(ComponentContainer container, Predicate<Object> extensionFilter, | |||
private void addDeclaredExtensions(ComponentContainer container, Predicate<Object> extensionFilter, | |||
Predicate<Object> additionalSideFilter, CoreExtension coreExtension) { | |||
ContextImpl context = new ContextImpl(container, extensionFilter, additionalSideFilter, coreExtension.getName()); | |||
coreExtension.load(context); | |||
return context.getProviders(); | |||
} | |||
private void addProvidedExtensions(ComponentContainer container, Predicate<Object> additionalSideFilter, | |||
String extensionCategory, List<Object> providerKeys) { | |||
providerKeys.stream() | |||
.map(providerKey -> (ExtensionProvider) container.getComponentByKey(providerKey)) | |||
.forEach(provider -> addFromProvider(container, additionalSideFilter, extensionCategory, provider)); | |||
} | |||
private void addFromProvider(ComponentContainer container, Predicate<Object> additionalSideFilter, | |||
String extensionCategory, ExtensionProvider provider) { | |||
Object obj = provider.provide(); | |||
if (obj != null) { | |||
if (obj instanceof Iterable) { | |||
for (Object ext : (Iterable) obj) { | |||
addSupportedExtension(container, additionalSideFilter, extensionCategory, ext); | |||
} | |||
} else { | |||
addSupportedExtension(container, additionalSideFilter, extensionCategory, obj); | |||
} | |||
} | |||
} | |||
private <T> boolean addSupportedExtension(ComponentContainer container, Predicate<Object> additionalSideFilter, | |||
@@ -130,7 +104,6 @@ public abstract class CoreExtensionsInstaller { | |||
private final Predicate<Object> extensionFilter; | |||
private final Predicate<Object> additionalSideFilter; | |||
private final String extensionCategory; | |||
private final List<Object> providers = new ArrayList<>(); | |||
public ContextImpl(ComponentContainer container, Predicate<Object> extensionFilter, | |||
Predicate<Object> additionalSideFilter, String extensionCategory) { | |||
@@ -160,8 +133,6 @@ public abstract class CoreExtensionsInstaller { | |||
if (!addSupportedExtension(container, additionalSideFilter, extensionCategory, component)) { | |||
container.declareExtension(extensionCategory, component); | |||
} else if (ExtensionProviderSupport.isExtensionProvider(component)) { | |||
providers.add(component); | |||
} | |||
return this; | |||
} | |||
@@ -179,9 +150,5 @@ public abstract class CoreExtensionsInstaller { | |||
components.forEach(this::addExtension); | |||
return this; | |||
} | |||
public List<Object> getProviders() { | |||
return providers; | |||
} | |||
} | |||
} |
@@ -19,17 +19,11 @@ | |||
*/ | |||
package org.sonar.core.extension; | |||
import org.sonar.api.ExtensionProvider; | |||
public final class ExtensionProviderSupport { | |||
private ExtensionProviderSupport() { | |||
// prevents implementation | |||
} | |||
public static boolean isExtensionProvider(Object extension) { | |||
return isType(extension, ExtensionProvider.class) || extension instanceof ExtensionProvider; | |||
} | |||
private static boolean isType(Object extension, Class extensionClass) { | |||
Class clazz = extension instanceof Class ? (Class) extension : extension.getClass(); | |||
return extensionClass.isAssignableFrom(clazz); |
@@ -40,7 +40,6 @@ import org.mockito.ArgumentCaptor; | |||
import org.mockito.InOrder; | |||
import org.mockito.Mockito; | |||
import org.picocontainer.ComponentAdapter; | |||
import org.sonar.api.ExtensionProvider; | |||
import org.sonar.api.Property; | |||
import org.sonar.api.SonarRuntime; | |||
import org.sonar.api.config.Configuration; | |||
@@ -225,21 +224,6 @@ public class CoreExtensionsInstallerTest { | |||
assertPropertyDefinitions(container, coreExtension, propertyDefinitionNoCategory, propertyDefinitionWithCategory); | |||
} | |||
@Test | |||
@UseDataProvider("allMethodsToAddExtension") | |||
public void install_adds_providers_to_container_and_install_extensions_they_provide_when_annotated_with_expected_annotation( | |||
BiConsumer<CoreExtension.Context, Collection<Object>> extensionAdder) { | |||
List<Object> extensions = ImmutableList.of(WestSideProvider.class, PartiallyWestSideProvider.class, EastSideProvider.class); | |||
CoreExtension coreExtension = newCoreExtension(context -> extensionAdder.accept(context, extensions)); | |||
when(coreExtensionRepository.loadedCoreExtensions()).thenReturn(Stream.of(coreExtension)); | |||
ComponentContainer container = new ComponentContainer(); | |||
underTest.install(container, noExtensionFilter(), noAdditionalSideFilter()); | |||
assertAddedExtensions(container, WestSideProvider.class, WestSideProvided.class, PartiallyWestSideProvider.class); | |||
assertPropertyDefinitions(container); | |||
} | |||
@DataProvider | |||
public static Object[][] allMethodsToAddExtension() { | |||
BiConsumer<CoreExtension.Context, Collection<Object>> addExtension = (context, objects) -> objects.forEach(context::addExtension); | |||
@@ -358,42 +342,6 @@ public class CoreExtensionsInstallerTest { | |||
} | |||
@WestSide | |||
public static class WestSideProvider extends ExtensionProvider { | |||
@Override | |||
public Object provide() { | |||
return WestSideProvided.class; | |||
} | |||
} | |||
@WestSide | |||
public static class WestSideProvided { | |||
} | |||
@WestSide | |||
public static class PartiallyWestSideProvider extends ExtensionProvider { | |||
@Override | |||
public Object provide() { | |||
return NotWestSideProvided.class; | |||
} | |||
} | |||
public static class NotWestSideProvided { | |||
} | |||
@EastSide | |||
public static class EastSideProvider extends ExtensionProvider { | |||
@Override | |||
public Object provide() { | |||
throw new IllegalStateException("EastSideProvider#provide should not be called"); | |||
} | |||
} | |||
@Property(key = "westKey", name = "westName") | |||
@WestSide | |||
public static class WestSidePropertyDefinition { |
@@ -25,7 +25,6 @@ import java.util.TreeMap; | |||
import javax.annotation.Nullable; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.fs.internal.DefaultInputFile; | |||
import org.sonar.api.batch.sensor.coverage.CoverageType; | |||
import org.sonar.api.batch.sensor.coverage.NewCoverage; | |||
import org.sonar.api.batch.sensor.internal.DefaultStorable; | |||
import org.sonar.api.batch.sensor.internal.SensorStorage; | |||
@@ -36,7 +35,6 @@ import static org.sonar.api.utils.Preconditions.checkState; | |||
public class DefaultCoverage extends DefaultStorable implements NewCoverage { | |||
private InputFile inputFile; | |||
private CoverageType type; | |||
private int totalCoveredLines = 0; | |||
private int totalConditions = 0; | |||
private int totalCoveredConditions = 0; | |||
@@ -62,16 +60,6 @@ public class DefaultCoverage extends DefaultStorable implements NewCoverage { | |||
return inputFile; | |||
} | |||
@Override | |||
public NewCoverage ofType(CoverageType type) { | |||
this.type = requireNonNull(type, "type can't be null"); | |||
return this; | |||
} | |||
public CoverageType type() { | |||
return type; | |||
} | |||
@Override | |||
public NewCoverage lineHits(int line, int hits) { | |||
validateFile(); |
@@ -75,18 +75,6 @@ public class DefaultHighlighting extends DefaultStorable implements NewHighlight | |||
return inputFile; | |||
} | |||
@Override | |||
public DefaultHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText) { | |||
checkInputFileNotNull(); | |||
TextRange newRange; | |||
try { | |||
newRange = inputFile.newRange(startOffset, endOffset); | |||
} catch (Exception e) { | |||
throw new IllegalArgumentException("Unable to highlight file " + inputFile, e); | |||
} | |||
return highlight(newRange, typeOfText); | |||
} | |||
@Override | |||
public DefaultHighlighting highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, TypeOfText typeOfText) { | |||
checkInputFileNotNull(); |
@@ -95,17 +95,6 @@ public class DefaultSensorDescriptor implements SensorDescriptor { | |||
return this; | |||
} | |||
@Override | |||
public DefaultSensorDescriptor requireProperty(String... propertyKey) { | |||
return requireProperties(propertyKey); | |||
} | |||
@Override | |||
public DefaultSensorDescriptor requireProperties(String... propertyKeys) { | |||
this.configurationPredicate = config -> Arrays.stream(propertyKeys).allMatch(config::hasKey); | |||
return this; | |||
} | |||
@Override | |||
public SensorDescriptor global() { | |||
this.global = true; |
@@ -73,18 +73,6 @@ public class DefaultSymbolTable extends DefaultStorable implements NewSymbolTabl | |||
return newSymbol(declarationRange); | |||
} | |||
@Override | |||
public NewSymbol newSymbol(int startOffset, int endOffset) { | |||
checkInputFileNotNull(); | |||
TextRange declarationRange; | |||
try { | |||
declarationRange = inputFile.newRange(startOffset, endOffset); | |||
} catch (Exception e) { | |||
throw new IllegalArgumentException("Unable to create symbol on file " + inputFile, e); | |||
} | |||
return newSymbol(declarationRange); | |||
} | |||
@Override | |||
public NewSymbol newSymbol(TextRange range) { | |||
checkInputFileNotNull(); | |||
@@ -105,17 +93,6 @@ public class DefaultSymbolTable extends DefaultStorable implements NewSymbolTabl | |||
this.references = references; | |||
} | |||
@Override | |||
public NewSymbol newReference(int startOffset, int endOffset) { | |||
TextRange referenceRange; | |||
try { | |||
referenceRange = inputFile.newRange(startOffset, endOffset); | |||
} catch (Exception e) { | |||
throw new IllegalArgumentException("Unable to create symbol reference on file " + inputFile, e); | |||
} | |||
return newReference(referenceRange); | |||
} | |||
@Override | |||
public NewSymbol newReference(int startLine, int startLineOffset, int endLine, int endLineOffset) { | |||
TextRange referenceRange; |
@@ -30,7 +30,6 @@ import org.sonar.api.server.rule.RulesDefinition; | |||
import org.sonar.api.server.rule.internal.DefaultNewRepository; | |||
import org.sonar.api.server.rule.internal.DefaultRepository; | |||
import static java.util.Collections.emptyList; | |||
import static java.util.Collections.unmodifiableList; | |||
import static org.sonar.api.utils.Preconditions.checkState; | |||
@@ -48,12 +47,6 @@ public class RulesDefinitionContext extends RulesDefinition.Context { | |||
return new DefaultNewRepository(this, RuleKey.EXTERNAL_RULE_REPO_PREFIX + engineId, language, true); | |||
} | |||
@Override | |||
@Deprecated | |||
public RulesDefinition.NewRepository extendRepository(String key, String language) { | |||
return createRepository(key, language); | |||
} | |||
@Override | |||
@CheckForNull | |||
public RulesDefinition.Repository repository(String key) { | |||
@@ -65,18 +58,6 @@ public class RulesDefinitionContext extends RulesDefinition.Context { | |||
return unmodifiableList(new ArrayList<>(repositoriesByKey.values())); | |||
} | |||
@Override | |||
@Deprecated | |||
public List<RulesDefinition.ExtendedRepository> extendedRepositories(String repositoryKey) { | |||
return emptyList(); | |||
} | |||
@Override | |||
@Deprecated | |||
public List<RulesDefinition.ExtendedRepository> extendedRepositories() { | |||
return emptyList(); | |||
} | |||
public void registerRepository(DefaultNewRepository newRepository) { | |||
RulesDefinition.Repository existing = repositoriesByKey.get(newRepository.key()); | |||
if (existing != null) { |
@@ -34,7 +34,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder; | |||
import org.sonar.api.batch.sensor.internal.SensorStorage; | |||
import static org.sonar.api.batch.sensor.highlighting.TypeOfText.COMMENT; | |||
import static org.sonar.api.batch.sensor.highlighting.TypeOfText.CPP_DOC; | |||
import static org.sonar.api.batch.sensor.highlighting.TypeOfText.KEYWORD; | |||
public class DefaultHighlightingTest { | |||
@@ -56,12 +55,12 @@ public class DefaultHighlightingTest { | |||
DefaultHighlighting highlightingDataBuilder = new DefaultHighlighting(Mockito.mock(SensorStorage.class)) | |||
.onFile(INPUT_FILE) | |||
.highlight(0, 10, COMMENT) | |||
.highlight(1, 0, 1, 10, COMMENT) | |||
.highlight(1, 10, 1, 12, KEYWORD) | |||
.highlight(24, 38, KEYWORD) | |||
.highlight(42, 50, KEYWORD) | |||
.highlight(24, 65, CPP_DOC) | |||
.highlight(12, 20, COMMENT); | |||
.highlight(1, 24, 1, 38, KEYWORD) | |||
.highlight(1, 42, 2, 0, KEYWORD) | |||
.highlight(1, 24, 2, 15, COMMENT) | |||
.highlight(1, 12, 1, 20, COMMENT); | |||
highlightingDataBuilder.save(); | |||
@@ -86,15 +85,15 @@ public class DefaultHighlightingTest { | |||
rangeOf(1, 24, 2, 15), | |||
rangeOf(1, 24, 1, 38), | |||
rangeOf(1, 42, 2, 0)); | |||
Assertions.assertThat(highlightingRules).extracting("textType").containsExactly(COMMENT, KEYWORD, COMMENT, CPP_DOC, KEYWORD, KEYWORD); | |||
Assertions.assertThat(highlightingRules).extracting("textType").containsExactly(COMMENT, KEYWORD, COMMENT, COMMENT, KEYWORD, KEYWORD); | |||
} | |||
@Test | |||
public void should_support_overlapping() { | |||
new DefaultHighlighting(Mockito.mock(SensorStorage.class)) | |||
.onFile(INPUT_FILE) | |||
.highlight(0, 15, KEYWORD) | |||
.highlight(8, 12, CPP_DOC) | |||
.highlight(1, 0, 1, 15, KEYWORD) | |||
.highlight(1, 8, 1, 12, COMMENT) | |||
.save(); | |||
} | |||
@@ -106,7 +105,7 @@ public class DefaultHighlightingTest { | |||
new DefaultHighlighting(Mockito.mock(SensorStorage.class)) | |||
.onFile(INPUT_FILE) | |||
.highlight(10, 10, KEYWORD) | |||
.highlight(1, 10, 1, 10, KEYWORD) | |||
.save(); | |||
} | |||
@@ -118,8 +117,8 @@ public class DefaultHighlightingTest { | |||
new DefaultHighlighting(Mockito.mock(SensorStorage.class)) | |||
.onFile(INPUT_FILE) | |||
.highlight(0, 10, KEYWORD) | |||
.highlight(8, 15, KEYWORD) | |||
.highlight(1, 0, 1, 10, KEYWORD) | |||
.highlight(1, 8, 1, 15, KEYWORD) | |||
.save(); | |||
} | |||
@@ -34,7 +34,7 @@ public class DefaultSensorDescriptorTest { | |||
.name("Foo") | |||
.onlyOnLanguage("java") | |||
.onlyOnFileType(InputFile.Type.MAIN) | |||
.requireProperty("sonar.foo.reportPath", "sonar.foo.reportPath2") | |||
.onlyWhenConfiguration(c -> c.hasKey("sonar.foo.reportPath2") && c.hasKey("sonar.foo.reportPath")) | |||
.createIssuesForRuleRepository("squid-java"); | |||
assertThat(descriptor.name()).isEqualTo("Foo"); |
@@ -198,8 +198,8 @@ public class SensorContextTesterTest { | |||
tester.newHighlighting() | |||
.onFile(new TestInputFileBuilder("foo", "src/Foo.java").initMetadata("annot dsf fds foo bar").build()) | |||
.highlight(1, 0, 1, 5, TypeOfText.ANNOTATION) | |||
.highlight(8, 10, TypeOfText.CONSTANT) | |||
.highlight(9, 10, TypeOfText.COMMENT) | |||
.highlight(1, 8, 1, 10, TypeOfText.CONSTANT) | |||
.highlight(1, 9, 1, 10, TypeOfText.COMMENT) | |||
.save(); | |||
assertThat(tester.highlightingTypeAt("foo:src/Foo.java", 1, 3)).containsExactly(TypeOfText.ANNOTATION); | |||
assertThat(tester.highlightingTypeAt("foo:src/Foo.java", 1, 9)).containsExactly(TypeOfText.CONSTANT, TypeOfText.COMMENT); | |||
@@ -228,15 +228,15 @@ public class SensorContextTesterTest { | |||
symbolTable | |||
.newSymbol(1, 1, 1, 5) | |||
.newReference(6, 9) | |||
.newReference(1, 10, 1, 13); | |||
symbolTable.save(); | |||
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 0)).isNull(); | |||
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 8)).isEmpty(); | |||
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 3)).extracting("start.line", "start.lineOffset", "end.line", "end.lineOffset").containsExactly(tuple(1, 6, 1, 9), | |||
tuple(1, 10, 1, 13)); | |||
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 3)) | |||
.extracting("start.line", "start.lineOffset", "end.line", "end.lineOffset") | |||
.containsExactly(tuple(1, 10, 1, 13)); | |||
} | |||
@Test(expected = UnsupportedOperationException.class) |
@@ -27,8 +27,8 @@ import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.fs.TextRange; | |||
import org.sonar.api.batch.sensor.internal.SensorStorage; | |||
import org.sonar.api.batch.fs.internal.TestInputFileBuilder; | |||
import org.sonar.api.batch.sensor.internal.SensorStorage; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
@@ -53,11 +53,13 @@ public class DefaultSymbolTableTest { | |||
DefaultSymbolTable symbolTableBuilder = new DefaultSymbolTable(mock(SensorStorage.class)) | |||
.onFile(INPUT_FILE); | |||
symbolTableBuilder | |||
.newSymbol(0, 10) | |||
.newReference(12, 15) | |||
.newReference(2, 10, 2, 15); | |||
.newSymbol(1, 0, 1, 10) | |||
.newReference(2, 10, 2, 15) | |||
.newReference(1, 16, 1, 20); | |||
symbolTableBuilder.newSymbol(1, 12, 1, 15).newReference(52, 55); | |||
symbolTableBuilder | |||
.newSymbol(1, 12, 1, 15) | |||
.newReference(2, 1, 2, 5); | |||
symbolTableBuilder.save(); | |||
@@ -248,7 +248,7 @@ public interface CoreProperties { | |||
/** | |||
* This property defines the SonarQubeServer base url, such as <i>http://yourhost.yourdomain/sonar</i>. | |||
* When this property is not set, the base url of the SonarQube server is provided by {@link Server#getURL()}. | |||
* When this property is not set, the base url of the SonarQube server is provided by {@link Server#getPublicRootUrl()}. | |||
* | |||
* @since 2.10 | |||
*/ |
@@ -1,70 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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; | |||
import org.sonar.api.ce.ComputeEngineSide; | |||
import org.sonar.api.server.ServerSide; | |||
/** | |||
* Factory of extensions. It allows to dynamically create extensions depending upon runtime context. One use-case is | |||
* to create one rule repository by language. | |||
* | |||
* <p>Notes : | |||
* <ul> | |||
* <li>the provider is declared in Plugin.getExtensions()</li> | |||
* <li>the provider must also add annotation {@link ServerSide}, {@link ComputeEngineSide} and/or {@link BatchSide}</li> | |||
* <li>the provider can accept dependencies (parameters) in its constructors.</li> | |||
* <li>the method provide() is executed once by the platform</li> | |||
* <li>the method provide() must return an object, a class or an Iterable of objects. <strong>Arrays are excluded</strong>.</li> | |||
* </ul> | |||
* | |||
* | |||
* <p>Example: | |||
* <pre> | |||
* {@code | |||
* {@literal @}ServerSide | |||
* public class RuleRepositoryProvider extends ExtensionProvider { | |||
* private Language[] languages; | |||
* | |||
* public RuleRepositoryProvider(Language[] languages) { | |||
* this.languages = languages; | |||
* } | |||
* | |||
* public List<RuleRepository> provide() { | |||
* List<RuleRepository> result = new ArrayList<RuleRepository>(); | |||
* for(Language language: languages) { | |||
* result.add(new RuleRepository(..., language, ...)); | |||
* } | |||
* return result; | |||
* } | |||
* } | |||
* } | |||
* </pre> | |||
* | |||
* | |||
* @since 2.3 | |||
* @deprecated since 6.0 should no more be used | |||
*/ | |||
@Deprecated | |||
@ExtensionPoint | |||
public abstract class ExtensionProvider { | |||
public abstract Object provide(); | |||
} |
@@ -52,15 +52,6 @@ public @interface PropertyField { | |||
*/ | |||
String description() default ""; | |||
/** | |||
* Indicative size of the field value in characters. This size is not validated, it is merely used by the GUI | |||
* to size the different input fields of a property set. | |||
* | |||
* @deprecated since 6.1, as it was only used for UI. | |||
*/ | |||
@Deprecated | |||
int indicativeSize() default 20; | |||
PropertyType type() default PropertyType.STRING; | |||
/** |
@@ -1,42 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.batch; | |||
import org.sonarsource.api.sonarlint.SonarLintSide; | |||
/** | |||
* Use this component to find the current running mode. | |||
* @since 5.1 | |||
* @deprecated since 7.3 preview mode deprecated since 6.6 | |||
*/ | |||
@ScannerSide | |||
@SonarLintSide | |||
@Deprecated | |||
public interface AnalysisMode { | |||
boolean isPreview(); | |||
/** | |||
* @since 5.2 | |||
*/ | |||
boolean isIssues(); | |||
boolean isPublish(); | |||
} |
@@ -19,8 +19,6 @@ | |||
*/ | |||
package org.sonar.api.batch.postjob; | |||
import org.sonar.api.batch.AnalysisMode; | |||
import org.sonar.api.batch.postjob.issue.PostJobIssue; | |||
import org.sonar.api.config.Configuration; | |||
/** | |||
@@ -34,29 +32,4 @@ public interface PostJobContext { | |||
* @since 6.5 | |||
*/ | |||
Configuration config(); | |||
/** | |||
* @deprecated since 7.3 preview mode deprecated since 6.6 | |||
*/ | |||
@Deprecated | |||
AnalysisMode analysisMode(); | |||
// ----------- Only available in preview mode -------------- | |||
/** | |||
* All the unresolved issues of the project, including the issues reported by end-users. Only available in preview/issues mode. | |||
* @throw {@link UnsupportedOperationException} if not in preview/issues mode. To test the mode you can use {@link #analysisMode()}. | |||
* @deprecated since 7.3 the preview/issues mode is deprecated since 6.7 | |||
*/ | |||
@Deprecated | |||
Iterable<PostJobIssue> issues(); | |||
/** | |||
* All the issues of this project that have been marked as resolved during this scan. Only available in preview/issues mode. | |||
* @throw {@link UnsupportedOperationException} if not in preview mode. To test the mode you can use {@link #analysisMode()}. | |||
* @deprecated since 7.3 the preview/issues mode is deprecated since 6.7 | |||
*/ | |||
@Deprecated | |||
Iterable<PostJobIssue> resolvedIssues(); | |||
} |
@@ -112,14 +112,6 @@ public class Checks<C> { | |||
return addAnnotatedChecks((Iterable) Arrays.asList(checkClassesOrObjects)); | |||
} | |||
/** | |||
* @deprecated since 5.2 use {@link #addAnnotatedChecks(Iterable)} | |||
*/ | |||
@Deprecated | |||
public Checks<C> addAnnotatedChecks(Collection checkClassesOrObjects) { | |||
return addAnnotatedChecks((Iterable) checkClassesOrObjects); | |||
} | |||
public Checks<C> addAnnotatedChecks(Iterable checkClassesOrObjects) { | |||
Map<String, Object> checksByEngineKey = new HashMap<>(); | |||
for (Object checkClassesOrObject : checkClassesOrObjects) { |
@@ -57,7 +57,6 @@ public interface SensorContext { | |||
*/ | |||
@Deprecated | |||
Settings settings(); | |||
/** | |||
* Get settings of the project. | |||
* @since 6.5 |
@@ -70,22 +70,6 @@ public interface SensorDescriptor { | |||
*/ | |||
SensorDescriptor createIssuesForRuleRepositories(String... repositoryKeys); | |||
/** | |||
* Property this {@link Sensor} depends on. Used by the platform to skip execution of the {@link Sensor} when | |||
* property is not set. | |||
* @deprecated since 6.5 use {@link #onlyWhenConfiguration(Predicate)} | |||
*/ | |||
@Deprecated | |||
SensorDescriptor requireProperty(String... propertyKey); | |||
/** | |||
* List properties this {@link Sensor} depends on. Used by the platform to skip execution of the {@link Sensor} when | |||
* property is not set. | |||
* @deprecated since 6.5 use {@link #onlyWhenConfiguration(Predicate)} | |||
*/ | |||
@Deprecated | |||
SensorDescriptor requireProperties(String... propertyKeys); | |||
/** | |||
* This sensor should be executed at the project level, instead of per-module. | |||
* @since 6.4 |
@@ -1,35 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.batch.sensor.coverage; | |||
/** | |||
* Different coverage categories. | |||
* @since 5.2 | |||
* | |||
* @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category | |||
*/ | |||
@Deprecated | |||
public enum CoverageType { | |||
UNIT, | |||
IT, | |||
OVERALL | |||
} |
@@ -54,12 +54,6 @@ public interface NewCoverage { | |||
*/ | |||
NewCoverage onFile(InputFile inputFile); | |||
/** | |||
* @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category | |||
*/ | |||
@Deprecated | |||
NewCoverage ofType(CoverageType type); | |||
/** | |||
* Call this method as many time as needed to report coverage hits per line. This method should only be called for executable lines. | |||
* @param line Line number (starts at 1). |
@@ -45,16 +45,6 @@ public interface NewHighlighting { | |||
*/ | |||
NewHighlighting onFile(InputFile inputFile); | |||
/** | |||
* Call this method to indicate the type of text in a range. | |||
* @param startOffset Starting position in file for this type of text. Beginning of a file starts with offset '0'. | |||
* @param endOffset End position in file for this type of text. | |||
* @param typeOfText see {@link TypeOfText} values. | |||
* @deprecated since 5.6 Only supported to ease migration from old API. Please prefer other {@code highlight()} methods. | |||
*/ | |||
@Deprecated | |||
NewHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText); | |||
/** | |||
* Call this method to indicate the type of text in a range. | |||
* @param range Range of text to highlight. See for example {@link InputFile#newRange(int, int, int, int)}. |
@@ -27,11 +27,7 @@ public enum TypeOfText { | |||
ANNOTATION("a"), | |||
CONSTANT("c"), | |||
COMMENT("cd"), | |||
/** | |||
* @deprecated use {@link #COMMENT} | |||
*/ | |||
@Deprecated | |||
CPP_DOC("cppd"), | |||
/** | |||
* For example Javadoc | |||
*/ |
@@ -27,16 +27,6 @@ import org.sonar.api.batch.fs.TextRange; | |||
* @since 5.6 | |||
*/ | |||
public interface NewSymbol { | |||
/** | |||
* Register a new symbol reference. | |||
* @param startOffset Starting position in file for the declaration of this symbol. Beginning of a file starts with offset '0'. | |||
* @param endOffset End position in file for this symbol declaration. | |||
* @deprecated since 6.1 Only supported to ease migration from old API. Please prefer other {@code newReference()} methods. | |||
*/ | |||
@Deprecated | |||
NewSymbol newReference(int startOffset, int endOffset); | |||
/** | |||
* Register a new symbol. | |||
* @param range Range of text for the symbol declaration. See for example {@link InputFile#newRange(int, int, int, int)}. |
@@ -48,15 +48,6 @@ public interface NewSymbolTable { | |||
*/ | |||
NewSymbolTable onFile(InputFile inputFile); | |||
/** | |||
* Register a new symbol declaration. | |||
* @param startOffset Starting position in file for the declaration of this symbol. Beginning of a file starts with offset '0'. | |||
* @param endOffset End position in file for this symbol declaration. | |||
* @deprecated since 5.6 Only supported to ease migration from old API. Please prefer {@link #newSymbol(int, int, int, int)}. | |||
*/ | |||
@Deprecated | |||
NewSymbol newSymbol(int startOffset, int endOffset); | |||
/** | |||
* Register a new symbol declaration. | |||
* @param range Range of text for the symbol declaration. See for example {@link InputFile#newRange(int, int, int, int)}. |
@@ -1,27 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.component; | |||
/** | |||
* @deprecated since 5.2 | |||
*/ | |||
@Deprecated | |||
public interface Perspective { | |||
} |
@@ -1,40 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.component; | |||
import javax.annotation.CheckForNull; | |||
import org.sonar.api.batch.fs.InputFile; | |||
import org.sonar.api.batch.fs.InputPath; | |||
import org.sonar.api.batch.sensor.SensorContext; | |||
/** | |||
* @since 3.5 | |||
* @deprecated since 5.6 all features are available on {@link SensorContext} | |||
*/ | |||
@Deprecated | |||
public interface ResourcePerspectives { | |||
/** | |||
* Allow to create perspective from {@link InputPath}. In particular from {@link InputFile}. | |||
* | |||
* @since 4.5.2 | |||
*/ | |||
@CheckForNull <P extends Perspective> P as(Class<P> perspectiveClass, InputPath inputPath); | |||
} |
@@ -1,23 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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. | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.api.component; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -28,7 +28,6 @@ import java.util.Set; | |||
import java.util.function.Function; | |||
import java.util.regex.Pattern; | |||
import java.util.regex.PatternSyntaxException; | |||
import java.util.stream.Stream; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.commons.lang.math.NumberUtils; | |||
@@ -42,7 +41,6 @@ import org.sonar.api.server.ServerSide; | |||
import org.sonarsource.api.sonarlint.SonarLintSide; | |||
import static java.util.Arrays.asList; | |||
import static java.util.Arrays.stream; | |||
import static java.util.Collections.unmodifiableSet; | |||
import static java.util.Objects.requireNonNull; | |||
import static org.apache.commons.lang.StringUtils.isBlank; | |||
@@ -110,7 +108,6 @@ public final class PropertyDefinition { | |||
private List<String> qualifiers; | |||
private boolean global; | |||
private boolean multiValues; | |||
private String propertySetKey; | |||
private String deprecatedKey; | |||
private List<PropertyFieldDefinition> fields; | |||
/** | |||
@@ -130,7 +127,6 @@ public final class PropertyDefinition { | |||
this.type = builder.type; | |||
this.options = builder.options; | |||
this.multiValues = builder.multiValues; | |||
this.propertySetKey = builder.propertySetKey; | |||
this.fields = builder.fields; | |||
this.deprecatedKey = builder.deprecatedKey; | |||
this.qualifiers = builder.onQualifiers; | |||
@@ -155,7 +151,6 @@ public final class PropertyDefinition { | |||
.type(annotation.type()) | |||
.options(asList(annotation.options())) | |||
.multiValues(annotation.multiValues()) | |||
.propertySetKey(annotation.propertySetKey()) | |||
.fields(PropertyFieldDefinition.create(annotation.fields())) | |||
.deprecatedKey(annotation.deprecatedKey()); | |||
List<String> qualifiers = new ArrayList<>(); | |||
@@ -312,14 +307,6 @@ public final class PropertyDefinition { | |||
return multiValues; | |||
} | |||
/** | |||
* @deprecated since 6.1, as it was not used and too complex to maintain. | |||
*/ | |||
@Deprecated | |||
public String propertySetKey() { | |||
return propertySetKey; | |||
} | |||
public List<PropertyFieldDefinition> fields() { | |||
return fields; | |||
} | |||
@@ -338,10 +325,7 @@ public final class PropertyDefinition { | |||
@Override | |||
public String toString() { | |||
if (isEmpty(propertySetKey)) { | |||
return key; | |||
} | |||
return new StringBuilder().append(propertySetKey).append('|').append(key).toString(); | |||
return key; | |||
} | |||
public static final class Result { | |||
@@ -386,7 +370,6 @@ public final class PropertyDefinition { | |||
private PropertyType type = PropertyType.STRING; | |||
private List<String> options = new ArrayList<>(); | |||
private boolean multiValues = false; | |||
private String propertySetKey = ""; | |||
private List<PropertyFieldDefinition> fields = new ArrayList<>(); | |||
private String deprecatedKey = ""; | |||
private boolean hidden = false; | |||
@@ -552,15 +535,6 @@ public final class PropertyDefinition { | |||
return this; | |||
} | |||
/** | |||
* @deprecated since 6.1, as it was not used and too complex to maintain. | |||
*/ | |||
@Deprecated | |||
public Builder propertySetKey(String propertySetKey) { | |||
this.propertySetKey = propertySetKey; | |||
return this; | |||
} | |||
public Builder fields(PropertyFieldDefinition first, PropertyFieldDefinition... rest) { | |||
this.fields.add(first); | |||
this.fields.addAll(asList(rest)); |
@@ -36,7 +36,6 @@ public final class PropertyFieldDefinition { | |||
private final String key; | |||
private final String name; | |||
private final String description; | |||
private final int indicativeSize; | |||
private final PropertyType type; | |||
private final List<String> options; | |||
@@ -44,7 +43,6 @@ public final class PropertyFieldDefinition { | |||
this.key = builder.key; | |||
this.name = builder.name; | |||
this.description = builder.description; | |||
this.indicativeSize = builder.indicativeSize; | |||
this.type = builder.type; | |||
this.options = builder.options; | |||
} | |||
@@ -55,7 +53,6 @@ public final class PropertyFieldDefinition { | |||
definitions.add(PropertyFieldDefinition.build(field.key()) | |||
.name(field.name()) | |||
.description(field.description()) | |||
.indicativeSize(field.indicativeSize()) | |||
.type(field.type()) | |||
.options(field.options()) | |||
.build()); | |||
@@ -79,14 +76,6 @@ public final class PropertyFieldDefinition { | |||
return description; | |||
} | |||
/** | |||
* @deprecated since 6.1, as it was only used for UI. | |||
*/ | |||
@Deprecated | |||
public int indicativeSize() { | |||
return indicativeSize; | |||
} | |||
public PropertyType type() { | |||
return type; | |||
} | |||
@@ -103,7 +92,6 @@ public final class PropertyFieldDefinition { | |||
private String key; | |||
private String name; | |||
private String description; | |||
private int indicativeSize; | |||
private PropertyType type; | |||
private List<String> options; | |||
@@ -111,7 +99,6 @@ public final class PropertyFieldDefinition { | |||
this.key = key; | |||
this.name = ""; | |||
this.description = ""; | |||
this.indicativeSize = 20; | |||
this.type = PropertyType.STRING; | |||
this.options = new ArrayList<>(); | |||
} | |||
@@ -126,15 +113,6 @@ public final class PropertyFieldDefinition { | |||
return this; | |||
} | |||
/** | |||
* @deprecated since 6.1, as it was only used for UI. | |||
*/ | |||
@Deprecated | |||
public Builder indicativeSize(int indicativeSize) { | |||
this.indicativeSize = indicativeSize; | |||
return this; | |||
} | |||
public Builder type(PropertyType type) { | |||
this.type = type; | |||
return this; |
@@ -1,48 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.measures; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import javax.annotation.CheckForNull; | |||
import org.sonar.api.scanner.ScannerSide; | |||
import org.sonar.api.ce.ComputeEngineSide; | |||
import org.sonar.api.server.ServerSide; | |||
/** | |||
* @since 2.5 | |||
* @deprecated since 5.1 use {@link org.sonar.api.batch.measure.MetricFinder} on scanner side. | |||
*/ | |||
@Deprecated | |||
@ScannerSide | |||
@ServerSide | |||
@ComputeEngineSide | |||
public interface MetricFinder { | |||
@CheckForNull | |||
Metric findByUuid(String uuid); | |||
@CheckForNull | |||
Metric findByKey(String key); | |||
Collection<Metric> findAll(List<String> metricKeys); | |||
Collection<Metric> findAll(); | |||
} |
@@ -69,13 +69,6 @@ public abstract class Server { | |||
*/ | |||
public abstract Date getStartedAt(); | |||
/** | |||
* @deprecated in 6.0. Replaced by {@link ServerFileSystem#getHomeDir()} | |||
* @return an existing directory in server and CE environments, {@code null} in scanner. | |||
*/ | |||
@Deprecated | |||
public abstract File getRootDir(); | |||
/** | |||
* Context path of web server. Value is blank {@code ""} by default. When defined by | |||
* the property {@code sonar.web.context} of conf/sonar.properties, then value starts but does | |||
@@ -92,15 +85,6 @@ public abstract class Server { | |||
*/ | |||
public abstract String getPublicRootUrl(); | |||
/** | |||
* Before version 6.6, the dev mode is enabled when the property {@code sonar.web.dev} is {@code true}. | |||
* Since 6.6, {@code false} is always returned. | |||
* @deprecated in 6.6 | |||
* @since 5.4 | |||
*/ | |||
@Deprecated | |||
public abstract boolean isDev(); | |||
/** | |||
* Return whether or not the {#getPublicRootUrl} is started with https. | |||
* | |||
@@ -109,12 +93,4 @@ public abstract class Server { | |||
*/ | |||
@Deprecated | |||
public abstract boolean isSecured(); | |||
/** | |||
* @return the server URL | |||
* @since since 2.4 on batch side only, since 5.6 on both batch side and server side (WebServer and Compute Engine) | |||
* @deprecated since 6.5, please use {@link #getPublicRootUrl()} instead | |||
*/ | |||
@Deprecated | |||
public abstract String getURL(); | |||
} |
@@ -1,74 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.profiles; | |||
import java.util.Collection; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.ce.ComputeEngineSide; | |||
import org.sonar.api.rules.Rule; | |||
import org.sonar.api.rules.RuleAnnotationUtils; | |||
import org.sonar.api.rules.RuleFinder; | |||
import org.sonar.api.rules.RulePriority; | |||
import org.sonar.api.server.ServerSide; | |||
import org.sonar.api.server.profile.BuiltInQualityProfileAnnotationLoader; | |||
import org.sonar.api.utils.ValidationMessages; | |||
import org.sonar.check.BelongsToProfile; | |||
/** | |||
* @since 2.3 | |||
* @deprecated since 6.6 use {@link BuiltInQualityProfileAnnotationLoader} | |||
*/ | |||
@ServerSide | |||
@ComputeEngineSide | |||
@Deprecated | |||
public final class AnnotationProfileParser { | |||
private final RuleFinder ruleFinder; | |||
public AnnotationProfileParser(RuleFinder ruleFinder) { | |||
this.ruleFinder = ruleFinder; | |||
} | |||
public RulesProfile parse(String repositoryKey, String profileName, String language, Collection<Class> annotatedClasses, ValidationMessages messages) { | |||
RulesProfile profile = RulesProfile.create(profileName, language); | |||
for (Class<?> aClass : annotatedClasses) { | |||
BelongsToProfile belongsToProfile = aClass.getAnnotation(BelongsToProfile.class); | |||
addRule(aClass, belongsToProfile, profile, repositoryKey, messages); | |||
} | |||
return profile; | |||
} | |||
private void addRule(Class aClass, BelongsToProfile annotation, RulesProfile profile, String repositoryKey, ValidationMessages messages) { | |||
if ((annotation != null) && StringUtils.equals(annotation.title(), profile.getName())) { | |||
String ruleKey = RuleAnnotationUtils.getRuleKey(aClass); | |||
Rule rule = ruleFinder.findByKey(repositoryKey, ruleKey); | |||
if (rule == null) { | |||
messages.addWarningText("Rule not found: [repository=" + repositoryKey + ", key=" + ruleKey + "]"); | |||
} else { | |||
RulePriority priority = null; | |||
if (annotation.priority() != null) { | |||
priority = RulePriority.fromCheckPriority(annotation.priority()); | |||
} | |||
profile.activateRule(rule, priority); | |||
} | |||
} | |||
} | |||
} |
@@ -1,41 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.profiles; | |||
import org.sonar.api.ExtensionPoint; | |||
import org.sonar.api.server.ServerSide; | |||
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition; | |||
import org.sonar.api.utils.ValidationMessages; | |||
/** | |||
* Define a profile which is automatically registered during sonar startup. | |||
* The components <code>AnnotationProfileParser</code> and <code>XMLProfileParser</code> can be used to help implementing the method create(). | |||
* | |||
* @since 2.3 | |||
* @deprecated since 6.6 use {@link BuiltInQualityProfilesDefinition} | |||
*/ | |||
@ServerSide | |||
@ExtensionPoint | |||
@Deprecated | |||
public abstract class ProfileDefinition { | |||
public abstract RulesProfile createProfile(ValidationMessages validation); | |||
} |
@@ -36,28 +36,6 @@ import org.sonar.api.utils.MessageException; | |||
* This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric thresholds too. | |||
*/ | |||
public class RulesProfile implements Cloneable { | |||
/** | |||
* Name of the default profile "Sonar Way" | |||
* @deprecated in 4.2. Use your own constant. | |||
*/ | |||
@Deprecated | |||
public static final String SONAR_WAY_NAME = "Sonar way"; | |||
/** | |||
* Name of the default java profile "Sonar way with Findbugs" | |||
* @deprecated in 4.2. Use your own constant. | |||
*/ | |||
@Deprecated | |||
public static final String SONAR_WAY_FINDBUGS_NAME = "Sonar way with Findbugs"; | |||
/** | |||
* Name of the default java profile "Sun checks" | |||
* @deprecated in 4.2. Use your own constant. | |||
*/ | |||
@Deprecated | |||
public static final String SUN_CONVENTIONS_NAME = "Sun checks"; | |||
private String name; | |||
private Boolean defaultProfile = Boolean.FALSE; | |||
private String language; | |||
@@ -212,28 +190,6 @@ public class RulesProfile implements Cloneable { | |||
return this; | |||
} | |||
/** | |||
* Does nothing. | |||
* | |||
* @return {@code null} | |||
* @deprecated in 6.5 | |||
*/ | |||
@Deprecated | |||
@CheckForNull | |||
public String getParentName() { | |||
return null; | |||
} | |||
/** | |||
* Does nothing. | |||
* | |||
* @deprecated in 6.5 | |||
*/ | |||
@Deprecated | |||
public void setParentName(String parentName) { | |||
// does nothing | |||
} | |||
/** | |||
* Note: disabled rules are excluded. | |||
* |
@@ -20,10 +20,8 @@ | |||
package org.sonar.api.rules; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.commons.lang.builder.ToStringBuilder; | |||
@@ -139,22 +137,6 @@ public class ActiveRule implements Cloneable { | |||
this.severity = severity; | |||
} | |||
/** | |||
* @deprecated since 2.5 use {@link #getSeverity()} instead. See http://jira.sonarsource.com/browse/SONAR-1829 | |||
*/ | |||
@Deprecated | |||
public RulePriority getPriority() { | |||
return severity; | |||
} | |||
/** | |||
* @deprecated since 2.5 use {@link #setSeverity(RulePriority)} instead. See http://jira.sonarsource.com/browse/SONAR-1829 | |||
*/ | |||
@Deprecated | |||
public void setPriority(RulePriority priority) { | |||
this.severity = priority; | |||
} | |||
public RulesProfile getRulesProfile() { | |||
return rulesProfile; | |||
} | |||
@@ -224,46 +206,6 @@ public class ActiveRule implements Cloneable { | |||
return rule.getKey(); | |||
} | |||
/** | |||
* @since 4.2 | |||
* @deprecated in 4.4. Feature dropped. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getNoteData() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.2 | |||
* @deprecated in 4.4. Feature dropped. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getNoteUserLogin() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.2 | |||
* @deprecated in 4.4. Feature dropped. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public Date getNoteCreatedAt() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.2 | |||
* @deprecated in 4.4. Feature dropped. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public Date getNoteUpdatedAt() { | |||
return null; | |||
} | |||
@Override | |||
public boolean equals(Object o) { | |||
if (this == o) { |
@@ -397,52 +397,6 @@ public class Rule { | |||
return this; | |||
} | |||
/** | |||
* For internal use only. | |||
* | |||
* @since 4.3 | |||
* @deprecated since 4.4, use {@link #getCharacteristicKey()} | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public Integer getCharacteristicId() { | |||
return null; | |||
} | |||
/** | |||
* For internal use only. | |||
* | |||
* @since 4.3 | |||
* @deprecated since 4.4, use {@link #setCharacteristicKey(String)} | |||
*/ | |||
@Deprecated | |||
public Rule setCharacteristicId(@Nullable Integer characteristicId) { | |||
return this; | |||
} | |||
/** | |||
* For internal use only. | |||
* | |||
* @since 4.3 | |||
* @deprecated since 4.4, use {@link #getDefaultCharacteristicKey()} | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public Integer getDefaultCharacteristicId() { | |||
return null; | |||
} | |||
/** | |||
* For internal use only. | |||
* | |||
* @since 4.3 | |||
* @deprecated since 4.4, use {@link #setDefaultCharacteristicKey(String)} | |||
*/ | |||
@Deprecated | |||
public Rule setDefaultCharacteristicId(@Nullable Integer defaultCharacteristicId) { | |||
return this; | |||
} | |||
@Override | |||
public boolean equals(Object obj) { | |||
if (!(obj instanceof Rule)) { | |||
@@ -518,79 +472,4 @@ public class Rule { | |||
return RuleKey.of(getRepositoryKey(), getKey()); | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getDefaultCharacteristicKey() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@Deprecated | |||
public Rule setDefaultCharacteristicKey(@Nullable String defaultCharacteristicKey) { | |||
return this; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getDefaultSubCharacteristicKey() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@Deprecated | |||
public Rule setDefaultSubCharacteristicKey(@Nullable String defaultSubCharacteristicKey) { | |||
return this; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getCharacteristicKey() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@Deprecated | |||
public Rule setCharacteristicKey(@Nullable String characteristicKey) { | |||
return this; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String getSubCharacteristicKey() { | |||
return null; | |||
} | |||
/** | |||
* @since 4.4 | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
*/ | |||
@Deprecated | |||
public Rule setSubCharacteristicKey(@Nullable String subCharacteristicKey) { | |||
return this; | |||
} | |||
} |
@@ -20,6 +20,7 @@ | |||
package org.sonar.api.security; | |||
import java.util.Collection; | |||
import javax.annotation.CheckForNull; | |||
import javax.servlet.http.HttpServletRequest; | |||
/** | |||
@@ -30,16 +31,6 @@ import javax.servlet.http.HttpServletRequest; | |||
*/ | |||
public abstract class ExternalGroupsProvider { | |||
/** | |||
* @return list of groups associated with specified user, or null if such user doesn't exist | |||
* @throws RuntimeException in case of unexpected error such as connection failure | |||
* @deprecated replaced by {@link #doGetGroups(org.sonar.api.security.ExternalGroupsProvider.Context)} since v. 5.2 | |||
*/ | |||
@Deprecated | |||
public Collection<String> doGetGroups(String username) { | |||
return null; | |||
} | |||
/** | |||
* Override this method in order to load user group information. | |||
* | |||
@@ -47,8 +38,9 @@ public abstract class ExternalGroupsProvider { | |||
* @throws RuntimeException in case of unexpected error such as connection failure | |||
* @since 5.2 | |||
*/ | |||
@CheckForNull | |||
public Collection<String> doGetGroups(Context context) { | |||
return doGetGroups(context.getUsername()); | |||
return null; | |||
} | |||
public static final class Context { |
@@ -29,20 +29,6 @@ import javax.servlet.http.HttpServletRequest; | |||
* @since 2.14 | |||
*/ | |||
public abstract class ExternalUsersProvider { | |||
/** | |||
* This method is overridden by old versions of plugins such as LDAP 1.1. It should not be overridden anymore. | |||
* | |||
* @param username the username | |||
* @return details for specified user, or null if such user doesn't exist | |||
* @throws RuntimeException in case of unexpected error such as connection failure | |||
* @deprecated replaced by {@link #doGetUserDetails(org.sonar.api.security.ExternalUsersProvider.Context)} since v. 3.1 | |||
*/ | |||
@Deprecated | |||
public UserDetails doGetUserDetails(@Nullable String username) { | |||
return null; | |||
} | |||
/** | |||
* Override this method in order load user information. | |||
* | |||
@@ -51,7 +37,7 @@ public abstract class ExternalUsersProvider { | |||
* @since 3.1 | |||
*/ | |||
public UserDetails doGetUserDetails(Context context) { | |||
return doGetUserDetails(context.getUsername()); | |||
return null; | |||
} | |||
public static final class Context { |
@@ -71,14 +71,6 @@ public interface DebtRemediationFunction { | |||
this.usesBaseEffort = usesBaseEffort; | |||
} | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #usesGapMultiplier()} | |||
*/ | |||
@Deprecated | |||
public boolean usesCoefficient() { | |||
return usesGapMultiplier(); | |||
} | |||
/** | |||
* @since 5.5 | |||
*/ | |||
@@ -86,14 +78,6 @@ public interface DebtRemediationFunction { | |||
return usesGapMultiplier; | |||
} | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #usesBaseEffort()} | |||
*/ | |||
@Deprecated | |||
public boolean usesOffset() { | |||
return usesBaseEffort(); | |||
} | |||
/** | |||
* @since 5.5 | |||
*/ | |||
@@ -108,13 +92,6 @@ public interface DebtRemediationFunction { | |||
*/ | |||
Type type(); | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #gapMultiplier()} | |||
*/ | |||
@Deprecated | |||
@CheckForNull | |||
String coefficient(); | |||
/** | |||
* Non-null value on {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET} functions, else {@code null}. | |||
* | |||
@@ -123,13 +100,6 @@ public interface DebtRemediationFunction { | |||
@CheckForNull | |||
String gapMultiplier(); | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #baseEffort()} | |||
*/ | |||
@Deprecated | |||
@CheckForNull | |||
String offset(); | |||
/** | |||
* Non-null value on {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE} functions, else {@code null}. | |||
* |
@@ -61,32 +61,12 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction { | |||
return type; | |||
} | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #gapMultiplier} | |||
*/ | |||
@Override | |||
@CheckForNull | |||
@Deprecated | |||
public String coefficient() { | |||
return gapMultiplier(); | |||
} | |||
@Override | |||
@CheckForNull | |||
public String gapMultiplier() { | |||
return gapMultiplier; | |||
} | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #baseEffort} | |||
*/ | |||
@Override | |||
@CheckForNull | |||
@Deprecated | |||
public String offset() { | |||
return baseEffort(); | |||
} | |||
@Override | |||
public String baseEffort() { | |||
return baseEffort; |
@@ -41,7 +41,6 @@ import org.sonar.api.server.rule.internal.DefaultNewRepository; | |||
import org.sonar.api.server.rule.internal.DefaultRepository; | |||
import org.sonarsource.api.sonarlint.SonarLintSide; | |||
import static java.util.Collections.emptyList; | |||
import static java.util.Collections.unmodifiableList; | |||
import static org.sonar.api.utils.Preconditions.checkState; | |||
@@ -129,230 +128,6 @@ import static org.sonar.api.utils.Preconditions.checkState; | |||
@SonarLintSide | |||
@ExtensionPoint | |||
public interface RulesDefinition { | |||
/** | |||
* Default sub-characteristics of technical debt model. See http://www.sqale.org | |||
* | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. | |||
* See https://jira.sonarsource.com/browse/MMF-184 | |||
*/ | |||
@Deprecated | |||
final class SubCharacteristics { | |||
/** | |||
* Related to characteristic REUSABILITY | |||
*/ | |||
public static final String MODULARITY = "MODULARITY"; | |||
/** | |||
* Related to characteristic REUSABILITY | |||
*/ | |||
public static final String TRANSPORTABILITY = "TRANSPORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String COMPILER_RELATED_PORTABILITY = "COMPILER_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String HARDWARE_RELATED_PORTABILITY = "HARDWARE_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String LANGUAGE_RELATED_PORTABILITY = "LANGUAGE_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String OS_RELATED_PORTABILITY = "OS_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String SOFTWARE_RELATED_PORTABILITY = "SOFTWARE_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String TIME_ZONE_RELATED_PORTABILITY = "TIME_ZONE_RELATED_PORTABILITY"; | |||
/** | |||
* Related to characteristic MAINTAINABILITY | |||
*/ | |||
public static final String READABILITY = "READABILITY"; | |||
/** | |||
* Related to characteristic MAINTAINABILITY | |||
*/ | |||
public static final String UNDERSTANDABILITY = "UNDERSTANDABILITY"; | |||
/** | |||
* Related to characteristic SECURITY | |||
*/ | |||
public static final String API_ABUSE = "API_ABUSE"; | |||
/** | |||
* Related to characteristic SECURITY | |||
*/ | |||
public static final String ERRORS = "ERRORS"; | |||
/** | |||
* Related to characteristic SECURITY | |||
*/ | |||
public static final String INPUT_VALIDATION_AND_REPRESENTATION = "INPUT_VALIDATION_AND_REPRESENTATION"; | |||
/** | |||
* Related to characteristic SECURITY | |||
*/ | |||
public static final String SECURITY_FEATURES = "SECURITY_FEATURES"; | |||
/** | |||
* Related to characteristic EFFICIENCY | |||
*/ | |||
public static final String CPU_EFFICIENCY = "CPU_EFFICIENCY"; | |||
/** | |||
* Related to characteristic EFFICIENCY | |||
*/ | |||
public static final String MEMORY_EFFICIENCY = "MEMORY_EFFICIENCY"; | |||
/** | |||
* Related to characteristic EFFICIENCY | |||
*/ | |||
public static final String NETWORK_USE = "NETWORK_USE"; | |||
/** | |||
* Related to characteristic CHANGEABILITY | |||
*/ | |||
public static final String ARCHITECTURE_CHANGEABILITY = "ARCHITECTURE_CHANGEABILITY"; | |||
/** | |||
* Related to characteristic CHANGEABILITY | |||
*/ | |||
public static final String DATA_CHANGEABILITY = "DATA_CHANGEABILITY"; | |||
/** | |||
* Related to characteristic CHANGEABILITY | |||
*/ | |||
public static final String LOGIC_CHANGEABILITY = "LOGIC_CHANGEABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String ARCHITECTURE_RELIABILITY = "ARCHITECTURE_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String DATA_RELIABILITY = "DATA_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String EXCEPTION_HANDLING = "EXCEPTION_HANDLING"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String FAULT_TOLERANCE = "FAULT_TOLERANCE"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String INSTRUCTION_RELIABILITY = "INSTRUCTION_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String LOGIC_RELIABILITY = "LOGIC_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String RESOURCE_RELIABILITY = "RESOURCE_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String SYNCHRONIZATION_RELIABILITY = "SYNCHRONIZATION_RELIABILITY"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String UNIT_TESTS = "UNIT_TESTS"; | |||
/** | |||
* Related to characteristic TESTABILITY | |||
*/ | |||
public static final String INTEGRATION_TESTABILITY = "INTEGRATION_TESTABILITY"; | |||
/** | |||
* Related to characteristic TESTABILITY | |||
*/ | |||
public static final String UNIT_TESTABILITY = "UNIT_TESTABILITY"; | |||
/** | |||
* Related to characteristic ACCESSIBILITY | |||
*/ | |||
public static final String USABILITY_ACCESSIBILITY = "USABILITY_ACCESSIBILITY"; | |||
/** | |||
* Related to characteristic ACCESSIBILITY | |||
*/ | |||
public static final String USABILITY_COMPLIANCE = "USABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic ACCESSIBILITY | |||
*/ | |||
public static final String USABILITY_EASE_OF_USE = "USABILITY_EASE_OF_USE"; | |||
/** | |||
* Related to characteristic REUSABILITY | |||
*/ | |||
public static final String REUSABILITY_COMPLIANCE = "REUSABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic PORTABILITY | |||
*/ | |||
public static final String PORTABILITY_COMPLIANCE = "PORTABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic MAINTAINABILITY | |||
*/ | |||
public static final String MAINTAINABILITY_COMPLIANCE = "MAINTAINABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic SECURITY | |||
*/ | |||
public static final String SECURITY_COMPLIANCE = "SECURITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic EFFICIENCY | |||
*/ | |||
public static final String EFFICIENCY_COMPLIANCE = "EFFICIENCY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic CHANGEABILITY | |||
*/ | |||
public static final String CHANGEABILITY_COMPLIANCE = "CHANGEABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic RELIABILITY | |||
*/ | |||
public static final String RELIABILITY_COMPLIANCE = "RELIABILITY_COMPLIANCE"; | |||
/** | |||
* Related to characteristic TESTABILITY | |||
*/ | |||
public static final String TESTABILITY_COMPLIANCE = "TESTABILITY_COMPLIANCE"; | |||
private SubCharacteristics() { | |||
// only constants | |||
} | |||
} | |||
/** | |||
* This implementation will be removed as soon as analyzers stop instantiating it. | |||
* Use RulesDefinitionContext in sonar-plugin-api-impl. | |||
@@ -371,12 +146,6 @@ public interface RulesDefinition { | |||
return new DefaultNewRepository(this, RuleKey.EXTERNAL_RULE_REPO_PREFIX + engineId, language, true); | |||
} | |||
@Override | |||
@Deprecated | |||
public RulesDefinition.NewRepository extendRepository(String key, String language) { | |||
return createRepository(key, language); | |||
} | |||
@Override | |||
@CheckForNull | |||
public RulesDefinition.Repository repository(String key) { | |||
@@ -388,18 +157,6 @@ public interface RulesDefinition { | |||
return unmodifiableList(new ArrayList<>(repositoriesByKey.values())); | |||
} | |||
@Override | |||
@Deprecated | |||
public List<RulesDefinition.ExtendedRepository> extendedRepositories(String repositoryKey) { | |||
return emptyList(); | |||
} | |||
@Override | |||
@Deprecated | |||
public List<RulesDefinition.ExtendedRepository> extendedRepositories() { | |||
return emptyList(); | |||
} | |||
public void registerRepository(DefaultNewRepository newRepository) { | |||
RulesDefinition.Repository existing = repositoriesByKey.get(newRepository.key()); | |||
if (existing != null) { | |||
@@ -442,31 +199,11 @@ public interface RulesDefinition { | |||
*/ | |||
public abstract NewRepository createExternalRepository(String engineId, String language); | |||
/** | |||
* @deprecated since 5.2. Simply use {@link #createRepository(String, String)} | |||
*/ | |||
@Deprecated | |||
public abstract NewRepository extendRepository(String key, String language); | |||
@CheckForNull | |||
public abstract Repository repository(String key); | |||
public abstract List<Repository> repositories(); | |||
/** | |||
* @deprecated returns empty list since 5.2. Concept of "extended repository" was misleading and not valuable. Simply declare | |||
* repositories and use {@link #repositories()}. See http://jira.sonarsource.com/browse/SONAR-6709 | |||
*/ | |||
@Deprecated | |||
public abstract List<ExtendedRepository> extendedRepositories(String repositoryKey); | |||
/** | |||
* @deprecated returns empty list since 5.2. Concept of "extended repository" was misleading and not valuable. Simply declare | |||
* repositories and use {@link #repositories()}. See http://jira.sonarsource.com/browse/SONAR-6709 | |||
*/ | |||
@Deprecated | |||
public abstract List<ExtendedRepository> extendedRepositories(); | |||
public abstract void setCurrentPluginKey(@Nullable String pluginKey); | |||
} | |||
@@ -639,17 +376,6 @@ public interface RulesDefinition { | |||
*/ | |||
public abstract NewRule setStatus(RuleStatus status); | |||
/** | |||
* SQALE sub-characteristic. See http://www.sqale.org | |||
* | |||
* @see org.sonar.api.server.rule.RulesDefinition.SubCharacteristics for constant values | |||
* @see #setType(RuleType) | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. This method does nothing. | |||
* See https://jira.sonarsource.com/browse/MMF-184 | |||
*/ | |||
@Deprecated | |||
public abstract NewRule setDebtSubCharacteristic(@Nullable String s); | |||
/** | |||
* Factory of {@link org.sonar.api.server.debt.DebtRemediationFunction} | |||
*/ | |||
@@ -660,12 +386,6 @@ public interface RulesDefinition { | |||
*/ | |||
public abstract NewRule setDebtRemediationFunction(@Nullable DebtRemediationFunction fn); | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #setGapDescription(String)} | |||
*/ | |||
@Deprecated | |||
public abstract NewRule setEffortToFixDescription(@Nullable String s); | |||
/** | |||
* For rules that use LINEAR or LINEAR_OFFSET remediation functions, the meaning | |||
* of the function parameter (= "gap") must be set. This description | |||
@@ -772,25 +492,9 @@ public interface RulesDefinition { | |||
public abstract RuleStatus status(); | |||
/** | |||
* @see #type() | |||
* @deprecated in 5.5. SQALE Quality Model is replaced by SonarQube Quality Model. {@code null} is | |||
* always returned. See https://jira.sonarsource.com/browse/MMF-184 | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public abstract String debtSubCharacteristic(); | |||
@CheckForNull | |||
public abstract DebtRemediationFunction debtRemediationFunction(); | |||
/** | |||
* @deprecated since 5.5, replaced by {@link #gapDescription()} | |||
*/ | |||
@Deprecated | |||
@CheckForNull | |||
public abstract String effortToFixDescription(); | |||
@CheckForNull | |||
public abstract String gapDescription(); | |||
@@ -130,25 +130,25 @@ import static org.apache.commons.lang.StringUtils.trim; | |||
* | |||
* <!-- Quality Model - type of debt remediation function --> | |||
* <!-- See enum {@link org.sonar.api.server.debt.DebtRemediationFunction.Type} for supported values --> | |||
* <!-- It was previously named 'debtRemediationFunction' which is still supported but deprecated since 5.5 --> | |||
* <!-- It was previously named 'debtRemediationFunction'. --> | |||
* <!-- Since 5.5 --> | |||
* <remediationFunction>LINEAR_OFFSET</remediationFunction> | |||
* | |||
* <!-- Quality Model - raw description of the "gap", used for some types of remediation functions. --> | |||
* <!-- See {@link org.sonar.api.server.rule.RulesDefinition.NewRule#setGapDescription(String)} --> | |||
* <!-- It was previously named 'effortToFixDescription' which is still supported but deprecated since 5.5 --> | |||
* <!-- It was previously named 'effortToFixDescription'. --> | |||
* <!-- Since 5.5 --> | |||
* <gapDescription>Effort to test one uncovered condition</gapFixDescription> | |||
* | |||
* <!-- Quality Model - gap multiplier of debt remediation function. Must be defined only for some function types. --> | |||
* <!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --> | |||
* <!-- It was previously named 'debtRemediationFunctionCoefficient' which is still supported but deprecated since 5.5 --> | |||
* <!-- It was previously named 'debtRemediationFunctionCoefficient'. --> | |||
* <!-- Since 5.5 --> | |||
* <remediationFunctionGapMultiplier>10min</remediationFunctionGapMultiplier> | |||
* | |||
* <!-- Quality Model - base effort of debt remediation function. Must be defined only for some function types. --> | |||
* <!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --> | |||
* <!-- It was previously named 'debtRemediationFunctionOffset' which is still supported but deprecated since 5.5 --> | |||
* <!-- It was previously named 'debtRemediationFunctionOffset'. --> | |||
* <!-- Since 5.5 --> | |||
* <remediationFunctionBaseEffort>2min</remediationFunctionBaseEffort> | |||
* |
@@ -172,11 +172,6 @@ class DefaultNewRule extends RulesDefinition.NewRule { | |||
return this; | |||
} | |||
@Override | |||
public DefaultNewRule setDebtSubCharacteristic(@Nullable String s) { | |||
return this; | |||
} | |||
@Override | |||
public RulesDefinition.DebtRemediationFunctions debtRemediationFunctions() { | |||
return functions; | |||
@@ -188,12 +183,6 @@ class DefaultNewRule extends RulesDefinition.NewRule { | |||
return this; | |||
} | |||
@Deprecated | |||
@Override | |||
public DefaultNewRule setEffortToFixDescription(@Nullable String s) { | |||
return setGapDescription(s); | |||
} | |||
@Override | |||
public DefaultNewRule setGapDescription(@Nullable String s) { | |||
this.gapDescription = s; |
@@ -154,26 +154,12 @@ public class DefaultRule extends RulesDefinition.Rule { | |||
return status; | |||
} | |||
@CheckForNull | |||
@Deprecated | |||
@Override | |||
public String debtSubCharacteristic() { | |||
return null; | |||
} | |||
@CheckForNull | |||
@Override | |||
public DebtRemediationFunction debtRemediationFunction() { | |||
return debtRemediationFunction; | |||
} | |||
@Deprecated | |||
@CheckForNull | |||
@Override | |||
public String effortToFixDescription() { | |||
return gapDescription(); | |||
} | |||
@CheckForNull | |||
@Override | |||
public String gapDescription() { |
@@ -33,7 +33,6 @@ import java.util.function.Supplier; | |||
import java.util.stream.Collectors; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.api.utils.DateUtils; | |||
import static java.lang.String.format; | |||
@@ -149,45 +148,6 @@ public abstract class Request { | |||
return part; | |||
} | |||
/** | |||
* @deprecated to be dropped in 4.4. Default values are declared in ws metadata | |||
*/ | |||
@CheckForNull | |||
@Deprecated | |||
public String param(String key, @CheckForNull String defaultValue) { | |||
return StringUtils.defaultString(param(key), defaultValue); | |||
} | |||
/** | |||
* @deprecated to be dropped in 4.4. Default values must be declared in {@link org.sonar.api.server.ws.WebService} then | |||
* this method can be replaced by {@link #mandatoryParamAsBoolean(String)}. | |||
*/ | |||
@Deprecated | |||
public boolean paramAsBoolean(String key, boolean defaultValue) { | |||
String value = param(key); | |||
return value == null ? defaultValue : parseBoolean(key, value); | |||
} | |||
/** | |||
* @deprecated to be dropped in 4.4. Default values must be declared in {@link org.sonar.api.server.ws.WebService} then | |||
* this method can be replaced by {@link #mandatoryParamAsInt(String)}. | |||
*/ | |||
@Deprecated | |||
public int paramAsInt(String key, int defaultValue) { | |||
String s = param(key); | |||
return s == null ? defaultValue : parseInt(key, s); | |||
} | |||
/** | |||
* @deprecated to be dropped in 4.4. Default values must be declared in {@link org.sonar.api.server.ws.WebService} then | |||
* this method can be replaced by {@link #mandatoryParamAsLong(String)}. | |||
*/ | |||
@Deprecated | |||
public long paramAsLong(String key, long defaultValue) { | |||
String s = param(key); | |||
return s == null ? defaultValue : parseLong(key, s); | |||
} | |||
@CheckForNull | |||
public Boolean paramAsBoolean(String key) { | |||
String value = param(key); |
@@ -673,17 +673,6 @@ public interface WebService extends Definable<WebService.Context> { | |||
return this; | |||
} | |||
/** | |||
* @see #setDeprecatedKey(String, String) | |||
* @since 5.0 | |||
* @deprecated since 6.4 | |||
*/ | |||
@Deprecated | |||
public NewParam setDeprecatedKey(@Nullable String s) { | |||
this.deprecatedKey = s; | |||
return this; | |||
} | |||
/** | |||
* @param deprecatedSince Version when the old key was replaced/deprecated. Ex: 5.6 | |||
* @see Param#deprecatedKey() |
@@ -1,35 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.task; | |||
import org.sonar.api.batch.ScannerSide; | |||
import org.sonar.api.batch.InstantiationStrategy; | |||
/** | |||
* All the classes implementing this interface can be injected in public constructors of {@link TaskExtension}. | |||
* | |||
* @since 3.6 | |||
* @deprecated since 5.1. Use {@link ScannerSide} and {@link InstantiationStrategy#PER_TASK} | |||
*/ | |||
@Deprecated | |||
@ScannerSide | |||
@InstantiationStrategy(InstantiationStrategy.PER_TASK) | |||
public interface TaskComponent { | |||
} |
@@ -1,35 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.task; | |||
import org.sonar.api.batch.ScannerSide; | |||
import org.sonar.api.batch.InstantiationStrategy; | |||
/** | |||
* Task extension point | |||
* | |||
* @since 3.6 | |||
* @deprecated since 5.1. Not used. | |||
*/ | |||
@Deprecated | |||
@ScannerSide | |||
@InstantiationStrategy(InstantiationStrategy.PER_TASK) | |||
public interface TaskExtension { | |||
} |
@@ -1,35 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
import java.util.List; | |||
/** | |||
* @deprecated since 5.6. Feature will be removed without any alternatives. | |||
*/ | |||
@Deprecated | |||
public interface CoverageBlock { | |||
TestCase testCase(); | |||
Testable testable(); | |||
List<Integer> lines(); | |||
} |
@@ -1,52 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
import java.util.List; | |||
import javax.annotation.Nullable; | |||
import org.sonar.api.batch.fs.InputFile; | |||
/** | |||
* @deprecated since 5.6. Feature will be removed without any alternatives. | |||
*/ | |||
@Deprecated | |||
public interface MutableTestCase extends TestCase { | |||
MutableTestCase setStatus(@Nullable Status s); | |||
MutableTestCase setDurationInMs(@Nullable Long l); | |||
MutableTestCase setMessage(@Nullable String s); | |||
MutableTestCase setStackTrace(@Nullable String s); | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
MutableTestCase setType(@Nullable String s); | |||
/** | |||
* @deprecated since 5.2. Use {@link #setCoverageBlock(InputFile, List)} | |||
*/ | |||
@Deprecated | |||
MutableTestCase setCoverageBlock(Testable testable, List<Integer> lines); | |||
MutableTestCase setCoverageBlock(InputFile mainFile, List<Integer> lines); | |||
} |
@@ -1,38 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
/** | |||
* @deprecated since 5.6. Feature will be removed without any alternatives. | |||
*/ | |||
@Deprecated | |||
public interface MutableTestPlan extends TestPlan<MutableTestCase> { | |||
/** | |||
* Add a {@link TestCase} to this test file. | |||
* Note that a same physical test (for example in Java a single method annotated with @Test) | |||
* can be executed several times (parameterized tests, different test suites, ...). As a result it is perfectly valid to register several | |||
* tests with the same name. Anyway in this situation the coverage per test will be merged for all tests with the same name. | |||
* @param name | |||
* @return | |||
*/ | |||
MutableTestCase addTestCase(String name); | |||
} |
@@ -1,28 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
/** | |||
* @deprecated since 5.6. Feature will be removed without any alternatives. | |||
*/ | |||
@Deprecated | |||
public interface MutableTestable extends Testable { | |||
} |
@@ -1,82 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
import java.util.Locale; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
public interface TestCase { | |||
enum Status { | |||
OK, FAILURE, ERROR, SKIPPED; | |||
public static Status of(@Nullable String s) { | |||
return s == null ? null : valueOf(s.toUpperCase(Locale.ENGLISH)); | |||
} | |||
} | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
String TYPE_UNIT = "UNIT"; | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
String TYPE_INTEGRATION = "INTEGRATION"; | |||
/** | |||
* Duration in milliseconds | |||
*/ | |||
@CheckForNull | |||
Long durationInMs(); | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
String type(); | |||
Status status(); | |||
String name(); | |||
@CheckForNull | |||
String message(); | |||
@CheckForNull | |||
String stackTrace(); | |||
TestPlan testPlan(); | |||
boolean doesCover(); | |||
int countCoveredLines(); | |||
Iterable<CoverageBlock> coverageBlocks(); | |||
@CheckForNull | |||
CoverageBlock coverageBlock(Testable testable); | |||
} |
@@ -1,32 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
import org.sonar.api.component.Perspective; | |||
/** | |||
* @deprecated since 5.2 not used | |||
*/ | |||
@Deprecated | |||
public interface TestPlan<T extends TestCase> extends Perspective { | |||
Iterable<T> testCases(); | |||
Iterable<T> testCasesByName(String name); | |||
} |
@@ -1,48 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.SortedSet; | |||
import org.sonar.api.component.Perspective; | |||
/** | |||
* @deprecated since 5.2 | |||
*/ | |||
@Deprecated | |||
public interface Testable extends Perspective { | |||
List<TestCase> testCases(); | |||
TestCase testCaseByName(String key); | |||
int countTestCasesOfLine(Integer line); | |||
Map<Integer, Integer> testCasesByLines(); | |||
List<TestCase> testCasesOfLine(int line); | |||
SortedSet<Integer> testedLines(); | |||
CoverageBlock coverageBlock(TestCase testCase); | |||
Iterable<CoverageBlock> coverageBlocks(); | |||
} |
@@ -1,30 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test.exception; | |||
/** | |||
* @deprecated since 5.6 feature will be removed soon | |||
*/ | |||
@Deprecated | |||
public class CoverageAlreadyExistsException extends TestException { | |||
public CoverageAlreadyExistsException(String message) { | |||
super(message); | |||
} | |||
} |
@@ -1,30 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test.exception; | |||
/** | |||
* @deprecated since 5.6 feature will be removed soon | |||
*/ | |||
@Deprecated | |||
public class IllegalDurationException extends TestException { | |||
public IllegalDurationException(String message) { | |||
super(message); | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2021 SonarSource SA | |||
* mailto:info 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.test.exception; | |||
/** | |||
* @deprecated since 5.6 feature will be removed soon | |||
*/ | |||
@Deprecated | |||
public class TestException extends RuntimeException { | |||
public TestException(String message) { | |||
super(message); | |||
} | |||
public TestException(String message, Throwable cause) { | |||
super(message, cause); | |||
} | |||
} |