]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16232 Delete sonar-plugin-api module
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 8 Apr 2022 17:41:49 +0000 (13:41 -0400)
committersonartech <sonartech@sonarsource.com>
Thu, 21 Apr 2022 20:02:50 +0000 (20:02 +0000)
547 files changed:
settings.gradle
sonar-plugin-api/build.gradle [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/Beta.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/Properties.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/Property.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/PropertyField.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/PropertyType.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarEdition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarProduct.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeVersion.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarRuntime.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/Startable.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/Phase.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/ScannerSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicate.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/IndexedFile.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputComponent.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputDir.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputModule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputPath.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextPointer.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextRange.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/Metric.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobDescriptor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/PostJobIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/LoadedActiveRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/RuleParam.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Severity.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameLine.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/IgnoreCommand.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorDescriptor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/ReadCache.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/WriteCache.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/NewSignificantCode.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/NewCpdTokens.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/AnalysisError.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/NewAnalysisError.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/NewHighlighting.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/TypeOfText.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueLocation.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssueLocation.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/NewMeasure.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/AdHocRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/NewAdHocRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbol.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbolTable.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/ComputeEngineSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Component.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Issue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Measure.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Settings.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestComponent.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestSettings.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Analysis.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Branch.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/CeTask.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Organization.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTask.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Project.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/QualityGate.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/ScannerContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/Category.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/Configuration.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/SubCategory.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/config/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/BaseIdentifiable.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/model/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/i18n/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/issue/DefaultTransitions.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueComment.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/issue/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContext.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/measures/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/notifications/AnalysisWarnings.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/notifications/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/platform/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/profiles/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/Scopes.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/resources/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleScope.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleStatus.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rule/Severity.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rule/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleAnnotationUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriority.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleQuery.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleType.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/rules/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/FilterableIssue.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilterChain.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/ScannerSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/InputProject.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/ProjectSensor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/DefaultGroups.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalGroupsProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalUsersProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/security/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ServerSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/BaseIdentityProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/OAuth2IdentityProvider.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UnauthorizedException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UserIdentity.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoader.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/profile/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagFormat.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagsToTypeConverter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoader.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultDebtRemediationFunctions.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewParam.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultParam.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRepository.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRule.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/rule/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Change.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Definable.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Response.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/task/Task.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/task/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/user/User.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/user/UserQuery.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/user/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/FieldUtils2.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/PathUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/Preconditions.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/SonarException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/Version.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/Command.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StreamConsumer.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StringStreamConsumer.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/TimeoutException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/command/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/AbstractLogTester.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/BaseLogger.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleFormatter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLogger.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLoggers.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ListInterceptor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogAndArguments.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptors.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTesterJUnit5.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLogger.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLoggers.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerFactory.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerLevel.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Loggers.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullInterceptor.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullProfiler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Profiler.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/log/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/text/CsvWriter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/text/WriterException.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/utils/text/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/UserRole.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/WebAnalytics.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/page/Context.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/page/Page.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/page/PageDefinition.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/web/page/package-info.java [deleted file]
sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/SonarLintSide.java [deleted file]
sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/package-info.java [deleted file]
sonar-plugin-api/src/main/resources/sonar-api-version.txt [deleted file]
sonar-plugin-api/src/main/resources/sq-version.txt [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/PluginTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/SonarQubeVersionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectReactorTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/AbstractCheck.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckFactoryTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithKey.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithOverriddenPropertyKey.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithPrimitiveProperties.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithStringProperty.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithUnsupportedPropertyType.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithoutProperties.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/ImplementedCheck.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/BlameLineTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/ScmProviderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/TypeOfTextTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/RangeDistributionBuilderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/GlobalPropertyChangeHandlerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/config/SubCategoryTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/database/model/UserTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/measures/MetricTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/platform/NewUserHandlerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileExporterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileImporterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/RulesProfileTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/LanguagesTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTreeTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypesTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTypeTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/FileExclusionsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/PathResolverTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalGroupsProviderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalUsersProviderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/security/SecurityRealmTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/security/UserDetailsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/DisplayTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoaderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagFormatTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoaderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultNewRuleTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRuleTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/task/TaskDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/ExceptionCauseMatcher.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/LocalizedMessagesTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/ManifestUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/ParsingUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/TestUtils.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/ValidationMessagesTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/VersionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/dag/DirectAcyclicGraphTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterJUnit5Test.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/text/CsvWriterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/web/ServletFilterTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/web/page/ContextTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageDefinitionTest.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageTest.java [deleted file]
sonar-plugin-api/src/test/resources/META-INF/MANIFEST.MF [deleted file]
sonar-plugin-api/src/test/resources/logback-test.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/getConfigurationFromReport.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginDependencies.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginManagementDependencies.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/mergeSettings.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overridePluginManagementSection.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersion.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersionFromPluginManagement.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/registerNewPlugin.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPom.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomPM.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomWithSourceEncoding.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenSurefireUtilsTest/MavenPom.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersion.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersionFromPluginManagement.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfile.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithRuleParameters.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithUnknownRuleParameter.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/nameAndLanguageShouldBeMandatory.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportEmptyProfile.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportProfile.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportRuleParameters.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.html [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.md [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/deprecated.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/invalid.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/rules.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8-with-bom.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/server/ws/WebServiceTest/response-example.txt [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-dtd-test.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-xsd-test.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/UriReaderTest/foo.txt [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/sample.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/unvalid.xml [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/bar.txt [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/dir1/hello.properties [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip [deleted file]
sonar-plugin-api/src/test/resources/org/sonar/api/web/AbstractRubyTemplateTest/template.erb [deleted file]
sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo.properties [deleted file]
sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo_es.properties [deleted file]
sonar-plugin-api/src/test/resources/sonar/bundles/Test.properties [deleted file]
sonar-plugin-api/src/test/resources/sonar/bundles/Test_fr.properties [deleted file]
sonar-plugin-api/src/test/scripts/echo.bat [deleted file]
sonar-plugin-api/src/test/scripts/echo.sh [deleted file]
sonar-plugin-api/src/test/scripts/forever.bat [deleted file]
sonar-plugin-api/src/test/scripts/forever.sh [deleted file]
sonar-plugin-api/src/test/scripts/output.bat [deleted file]
sonar-plugin-api/src/test/scripts/output.sh [deleted file]
sonar-plugin-api/test-resources/README.txt [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/.gitignore [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/sonar-project.properties [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/testx [deleted symlink]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/xources [deleted symlink]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/sonar-project.properties [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.measures [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.scm [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.measures [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.scm [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo.measures [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.dirPrefixedWithDot/Excluded.java [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.sonar/Excluded2.java [deleted file]
sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/sonar/Included.java [deleted file]

index 2ce4a7f6cf6d8cb620e6d58fbe13d618bb559ddb..b1998de61aa3169fe3ddf85d109dbef4d373385f 100644 (file)
@@ -47,7 +47,6 @@ include 'sonar-check-api'
 include 'sonar-core'
 include 'sonar-duplications'
 include 'sonar-markdown'
-include 'sonar-plugin-api'
 include 'sonar-plugin-api-impl'
 include 'sonar-scanner-engine'
 include 'sonar-scanner-engine-shaded'
diff --git a/sonar-plugin-api/build.gradle b/sonar-plugin-api/build.gradle
deleted file mode 100644 (file)
index 9dc4e8d..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-sonarqube {
-  properties {
-    property 'sonar.projectName', "${projectTitle} :: Plugin API"
-  }
-}
-
-apply plugin: 'com.github.johnrengelman.shadow'
-
-dependencies {
-  // please keep the list grouped by configuration and ordered by name
-
-  compile 'commons-io:commons-io'
-  compile 'commons-lang:commons-lang'
-  compile 'com.google.code.gson:gson'
-
-  // shaded, but not relocated
-  compile project(':sonar-check-api')
-
-  compileOnly 'ch.qos.logback:logback-classic'
-  compileOnly 'com.google.code.findbugs:jsr305'
-  compileOnly 'javax.servlet:javax.servlet-api'
-  compileOnly 'junit:junit'
-  // Used by LogTesterJUnit5
-  compileOnly 'org.junit.jupiter:junit-jupiter-api'
-  compileOnly 'org.slf4j:slf4j-api'
-
-  testCompile 'com.google.guava:guava'
-  testCompile 'com.tngtech.java:junit-dataprovider'
-  testCompile 'org.assertj:assertj-core'
-  testCompile 'org.mockito:mockito-core'
-  testCompile project(':sonar-plugin-api-impl')
-  testCompile project(':ut-monitoring')
-}
-
-configurations {
-  // Make the compileOnly dependencies available when compiling/running tests
-  testImplementation.extendsFrom compileOnly
-}
-
-def on3Digits(version) {
-  def projectversion3digits = version - ~/-\w+/
-  projectversion3digits = projectversion3digits.tokenize('.').plus(0).take(3).join('.')
-}
-
-import org.apache.tools.ant.filters.ReplaceTokens
-processResources {
-  filter ReplaceTokens, tokens: [
-    // The build version is composed of 4 fields, including the semantic version and the build number provided by Travis.
-    'project.buildVersion': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version) + '.' + (System.getProperty("buildNumber") ?: '0'),
-    'project.version.3digits': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version)
-  ]
-}
-
-shadowJar {
-  configurations = [project.configurations.runtimeClasspath]
-  minimize {
-    exclude(project(':sonar-check-api'))
-  }
-  relocate('com.google', 'org.sonar.api.internal.google')
-  relocate('org.apache.commons', 'org.sonar.api.internal.apachecommons')
-}
-
-// only interested in shadowJar
-jar.enabled = false
-artifactoryPublish.skip = false
-
-publishing {
-  publications {
-    mavenJava(MavenPublication) {
-      artifact source: shadowJar, classifier: null
-      if (release) {
-        artifact sourcesJar
-        artifact javadocJar
-      }
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java
deleted file mode 100644 (file)
index 36157d2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.ScannerSide;
-
-/**
- * Marker interface for all the components available in container of batch (code analyzer). Note that
- * injection of dependencies by constructor is used :
- * <pre>
- *   public class Foo implements BatchComponent {
- *
- *   }
- *   public class Bar implements BatchComponent {
- *     private final Foo foo;
- *     public Bar(Foo f) {
- *       this.foo = f;
- *     }
- *   }
- *
- * </pre>
- *
- * @since 2.2
- * @deprecated since 5.2 use {@link ScannerSide} annotation
- */
-@Deprecated
-@ScannerSide
-public interface BatchComponent {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Beta.java b/sonar-plugin-api/src/main/java/org/sonar/api/Beta.java
deleted file mode 100644 (file)
index 228515a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotations marks API as experimental.
- * API marked with it can be subject to breaking changes or removal in any future version without compliance with deprecation policies.
- */
-@Retention(RetentionPolicy.CLASS)
-@Target({
-  ElementType.ANNOTATION_TYPE,
-  ElementType.CONSTRUCTOR,
-  ElementType.FIELD,
-  ElementType.METHOD,
-  ElementType.TYPE})
-@Documented
-public @interface Beta {}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
deleted file mode 100644 (file)
index 890f1fe..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.fs.FileSystem;
-import org.sonar.api.platform.Server;
-
-/**
- * Non-exhaustive list of constants of core properties.
- *
- * @since 1.11
- */
-public interface CoreProperties {
-
-  /**
-   * @since 3.0
-   */
-  String ENCRYPTION_SECRET_KEY_PATH = "sonar.secretKeyPath";
-
-  /**
-   * @since 2.11
-   */
-  String CATEGORY_GENERAL = "general";
-
-  /**
-   * @since 4.0
-   * @deprecated since 8.1. Database cleaning now has a dedicated category {@link CoreProperties#CATEGORY_HOUSEKEEPING}.
-   */
-  @Deprecated
-  String SUBCATEGORY_DATABASE_CLEANER = "databaseCleaner";
-
-  /**
-   * @since 7.6
-   */
-  String SUBCATEGORY_MODULES = "subProjects";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_DUPLICATIONS = "duplications";
-
-  /**
-   * @since 8.2
-   */
-  String CATEGORY_ALM_INTEGRATION = "almintegration";
-
-  /**
-   * @since 8.1
-   */
-  String CATEGORY_HOUSEKEEPING = "housekeeping";
-  /**
-   * @since 9.1
-   */
-  String CATEGORY_AUDIT_LOGS = "auditLogs";
-
-  /**
-   * @since 6.6
-   */
-  String SUBCATEGORY_BRANCHES_AND_PULL_REQUESTS = "branchesAndPullRequests";
-
-  /**
-   * @since 8.1
-   */
-  String SUBCATEGORY_GENERAL = "general";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_DIFFERENTIAL_VIEWS = "differentialViews";
-
-  /**
-   * @since 5.1
-   */
-  String SUBCATEGORY_LOOKNFEEL = "looknfeel";
-
-  /**
-   * @since 5.1
-   */
-  String SUBCATEGORY_ISSUES = "issues";
-
-  /**
-   * @since 8.9
-   */
-  String SUBCATEGORY_QUALITY_GATE = "qualityGate";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_L10N = "localization";
-
-  /**
-   * @since 7.2
-   */
-  String CATEGORY_EXTERNAL_ISSUES = "externalIssues";
-
-  /**
-   * @since 2.11
-   */
-  String CATEGORY_CODE_COVERAGE = "codeCoverage";
-
-  /**
-   * @since 2.11
-   */
-  String CATEGORY_SECURITY = "security";
-
-  /**
-   * @since 3.3
-   */
-  String CATEGORY_EXCLUSIONS = "exclusions";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_FILES_EXCLUSIONS = "files";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_DUPLICATIONS_EXCLUSIONS = "duplications";
-
-  /**
-   * @since 4.0
-   */
-  String SUBCATEGORY_COVERAGE_EXCLUSIONS = "coverage";
-
-  /**
-   * @since 6.1
-   */
-  String SUBCATEGORY_EMAIL = "email";
-
-  /**
-   * @since 3.7
-   */
-  String CATEGORY_LICENSES = "licenses";
-
-  /**
-   * @since 4.0
-   */
-  String CATEGORY_TECHNICAL_DEBT = "technicalDebt";
-
-  /* Global settings */
-  String SONAR_HOME = "SONAR_HOME";
-
-  String PROJECT_VERSION_PROPERTY = "sonar.projectVersion";
-  String BUILD_STRING_PROPERTY = "sonar.buildString";
-
-  /**
-   * @since 2.6
-   */
-  String PROJECT_KEY_PROPERTY = "sonar.projectKey";
-
-  /**
-   * @since 2.6
-   */
-  String PROJECT_NAME_PROPERTY = "sonar.projectName";
-
-  /**
-   * @since 2.6
-   */
-  String PROJECT_DESCRIPTION_PROPERTY = "sonar.projectDescription";
-
-  /**
-   * To determine value of this property use {@link FileSystem#encoding()}.
-   *
-   * @since 2.6
-   */
-  String ENCODING_PROPERTY = "sonar.sourceEncoding";
-
-  /**
-   * Value format is yyyy-MM-dd
-   */
-  String PROJECT_DATE_PROPERTY = "sonar.projectDate";
-
-  /* Exclusions */
-  String PROJECT_INCLUSIONS_PROPERTY = "sonar.inclusions";
-  String PROJECT_EXCLUSIONS_PROPERTY = "sonar.exclusions";
-
-  /* Coverage exclusions */
-  String PROJECT_COVERAGE_EXCLUSIONS_PROPERTY = "sonar.coverage.exclusions";
-
-  /**
-   * @since 3.3
-   */
-  String PROJECT_TEST_INCLUSIONS_PROPERTY = "sonar.test.inclusions";
-  String PROJECT_TEST_EXCLUSIONS_PROPERTY = "sonar.test.exclusions";
-  String GLOBAL_EXCLUSIONS_PROPERTY = "sonar.global.exclusions";
-  String GLOBAL_TEST_EXCLUSIONS_PROPERTY = "sonar.global.test.exclusions";
-
-  /* Sonar Core */
-
-  String CORE_FORCE_AUTHENTICATION_PROPERTY = "sonar.forceAuthentication";
-  boolean CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE = true;
-  String CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_PROPERTY = "sonar.allowPermissionManagementForProjectAdmins";
-  boolean CORE_ALLOW_PERMISSION_MANAGEMENT_FOR_PROJECT_ADMINS_DEFAULT_VALUE = true;
-  String SONAR_VALIDATE_WEBHOOKS_PROPERTY = "sonar.validateWebhooks";
-  boolean SONAR_VALIDATE_WEBHOOKS_DEFAULT_VALUE = true;
-
-  /**
-   * @deprecated since 2.14. See http://jira.sonarsource.com/browse/SONAR-3153. Replaced by {@link #CORE_AUTHENTICATOR_REALM}.
-   */
-  @Deprecated
-  String CORE_AUTHENTICATOR_CLASS = "sonar.authenticator.class";
-
-  /**
-   * @since 2.14
-   * @deprecated since 7.1, this setting should not be used by plugin
-   */
-  @Deprecated
-  String CORE_AUTHENTICATOR_REALM = "sonar.security.realm";
-
-  /**
-   * @deprecated since 7.1, this setting should not be used by plugin
-   */
-  @Deprecated
-  String CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE = "sonar.authenticator.ignoreStartupFailure";
-
-  /**
-   * @deprecated since 6.3. This feature is not supported anymore
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-8208">SONAR-8208/a>
-   */
-  @Deprecated
-  String CORE_AUTHENTICATOR_CREATE_USERS = "sonar.authenticator.createUsers";
-
-  /**
-   * @since 3.6
-   * @deprecated since 5.4. This feature is not supported anymore. See http://jira.sonarsource.com/browse/SONAR-7219
-   */
-  @Deprecated
-  String CORE_AUTHENTICATOR_UPDATE_USER_ATTRIBUTES = "sonar.security.updateUserAttributes";
-
-  String SERVER_ID = "sonar.core.id";
-
-  // format is yyyy-MM-dd'T'HH:mm:ssZ
-  String SERVER_STARTTIME = "sonar.core.startTime";
-
-  /**
-   * 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#getPublicRootUrl()}.
-   *
-   * @since 2.10
-   */
-  String SERVER_BASE_URL = "sonar.core.serverBaseURL";
-
-  /**
-   * @since 2.11
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  String CPD_CROSS_PROJECT = "sonar.cpd.cross_project";
-
-  /**
-   * @since 3.5
-   */
-  String CPD_EXCLUSIONS = "sonar.cpd.exclusions";
-
-  /**
-   * @since 3.3
-   */
-  String LINKS_HOME_PAGE = "sonar.links.homepage";
-
-  /**
-   * @since 3.3
-   */
-  String LINKS_CI = "sonar.links.ci";
-
-  /**
-   * @since 3.3
-   */
-  String LINKS_ISSUE_TRACKER = "sonar.links.issue";
-
-  /**
-   * @since 3.3
-   */
-  String LINKS_SOURCES = "sonar.links.scm";
-
-  /**
-   * @since 3.3
-   * @deprecated since 7.1, developer connection link is no more feed
-   */
-  @Deprecated
-  String LINKS_SOURCES_DEV = "sonar.links.scm_dev";
-
-  /**
-   * @since 3.4
-   */
-  String LOGIN = "sonar.login";
-
-  /**
-   * @since 3.4
-   */
-  String PASSWORD = "sonar.password";
-
-  /**
-   * @since 3.5
-   * @deprecated since 7.6
-   */
-  @Deprecated
-  String TASK = "sonar.task";
-
-  /**
-   * @since 3.6
-   * @deprecated since 7.6
-   */
-  @Deprecated
-  String SCAN_TASK = "scan";
-
-  /**
-   * @since 3.6
-   * Removed in 8.4 by mistake and reintroduced in 8.5
-   */
-  String PROFILING_LOG_PROPERTY = "sonar.showProfiling";
-
-  /**
-   * @since 4.0
-   */
-  String WORKING_DIRECTORY = "sonar.working.directory";
-
-  String WORKING_DIRECTORY_DEFAULT_VALUE = ".sonar";
-
-  /**
-   * @since 5.2
-   */
-  String GLOBAL_WORKING_DIRECTORY = "sonar.globalWorking.directory";
-  String GLOBAL_WORKING_DIRECTORY_DEFAULT_VALUE = "";
-
-  /**
-   * @since 4.5
-   */
-  String DEVELOPMENT_COST = "sonar.technicalDebt.developmentCost";
-
-  /**
-   * @since 4.5
-   */
-  String DEVELOPMENT_COST_DEF_VALUE = "30";
-
-  /**
-   * @since 4.5
-   */
-  String RATING_GRID = "sonar.technicalDebt.ratingGrid";
-
-  /**
-   * @since 4.5
-   */
-  String RATING_GRID_DEF_VALUES = "0.05,0.1,0.2,0.5";
-
-  /**
-   * @since 4.5
-   */
-  String LANGUAGE_SPECIFIC_PARAMETERS = "languageSpecificParameters";
-
-  /**
-   * @since 4.5
-   */
-  String LANGUAGE_SPECIFIC_PARAMETERS_LANGUAGE_KEY = "language";
-
-  /**
-   * @since 4.5
-   */
-  String LANGUAGE_SPECIFIC_PARAMETERS_MAN_DAYS_KEY = "man_days";
-
-  /**
-   * @since 4.5
-   */
-  String LANGUAGE_SPECIFIC_PARAMETERS_SIZE_METRIC_KEY = "size_metric";
-
-  /**
-   * @since 5.0
-   */
-  String CATEGORY_SCM = "scm";
-
-  /**
-   * @since 5.0
-   */
-  String SCM_DISABLED_KEY = "sonar.scm.disabled";
-
-  /**
-   * @since 7.6
-   */
-  String SCM_EXCLUSIONS_DISABLED_KEY = "sonar.scm.exclusions.disabled";
-
-  /**
-   * @since 5.0
-   */
-  String SCM_PROVIDER_KEY = "sonar.scm.provider";
-
-  /**
-   * @since 5.1
-   */
-  String DEFAULT_ISSUE_ASSIGNEE = "sonar.issues.defaultAssigneeLogin";
-
-  /**
-   * @since 8.5
-   */
-  String DEVELOPER_AGGREGATED_INFO_DISABLED = "sonar.developerAggregatedInfo.disabled";
-
-  /**
-   * @since 7.6
-   */
-  String MODULE_LEVEL_ARCHIVED_SETTINGS = "sonar.subproject.settings.archived";
-
-  /**
-   * since 8.9
-   */
-  String QUALITY_GATE_IGNORE_SMALL_CHANGES = "sonar.qualitygate.ignoreSmallChanges";
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java
deleted file mode 100644 (file)
index b07eb53..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation for all the interfaces that are extension point (ie can be implemented by plugins 
- * and will be called at some point of time by the platform).
- *
- * @since 5.2
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ExtensionPoint {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java b/sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java
deleted file mode 100644 (file)
index b8bf262..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.utils.Version;
-
-import static java.util.Arrays.asList;
-import static java.util.Objects.requireNonNull;
-
-/**
- * Entry-point for plugins to inject extensions into SonarQube.
- * <p>The JAR manifest must declare the name of the implementation class in the property <code>Plugin-Class</code>.
- * This property is automatically set by sonar-packaging-maven-plugin when building plugin.
- * <p>Example of implementation
- * <pre>
-  * public class MyPlugin implements Plugin {
- *  {@literal @}Override
- *   public void define(Context context) {
- *     context.addExtensions(MySensor.class, MyRules.class);
- *     if (context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(6, 0))) {
- *       // Extension which supports only versions 6.0 and greater
- *       // See org.sonar.api.SonarRuntime for more details.
- *       context.addExtension(MyNewExtension.class);
- *     }
- *   }
- * }
- * </pre>
- *
- * <p>Example of pom.xml
- * <pre>
- * &lt;project&gt;
- *   ...
- *   &lt;packaging&gt;sonar-plugin&lt;/packaging&gt;
- *
- *   &lt;build&gt;
- *     &lt;plugins&gt;
- *       &lt;plugin&gt;
- *         &lt;groupId&gt;org.sonarsource.sonar-packaging-maven-plugin&lt;/groupId&gt;
- *         &lt;artifactId&gt;sonar-packaging-maven-plugin&lt;/artifactId&gt;
- *         &lt;extensions&gt;true&lt;/extensions&gt;
- *         &lt;configuration&gt;
- *           &lt;pluginClass&gt;com.mycompany.sonarqube.MyPlugin&lt;/pluginClass&gt;
- *         &lt;/configuration&gt;
- *       &lt;/plugin&gt;
- *     &lt;/plugins&gt;
- *   &lt;/build&gt;
- * &lt;/project&gt;
- * </pre>
- *
- * <p>Example of Test
- * Add a test dependency to sonar-plugin-api-impl to have access to implementation classes in tests.
- * <pre>
- *{@literal @}Test
- * public void test_plugin_extensions_compatible_with_5_6() {
- *   SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(5, 6), SonarQubeSide.SCANNER);
- *   Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build();
- *   MyPlugin underTest = new MyPlugin();
- *
- *   underTest.define(context);
- *
- *   assertThat(context.getExtensions()).hasSize(4);
- * }
- * </pre>
- *
- * @since 5.5
- * @see org.sonar.api.internal.PluginContextImpl for unit tests
- */
-public interface Plugin {
-
-  class Context {
-    private final SonarRuntime sonarRuntime;
-    private final List extensions = new ArrayList();
-
-    /**
-     * For unit tests only. It's recommended to use {@link org.sonar.api.internal.PluginContextImpl.Builder}
-     * to create instances of {@link Plugin.Context}.
-     * The configuration returned by {@see #getBootConfiguration()} is empty.
-     */
-    public Context(SonarRuntime sonarRuntime) {
-      this.sonarRuntime = requireNonNull(sonarRuntime, "sonarRuntime is null");
-    }
-
-    /**
-     * Shortcut on {@code getRuntime().getApiVersion()} since version 6.0.
-     *
-     * @see #getRuntime()
-     * @since 5.5
-     * @return the version of SonarQube API at runtime, not at compilation time
-     */
-    public Version getSonarQubeVersion() {
-      return sonarRuntime.getApiVersion();
-    }
-
-    /**
-     * Runtime environment. Can be use to add some extensions only on some conditions.
-     * @since 6.0
-     */
-    public SonarRuntime getRuntime() {
-      return sonarRuntime;
-    }
-
-    /**
-     * Add an extension as :
-     * <ul>
-     *   <li>a Class that is annotated with {@link org.sonar.api.scanner.ScannerSide}, {@link org.sonar.api.server.ServerSide}
-     *   or {@link org.sonar.api.ce.ComputeEngineSide}. The extension will be instantiated once. Its dependencies are
-     *   injected through constructor parameters.</li>
-     *   <li>an instance that is annotated with {@link org.sonar.api.scanner.ScannerSide}, {@link org.sonar.api.server.ServerSide}
-     *   or {@link org.sonar.api.ce.ComputeEngineSide}.</li>
-     * </ul>
-     * Only a single component can be registered for a class. It's not allowed for example to register:
-     * <ul>
-     *   <li>two MyExtension.class</li>
-     *   <li>MyExtension.class and new MyExtension()</li>
-     * </ul>
-     */
-    public Context addExtension(Object extension) {
-      requireNonNull(extension);
-      this.extensions.add(extension);
-      return this;
-    }
-
-    /**
-     * @see #addExtension(Object)
-     */
-    public Context addExtensions(Collection extensions) {
-      this.extensions.addAll(extensions);
-      return this;
-    }
-
-    /**
-     * @see #addExtension(Object)
-     */
-    public Context addExtensions(Object first, Object second, Object... others) {
-      addExtension(first);
-      addExtension(second);
-      addExtensions(asList(others));
-      return this;
-    }
-
-    public List getExtensions() {
-      return extensions;
-    }
-
-    /**
-     * The configuration that contains only the few properties required to bootstrap the process, for example:
-     * - conf/sonar.properties and persisted properties on web server and Compute Engine sides. The default values
-     *   defined by plugins are ignored.
-     * - command-line arguments on scanner side. Default values or properties persisted in server are ignored.
-     *
-     * @since 7.1
-     */
-    public Configuration getBootConfiguration() {
-      throw new UnsupportedOperationException("Unit tests should create Plugin.Context with org.sonar.api.internal.PluginContextImpl#Builder");
-    }
-
-  }
-
-  /**
-   * This method is executed at runtime when:
-   * <ul>
-   *   <li>Web Server starts</li>
-   *   <li>Compute Engine starts</li>
-   *   <li>Scanner starts</li>
-   * </ul>
-   */
-  void define(Context context);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Properties.java b/sonar-plugin-api/src/main/java/org/sonar/api/Properties.java
deleted file mode 100644 (file)
index 243c3d1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import org.sonar.api.config.Configuration;
-
-/**
- * Plugin properties. This annotation is only used on classes implementing org.sonar.api.Plugin.
- * <br>
- * Note that {@link org.sonar.api.config.PropertyDefinition} is an alternative, programmatic and recommended approach
- * to declare properties.
- * <br>
- * Effective property values are accessible at runtime through the component {@link Configuration}
- *
- * @since 1.10
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Properties {
-  Property[] value();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Property.java b/sonar-plugin-api/src/main/java/org/sonar/api/Property.java
deleted file mode 100644 (file)
index 3c7c155..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Property value can be set in different ways :
- * <ul>
- * <li>System property</li>
- * <li>Batch command-line (-Dfoo=bar in Maven or sonar-runner)</li>
- * <li>Maven pom.xml (element {@literal <properties>})</li>
- * <li>Maven settings.xml</li>
- * <li>SonarQube web administration console</li>
- * </ul>
- *
- * @since 1.10
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Property {
-
-  /**
-   * Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples :
-   * 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'.
-   */
-  String key();
-
-  /**
-   * The empty string "" is considered as null, so it's not possible to have empty strings for default values.
-   */
-  String defaultValue() default "";
-
-  String name();
-
-  String description() default "";
-
-  /**
-   * @since 2.11
-   * @see org.sonar.api.config.PropertyDefinition#category()
-   */
-  String category() default "";
-
-  /**
-   * Is the property displayed in project settings page ?
-   */
-  boolean project() default false;
-
-  /**
-   * Is the property displayed in module settings page ? A module is a maven sub-project.
-   */
-  boolean module() default false;
-
-  /**
-   * Is the property displayed in global settings page ?
-   */
-  boolean global() default true;
-
-  /**
-   * @since 3.0
-   */
-  PropertyType type() default PropertyType.STRING;
-
-  /**
-   * Options for *_LIST types
-   *
-   * @since 3.0  Options for property of type {@link PropertyType#SINGLE_SELECT_LIST}
-   * For example {"property_1", "property_3", "property_3"}).
-   *
-   * @since 3.3  Options for property of type {@link PropertyType#METRIC}<br>
-   * If no option is specified, any metric will match.<br>
-   * If options are specified, all must match for the metric to be displayed.<br>
-   * Three types of filter are supported <code>key:REGEXP</code>, <code>domain:REGEXP</code> and <code>type:comma_separated__list_of_types</code>.<br>
-   * For example <code>key:new_.*</code> will match any metric which key starts by <code>new_</code>.<br>
-   * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>.<br>
-   * For example <code>type:NUMERIC</code> will match any metric of numerictype.
-   */
-  String[] options() default {};
-
-  /**
-   * Can the property take multiple values. Eg: list of email addresses.
-   *
-   * @since 3.3
-   */
-  boolean multiValues() default false;
-
-  /**
-   * A Property of type <code>PropertyType.PROPERTY_SET</code> can reference a set of properties
-   * by its key.
-   *
-   * @since 3.3
-   * @deprecated since 6.1, as it was not used and too complex to maintain.
-   */
-  @Deprecated
-  String propertySetKey() default "";
-
-  /**
-   * A Property with fields is considered a property set.
-   *
-   * @since 3.3
-   */
-  PropertyField[] fields() default {};
-
-  /**
-   * Relocation of key.
-   * @since 3.4
-   */
-  String deprecatedKey() default "";
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/PropertyField.java b/sonar-plugin-api/src/main/java/org/sonar/api/PropertyField.java
deleted file mode 100644 (file)
index 7a01396..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Property field.
- *
- * @since 3.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface PropertyField {
-  /**
-   * Unique key within a property. It shouldn't be prefixed.
-   * Settings for this field are stored into the database with a composite key
-   * <code>{key of parent property}.{key of the set}.{key of this field}</code>
-   * eg. <code>sonar.jira.servers.JIRA1.url</code>
-   */
-  String key();
-
-  /**
-   * This name will be displayed on the Settings page. This can be overridden/translated
-   * by adding a a value for: <code>field.{key of parent property}.{key of this field}.name</code> in the language bundle.
-   */
-  String name();
-
-  /**
-   * If not empty, this description will be displayed on the Settings page. This can be overridden/translated
-   * by adding a a value for: <code>field.{key of parent property}.{key of this field}.description</code> in the language bundle.
-   */
-  String description() default "";
-
-  PropertyType type() default PropertyType.STRING;
-
-  /**
-   * Options for *_LIST types
-   */
-  String[] options() default {};
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/PropertyType.java b/sonar-plugin-api/src/main/java/org/sonar/api/PropertyType.java
deleted file mode 100644 (file)
index ae8b39c..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * @since 3.0
- */
-public enum PropertyType {
-  /**
-   * Basic single line input field
-   */
-  STRING,
-
-  /**
-   * Multiple line text-area
-   */
-  TEXT,
-
-  /**
-   * Variation of {#STRING} with masked characters
-   */
-  PASSWORD,
-
-  /**
-   * True/False
-   */
-  BOOLEAN,
-
-  /**
-   * Integer value, positive or negative
-   */
-  INTEGER,
-
-  /**
-   * Floating point number
-   */
-  FLOAT,
-
-  /**
-   * Single select list with a list of options
-   */
-  SINGLE_SELECT_LIST,
-
-  /**
-   * Sonar Metric
-   *
-   * @deprecated since 6.3, this type is useless as Dashboards have been removed
-   */
-  @Deprecated
-  METRIC,
-
-  /**
-   * SonarSource license
-   * @deprecated in 6.7.
-   */
-  @Deprecated
-  LICENSE,
-
-  /**
-   * Regular expression
-   *
-   * @since 3.2
-   */
-  REGULAR_EXPRESSION,
-
-  /**
-   * Property set instance
-   *
-   * @since 3.3
-   */
-  PROPERTY_SET,
-
-  /**
-  * User login
-  * @since 5.1
-  */
-  USER_LOGIN,
-
-  /**
-   * Level metric type
-   *
-   * @deprecated since 6.3, this type is useless as Dashboards have been removed
-   */
-  @Deprecated
-  METRIC_LEVEL,
-
-  /**
-   * Long value, positive or negative
-   *
-   * @deprecated since 6.3, this type is useless as Dashboards have been removed
-   */
-  @Deprecated
-  LONG,
-
-  /**
-   * JSON property type
-   * @since 8.8
-   */
-  JSON
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarEdition.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarEdition.java
deleted file mode 100644 (file)
index 9bf4423..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-public enum SonarEdition {
-  COMMUNITY("Community"),
-  DEVELOPER("Developer"),
-  ENTERPRISE("Enterprise"),
-  DATACENTER("Data Center"),
-  SONARCLOUD("SonarCloud");
-
-  private final String label;
-
-  SonarEdition(String label) {
-    this.label = label;
-  }
-
-  public String getLabel() {
-    return label;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java
deleted file mode 100644 (file)
index 91bbe19..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.util.List;
-
-/**
- * Plugin entry-point used to declare its extensions (see {@link org.sonar.api.Extension}.
- * <br>
- * <p>The JAR manifest must declare the name of the implementation class in the property <code>Plugin-Class</code>.
- * This property is automatically set by sonar-packaging-maven-plugin when building plugin.
- * 
- * @since 2.8
- * @deprecated replaced by {@link Plugin} in version 5.6.
- */
-@Deprecated
-public abstract class SonarPlugin implements Plugin {
-
-  /**
-   * Classes of the implemented extensions.
-   */
-  public abstract List getExtensions();
-
-  /**
-   * Returns a string representation of the plugin, suitable for debugging purposes only.
-   */
-  @Override
-  public String toString() {
-    return getClass().getSimpleName();
-  }
-
-  @Override
-  public void define(Context context) {
-    context.addExtensions(getExtensions());
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarProduct.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarProduct.java
deleted file mode 100644 (file)
index 611e9a4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * List of different products/runtimes. 
- * @since 6.0
- */
-public enum SonarProduct {
-
-  SONARQUBE,
-  SONARLINT
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeSide.java
deleted file mode 100644 (file)
index 25f6464..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * Runtime stack in SonarQube product.
- * @see SonarRuntime#getSonarQubeSide()
- * @since 6.0
- */
-public enum SonarQubeSide {
-
-  SCANNER,
-  SERVER,
-  COMPUTE_ENGINE
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeVersion.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarQubeVersion.java
deleted file mode 100644 (file)
index 2b64930..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 javax.annotation.concurrent.Immutable;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.batch.sensor.SensorContext;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.Version;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * Version of SonarQube at runtime, but not at compilation time.
- * This component can be injected as a dependency of plugin extensions.
- * The main usage for a plugin is to benefit from new APIs
- * while keeping backward-compatibility with previous versions of API.
- *
- * <p>
- * Example: a plugin extension needs a new feature of API 6.0 without
- * breaking compatibility with version 5.6 at runtime. This new feature
- * would be disabled when plugin is executed within SonarQube 5.6.
- * </p>
- * <pre>
- * // Component provided by sonar-plugin-api
- * // @since 5.6
- * public interface AnApi {
- *   // implicitly since 5.6
- *   public void foo();
- *
- *   // @since 6.0
- *   public void bar();
- * }
- *
- * // Component provided by plugin
- * public class MyExtension {
- *   private final SonarQubeVersion sonarQubeVersion;
- *   private final AnApi api;
- *
- *   public MyExtension(SonarQubeVersion sonarQubeVersion, AnApi api) {
- *     this.sonarQubeVersion = sonarQubeVersion;
- *     this.api = api;
- *   }
- *
- *   public void doSomething() {
- *     // assume that runtime is 5.6+
- *     api.foo();
- *
- *     if (sonarQubeVersion.isGreaterThanOrEqual(Version.create(6, 0))) {
- *       api.bar();
- *     }
- *   }
- * }
- * </pre>
- *
- * <p>
- *   Note that {@link Sensor} extensions can directly get {@link SonarQubeVersion} through
- * {@link SensorContext#getSonarQubeVersion()}, without using constructor injection:
- * </p>
- * <pre>
- * public class MySensor implements Sensor {
- *
- *   public void execute(SensorContext context) {
- *     if (context.getSonarQubeVersion().isGreaterThanOrEqual(Version.create(6, 0)) {
- *       context.newMethodIntroducedIn6_0();
- *     }
- *   }
- *
- * }
- * </pre>
- * <p>
- * The minimal supported version of SonarQube is verified at runtime. As plugin is built
- * with sonar-plugin-api 6.0, we assume that the plugin requires v6.0 or greater at runtime.
- * As the plugin codebase is compatible with 5.6, the plugin must define what is the
- * effective minimal supported version through the configuration of sonar-packaging-maven-plugin 1.16+:
- * <p>
- * <pre>
- * &lt;packaging&gt;sonar-plugin&lt;/packaging&gt;
- *
- * &lt;dependencies&gt;
- *   &lt;dependency&gt;
- *     &lt;groupId&gt;org.sonarsource.sonarqube&lt;/groupId&gt;
- *     &lt;artifactId&gt;sonar-plugin-api&lt;/artifactId&gt;
- *     &lt;version&gt;6.0&lt;/version&gt;
- *     &lt;scope&gt;provided&lt;/scope&gt;
- *   &lt;/dependency&gt;
- * &lt;/dependencies&gt;
- *
- * &lt;build&gt;
- *  &lt;plugins&gt;
- *    &lt;plugin&gt;
- *      &lt;groupId&gt;org.sonarsource.sonar-packaging-maven-plugin&lt;/groupId&gt;
- *      &lt;artifactId&gt;sonar-packaging-maven-plugin&lt;/artifactId&gt;
- *      &lt;version&gt;1.16&lt;/version&gt;
- *      &lt;extensions&gt;true&lt;/extensions&gt;
- *      &lt;configuration&gt;
- *        &lt;!-- Override the default value 6.0 which is guessed from sonar-plugin-api dependency --&gt;
- *        &lt;sonarQubeMinVersion&gt;5.6&lt;/sonarQubeMinVersion&gt;
- *      &lt;/configuration&gt;
- *    &lt;/plugin&gt;
- *  &lt;/plugins&gt;
- * &lt;/build&gt;
- * </pre>
- *
- * <p>
- * The component {@link SonarRuntime}, introduced in version 6.0, is more complete.
- * It is preferred over {@link SonarQubeVersion} if compatibility with version 5.6 Long Term Support
- * is not required.
- * </p>
- *
- * @see SonarRuntime
- * @deprecated since 7.8 Use {@link SonarRuntime} instead.
- * @since 5.5
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-@Immutable
-@Deprecated
-public class SonarQubeVersion {
-
-  private final Version version;
-
-  public SonarQubeVersion(Version version) {
-    requireNonNull(version);
-    this.version = version;
-  }
-
-  public Version get() {
-    return this.version;
-  }
-
-  public boolean isGreaterThanOrEqual(Version than) {
-    return this.version.isGreaterThanOrEqual(than);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/SonarRuntime.java b/sonar-plugin-api/src/main/java/org/sonar/api/SonarRuntime.java
deleted file mode 100644 (file)
index 49ab13f..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 javax.annotation.concurrent.Immutable;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.batch.sensor.SensorContext;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.Version;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * Information about runtime environment.
- *
- * <p>
- * A usage for plugins is to benefit from new APIs
- * while keeping backward-compatibility with previous versions of SonarQube
- * or SonarLint.
- * </p>
- *
- * <p>
- * Example: a plugin extension wants to use a new feature of API 6.1 without
- * breaking compatibility with version 6.0 at runtime. This new feature
- * would be enabled only in 6.1 and greater runtimes.
- * </p>
- * <pre>
- * // Component provided by sonar-plugin-api
- * // @since 6.0
- * public interface AnApi {
- *   // implicitly since 6.0
- *   public void foo();
- *
- *   // @since 6.1
- *   public void bar();
- * }
- *
- * // Plugin extension
- * public class MyExtension {
- *   private final SonarRuntime sonarRuntime;
- *   private final AnApi api;
- *
- *   public MyExtension(SonarRuntime sonarRuntime, AnApi api) {
- *     this.sonarRuntime = sonarRuntime;
- *     this.api = api;
- *   }
- *
- *   public void doSomething() {
- *     // assume that minimal supported runtime is 6.0
- *     api.foo();
- *
- *     if (sonarRuntime.getApiVersion().isGreaterThanOrEqual(Version.create(6, 1))) {
- *       api.bar();
- *     }
- *   }
- * }
- * </pre>
- *
- *
- * <p>
- * Note that {@link Sensor} extensions can directly get {@link SonarRuntime} through
- * {@link SensorContext#runtime()}, without using constructor injection:
- * </p>
- * <pre>
- * public class MySensor implements Sensor {
- *
- *   public void execute(SensorContext context) {
- *     if (context.runtime().getApiVersion().isGreaterThanOrEqual(Version.create(6, 1)) {
- *       context.newMethodIntroducedIn6_0();
- *     }
- *   }
- *
- * }
- * </pre>
- *
- * <p>
- * The minimal supported version of plugin API is verified at runtime. As plugin is built
- * with sonar-plugin-api 6.1, we assume that the plugin requires v6.1 or greater at runtime.
- * For this reason the plugin must override the minimal supported version
- * in the configuration of sonar-packaging-maven-plugin 1.16+:
- * <p>
- * <pre>
- * &lt;packaging&gt;sonar-plugin&lt;/packaging&gt;
- *
- * &lt;dependencies&gt;
- *   &lt;dependency&gt;
- *     &lt;groupId&gt;org.sonarsource.sonarqube&lt;/groupId&gt;
- *     &lt;artifactId&gt;sonar-plugin-api&lt;/artifactId&gt;
- *     &lt;version&gt;6.1&lt;/version&gt;
- *     &lt;scope&gt;provided&lt;/scope&gt;
- *   &lt;/dependency&gt;
- * &lt;/dependencies&gt;
- *
- * &lt;build&gt;
- *  &lt;plugins&gt;
- *    &lt;plugin&gt;
- *      &lt;groupId&gt;org.sonarsource.sonar-packaging-maven-plugin&lt;/groupId&gt;
- *      &lt;artifactId&gt;sonar-packaging-maven-plugin&lt;/artifactId&gt;
- *      &lt;version&gt;1.16&lt;/version&gt;
- *      &lt;extensions&gt;true&lt;/extensions&gt;
- *      &lt;configuration&gt;
- *        &lt;!-- Override the default value 6.0 which is guessed from sonar-plugin-api dependency --&gt;
- *        &lt;sonarQubeMinVersion&gt;6.0&lt;/sonarQubeMinVersion&gt;
- *      &lt;/configuration&gt;
- *    &lt;/plugin&gt;
- *  &lt;/plugins&gt;
- * &lt;/build&gt;
- * </pre>
- *
- * <p>
- * As this component was introduced in version 6.0, the pattern described above can't be
- * exactly applied when plugin must support version 5.6 Long Term Support. In this case plugin
- * should use {@link SonarQubeVersion}, for example through {@link Plugin.Context#getSonarQubeVersion()} or
- * {@link SensorContext#getSonarQubeVersion()}.
- * </p>
- *
- * <p>
- * Unit tests of plugin extensions can add a test dependency to available in sonar-plugin-api-impl and create instances of {@link SonarRuntime}
- * via {@link org.sonar.api.internal.SonarRuntimeImpl}.
- * </p>
- *
- * @since 6.0
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-@SonarLintSide
-@Immutable
-public interface SonarRuntime {
-
-  /**
-   * Version of API (sonar-plugin-api artifact) at runtime.
-   * It can be helpful to call some API classes/methods without checking their availability at
-   * runtime by using reflection.
-   * <br/>
-   * Since 6.3, the returned version includes the build number in the fourth field, for
-   * example {@code "6.3.0.12345"}.
-   */
-  Version getApiVersion();
-
-  /**
-   * The product being executed at runtime. It targets analysers so that they can implement
-   * different behaviours in SonarQube/SonarCloud and SonarLint.
-   */
-  SonarProduct getProduct();
-
-  /**
-   * The SonarQube/SonarCloud stack being executed at runtime.
-   *
-   * @throws UnsupportedOperationException if {@link #getProduct()} is not equal to {@link SonarProduct#SONARQUBE}
-   */
-  SonarQubeSide getSonarQubeSide();
-
-  /**
-   * The SonarQube/SonarCloud edition being executed at runtime.
-   * Note that there is a specific edition for SonarCloud.
-   *
-   * @throws UnsupportedOperationException if {@link #getProduct()} is not equal to {@link SonarProduct#SONARQUBE}
-   * @since 7.8
-   */
-  SonarEdition getEdition();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Startable.java b/sonar-plugin-api/src/main/java/org/sonar/api/Startable.java
deleted file mode 100644 (file)
index 788fb9f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * An interface which is implemented by classes annotated with {@link org.sonar.api.scanner.ScannerSide ScannerSide},
- * {@link org.sonar.api.server.ServerSide ServerSide} and/or {@link org.sonar.api.ce.ComputeEngineSide ComputeEngineSide}
- * (referred to below as "component") that can be started and stopped.
- * <p>
- * The method {@link #start()} is called at the begin of the component lifecycle.
- * It can be called again only after a call to {@link #stop()}. The {@link #stop()} method is called at the end of the
- * component lifecycle, and can further be called after every {@link Startable#start()}.
- * </p>
- * <p>
- * In the WebServer, a component is started once: either right when the WebServer is started if there is no migration,
- * otherwise only after Database has been successfully migrated. It is stopped once when the WebServer is shutdown. Any
- * exception thrown by method {@link #start()} will make the WebServer startup fail.
- * </p>
- * <p>
- * In the Compute Engine, a component is started once when the Compute Engine is started and stopped once when the
- * ComputeEngine is shut down. Any exception thrown by method {@link #start()} will make the Compute Engine startup fail.
- * </p>
- * <p>
- * On Scanner side, the lifecycle of a component depends on the value of the {@link org.sonar.api.batch.InstantiationStrategy
- * InstantiationStrategy} annotation.
- * </p>
- */
-public interface Startable {
-  /**
-   * Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
-   */
-  void start();
-
-  /**
-   * Stop this component. Called near the end of the lifecycle. It can be called again after a further start.
-   */
-  void stop();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java
deleted file mode 100644 (file)
index 54ce625..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @since 1.10
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface DependedUpon {
-
-  /**
-   * Used only on classes. Must be keep empty on methods.
-   *
-   * @see org.sonar.api.batch.DecoratorBarriers for a list of possible values.
-   */
-  String[] value() default {};
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java
deleted file mode 100644 (file)
index 16302aa..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @since 1.10
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface DependsUpon {
-
-  /**
-   * Used only on classes. Must be keep empty on methods.
-   */
-  String[] value() default {};
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java
deleted file mode 100644 (file)
index 3e40767..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Define instantiation strategy of batch IoC components. If a component is not annotated, then default value
- * is {@link org.sonar.api.batch.InstantiationStrategy#PER_PROJECT}.
- * @since 4.4
- * @deprecated since 7.6 removal of modules and tasks is planned. All extensions should progressively move to the project scope, using {@link org.sonar.api.scanner.ScannerSide}
- */
-@Deprecated
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface InstantiationStrategy {
-
-  /**
-   * Shared task extension. Available in task container.
-   */
-  String PER_TASK = "PER_TASK";
-
-  /**
-   * Shared extension. Available in top level project container.
-   */
-  String PER_BATCH = "PER_BATCH";
-
-  /**
-   * Created and initialized for each project and sub-project (a project is a module in Maven terminology).
-   */
-  String PER_PROJECT = "PER_PROJECT";
-
-  String value();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Phase.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Phase.java
deleted file mode 100644 (file)
index 14c674d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @since 1.10
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Phase {
-
-  Name name();
-
-  enum Name {
-    PRE, DEFAULT, POST
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/ScannerSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/ScannerSide.java
deleted file mode 100644 (file)
index e29e075..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation for all the components available in the container of the scanner (code analyzer). Note that
- * injection of dependencies by constructor is used :
- * <pre>
- *   {@literal @}ScannerSide
- *   public class Foo {
- *
- *   }
- *   {@literal @}ScannerSide
- *   public class Bar {
- *     private final Foo foo;
- *     public Bar(Foo f) {
- *       this.foo = f;
- *     }
- *   }
- *
- * </pre>
- *
- * @since 6.0
- * @deprecated since 7.6 use {@link org.sonar.api.scanner.ScannerSide} that will move the component to the project container
- */
-@Deprecated
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ScannerSide {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java
deleted file mode 100644 (file)
index aedfb65..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * This extension point allows to change project structure at runtime. It is executed once during task startup.
- * Some use-cases :
- * <ul>
- *   <li>Add sub-projects. For example the C# plugin gets the hierarchy
- *   of sub-projects from the Visual Studio metadata file. The single root pom.xml does not contain any declarations of
- *   modules</li>
- *   <li>Change project metadata like description or source directories.</li>
- * </ul>
- *
- * @deprecated since 6.5. It won't be possible to manipulate the project's structure.
- * @since 2.9
- */
-@ScannerSide
-@ExtensionPoint
-@Deprecated
-public abstract class ProjectBuilder {
-
-  @Deprecated
-  public interface Context {
-    ProjectReactor projectReactor();
-
-    /**
-     * Global config (command line arguments, global scanner properties).
-     * @since 8.3 Only as a replacement for injecting Settings
-     */
-    Configuration config();
-  }
-
-  /**
-   * @since 3.7
-   */
-  protected ProjectBuilder() {
-  }
-
-  /**
-   * Override this method to change project reactor structure.
-   * @since 3.7
-   */
-  public void build(Context context) {
-    // Call deprecated method for backward compatibility
-    build(context.projectReactor());
-  }
-
-  /**
-   * @deprecated since 3.7 override {@link #build(Context)} instead
-   */
-  @Deprecated
-  protected void build(ProjectReactor reactor) {
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java
deleted file mode 100644 (file)
index 9e429ed..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import javax.annotation.CheckForNull;
-import org.apache.commons.lang.ObjectUtils;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.CoreProperties;
-
-/**
- * Defines project metadata (key, name, source directories, ...). It's generally used by the
- * {@link org.sonar.api.batch.bootstrap.ProjectBuilder extension point} and must not be used
- * by other standard extensions.
- *
- * Since 6.5, plugins should no longer manipulate the project's structure.
- *
- * @since 2.9
- * @deprecated since 7.6 use {@link org.sonar.api.scanner.fs.InputProject}
- */
-@Deprecated
-public class ProjectDefinition {
-
-  public static final String SOURCES_PROPERTY = "sonar.sources";
-
-  public static final String TESTS_PROPERTY = "sonar.tests";
-
-  private static final char SEPARATOR = ',';
-
-  private File baseDir;
-  private File workDir;
-  private Map<String, String> properties = new LinkedHashMap<>();
-  private ProjectDefinition parent = null;
-  private List<ProjectDefinition> subProjects = new ArrayList<>();
-
-  private ProjectDefinition(Properties p) {
-    for (Entry<Object, Object> entry : p.entrySet()) {
-      this.properties.put(entry.getKey().toString(), entry.getValue().toString());
-    }
-  }
-
-  public static ProjectDefinition create() {
-    return new ProjectDefinition(new Properties());
-  }
-
-  public ProjectDefinition setBaseDir(File baseDir) {
-    this.baseDir = baseDir;
-    return this;
-  }
-
-  public File getBaseDir() {
-    return baseDir;
-  }
-
-  public ProjectDefinition setWorkDir(File workDir) {
-    this.workDir = workDir;
-    return this;
-  }
-
-  public File getWorkDir() {
-    return workDir;
-  }
-
-  public Map<String, String> properties() {
-    return properties;
-  }
-
-  public ProjectDefinition setProperties(Map<String, String> properties) {
-    this.properties.putAll(properties);
-    return this;
-  }
-
-  public ProjectDefinition setProperty(String key, String value) {
-    properties.put(key, value);
-    return this;
-  }
-
-  public ProjectDefinition setKey(String key) {
-    properties.put(CoreProperties.PROJECT_KEY_PROPERTY, key);
-    return this;
-  }
-
-  public ProjectDefinition setProjectVersion(String s) {
-    properties.put(CoreProperties.PROJECT_VERSION_PROPERTY, StringUtils.defaultString(s));
-    return this;
-  }
-
-  public ProjectDefinition setName(String s) {
-    properties.put(CoreProperties.PROJECT_NAME_PROPERTY, StringUtils.defaultString(s));
-    return this;
-  }
-
-  public ProjectDefinition setDescription(String s) {
-    properties.put(CoreProperties.PROJECT_DESCRIPTION_PROPERTY, StringUtils.defaultString(s));
-    return this;
-  }
-
-  public String getKey() {
-    return properties.get(CoreProperties.PROJECT_KEY_PROPERTY);
-  }
-
-  /**
-   * @deprecated since 7.7, use {@link #getOriginalProjectVersion()} instead
-   */
-  @Deprecated
-  @CheckForNull
-  public String getOriginalVersion() {
-    return getOriginalProjectVersion();
-  }
-
-  /**
-   * @deprecated since 7.7, use {@link #getProjectVersion()} instead
-   */
-  @Deprecated
-  public String getVersion() {
-    return getProjectVersion();
-  }
-
-  @CheckForNull
-  public String getOriginalProjectVersion() {
-    return properties.get(CoreProperties.PROJECT_VERSION_PROPERTY);
-  }
-
-  public String getProjectVersion() {
-    String version = properties.get(CoreProperties.PROJECT_VERSION_PROPERTY);
-    if (StringUtils.isBlank(version)) {
-      version = "not provided";
-    }
-    return version;
-  }
-
-  @CheckForNull
-  public String getOriginalName() {
-    return properties.get(CoreProperties.PROJECT_NAME_PROPERTY);
-  }
-
-  public String getName() {
-    String name = properties.get(CoreProperties.PROJECT_NAME_PROPERTY);
-    if (StringUtils.isBlank(name)) {
-      name = getKey();
-    }
-    return name;
-  }
-
-  public String getDescription() {
-    return properties.get(CoreProperties.PROJECT_DESCRIPTION_PROPERTY);
-  }
-
-  private void appendProperty(String key, String value) {
-    String current = (String) ObjectUtils.defaultIfNull(properties.get(key), "");
-    if (StringUtils.isBlank(current)) {
-      properties.put(key, value);
-    } else {
-      properties.put(key, current + SEPARATOR + value);
-    }
-  }
-
-  /**
-   * @return Source files and folders.
-   */
-  public List<String> sources() {
-    String sources = (String) ObjectUtils.defaultIfNull(properties.get(SOURCES_PROPERTY), "");
-    return trim(StringUtils.split(sources, SEPARATOR));
-  }
-
-  /**
-   * @param paths paths to file or directory with main sources.
-   *              They can be absolute or relative to project base directory.
-   */
-  public ProjectDefinition addSources(String... paths) {
-    for (String path : paths) {
-      appendProperty(SOURCES_PROPERTY, path);
-    }
-    return this;
-  }
-
-  public ProjectDefinition addSources(File... fileOrDirs) {
-    for (File fileOrDir : fileOrDirs) {
-      addSources(fileOrDir.getAbsolutePath());
-    }
-    return this;
-  }
-
-  public ProjectDefinition resetSources() {
-    properties.remove(SOURCES_PROPERTY);
-    return this;
-  }
-
-  public ProjectDefinition setSources(String... paths) {
-    resetSources();
-    return addSources(paths);
-  }
-
-  public ProjectDefinition setSources(File... filesOrDirs) {
-    resetSources();
-    for (File fileOrDir : filesOrDirs) {
-      addSources(fileOrDir.getAbsolutePath());
-    }
-    return this;
-  }
-
-  public List<String> tests() {
-    String sources = (String) ObjectUtils.defaultIfNull(properties.get(TESTS_PROPERTY), "");
-    return trim(StringUtils.split(sources, SEPARATOR));
-  }
-
-  /**
-   * @param paths path to files or directories with test sources.
-   *              It can be absolute or relative to project directory.
-   */
-  public ProjectDefinition addTests(String... paths) {
-    for (String path : paths) {
-      appendProperty(TESTS_PROPERTY, path);
-    }
-    return this;
-  }
-
-  public ProjectDefinition addTests(File... fileOrDirs) {
-    for (File fileOrDir : fileOrDirs) {
-      addTests(fileOrDir.getAbsolutePath());
-    }
-    return this;
-  }
-
-  public ProjectDefinition setTests(String... paths) {
-    resetTests();
-    return addTests(paths);
-  }
-
-  public ProjectDefinition setTests(File... fileOrDirs) {
-    resetTests();
-    for (File dir : fileOrDirs) {
-      addTests(dir.getAbsolutePath());
-    }
-    return this;
-  }
-
-  public ProjectDefinition resetTests() {
-    properties.remove(TESTS_PROPERTY);
-    return this;
-  }
-
-  /**
-   * @since 2.8
-   */
-  public ProjectDefinition addSubProject(ProjectDefinition child) {
-    subProjects.add(child);
-    child.setParent(this);
-    return this;
-  }
-
-  @CheckForNull
-  public ProjectDefinition getParent() {
-    return parent;
-  }
-
-  public void remove() {
-    if (parent != null) {
-      parent.subProjects.remove(this);
-      parent = null;
-      subProjects.clear();
-    }
-  }
-
-  private void setParent(ProjectDefinition parent) {
-    this.parent = parent;
-  }
-
-  /**
-   * @since 2.8
-   */
-  public List<ProjectDefinition> getSubProjects() {
-    return subProjects;
-  }
-
-  private static List<String> trim(String[] strings) {
-    List<String> result = new ArrayList<>();
-    for (String s : strings) {
-      result.add(StringUtils.trim(s));
-    }
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    ProjectDefinition that = (ProjectDefinition) o;
-    String key = getKey();
-    return !((key != null) ? !key.equals(that.getKey()) : (that.getKey() != null));
-
-  }
-
-  @Override
-  public int hashCode() {
-    String key = getKey();
-    return key != null ? key.hashCode() : 0;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
deleted file mode 100644 (file)
index 924d8fc..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Mutable project definitions that can be modified by {@link ProjectBuilder} extensions.
- * 
- * @deprecated since 6.5 plugins should no longer modify the project's structure
- * @since 2.9
- */
-@Deprecated
-@ScannerSide
-public class ProjectReactor {
-
-  private ProjectDefinition root;
-
-  public ProjectReactor(ProjectDefinition root) {
-    if (root.getParent() != null) {
-      throw new IllegalArgumentException("Not a root project: " + root);
-    }
-    this.root = root;
-  }
-
-  public List<ProjectDefinition> getProjects() {
-    return collectProjects(root, new ArrayList<>());
-  }
-
-  /**
-   * Populates list of projects from hierarchy.
-   */
-  private static List<ProjectDefinition> collectProjects(ProjectDefinition def, List<ProjectDefinition> collected) {
-    collected.add(def);
-    for (ProjectDefinition child : def.getSubProjects()) {
-      collectProjects(child, collected);
-    }
-    return collected;
-  }
-
-  public ProjectDefinition getRoot() {
-    return root;
-  }
-
-  public ProjectDefinition getProject(String key) {
-    for (ProjectDefinition p : getProjects()) {
-      if (key.equals(p.getKey())) {
-        return p;
-      }
-    }
-    return null;
-  }
-
-  public String get() {
-    if (root != null) {
-      return root.getKey();
-    }
-    return null;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/ProjectBuilderContext.java
deleted file mode 100644 (file)
index 681c330..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap.internal;
-
-
-import org.sonar.api.batch.bootstrap.ProjectBuilder;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.api.config.Configuration;
-
-/**
- * Context that is passed to {@link org.sonar.api.batch.bootstrap.ProjectBuilder} as parameter.
- * Important - plugins must use this class only for unit test needs.
- *
- * @deprecated since 6.5
- * @since 3.7
- */
-@Deprecated
-public class ProjectBuilderContext implements ProjectBuilder.Context {
-
-  private final ProjectReactor reactor;
-  private final Configuration configuration;
-
-  public ProjectBuilderContext(ProjectReactor reactor, Configuration configuration) {
-    this.reactor = reactor;
-    this.configuration = configuration;
-  }
-
-  @Override
-  public ProjectReactor projectReactor() {
-    return reactor;
-  }
-
-  @Override
-  public Configuration config() {
-    return configuration;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/package-info.java
deleted file mode 100644 (file)
index 77a34e7..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.bootstrap.internal;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/package-info.java
deleted file mode 100644 (file)
index 5534cd3..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.bootstrap;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicate.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicate.java
deleted file mode 100644 (file)
index 1d9f0f6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-/**
- * Determines if a file must be kept in search results. See {@link org.sonar.api.batch.fs.FileSystem}
- * and {@link org.sonar.api.batch.fs.FilePredicates}.
- * @since 4.2
- */
-public interface FilePredicate {
-  /**
-   * Test if provided file is valid for this predicate
-   */
-  boolean apply(InputFile inputFile);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicates.java
deleted file mode 100644 (file)
index fb19a2f..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Collection;
-
-/**
- * Factory of {@link org.sonar.api.batch.fs.FilePredicate}
- *
- * @since 4.2
- */
-public interface FilePredicates {
-  /**
-   * Predicate that always evaluates to true
-   */
-  FilePredicate all();
-
-  /**
-   * Predicate that always evaluates to false
-   */
-  FilePredicate none();
-
-  /**
-   * Predicate that find file by its absolute path. The parameter
-   * accepts forward/back slashes as separator and non-normalized values
-   * (<code>/path/to/../foo.txt</code> is same as <code>/path/foo.txt</code>).
-   * <p>
-   * Warning - may not be supported in SonarLint
-   */
-  FilePredicate hasAbsolutePath(String s);
-
-  /**
-   * Predicate that gets a file by its relative path. The parameter
-   * accepts forward/back slashes as separator and non-normalized values
-   * (<code>foo/../bar.txt</code> is same as <code>bar.txt</code>). It must
-   * not be <code>null</code>.
-   * <p>
-   * Warning - may not be supported in SonarLint
-   */
-  FilePredicate hasRelativePath(String s);
-
-  /**
-   * Predicate that matches files by filename, in any directory.
-   * For example, the parameter <code>Foo.java</code> will match both
-   * <code>some/path/Foo.java</code> and <code>other/path/Foo.java</code>.
-   * The parameter must match exactly, no patterns are allowed,
-   * and it must not be <code>null</code>.
-   * 
-   * @since 6.3
-   */
-  FilePredicate hasFilename(String s);
-
-  /**
-   * Predicate that matches files by extension (case insensitive).
-   * For example, the parameter <code>java</code> will match
-   * <code>some/path/Foo.java</code> and <code>other/path/Foo.JAVA</code>
-   * but not <code>some/path/Foo.js</code>.
-   * The parameter must not be <code>null</code>.
-   * 
-   * @since 6.3
-   */
-  FilePredicate hasExtension(String s);
-
-  /**
-   * Predicate that gets a file by its {@link InputFile#uri()}.
-   * 
-   * @since 6.6
-   */
-  FilePredicate hasURI(URI uri);
-
-  /**
-   * Predicate that gets the files which "path" matches a wildcard pattern.
-   * <p>
-   * The path is the path part of the {@link InputFile#uri()}. Pattern is case-sensitive, except for file extension.
-   * <p>
-   * Supported wildcards are <code>&#42;</code> and <code>&#42;&#42;</code>, but not <code>?</code>.
-   * <br>
-   * Examples:
-   * <ul>
-   *   <li><code>&#42;&#42;/&#42;Foo.java</code> matches Foo.java, src/Foo.java and src/java/SuperFoo.java</li>
-   *   <li><code>&#42;&#42;/&#42;Foo&#42;.java</code> matches src/Foo.java, src/BarFoo.java, src/FooBar.java
-   *   and src/BarFooBaz.java</li>
-   *   <li><code>&#42;&#42;/&#42;FOO.JAVA</code> matches FOO.java and FOO.JAVA but not Foo.java</li>
-   * </ul>
-   */
-  FilePredicate matchesPathPattern(String inclusionPattern);
-
-  /**
-   * Predicate that gets the files matching at least one wildcard pattern. No filter is applied when
-   * zero wildcard patterns (similar to {@link #all()}.
-   * @see #matchesPathPattern(String)
-   */
-  FilePredicate matchesPathPatterns(String[] inclusionPatterns);
-
-  /**
-   * Predicate that gets the files that do not match the given wildcard pattern.
-   * @see #matchesPathPattern(String)
-   */
-  FilePredicate doesNotMatchPathPattern(String exclusionPattern);
-
-  /**
-   * Predicate that gets the files that do not match any of the given wildcard patterns. No filter is applied when
-   * zero wildcard patterns (similar to {@link #all()}.
-   * @see #matchesPathPattern(String)
-   */
-  FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns);
-
-  /**
-   * if the parameter represents an absolute path for the running environment, then
-   * returns {@link #hasAbsolutePath(String)}, else {@link #hasRelativePath(String)}
-   * <p>
-   * Warning - may not be supported in SonarLint
-   */
-  FilePredicate hasPath(String s);
-
-  /**
-   * Warning - may not be supported in SonarLint
-   */
-  FilePredicate is(File ioFile);
-
-  FilePredicate hasLanguage(String language);
-
-  FilePredicate hasLanguages(Collection<String> languages);
-
-  FilePredicate hasLanguages(String... languages);
-
-  FilePredicate hasType(InputFile.Type type);
-
-  FilePredicate not(FilePredicate p);
-
-  FilePredicate or(Collection<FilePredicate> or);
-
-  FilePredicate or(FilePredicate... or);
-
-  FilePredicate or(FilePredicate first, FilePredicate second);
-
-  FilePredicate and(Collection<FilePredicate> and);
-
-  FilePredicate and(FilePredicate... and);
-
-  FilePredicate and(FilePredicate first, FilePredicate second);
-
-  /**
-   * Look for InputFile having a specific {@link InputFile#status()}
-   * @since 6.6
-   */
-  FilePredicate hasStatus(InputFile.Status status);
-
-  /**
-   * Explicitely look for InputFile having any {@link InputFile#status()}
-   * @since 6.6
-   */
-  FilePredicate hasAnyStatus();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
deleted file mode 100644 (file)
index c057846..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.SortedSet;
-import javax.annotation.CheckForNull;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * The {@link FileSystem} manages all the source files to be analyzed.
- * <p>
- * This is not an extension point so it must not be implemented by plugins. It must be injected as a
- * constructor parameter :
- * <pre>
- * public class MySensor implements Sensor {
- *   private final FileSystem fs;
- *
- *   public MySensor(FileSystem fs) {
- *     this.fs = fs;
- *   }
- * }
- * </pre>
- *
- * <h2>How to use in unit tests</h2>
- * The unit tests needing an instance of FileSystem can use the implementation, available in sonar-plugin-api-impl,
- * {@link org.sonar.api.batch.fs.internal.DefaultFileSystem} and the related {@link org.sonar.api.batch.fs.internal.DefaultInputFile},
- * for example :
- * <pre>
- * DefaultFileSystem fs = new DefaultFileSystem();
- * fs.add(new DefaultInputFile("myprojectKey", "src/foo/bar.php"));
- * </pre>
- *
- * @since 4.2
- */
-@ScannerSide
-public interface FileSystem {
-
-  /**
-   * Absolute base directory of module.
-   */
-  File baseDir();
-
-  /**
-   * Default encoding of files in this project. If it's not defined, then
-   * the platform default encoding is returned.
-   * When reading an {@link InputFile} it is preferable to use {@link InputFile#charset()} 
-   */
-  Charset encoding();
-
-  /**
-   * Absolute work directory. It can be used to
-   * store third-party analysis reports.
-   * <br>
-   * The work directory can be located outside {@link #baseDir()}.
-   */
-  File workDir();
-
-  /**
-   * Factory of {@link FilePredicate}
-   */
-  FilePredicates predicates();
-
-  /**
-   * Returns the single element matching the predicate. If more than one elements match
-   * the predicate, then {@link IllegalArgumentException} is thrown. Returns {@code null}
-   * if no files match.
-   *
-   * <p>
-   * How to use :
-   * <pre>
-   * InputFile file = fs.inputFile(fs.predicates().hasRelativePath("src/Foo.php"));
-   * </pre>
-   *
-   * @see #predicates()
-   */
-  @CheckForNull
-  InputFile inputFile(FilePredicate predicate);
-
-  /**
-   * Returns {@link InputDir} matching the current {@link File}.
-   * @return null if directory is not indexed.
-   * @throws IllegalArgumentException is File is null or not a directory.
-   * 
-   * @since 4.5
-   * @deprecated since 6.6 Ability to report issues or measures on directories will soon be dropped. Report issues on project if needed. 
-   */
-  @Deprecated
-  @CheckForNull
-  InputDir inputDir(File dir);
-
-  /**
-   * Input files matching the given attributes. Return all the files if the parameter
-   * <code>attributes</code> is empty.
-   * <p>
-   * <b>Important</b> - result is an {@link java.lang.Iterable} to benefit from streaming and decreasing
-   * memory consumption. It should be iterated only once, else copy it into a list :
-   * {@code com.google.common.collect.Lists.newArrayList(inputFiles(predicate))}
-   * <p>
-   * How to use :
-   * <pre>
-   * {@code
-   * FilePredicates p = fs.predicates();
-   * Iterable<InputFile> files = fs.inputFiles(p.and(p.hasLanguage("java"), p.hasType(InputFile.Type.MAIN)));
-   * }
-   * </pre>
-   *
-   * @see #predicates()
-   */
-  Iterable<InputFile> inputFiles(FilePredicate predicate);
-
-  /**
-   * Returns true if at least one {@link org.sonar.api.batch.fs.InputFile} matches
-   * the given predicate. This method can be faster than checking if {@link #inputFiles(org.sonar.api.batch.fs.FilePredicate)}
-   * has elements.
-   * @see #predicates()
-   */
-  boolean hasFiles(FilePredicate predicate);
-
-  /**
-   * Files matching the given predicate.
-   * @see #predicates()
-   * @deprecated since 6.6 Plugins should avoid working with {@link File} and prefer working with {@link InputFile}
-   */
-  @Deprecated
-  Iterable<File> files(FilePredicate predicate);
-
-  /**
-   * Languages detected in all files, whatever their type (main or test)
-   */
-  SortedSet<String> languages();
-
-  /**
-   * Utility method mainly used to resolve location of reports.
-   * @return file in canonical form from specified path. Path can be absolute or relative to project basedir.
-   *         For example resolvePath("pom.xml") or resolvePath("src/main/java")
-   * @since 5.0
-   */
-  File resolvePath(String path);
-
-  /**
-   * Interface of the underlying file index.
-   */
-  interface Index {
-    Iterable<InputFile> inputFiles();
-
-    @CheckForNull
-    InputFile inputFile(String relativePath);
-
-    /**
-     * @since 6.3
-     */
-    Iterable<InputFile> getFilesByName(String filename);
-
-    /**
-     * @since 6.3
-     */
-    Iterable<InputFile> getFilesByExtension(String extension);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/IndexedFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/IndexedFile.java
deleted file mode 100644 (file)
index 6390826..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.nio.file.Path;
-import javax.annotation.CheckForNull;
-
-/**
- * Represents the indexed view of an {@link InputFile}. Accessing any of data exposed here won't trigger the expensive generation of 
- * metadata for the {@link InputFile}.
- * 
- * @since 6.3 
- */
-public interface IndexedFile extends InputPath {
-  /**
-   * Path relative to module base directory. Path is unique and identifies file
-   * within given <code>{@link FileSystem}</code>. File separator is the forward
-   * slash ('/'), even on Microsoft Windows.
-   * <br>
-   * Returns <code>src/main/java/com/Foo.java</code> if module base dir is
-   * <code>/path/to/module</code> and if file is
-   * <code>/path/to/module/src/main/java/com/Foo.java</code>.
-   * <br>
-   * Relative path is not null and is normalized ('foo/../foo' is replaced by 'foo').
-   * @deprecated since 6.6 use {@link #inputStream()}, {@link #filename()} or {@link #uri()}
-   */
-  @Deprecated
-  @Override
-  String relativePath();
-
-  /**
-   * Normalized absolute path. File separator is forward slash ('/'), even on Microsoft Windows.
-   * <br>
-   * This is not canonical path. Symbolic links are not resolved. For example if /project/src links
-   * to /tmp/src and basedir is /project, then this method returns /project/src/index.php. Use
-   * {@code file().getCanonicalPath()} to resolve symbolic link.
-   * @deprecated since 6.6 use {@link #inputStream()}, {@link #filename()} or {@link #uri()}
-   */
-  @Deprecated
-  @Override
-  String absolutePath();
-
-  /**
-   * The underlying absolute {@link java.io.File}. It should not be used to read the file in the filesystem.
-   * @see #contents()
-   * @see #inputStream()
-   * @deprecated since 6.6 use {@link #inputStream()}, {@link #filename()} or {@link #uri()}
-   */
-  @Deprecated
-  @Override
-  File file();
-
-  /**
-   * The underlying absolute {@link Path}.
-   * It should not be used to read the file in the filesystem.
-   * @see #contents()
-   * @see #inputStream()
-   * @since 5.1
-   * @deprecated since 6.6 use {@link #inputStream()}, {@link #filename()} or {@link #uri()}
-   */
-  @Deprecated
-  @Override
-  Path path();
-
-  /**
-   * Identifier of the file. The only guarantee is that it is unique in the project.
-   * You should not assume it is a file:// URI.
-   * @since 6.6
-   */
-  URI uri();
-
-  /**
-   * Filename for this file (inclusing extension). For example: MyClass.java.
-   * @since 6.6
-   */
-  String filename();
-
-  /**
-   * Language, for example "java" or "php". Can be null if indexation of all files is enabled and no language claims to support the file.
-   */
-  @CheckForNull
-  String language();
-
-  /**
-   * Does it contain main or test code ?
-   */
-  InputFile.Type type();
-
-  /**
-   * Creates a stream of the file's contents. Depending on the runtime context, the source might be a file in a physical or virtual filesystem.
-   * Typically, it won't be buffered. <b>The stream must be closed by the caller</b>.
-   * @since 6.2
-   */
-  InputStream inputStream() throws IOException;
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputComponent.java
deleted file mode 100644 (file)
index 4948c00..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-/**
- * Common interface for all input components.
- *
- * @since 5.2
- * @see InputFile
- * @see InputDir
- * @see InputModule
- * @see org.sonar.api.scanner.fs.InputProject
- */
-public interface InputComponent {
-
-  /**
-   * Component key shared by all part of SonarQube (scanner, server, WS...). 
-   * It doesn't include the branch.
-   * Warning. Do not use in SonarLint.
-   */
-  String key();
-
-  /**
-   * Is the component an {@link InputFile}
-   */
-  boolean isFile();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputDir.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputDir.java
deleted file mode 100644 (file)
index c398566..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.nio.file.Path;
-
-/**
- * Layer over {@link java.io.File} for directories. You can access InputDir using {@link FileSystem#inputDir(File)}.
- *
- * @since 4.5
- * @deprecated since 6.6 Ability to report issues or measures on directories will soon be dropped. Report issues on project if needed. 
- */
-@Deprecated
-public interface InputDir extends InputPath {
-
-  /**
-   * Path relative to module base directory. Path is unique and identifies directory
-   * within given <code>{@link FileSystem}</code>. File separator is the forward
-   * slash ('/'), even on Microsoft Windows.
-   * <br>
-   * Returns <code>src/main/java/com</code> if module base dir is
-   * <code>/path/to/module</code> and if directory is
-   * <code>/path/to/module/src/main/java/com</code>.
-   * <br>
-   * Relative path is not null and is normalized ('foo/../foo' is replaced by 'foo').
-   */
-  @Override
-  String relativePath();
-
-  /**
-   * Normalized absolute path. File separator is forward slash ('/'), even on Microsoft Windows.
-   * <br>
-   * This is not canonical path. Symbolic links are not resolved. For example if /project/src links
-   * to /tmp/src and basedir is /project, then this method returns /project/src. Use
-   * {@code file().getCanonicalPath()} to resolve symbolic link.
-   */
-  @Override
-  String absolutePath();
-
-  /**
-   * The underlying absolute {@link java.io.File}
-   */
-  @Override
-  File file();
-
-  /**
-   * The underlying absolute {@link Path}
-   */
-  @Override
-  Path path();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFile.java
deleted file mode 100644 (file)
index 1dec70d..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.nio.file.Path;
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.sensor.SensorDescriptor;
-
-/**
- * This layer over {@link java.io.File} adds information for code analyzers.
- * For unit testing purpose, use TestInputFileBuilder available in sonar-plugin-api-impl and initialize
- * the needed fields:
- * 
- * <pre>
- *   new TestInputFileBuilder("moduleKey", "relative/path/from/module/baseDir.java")
- *     .setModuleBaseDir(path)
- *     .build();
- * </pre>
- *
- * @since 4.2
- */
-public interface InputFile extends IndexedFile {
-
-  enum Type {
-    MAIN, TEST
-  }
-
-  /** 
-   * Status regarding previous analysis
-   */
-  enum Status {
-    SAME, CHANGED, ADDED
-  }
-
-  /**
-   * Relative path to module (for normal Sensors) or project (for {@link SensorDescriptor#global() global} Sensors) base directory.
-   * File separator is the forward
-   * slash ('/'), even on Microsoft Windows.
-   * <br>
-   * Returns <code>src/main/java/com/Foo.java</code> if module base dir is
-   * <code>/path/to/module</code> and if file is
-   * <code>/path/to/module/src/main/java/com/Foo.java</code>.
-   * <br>
-   * Relative path is not null and is normalized ('foo/../foo' is replaced by 'foo').
-   * @deprecated since 6.6 use {@link #inputStream()} for file content, {@link #filename()} for file name, {@link #uri()} for an unique identifier, and {@link #toString()} for logging
-   */
-  @Deprecated
-  @Override
-  String relativePath();
-
-  /**
-   * Normalized absolute path. File separator is forward slash ('/'), even on Microsoft Windows.
-   * <br>
-   * This is not canonical path. Symbolic links are not resolved. For example if /project/src links
-   * to /tmp/src and basedir is /project, then this method returns /project/src/index.php. Use
-   * {@code file().getCanonicalPath()} to resolve symbolic link.
-   * @deprecated since 6.6 use {@link #inputStream()} for file content, {@link #filename()} for file name, {@link #uri()} for an unique identifier, and {@link #toString()} for logging
-   */
-  @Deprecated
-  @Override
-  String absolutePath();
-
-  /**
-   * The underlying absolute {@link java.io.File}. It should not be used to read the file in the filesystem.
-   * @see #contents()
-   * @see #inputStream()
-   * @deprecated since 6.6 use {@link #inputStream()} for file content, {@link #filename()} for file name, {@link #uri()} for an unique identifier, and {@link #toString()} for logging
-   */
-  @Deprecated
-  @Override
-  File file();
-
-  /**
-   * The underlying absolute {@link Path}.
-   * It should not be used to read the file in the filesystem.
-   * @see #contents()
-   * @see #inputStream()
-   * @since 5.1
-   * @deprecated since 6.6 use {@link #inputStream()} for file content, {@link #filename()} for file name, {@link #uri()} for an unique identifier, and {@link #toString()} for logging
-   */
-  @Deprecated
-  @Override
-  Path path();
-
-  /**
-   * Language, for example "java" or "php". Can be null if indexation of all files is enabled and no language claims to support the file.
-   */
-  @CheckForNull
-  @Override
-  String language();
-
-  /**
-   * Does it contain main or test code ?
-   */
-  @Override
-  Type type();
-
-  /**
-   * Creates a stream of the file's contents. Depending on the runtime context, the source might be a file in a physical or virtual filesystem.
-   * Typically, it won't be buffered. <b>The stream must be closed by the caller</b>.
-   * Since 6.4 BOM is automatically filtered out.
-   * @since 6.2
-   */
-  @Override
-  InputStream inputStream() throws IOException;
-
-  /**
-   * Fetches the entire contents of the file, decoding with the {@link #charset}.
-   * Since 6.4 BOM is automatically filtered out.
-   * @since 6.2
-   */
-  String contents() throws IOException;
-
-  Status status();
-
-  /**
-   * Number of physical lines. This method supports all end-of-line characters. Formula is (number of line break + 1). 
-   * <p>
-   * Returns 1 if the file is empty.
-   * <br> 
-   * Returns 2 for <tt>foo\nbar</tt>. 
-   * <br>
-   * Returns 3 for <tt>foo\nbar\n</tt>.
-   */
-  int lines();
-
-  /**
-   * Check if the file content is empty (ignore potential BOM).
-   * @since 5.2
-   */
-  boolean isEmpty();
-
-  /**
-   * Returns a {@link TextPointer} in the given file.
-   * @param line Line of the pointer. Start at 1.
-   * @param lineOffset Offset in the line. Start at 0.
-   * @throws IllegalArgumentException if line or offset is not valid for the given file.
-   * @since 5.2
-   */
-  TextPointer newPointer(int line, int lineOffset);
-
-  /**
-   * Returns a {@link TextRange} in the given file.
-   * @param start start pointer
-   * @param end end pointer
-   * @throws IllegalArgumentException if start or stop pointers are not valid for the given file.
-   * @since 5.2
-   */
-  TextRange newRange(TextPointer start, TextPointer end);
-
-  /**
-   * Returns a {@link TextRange} in the given file.
-   * <ul>
-   * <li><code>newRange(1, 0, 1, 1)</code> selects the first character at line 1</li>
-   * <li><code>newRange(1, 0, 1, 10)</code> selects the 10 first characters at line 1</li>
-   * </ul>
-   * @throws IllegalArgumentException if start or stop positions are not valid for the given file.
-   * @since 5.2
-   */
-  TextRange newRange(int startLine, int startLineOffset, int endLine, int endLineOffset);
-
-  /**
-   * Returns a {@link TextRange} in the given file that select the full line.
-   * @param line Start at 1.
-   * @throws IllegalArgumentException if line is not valid for the given file.
-   * @since 5.2
-   */
-  TextRange selectLine(int line);
-
-  /**
-   * Charset to be used to decode this specific file.
-   * @since 6.0
-   */
-  Charset charset();
-
-  /**
-   * Return a string to identify this file (suitable for logs).
-   */
-  @Override
-  String toString();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java
deleted file mode 100644 (file)
index b2389d8..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * Extension point to exclude some files from inspection
- * @since 4.2
- * @since 7.6 evaluated at project level
- */
-@ScannerSide
-@SonarLintSide
-@ExtensionPoint
-@FunctionalInterface
-public interface InputFileFilter {
-
-  boolean accept(InputFile f);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputModule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputModule.java
deleted file mode 100644 (file)
index 2cf4b63..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-
-import javax.annotation.concurrent.Immutable;
-
-import org.sonar.api.batch.sensor.SensorContext;
-
-/**
- * Used to create issues and measures on modules. You can access InputModule using {@link SensorContext#module()}
- *
- * @since 5.2
- * @deprecated since 7.6 modules are deprecated. Use {@link org.sonar.api.scanner.fs.InputProject} instead.
- */
-@Deprecated
-@Immutable
-public interface InputModule extends InputComponent {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputPath.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputPath.java
deleted file mode 100644 (file)
index 2713610..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-import java.io.File;
-import java.net.URI;
-import java.nio.file.Path;
-
-/**
- * Layer over {@link java.io.File} for files or directories.
- *
- * @since 4.5
- * @see InputFile
- * @see InputDir
- */
-public interface InputPath extends InputComponent {
-
-  /**
-   * @see InputFile#relativePath()
-   * @see InputDir#relativePath()
-   * @deprecated since 6.5 use {@link #uri()}
-   */
-  @Deprecated
-  String relativePath();
-
-  /**
-   * @see InputFile#absolutePath()
-   * @see InputDir#absolutePath()
-   * @deprecated since 6.5 use {@link #uri()}
-   */
-  @Deprecated
-  String absolutePath();
-
-  /**
-   * @see InputFile#file()
-   * @see InputDir#file()
-   * @deprecated since 6.5 use {@link #uri()}
-   */
-  @Deprecated
-  File file();
-
-  /**
-   * @see InputFile#path()
-   * @see InputDir#path()
-   * @since 5.1
-   * @deprecated since 6.5 use {@link #uri()}
-   */
-  @Deprecated
-  Path path();
-
-  /**
-   * Identifier of the component. The only guarantee is that it is unique in the project.
-   * You should not assume it is a file:// URI.
-   * @since 6.5
-   */
-  URI uri();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextPointer.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextPointer.java
deleted file mode 100644 (file)
index 9430c83..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-/**
- * Represents a position in a text file {@link InputFile}
- *
- * @since 5.2
- */
-public interface TextPointer extends Comparable<TextPointer> {
-
-  /**
-   * The logical line where this pointer is located. First line is 1.
-   */
-  int line();
-
-  /**
-   * The offset of this pointer in the current line. First position in a line is 0.
-   */
-  int lineOffset();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextRange.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/TextRange.java
deleted file mode 100644 (file)
index b563a4a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.fs;
-
-/**
- * Represents a text range in an {@link InputFile}. 
- * 
- * A range is delimited by two {@link TextPointer}. 
- * <ul>
- * <li><code>TextRange(TextPointer(1, 0), TextPointer(1, 1))</code> represents the first character at line 1</li>
- * <li><code>TextRange(TextPointer(1, 0), TextPointer(1, 10))</code> represents the 10 first characters at line 1</li>
- * </ul>
- * @see InputFile#newRange(int, int, int, int)
- *
- * @since 5.2
- */
-public interface TextRange {
-
-  /**
-   * Start position of the range
-   */
-  TextPointer start();
-
-  /**
-   * End position of the range
-   */
-  TextPointer end();
-
-  /**
-   * Test if the current range has some common area with another range.
-   * Exemple: say the two ranges are on same line. Range with offsets [1,3] overlaps range with offsets [2,4] but not
-   * range with offset [3,5]
-   */
-  boolean overlap(TextRange another);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/package-info.java
deleted file mode 100644 (file)
index f3845b4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.fs;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/Metric.java
deleted file mode 100644 (file)
index 46fb61c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.measure;
-
-import java.io.Serializable;
-
-/**
- * @since 4.4
- */
-public interface Metric<G extends Serializable> {
-
-  String key();
-
-  Class<G> valueType();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java
deleted file mode 100644 (file)
index be23e99..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.measure;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.ThreadSafe;
-
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * @since 4.5
- */
-@ScannerSide
-@ThreadSafe
-public interface MetricFinder {
-
-  @CheckForNull
-  <G extends Serializable> Metric<G> findByKey(String key);
-
-  Collection<Metric<Serializable>> findAll(List<String> metricKeys);
-
-  Collection<Metric<Serializable>> findAll();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/package-info.java
deleted file mode 100644 (file)
index 182b74b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.measure;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/package-info.java
deleted file mode 100644 (file)
index 680c6c8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java
deleted file mode 100644 (file)
index e6b7c42..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.postjob;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * PostJobs are executed at the very end of scanner analysis. A PostJob can't do any modification
- * since everything is already computed (issues, measures,...). <br>
- * WARNING: Do not rely on the fact that analysis results are available on server side when using WS since this is an
- * asynchronous process to compute data on server side in 5.x series.
- *
- * @since 5.2
- * @since 7.6 postjobs are loaded in the project container
- */
-@ScannerSide
-@ExtensionPoint
-public interface PostJob {
-
-  /**
-   * Populate {@link PostJobDescriptor} of this PostJob.
-   */
-  void describe(PostJobDescriptor descriptor);
-
-  /**
-   * Called at the end of the analysis.
-   */
-  void execute(PostJobContext context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java
deleted file mode 100644 (file)
index 15be69d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.postjob;
-
-import org.sonar.api.config.Configuration;
-
-/**
- * See {@link PostJob#execute(PostJobContext)}
- * @since 5.2
- */
-public interface PostJobContext {
-
-  /**
-   * Get configuration of the current project.
-   * @since 6.5
-   */
-  Configuration config();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobDescriptor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobDescriptor.java
deleted file mode 100644 (file)
index 92878e5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.postjob;
-
-/**
- * Describe what a {@link PostJob} is doing. Information may be used by the platform
- * to log interesting information or perform some optimization.
- * See {@link PostJob#describe(PostJobDescriptor)}
- * @since 5.2
- */
-public interface PostJobDescriptor {
-
-  /**
-   * Displayable name of the {@link PostJob}. Will be displayed in logs.
-   */
-  PostJobDescriptor name(String postJobName);
-
-  /**
-   * Property this {@link PostJob} depends on. Used by the platform to skip execution of the {@link PostJob} when
-   * property is not set.
-   */
-  PostJobDescriptor requireProperty(String... propertyKey);
-
-  /**
-   * List properties this {@link PostJob} depends on. Used by the platform to skip execution of the {@link PostJob} when
-   * property is not set.
-   */
-  PostJobDescriptor requireProperties(String... propertyKeys);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/PostJobIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/PostJobIssue.java
deleted file mode 100644 (file)
index 5692702..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.postjob.issue;
-
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.rule.RuleKey;
-
-/**
- * Represents an issue state at the end of the scanner analysis in preview/issues mode.
- *
- * @since 5.2
- */
-public interface PostJobIssue {
-
-  /**
-   * Key of the issue.
-   */
-  String key();
-
-  /**
-   * The {@link RuleKey} of this issue.
-   */
-  RuleKey ruleKey();
-
-  /**
-   * Component key like foo:src/Foo.php
-   */
-  String componentKey();
-
-  /**
-   * The {@link InputComponent} this issue belongs to. Returns null if component was deleted (for resolved issues).
-   */
-  @CheckForNull
-  InputComponent inputComponent();
-
-  /**
-   * Line of the issue. Null for global issues and issues on directories. Can also be null
-   * for files (issue global to the file).
-   */
-  @CheckForNull
-  Integer line();
-
-  /**
-   * Message of the issue.
-   */
-  @CheckForNull
-  String message();
-
-  /**
-   * Severity.
-   */
-  Severity severity();
-
-  /**
-   * If the issue a new one.
-   */
-  boolean isNew();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/issue/package-info.java
deleted file mode 100644 (file)
index 890c8b5..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.postjob.issue;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/package-info.java
deleted file mode 100644 (file)
index fd1d724..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.postjob;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java
deleted file mode 100644 (file)
index 9302eb0..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-
-import org.sonar.api.rule.RuleKey;
-
-/**
- * Configuration of a rule activated on a Quality profile
- * @since 4.2
- */
-@Immutable
-public interface ActiveRule {
-
-  RuleKey ruleKey();
-
-  /**
-   * Non-null severity.
-   * @see org.sonar.api.rule.Severity
-   */
-  String severity();
-
-  /**
-   * Language of rule, for example <code>java</code>
-   */
-  String language();
-
-  /**
-   * Value of given parameter. Returns <code>null</code> if the parameter key does not
-   * exist on the rule or if the parameter has no value nor default value.
-   */
-  @CheckForNull
-  String param(String key);
-
-  /**
-   * Immutable parameter values. Returns an empty map if no parameters are defined.
-   */
-  Map<String, String> params();
-
-  /**
-   * Optional key declared and used by the underlying rule engine. As an example
-   * the key of a Checkstyle rule looks like <code>com.puppycrawl.tools.checkstyle.checks.FooCheck</code>
-   * whereas its internal key can be <code>Checker/TreeWalker/Foo</code>.
-   */
-  @CheckForNull
-  String internalKey();
-
-  /**
-   * Optional rule key of the template rule.
-   * @since 4.5.3
-   */
-  @CheckForNull
-  String templateRuleKey();
-
-  /**
-   * Key of the quality profile the rule belongs to.
-   * @since 7.5
-   */
-  String qpKey();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java
deleted file mode 100644 (file)
index 4565d6a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.rule.RuleKey;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-
-import java.util.Collection;
-
-/**
- * The rules that are activated on the current project. Quality profiles are
- * merged, so rules can relate to different repositories and languages.
- * <br>
- * Use {@link org.sonar.api.batch.rule.internal.ActiveRulesBuilder} available in sonar-plugin-api-impl to instantiate
- * this component in unit tests.
- *
- * @since 4.2
- */
-@Immutable
-@ScannerSide
-public interface ActiveRules {
-
-  /**
-   * Find a {@link ActiveRule} by the associated rule key. <code>null</code>
-   * is returned if the rule does not exist or if the rule is not activated
-   * on any Quality profile associated with the project.
-   */
-  @CheckForNull
-  ActiveRule find(RuleKey ruleKey);
-
-  /**
-   * All the active rules, whatever their repository and related language.
-   */
-  Collection<ActiveRule> findAll();
-
-  /**
-   * The active rules for a given repository, like <code>findbugs</code>
-   */
-  Collection<ActiveRule> findByRepository(String repository);
-
-  /**
-   * The active rules for a given language, like <code>java</code>
-   */
-  Collection<ActiveRule> findByLanguage(String language);
-
-  /**
-   * Find a {@link ActiveRule} by the associated internal key. <code>null</code>
-   * is returned if the rule does not exist or if the rule is not activated
-   * on any Quality profile associated with the project.
-   */
-  @CheckForNull
-  ActiveRule findByInternalKey(String repository, String internalKey);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java
deleted file mode 100644 (file)
index 5dba2fe..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Creates {@link org.sonar.api.batch.rule.Checks}. This class is available
- * by dependency injection. It must not be extended by plugins.
- *
- * @since 4.2
- */
-@ScannerSide
-public class CheckFactory {
-
-  private final ActiveRules activeRules;
-
-  public CheckFactory(ActiveRules activeRules) {
-    this.activeRules = activeRules;
-  }
-
-  public <C> Checks<C> create(String repository) {
-    return new Checks<>(activeRules, repository);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Checks.java
deleted file mode 100644 (file)
index f9fd33b..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.AnnotationUtils;
-import org.sonar.api.utils.FieldUtils2;
-import org.sonar.api.utils.SonarException;
-import org.sonar.check.RuleProperty;
-
-/**
- * Instantiates checks (objects that provide implementation of coding
- * rules) that use sonar-check-api annotations. Checks are selected and configured
- * from the Quality profiles enabled on the current module.
- * <br>
- * Example of check class:
- * <pre>
- *   {@literal @}org.sonar.check.Rule(key = "S001")
- *   public class CheckS001 {
- *     {@literal @}org.sonar.check.RuleProperty
- *     private String pattern;
- *
- *     public String getPattern() {
- *       return pattern;
- *     }
- * }
- * </pre>
- * How to use:
- * <pre>
- *   public class MyRuleEngine extends BatchExtension {
- *     private final CheckFactory checkFactory;
- *
- *     public MyRuleEngine(CheckFactory checkFactory) {
- *       this.checkFactory = checkFactory;
- *     }
- *
- *     public void execute() {
- *       Checks checks = checkFactory.create("my-rule-repository");
- *       checks.addAnnotatedChecks(CheckS001.class);
- *       // checks.all() contains an instance of CheckS001
- *       // with field "pattern" set to the value specified in
- *       // the Quality profile
- *
- *       // Checks are used to detect issues on source code
- *
- *       // checks.ruleKey(obj) can be used to create the related issues
- *     }
- *   }
- * </pre>
- * <br>
- * It replaces org.sonar.api.checks.AnnotationCheckFactory
- *
- * @since 4.2
- */
-public class Checks<C> {
-  private final ActiveRules activeRules;
-  private final String repository;
-  private final Map<RuleKey, C> checkByRule = new HashMap<>();
-  private final Map<C, RuleKey> ruleByCheck = new IdentityHashMap<>();
-
-  Checks(ActiveRules activeRules, String repository) {
-    this.activeRules = activeRules;
-    this.repository = repository;
-  }
-
-  @CheckForNull
-  public C of(RuleKey ruleKey) {
-    return checkByRule.get(ruleKey);
-  }
-
-  public Collection<C> all() {
-    return checkByRule.values();
-  }
-
-  @CheckForNull
-  public RuleKey ruleKey(C check) {
-    return ruleByCheck.get(check);
-  }
-
-  private void add(RuleKey ruleKey, C obj) {
-    checkByRule.put(ruleKey, obj);
-    ruleByCheck.put(obj, ruleKey);
-  }
-
-  public Checks<C> addAnnotatedChecks(Object... checkClassesOrObjects) {
-    return addAnnotatedChecks(Arrays.asList(checkClassesOrObjects));
-  }
-
-  public Checks<C> addAnnotatedChecks(Iterable checkClassesOrObjects) {
-    Map<String, Object> checksByEngineKey = new HashMap<>();
-    for (Object checkClassesOrObject : checkClassesOrObjects) {
-      String engineKey = annotatedEngineKey(checkClassesOrObject);
-      if (engineKey != null) {
-        checksByEngineKey.put(engineKey, checkClassesOrObject);
-      }
-    }
-
-    for (ActiveRule activeRule : activeRules.findByRepository(repository)) {
-      String engineKey = StringUtils.defaultIfBlank(activeRule.templateRuleKey(), activeRule.ruleKey().rule());
-      Object checkClassesOrObject = checksByEngineKey.get(engineKey);
-      if (checkClassesOrObject != null) {
-        Object obj = instantiate(activeRule, checkClassesOrObject);
-        add(activeRule.ruleKey(), (C) obj);
-      }
-    }
-    return this;
-  }
-
-  private static String annotatedEngineKey(Object annotatedClassOrObject) {
-    String key = null;
-    org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(annotatedClassOrObject, org.sonar.check.Rule.class);
-    if (ruleAnnotation != null) {
-      key = ruleAnnotation.key();
-    }
-    Class clazz = annotatedClassOrObject.getClass();
-    if (annotatedClassOrObject instanceof Class) {
-      clazz = (Class) annotatedClassOrObject;
-    }
-    return StringUtils.defaultIfEmpty(key, clazz.getCanonicalName());
-  }
-
-  private static Object instantiate(ActiveRule activeRule, Object checkClassOrInstance) {
-    try {
-      Object check = checkClassOrInstance;
-      if (check instanceof Class) {
-        check = ((Class) checkClassOrInstance).newInstance();
-      }
-      configureFields(activeRule, check);
-      return check;
-    } catch (InstantiationException | IllegalAccessException e) {
-      throw failToInstantiateCheck(activeRule, checkClassOrInstance, e);
-    }
-  }
-
-  private static RuntimeException failToInstantiateCheck(ActiveRule activeRule, Object checkClassOrInstance, Exception e) {
-    throw new IllegalStateException(String.format("Fail to instantiate class %s for rule %s", checkClassOrInstance, activeRule.ruleKey()), e);
-  }
-
-  private static void configureFields(ActiveRule activeRule, Object check) {
-    for (Map.Entry<String, String> param : activeRule.params().entrySet()) {
-      Field field = getField(check, param.getKey());
-      if (field == null) {
-        throw new IllegalStateException(
-          String.format("The field '%s' does not exist or is not annotated with @RuleProperty in the class %s", param.getKey(), check.getClass().getName()));
-      }
-      if (StringUtils.isNotBlank(param.getValue())) {
-        configureField(check, field, param.getValue());
-      }
-    }
-  }
-
-  @CheckForNull
-  private static Field getField(Object check, String key) {
-    List<Field> fields = FieldUtils2.getFields(check.getClass(), true);
-    for (Field field : fields) {
-      RuleProperty propertyAnnotation = field.getAnnotation(RuleProperty.class);
-      if (propertyAnnotation != null && (StringUtils.equals(key, field.getName()) || StringUtils.equals(key, propertyAnnotation.key()))) {
-        return field;
-      }
-    }
-    return null;
-  }
-
-  private static void configureField(Object check, Field field, String value) {
-    try {
-      field.setAccessible(true);
-
-      if (field.getType().equals(String.class)) {
-        field.set(check, value);
-
-      } else if (int.class == field.getType()) {
-        field.setInt(check, Integer.parseInt(value));
-
-      } else if (short.class == field.getType()) {
-        field.setShort(check, Short.parseShort(value));
-
-      } else if (long.class == field.getType()) {
-        field.setLong(check, Long.parseLong(value));
-
-      } else if (double.class == field.getType()) {
-        field.setDouble(check, Double.parseDouble(value));
-
-      } else if (boolean.class == field.getType()) {
-        field.setBoolean(check, Boolean.parseBoolean(value));
-
-      } else if (byte.class == field.getType()) {
-        field.setByte(check, Byte.parseByte(value));
-
-      } else if (Integer.class == field.getType()) {
-        field.set(check, Integer.parseInt(value));
-
-      } else if (Long.class == field.getType()) {
-        field.set(check, Long.parseLong(value));
-
-      } else if (Double.class == field.getType()) {
-        field.set(check, Double.parseDouble(value));
-
-      } else if (Boolean.class == field.getType()) {
-        field.set(check, Boolean.parseBoolean(value));
-
-      } else {
-        throw new SonarException("The type of the field " + field + " is not supported: " + field.getType());
-      }
-    } catch (IllegalAccessException e) {
-      throw new SonarException("Can not set the value of the field " + field + " in the class: " + check.getClass().getName(), e);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/LoadedActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/LoadedActiveRule.java
deleted file mode 100644 (file)
index 137f231..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.util.Map;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.rule.RuleKey;
-
-public class LoadedActiveRule {
-  private RuleKey ruleKey;
-  private String severity;
-  private String name;
-  private String language;
-  private Map<String, String> params;
-  private long createdAt;
-  private long updatedAt;
-  private String templateRuleKey;
-  private String internalKey;
-  private Set<RuleKey> deprecatedKeys;
-
-  public LoadedActiveRule() {
-    // nothing to do here
-  }
-
-  public RuleKey getRuleKey() {
-    return ruleKey;
-  }
-
-  public void setRuleKey(RuleKey ruleKey) {
-    this.ruleKey = ruleKey;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getSeverity() {
-    return severity;
-  }
-
-  public void setSeverity(String severity) {
-    this.severity = severity;
-  }
-
-  public String getLanguage() {
-    return language;
-  }
-
-  public void setLanguage(String language) {
-    this.language = language;
-  }
-
-  public Map<String, String> getParams() {
-    return params;
-  }
-
-  public void setParams(Map<String, String> params) {
-    this.params = params;
-  }
-
-  public long getCreatedAt() {
-    return createdAt;
-  }
-
-  public void setCreatedAt(long createdAt) {
-    this.createdAt = createdAt;
-  }
-
-  public long getUpdatedAt() {
-    return updatedAt;
-  }
-
-  public void setUpdatedAt(long updatedAt) {
-    this.updatedAt = updatedAt;
-  }
-
-  @CheckForNull
-  public String getTemplateRuleKey() {
-    return templateRuleKey;
-  }
-
-  public void setTemplateRuleKey(@Nullable String templateRuleKey) {
-    this.templateRuleKey = templateRuleKey;
-  }
-
-  public String getInternalKey() {
-    return internalKey;
-  }
-
-  public void setInternalKey(String internalKey) {
-    this.internalKey = internalKey;
-  }
-
-  public Set<RuleKey> getDeprecatedKeys() {
-    return deprecatedKeys;
-  }
-
-  public void setDeprecatedKeys(Set<RuleKey> deprecatedKeys) {
-    this.deprecatedKeys = deprecatedKeys;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java
deleted file mode 100644 (file)
index 20b3f77..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleStatus;
-
-/**
- * @since 4.2
- */
-public interface Rule {
-
-  RuleKey key();
-
-  String name();
-
-  @CheckForNull
-  String description();
-
-  @CheckForNull
-  String internalKey();
-
-  String severity();
-
-  @CheckForNull
-  RuleParam param(String paramKey);
-
-  Collection<RuleParam> params();
-
-  RuleStatus status();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/RuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/RuleParam.java
deleted file mode 100644 (file)
index f568a46..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import javax.annotation.concurrent.Immutable;
-
-/**
- * @since 4.2
- */
-@Immutable
-public interface RuleParam {
-  String key();
-
-  String description();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
deleted file mode 100644 (file)
index 44366b4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.rule.RuleKey;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-
-import java.util.Collection;
-
-/**
- * Searches for rules. This component is available by dependency injection. It must not
- * be extended by plugins.
- *
- * @since 4.2
- * @deprecated since 7.4 we plan to stop loading rules on scanner side
- */
-@Deprecated
-@ScannerSide
-@Immutable
-public interface Rules {
-
-  /**
-   * Get a rule by its key. Returns <code>null</code> if rule does not exist.
-   */
-  @CheckForNull
-  Rule find(RuleKey key);
-
-  Collection<Rule> findAll();
-
-  /**
-   * Get the rules of the given repository. Returns an empty collection if the
-   * repository does not exist.
-   */
-  Collection<Rule> findByRepository(String repository);
-
-  /**
-   * @since 5.2
-   */
-  Collection<Rule> findByInternalKey(String repository, String internalKey);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Severity.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Severity.java
deleted file mode 100644 (file)
index 92cb5c5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-/**
- * @since 5.2
- */
-public enum Severity {
-  INFO,
-  MINOR,
-  MAJOR,
-  CRITICAL,
-  BLOCKER
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/package-info.java
deleted file mode 100644 (file)
index 364095b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.rule;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java
deleted file mode 100644 (file)
index f834e53..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import java.util.List;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.batch.fs.FileSystem;
-import org.sonar.api.batch.fs.InputFile;
-
-/**
- * This class should be implemented by SCM providers.
- * @since 5.0
- */
-@ScannerSide
-public abstract class BlameCommand {
-
-  /**
-   * Compute blame of the provided files. 
-   * Computation can be done in parallel if this is more efficient.
-   * If there is an error that prevent to blame a file then an exception should be raised. If 
-   * one file is new or contains local modifications then an exception should be raised.
-   * @see BlameOutput#blameResult(InputFile, List)
-   */
-  public abstract void blame(BlameInput input, BlameOutput output);
-
-  /**
-   * Callback for the provider to report results of blame per file.
-   */
-  public interface BlameInput {
-
-    /**
-     * Filesystem of the current (sub )project.
-     */
-    FileSystem fileSystem();
-
-    /**
-     * List of files that should be blamed.
-     */
-    Iterable<InputFile> filesToBlame();
-
-  }
-
-  /**
-   * Callback for the provider to report results of blame per file.
-   */
-  public interface BlameOutput {
-
-    /**
-     * Add result of the blame command for a single file. Number of lines should
-     * be consistent with {@link InputFile#lines()}. This method is thread safe.
-     * @param lines One entry per line in the file. <b>Every line must have a <code>non-null</code> date and revision </b>.
-     */
-    void blameResult(InputFile file, List<BlameLine> lines);
-
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameLine.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameLine.java
deleted file mode 100644 (file)
index 4e080c7..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.util.Date;
-
-/**
- * @since 5.0
- */
-public class BlameLine {
-
-  private Date date;
-  private String revision;
-  private String author;
-  
-  public BlameLine() {
-    // for backward compatibility
-  }
-  
-  /**
-   * Preferred constructor. Date and revision must be set.
-   * @since 5.2
-   */
-  public BlameLine(Date date, String revision) {
-    this.date = date;
-    this.revision = revision;
-  }
-
-  public String revision() {
-    return revision;
-  }
-
-  /**
-   * Mandatory field
-   */
-  public BlameLine revision(String revision) {
-    this.revision = revision;
-    return this;
-  }
-
-  @CheckForNull
-  public String author() {
-    return author;
-  }
-
-  /**
-   * Sets author for this line.
-   * The string will be trimmed, and null will be set if it is empty.
-   */
-  public BlameLine author(@Nullable String author) {
-    this.author = StringUtils.trimToNull(author);
-    return this;
-  }
-
-  /**
-   * @return the commit date
-   */
-  public Date date() {
-    return date;
-  }
-
-  /**
-   * Mandatory field
-   */
-  public BlameLine date(@Nullable Date date) {
-    this.date = date;
-    return this;
-  }
-
-  // For testing purpose
-
-  @Override
-  public boolean equals(Object obj) {
-    if (obj == null) {
-      return false;
-    }
-    if (obj == this) {
-      return true;
-    }
-    if (obj.getClass() != getClass()) {
-      return false;
-    }
-    BlameLine rhs = (BlameLine) obj;
-    return new EqualsBuilder()
-      .append(date, rhs.date)
-      .append(revision, rhs.revision)
-      .append(author, rhs.author)
-      .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(27, 45).
-      append(date)
-      .append(revision)
-      .append(author)
-      .toHashCode();
-  }
-
-  @Override
-  public String toString() {
-    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/IgnoreCommand.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/IgnoreCommand.java
deleted file mode 100644 (file)
index 216644e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import java.nio.file.Path;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * @since 7.6
- */
-@ScannerSide
-public interface IgnoreCommand {
-
-  /**
-   * Check if a file is ignored by the scm.
-   * {@link #init(Path)} must be called before the first call to this method and {@link #clean()} after the last one
-   *
-   * @param file Absolute path of a project file
-   * @return true if the given file is ignored by the scm, false otherwise
-   */
-  boolean isIgnored(Path file);
-
-  /**
-   * Must be called before the calling {@link #isIgnored(Path)}
-   *
-   * It should contains any operation (e.g. building cache) required before handling {@link #isIgnored(Path)} calls.
-   *
-   * @param baseDir the root directory of the project
-   */
-  void init(Path baseDir);
-
-  /**
-   * To be called after the last call to {@link #isIgnored(Path)}.
-   *
-   * Cache or any other resources used should be cleared.
-   */
-  void clean();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java
deleted file mode 100644 (file)
index fca363b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.time.Instant;
-import java.util.Map;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * @since 5.0
- */
-@ScannerSide
-@ExtensionPoint
-public abstract class ScmProvider {
-
-  /**
-   * Unique identifier of the provider. Can be passed to {@link CoreProperties#SCM_PROVIDER_KEY}
-   * Can be used in SCM URL to define the provider to use.
-   */
-  public abstract String key();
-
-  /**
-   * Whether this provider is able to manage files located in this directory.
-   * Used by autodetection. Not considered if user has forced the provider key.
-   *
-   * @return false by default
-   */
-  public boolean supports(File baseDir) {
-    return false;
-  }
-
-  public BlameCommand blameCommand() {
-    throw new UnsupportedOperationException(formatUnsupportedMessage("Blame command"));
-  }
-
-  /**
-   * Return absolute path of the files changed in the current branch, compared to the provided target branch.
-   *
-   * @return null if the SCM provider was not able to compute the list of files.
-   * @since 7.0
-   */
-  @CheckForNull
-  public Set<Path> branchChangedFiles(String targetBranchName, Path rootBaseDir) {
-    return null;
-  }
-
-  /**
-   * Return a map between paths given as argument and the corresponding line numbers which are new compared to the provided target branch.
-   * If nothing is returned for a file, the scanner will consider that the provider was unable to determine changes for that file and it will
-   * assume that nothing was changed in it.
-   * If null is returned, an imprecise fallback mechanism will be used to detect which lines are new (based on SCM dates).
-   *
-   * @param files Absolute path of files of interest
-   * @return null if the SCM provider was not able to compute the new lines
-   * @since 7.4
-   */
-  @CheckForNull
-  public Map<Path, Set<Integer>> branchChangedLines(String targetBranchName, Path rootBaseDir, Set<Path> files) {
-    return null;
-  }
-
-  /**
-   * Find the date of the merge base between the current branch and the given reference branch.
-   *
-   * @return null if the SCM provider was not able to compute the date
-   * @since 8.4
-   * @deprecated Not used anymore since 9.3
-   */
-  @CheckForNull
-  @Deprecated
-  public Instant forkDate(String referenceBranchName, Path rootBaseDir) {
-    return null;
-  }
-
-  /**
-   * The relative path from SCM root
-   * @since 7.0
-   */
-  public Path relativePathFromScmRoot(Path path) {
-    throw new UnsupportedOperationException(formatUnsupportedMessage("Getting relative path from SCM root"));
-  }
-
-  /**
-   * @since 7.7
-   */
-  public IgnoreCommand ignoreCommand() {
-    throw new UnsupportedOperationException(formatUnsupportedMessage("Checking for ignored files"));
-  }
-
-  /**
-   * The current revision id of the analyzed code,
-   * for example the SHA1 of the current HEAD in a Git branch.
-   * @since 7.0
-   */
-  @CheckForNull
-  public String revisionId(Path path) {
-    throw new UnsupportedOperationException(formatUnsupportedMessage("Getting revision id"));
-  }
-
-  private String formatUnsupportedMessage(String prefix) {
-    return prefix + " is not supported by " + key() + " provider";
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/package-info.java
deleted file mode 100644 (file)
index e316307..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.batch.scm;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java
deleted file mode 100644 (file)
index 61fd9d3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.ScannerSide;
-import org.sonar.api.scanner.sensor.ProjectSensor;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * <p>
- * A sensor is invoked once for each module of a project, starting from leaf modules. The sensor can parse a flat file, connect to a web server... Sensors are
- * used to add measure and issues at file level.
- * <p>
- * For example the Cobertura Sensor parses Cobertura report and saves the first-level of measures on files.
- * 
- * For testing purpose you can use SensorContextTester, available in sonar-plugin-api-impl
- * @since 5.1
- * @since 7.6 use {@link ProjectSensor} instead to make your Sensor run only once per analysis, and no more once per module
- */
-@ScannerSide
-@InstantiationStrategy(InstantiationStrategy.PER_PROJECT)
-@SonarLintSide
-@ExtensionPoint
-public interface Sensor extends ProjectSensor {
-
-  /**
-   * Populate {@link SensorDescriptor} of this sensor.
-   */
-  void describe(SensorDescriptor descriptor);
-
-  /**
-   * The actual sensor code.
-   */
-  void execute(SensorContext context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
deleted file mode 100644 (file)
index 9f1a282..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-import java.io.Serializable;
-import org.sonar.api.Beta;
-import org.sonar.api.SonarRuntime;
-import org.sonar.api.batch.fs.FileSystem;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.InputModule;
-import org.sonar.api.batch.rule.ActiveRules;
-import org.sonar.api.batch.sensor.cache.ReadCache;
-import org.sonar.api.batch.sensor.cache.WriteCache;
-import org.sonar.api.batch.sensor.code.NewSignificantCode;
-import org.sonar.api.batch.sensor.coverage.NewCoverage;
-import org.sonar.api.batch.sensor.cpd.NewCpdTokens;
-import org.sonar.api.batch.sensor.error.NewAnalysisError;
-import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
-import org.sonar.api.batch.sensor.issue.ExternalIssue;
-import org.sonar.api.batch.sensor.issue.Issue;
-import org.sonar.api.batch.sensor.issue.NewExternalIssue;
-import org.sonar.api.batch.sensor.issue.NewIssue;
-import org.sonar.api.batch.sensor.measure.Measure;
-import org.sonar.api.batch.sensor.measure.NewMeasure;
-import org.sonar.api.batch.sensor.rule.AdHocRule;
-import org.sonar.api.batch.sensor.rule.NewAdHocRule;
-import org.sonar.api.batch.sensor.symbol.NewSymbolTable;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.config.Settings;
-import org.sonar.api.scanner.fs.InputProject;
-import org.sonar.api.scanner.sensor.ProjectSensor;
-import org.sonar.api.utils.Version;
-
-/**
- * See {@link Sensor#execute(SensorContext)}
- * In order to write unit tests you can use SensorContextTester, available in sonar-plugin-api-impl
- * @since 5.1
- */
-public interface SensorContext {
-
-  /**
-   * @deprecated since 6.5 use {@link #config()}
-   */
-  @Deprecated
-  Settings settings();
-
-  /**
-   * Get settings of the project.
-   * @since 6.5
-   */
-  Configuration config();
-
-  /**
-   * In some situations, there is no need to analyze unchanged files, as reported by {@link InputFile#status()} as {@link InputFile.Status#SAME},
-   * and analyzers can skip reporting any data for those files.
-   * Plugins should be prepared for the flag to be always false in the future.
-   * @since 9.4
-   */
-  boolean canSkipUnchangedFiles();
-
-  /**
-   * Get filesystem of the project.
-   */
-  FileSystem fileSystem();
-
-  /**
-   * Get list of active rules.
-   */
-  ActiveRules activeRules();
-
-  /**
-   * @since 5.5
-   * @deprecated since 7.6 modules are deprecated. Use {@link #project()} instead.
-   * @throws UnsupportedOperationException for global {@link ProjectSensor}s
-   */
-  @Deprecated
-  InputModule module();
-
-  /**
-   * The current project.
-   * @since 7.6
-   */
-  InputProject project();
-
-  /**
-   * Version of API at runtime, not at compilation time. It's a shortcut on
-   * {@code runtime().getApiVersion()} since 6.0.
-   * @since 5.5
-   * @see #runtime() since version 6.0.
-   */
-  Version getSonarQubeVersion();
-
-  /**
-   * Runtime information, mainly:
-   * <ul>
-   *   <li>to be able to have different behaviours between SonarQube and SonarLint</li>
-   *   <li>to enable new features depending on version of API available at runtime</li>
-   * </ul>
-   * @since 6.0
-   */
-  SonarRuntime runtime();
-
-  /**
-   * Test if a cancellation of the analysis was requested. Sensors should periodically test this flag
-   * and gracefully stop if value is {@code true}. For example it could be tested between each processed file.
-   * @since 6.0
-   */
-  boolean isCancelled();
-
-  // ----------- MEASURES --------------
-
-  /**
-   * Fluent builder to create a new {@link Measure}. Don't forget to call {@link NewMeasure#save()} once all parameters are provided.
-   */
-  <G extends Serializable> NewMeasure<G> newMeasure();
-
-  // ----------- ISSUES --------------
-
-  /**
-   * Fluent builder to create a new {@link Issue}. Don't forget to call {@link NewIssue#save()} once all parameters are provided.
-   */
-  NewIssue newIssue();
-
-  /**
-   * Fluent builder to create a new {@link ExternalIssue}. Don't forget to call {@link NewExternalIssue#save()} once all parameters are provided.
-   * @since 7.2
-   */
-  NewExternalIssue newExternalIssue();
-
-  /**
-   * Fluent builder to create a new {@link AdHocRule}. Don't forget to call {@link NewAdHocRule#save()} once all parameters are provided.
-   * @since 7.4
-   */
-  NewAdHocRule newAdHocRule();
-
-  // ------------ HIGHLIGHTING ------------
-
-  /**
-   * Builder to define highlighting of a file. Don't forget to call {@link NewHighlighting#save()} once all elements are provided.
-   */
-  NewHighlighting newHighlighting();
-
-  // ------------ SYMBOL TABLE ------------
-
-  /**
-   * Builder to define symbol table of a file. Don't forget to call {@link NewSymbolTable#save()} once all symbols are provided.
-   * @since 5.6
-   */
-  NewSymbolTable newSymbolTable();
-
-  // ------------ COVERAGE ------------
-
-  /**
-   * Builder to define coverage in a file.
-   * Don't forget to call {@link NewCoverage#save()}.
-   */
-  NewCoverage newCoverage();
-
-  // ------------ CPD ------------
-
-  /**
-   * Builder to define CPD tokens in a file.
-   * Don't forget to call {@link NewCpdTokens#save()}.
-   * @since 5.5
-   */
-  NewCpdTokens newCpdTokens();
-
-  // ------------ ANALYSIS ERROR ------------
-
-  /**
-   * Builder to declare errors that happened while processing a source file.
-   * Don't forget to call {@link NewAnalysisError#save()}.
-   * @since 6.0
-   */
-  NewAnalysisError newAnalysisError();
-
-  /**
-   * Builder to declare which parts of the code is significant code. 
-   * Ranges that are not reported as significant code will be ignored and won't be considered when calculating which lines were modified.
-   *
-   * If the significant code is not reported for a file, it is assumed that the entire file is significant code.
-   *
-   * @since 7.2
-   */
-  NewSignificantCode newSignificantCode();
-
-  /**
-   * Add a property to the scanner context. This context is available
-   * in Compute Engine when processing the report.
-   * <br/>
-   * The properties starting with {@code "sonar.analysis."} are included to the
-   * payload of webhooks.
-   *
-   * @throws IllegalArgumentException if key or value parameter is null
-   * @see org.sonar.api.ce.posttask.PostProjectAnalysisTask.ProjectAnalysis#getScannerContext()
-   * @since 6.1
-   */
-  void addContextProperty(String key, String value);
-
-  /**
-   * Indicate that a file should be published in the report sent to SonarQube.
-   * Files are automatically marked if any data is created for it (issues, highlighting, coverage, etc.).
-   * @since 6.3
-   */
-  void markForPublishing(InputFile inputFile);
-
-  /**
-   * Access object to write cache that will be stored and made available in a future analysis.
-   * If cache is disabled, the methods in the returned object will have no effect.
-   * This API is experimental and can be changed or dropped at any time.
-   * @see #isCacheEnabled()
-   * @since 9.4
-   */
-  @Beta
-  WriteCache nextCache();
-
-  /**
-   * Access object to read cached data. The origin of the cached data is not specified and could come from a different branch.
-   * If cache is disabled, the methods in the returned object will have no effect.
-   * This API is experimental and can be changed or dropped at any time.
-   * @see #isCacheEnabled()
-   * @since 9.4
-   */
-  @Beta
-  ReadCache previousCache();
-
-  /**
-   * Returns true if caching is enabled.
-   * This API is experimental and can be changed or dropped at any time.
-   * @see #nextCache()
-   * @see #previousCache()
-   * @since 9.4
-   */
-  @Beta
-  boolean isCacheEnabled();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorDescriptor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorDescriptor.java
deleted file mode 100644 (file)
index 3344a2c..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-import java.util.function.Predicate;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.scanner.sensor.ProjectSensor;
-
-/**
- * Describe what a {@link Sensor} is doing. Information may be used by the platform
- * to log interesting information or perform some optimization.
- * See {@link Sensor#describe(SensorDescriptor)}
- * @since 5.1
- */
-public interface SensorDescriptor {
-
-  /**
-   * Displayable name of the {@link Sensor}. Will be displayed in logs.
-   */
-  SensorDescriptor name(String sensorName);
-
-  /**
-   * Language this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when
-   * no file for given languages are present in the project.
-   * Default is to execute sensor for all languages.
-   */
-  SensorDescriptor onlyOnLanguage(String languageKey);
-
-  /**
-   * List languages this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when
-   * no file for given languages are present in the project.
-   * Default is to execute sensor for all languages.
-   */
-  SensorDescriptor onlyOnLanguages(String... languageKeys);
-
-  /**
-   * {@link InputFile.Type} this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when
-   * no file for given type are present in the project.
-   * Default is to execute sensor whatever are the available file types.
-   */
-  SensorDescriptor onlyOnFileType(InputFile.Type type);
-
-  /**
-   * Rule repository this {@link Sensor} create issues for. Used by the platform to skip execution of the {@link Sensor} when
-   * no rule is activated for the given repository.
-   */
-  SensorDescriptor createIssuesForRuleRepository(String... repositoryKey);
-
-  /**
-   * List rule repositories this {@link Sensor} create issues for. Used by the platform to skip execution of the {@link Sensor} when
-   * no rule is activated for the given repositories.
-   */
-  SensorDescriptor createIssuesForRuleRepositories(String... repositoryKeys);
-
-  /**
-   * This sensor should be executed at the project level, instead of per-module.
-   * @since 6.4
-   * @deprecated since 7.6 change your {@link Sensor} to a {@link ProjectSensor} instead
-   */
-  @Deprecated
-  SensorDescriptor global();
-
-  /**
-   * Predicate that will be evaluated on current project {@link Configuration} by the platform to decide if execution of the {@link Sensor} should be skipped.
-   * @since 6.5
-   */
-  SensorDescriptor onlyWhenConfiguration(Predicate<Configuration> predicate);
-
-  /**
-   * Advertise that this sensor process each file independently. It means executing the sensor twice with FileSystem=[FileA] and FileSystem=[FileB] will produce the same result
-   * than executing the sensor only once with FileSystem=[FileA,FileB].
-   * This will allow the platform to optimize sensor execution.
-   * @since 9.3
-   */
-  SensorDescriptor processesFilesIndependently();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/ReadCache.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/ReadCache.java
deleted file mode 100644 (file)
index e9b4973..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.cache;
-
-import java.io.InputStream;
-import org.sonar.api.Beta;
-
-@Beta
-public interface ReadCache {
-  /**
-   * Returns an input stream for the data cached with the key.
-   * It's the responsibility of the caller to close the stream.
-   * @throws IllegalArgumentException if cache doesn't contain key
-   */
-  InputStream read(String key);
-
-  /**
-   * Checks whether the cache contains a key
-   */
-  boolean contains(String key);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/WriteCache.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/WriteCache.java
deleted file mode 100644 (file)
index 1a6bf3c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.cache;
-
-import java.io.InputStream;
-import org.sonar.api.Beta;
-
-@Beta
-public interface WriteCache {
-  /**
-   * Save a new entry in the cache. The stream will be consumed immediately.
-   * @throws IllegalArgumentException if the cache already contains the key
-   */
-  void write(String key, InputStream data);
-
-  /**
-   * Save a new entry in the cache.
-   * @throws IllegalArgumentException if the cache already contains the key
-   */
-  void write(String key, byte[] data);
-
-  /**
-   * Copy a cached entry from the previous cache to the new one.
-   * @throws IllegalArgumentException if the previous cache doesn't contain given key or if this cache already contains the key
-   */
-  void copyFromPrevious(String key);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/package-info.java
deleted file mode 100644 (file)
index 3efdfe2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.cache;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/NewSignificantCode.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/NewSignificantCode.java
deleted file mode 100644 (file)
index 05d080a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.code;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * This object is used to report ranges of a file which contain significant code.
- * Lines that are left out (no range reported) will be ignored and won't be considered when calculating which lines were modified.
- * It's particularly useful when portions of the lines are automatically modified by code editors and do not contain  
- * code or comments were issues might be created. 
- * 
- * Don't forget to call {@link #save()} after setting the file and the ranges where the significant code is.
- * 
- * @since 7.2
- */
-public interface NewSignificantCode {
-  /**
-   * The file for which significant code is being reported. This field must be set before saving the error.
-   */
-  NewSignificantCode onFile(InputFile file);
-
-  /**
-   * Add a range of significant code. The range may only include a single line and only one range is accepted per line.
-   */
-  NewSignificantCode addRange(TextRange range);
-
-  /**
-   * Save the reported information for the given file.
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/code/package-info.java
deleted file mode 100644 (file)
index e022404..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.code;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java
deleted file mode 100644 (file)
index bbe23c2..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-import org.sonar.api.batch.fs.InputFile;
-
-/**
- * This class is used to report code coverage on files.
- * 
- * Example:
- * 
- * <pre>
- *   sensorContext.newCoverage().onFile(file)
-       .lineHits(1, 2)
-       .lineHits(2, 5)
-       .lineHits(3, 0)
-       . ...
-       .conditions(3, 4, 2)
-       .conditions(12, 2, 2)
-       . ...
-       .save();
- *     
- * </pre>
- * 
- * Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy:
- * <ul>
- *   <li>Line hits are cumulated</li>
- *   <li>We keep the max for condition coverage. Examples: 2/4 + 2/4 = 2/4, 2/4 + 3/4 = 3/4</li>
- * </ul>
- * 
- * @since 5.2
- */
-public interface NewCoverage {
-
-  /**
-   * The covered file.
-   */
-  NewCoverage onFile(InputFile inputFile);
-
-  /**
-   * 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).
-   * @param hits Number of time the line was hit.
-   */
-  NewCoverage lineHits(int line, int hits);
-
-  /**
-   * Call this method as many time as needed to report coverage of conditions.
-   * @param line Line number (starts at 1).
-   * @param conditions Number of conditions on this line (should be greater than 1).
-   * @param coveredConditions Number of covered conditions.
-   */
-  NewCoverage conditions(int line, int conditions, int coveredConditions);
-
-  /**
-   * Call this method to save the coverage report for the given file. Data will be merged with existing coverage information.
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/package-info.java
deleted file mode 100644 (file)
index 59c33b2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.coverage;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/NewCpdTokens.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/NewCpdTokens.java
deleted file mode 100644 (file)
index e8025a2..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.cpd;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * This builder is used to define tokens used by CPD algorithm on files.
- * 
- * Example:
- * 
- * <pre>
- *   sensorContext.newCpdTokens().onFile(inputFile)
- *     .addToken(1, 10, 1, 15, "class")
- *     .addToken(1, 16, 1, 18, "IDENTIFIER")
- *     // Add more tokens
- *     .save;
- *     
- * </pre>
- * @since 5.5
- */
-public interface NewCpdTokens {
-
-  /**
-   * The tokenized file.
-   */
-  NewCpdTokens onFile(InputFile inputFile);
-
-  /**
-   * Call this method to register a token in a range. Tokens should be registered in order.
-   * @param range Token position. Use {@link InputFile#newRange(int, int, int, int)} to get a valid range.
-   * @param image Text content of the token. Can be replaced by a constant placeholder for some tokens (like litterals).
-   */
-  NewCpdTokens addToken(TextRange range, String image);
-
-  /**
-   * Shortcut to avoid calling {@link InputFile#newRange(int, int, int, int)}
-   * @since 5.6
-   */
-  NewCpdTokens addToken(int startLine, int startLineOffset, int endLine, int endLineOffset, String image);
-
-  /**
-   * Call this method only once when your are done with defining tokens of the file. It is not supported to save CPD tokens twice for the same file.
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/TokensLine.java
deleted file mode 100644 (file)
index 8eb93ab..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.cpd.internal;
-
-/**
- * Immutable code fragment, which formed from tokens of one line.
- */
-public class TokensLine {
-
-  private final String value;
-
-  private final int startLine;
-  private final int hashCode;
-
-  private final int startUnit;
-  private final int endUnit;
-
-  public TokensLine(int startUnit, int endUnit, int startLine, String value) {
-    if (startLine <= 0) {
-      throw new IllegalArgumentException("Start line should be strictly positive");
-    }
-    // TODO do we have requirements for length and hashcode ?
-    this.startLine = startLine;
-    this.value = value;
-    this.hashCode = value.hashCode();
-
-    this.startUnit = startUnit;
-    this.endUnit = endUnit;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public int getStartLine() {
-    return startLine;
-  }
-
-  /**
-   * Same as {@link #getStartLine()}
-   */
-  public int getEndLine() {
-    return startLine;
-  }
-
-  public int getHashCode() {
-    return hashCode;
-  }
-
-  public int getStartUnit() {
-    return startUnit;
-  }
-
-  public int getEndUnit() {
-    return endUnit;
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/package-info.java
deleted file mode 100644 (file)
index 0fa0982..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.cpd.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/package-info.java
deleted file mode 100644 (file)
index 513c31c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.cpd;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/AnalysisError.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/AnalysisError.java
deleted file mode 100644 (file)
index 0f9154a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.error;
-
-import javax.annotation.CheckForNull;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextPointer;
-import org.sonar.api.batch.sensor.Sensor;
-
-/**
- * Represents an analysis error, such as a parsing error, reported by a {@link Sensor}.
- *
- * @since 6.0
- */
-public interface AnalysisError {
-  /**
-   * The file that was being processed when the error occurred.
-   */
-  InputFile inputFile();
-  
-  /**
-   * A description of the error.
-   */
-  @CheckForNull
-  String message();
-  
-  /**
-   * Location of the error.
-   */
-  @CheckForNull
-  TextPointer location();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/NewAnalysisError.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/NewAnalysisError.java
deleted file mode 100644 (file)
index 30f0b6d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.error;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextPointer;
-import org.sonar.api.batch.sensor.Sensor;
-
-/**
- * Represents an analysis error, such as a parsing error, that occurs during the execution of a {@link Sensor}.
- * Multiple analysis errors might be reported for the same file and issues may be created for a file which also has analysis errors reported. 
- * The handling of such situations is unspecified and might vary depending on the implementation.
- * 
- * @since 6.0
- */
-public interface NewAnalysisError {
-  /**
-   * The file that was being processed when the error occurred. This field must be set before saving the error.
-   */
-  NewAnalysisError onFile(InputFile inputFile);
-
-  /**
-   * Message about the error. This field is optional.
-   */
-  NewAnalysisError message(String message);
-
-  /**
-   * Location of this error. This field is optional.
-   */
-  NewAnalysisError at(TextPointer location);
-
-  /**
-   * Save this error information.
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/error/package-info.java
deleted file mode 100644 (file)
index b674c3a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.error;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/NewHighlighting.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/NewHighlighting.java
deleted file mode 100644 (file)
index 6ab71ac..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.highlighting;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * This builder is used to define syntax highlighting (aka code coloration) on files.
- * 
- * Example:
- * 
- * <pre>
- *   sensorContext.newHighlighting().onFile(inputFile)
- *     .highlight(1, 10, 1, 15, KEYWORD)
- *     .highlight(1, 16, 1, 18, STRING)
- *     // Add more highlight if needed
- *     .save();
- *     
- * </pre>
- * 
- * @since 5.1
- */
-public interface NewHighlighting {
-
-  /**
-   * The file the highlighting belongs to.
-   */
-  NewHighlighting onFile(InputFile inputFile);
-
-  /**
-   * 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)}.
-   * @param typeOfText see {@link TypeOfText} values.
-   * @since 5.6
-   */
-  NewHighlighting highlight(TextRange range, TypeOfText typeOfText);
-
-  /**
-   * Shortcut to avoid calling {@link InputFile#newRange(int, int, int, int)}
-   * @param typeOfText see {@link TypeOfText} values.
-   * @since 5.6
-   */
-  NewHighlighting highlight(int startLine, int startLineOffset, int endLine, int endLineOffset, TypeOfText typeOfText);
-
-  /**
-   * Call this method only once when your are done with defining highlighting of the file. It is not supported to save highlighting twice for the same file.
-   * @throws IllegalStateException if you have defined overlapping highlighting
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/TypeOfText.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/TypeOfText.java
deleted file mode 100644 (file)
index 7b522d6..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.highlighting;
-
-/**
- * Possible types for highlighting code. See sonar-colorizer.css
- * @since 5.1
- */
-public enum TypeOfText {
-  ANNOTATION("a"),
-  CONSTANT("c"),
-  COMMENT("cd"),
-
-  /**
-   * For example Javadoc
-   */
-  STRUCTURED_COMMENT("j"),
-  KEYWORD("k"),
-  STRING("s"),
-  KEYWORD_LIGHT("h"),
-  PREPROCESS_DIRECTIVE("p");
-
-  private final String cssClass;
-
-  TypeOfText(String cssClass) {
-    this.cssClass = cssClass;
-  }
-
-  public static TypeOfText forCssClass(String cssClass) {
-    for (TypeOfText typeOfText : TypeOfText.values()) {
-      if (typeOfText.cssClass().equals(cssClass)) {
-        return typeOfText;
-      }
-    }
-    throw new IllegalArgumentException("No TypeOfText for CSS class " + cssClass);
-  }
-
-  /**
-   * For internal use
-   */
-  public String cssClass() {
-    return cssClass;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/package-info.java
deleted file mode 100644 (file)
index af927a0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.highlighting;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
deleted file mode 100644 (file)
index 75a81c0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.internal;
-
-import org.sonar.api.batch.sensor.code.NewSignificantCode;
-import org.sonar.api.batch.sensor.coverage.NewCoverage;
-import org.sonar.api.batch.sensor.cpd.NewCpdTokens;
-import org.sonar.api.batch.sensor.error.AnalysisError;
-import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
-import org.sonar.api.batch.sensor.issue.ExternalIssue;
-import org.sonar.api.batch.sensor.issue.Issue;
-import org.sonar.api.batch.sensor.measure.Measure;
-import org.sonar.api.batch.sensor.rule.AdHocRule;
-import org.sonar.api.batch.sensor.symbol.NewSymbolTable;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Interface for storing data computed by sensors.
- *
- * @since 5.1
- */
-@ScannerSide
-public interface SensorStorage {
-
-  void store(Measure measure);
-
-  void store(Issue issue);
-
-  void store(ExternalIssue issue);
-
-  void store(AdHocRule adHocRule);
-
-  void store(NewHighlighting highlighting);
-
-  /**
-   * @since 5.2
-   */
-  void store(NewCoverage defaultCoverage);
-
-  /**
-   * @since 5.5
-   */
-  void store(NewCpdTokens cpdTokens);
-
-  /**
-   * @since 5.6
-   */
-  void store(NewSymbolTable symbolTable);
-
-  /**
-   * @since 6.0
-   */
-  void store(AnalysisError analysisError);
-
-  /**
-   * Value is overridden if the key was already stored.
-   *
-   * @throws IllegalArgumentException if key is null
-   * @throws IllegalArgumentException if value is null
-   * @since 6.1
-   */
-  void storeProperty(String key, String value);
-
-  /**
-   * @since 7.2
-   */
-  void store(NewSignificantCode significantCode);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/package-info.java
deleted file mode 100644 (file)
index 86ea028..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.internal;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/ExternalIssue.java
deleted file mode 100644 (file)
index f5f5ecf..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.rules.RuleType;
-
-/**
- * Represents an issue imported from an external rule engine by a {@link Sensor}.
- * @since 7.2
- */
-public interface ExternalIssue extends IIssue {
-
-  /**
-   * @since 7.4
-   */
-  String engineId();
-
-  /**
-   * @since 7.4
-   */
-  String ruleId();
-
-  Severity severity();
-
-  /**
-   * Effort to fix the issue, in minutes.
-   */
-  @CheckForNull
-  Long remediationEffort();
-
-  /**
-   * Type of the issue.
-   */
-  RuleType type();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IIssue.java
deleted file mode 100644 (file)
index b7995ff..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.List;
-import org.sonar.api.batch.sensor.issue.Issue.Flow;
-import org.sonar.api.rule.RuleKey;
-
-/**
- * @since 7.2
- */
-public interface IIssue {
-  /**
-   * The {@link RuleKey} of this issue.
-   */
-  RuleKey ruleKey();
-  
-  /**
-   * Primary locations for this issue.
-   */
-  IssueLocation primaryLocation();
-
-  /**
-   * List of flows for this issue. Can be empty.
-   */
-  List<Flow> flows();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java
deleted file mode 100644 (file)
index 3e6cec2..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.List;
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-
-/**
- * Represents an issue detected by a {@link Sensor}.
- *
- * @since 5.1
- */
-public interface Issue extends IIssue {
-  interface Flow {
-    /**
-     * @return Ordered list of locations for the execution flow
-     */
-    List<IssueLocation> locations();
-  }
-
-  /**
-   * Gap used to compute the effort for fixing the issue.
-   * @since 5.5
-   */
-  @CheckForNull
-  Double gap();
-
-  /**
-   * Overridden severity.
-   */
-  @CheckForNull
-  Severity overriddenSeverity();
-
-  /**
-   * Primary locations for this issue.
-   * @since 5.2
-   */
-  @Override
-  IssueLocation primaryLocation();
-
-  /**
-   * List of flows for this issue. Can be empty.
-   * @since 5.2
-   */
-  @Override
-  List<Flow> flows();
-
-  /**
-   * Is there a QuickFix available in SonarLint for this issue
-   * @since 9.2
-   */
-  boolean isQuickFixAvailable();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueLocation.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueLocation.java
deleted file mode 100644 (file)
index e282ff2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * Represents an issue location.
- *
- * @since 5.2
- */
-public interface IssueLocation {
-
-  /**
-   * The {@link InputComponent} this location belongs to.
-   */
-  InputComponent inputComponent();
-
-  /**
-   * Range of the issue. Null for global issues and issues on directories. Can also be null
-   * for files (issue global to the file).
-   */
-  @CheckForNull
-  TextRange textRange();
-
-  /**
-   * Message of the issue.
-   */
-  @CheckForNull
-  String message();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewExternalIssue.java
deleted file mode 100644 (file)
index 840f239..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import javax.annotation.Nullable;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rules.RuleType;
-
-/**
- * Builder for an issue imported from an external rule engine by a {@link Sensor}.
- * Don't forget to {@link #save()} after setting the fields.
- * 
- * @since 7.2 
- */
-public interface NewExternalIssue {
-  /**
-   * The {@link RuleKey} of the issue.
-   * @deprecated since 7.4. It is misleading, because of the "external_" prefix that is added on server side. Use {@link #engineId(String)} and {@link #ruleId(String)}
-   */
-  @Deprecated
-  NewExternalIssue forRule(RuleKey ruleKey);
-
-  /**
-   * Unique identifier of the external analyzer (e.g. eslint, pmd, ...)
-   * @since 7.4
-   */
-  NewExternalIssue engineId(String engineId);
-
-  /**
-   * Unique rule identifier for a given {@link #engineId(String)}
-   * @since 7.4
-   */
-  NewExternalIssue ruleId(String ruleId);
-
-  /**
-   * Type of issue.
-   */
-  NewExternalIssue type(RuleType type);
-
-  /**
-   * Effort to fix the issue, in minutes.
-   */
-  NewExternalIssue remediationEffortMinutes(@Nullable Long effortInMinutes);
-
-  /**
-   * Set the severity of the issue.
-   */
-  NewExternalIssue severity(Severity severity);
-
-  /**
-   * Primary location for this issue.
-   */
-  NewExternalIssue at(NewIssueLocation primaryLocation);
-
-  /**
-   * Add a secondary location for this issue. Several secondary locations can be registered.
-   */
-  NewExternalIssue addLocation(NewIssueLocation secondaryLocation);
-
-  /**
-   * Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue.
-   * It should be a <b>path that backtracks the issue from its primary location to the start of the flow</b>. 
-   * Several flows can be registered.
-   */
-  NewExternalIssue addFlow(Iterable<NewIssueLocation> flowLocations);
-
-  /**
-   * Create a new location for this issue. First registered location is considered as primary location.
-   */
-  NewIssueLocation newLocation();
-
-  /**
-   * Save the issue. If rule key is unknown or rule not enabled in the current quality profile then a warning is logged but no exception
-   * is thrown.
-   */
-  void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssue.java
deleted file mode 100644 (file)
index dd9c0b2..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import javax.annotation.Nullable;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.rule.RuleKey;
-
-/**
- * Represents an issue detected by a {@link Sensor}.
- *
- * @since 5.1
- */
-public interface NewIssue {
-
-  /**
-   * The {@link RuleKey} of the issue.
-   */
-  NewIssue forRule(RuleKey ruleKey);
-
-  /**
-   * Gap used for the computation of the effort. 
-   * @since 5.5
-   */
-  NewIssue gap(@Nullable Double gap);
-
-  /**
-   * Override severity of the issue.
-   * Setting a null value or not calling this method means to use severity configured in quality profile.
-   */
-  NewIssue overrideSeverity(@Nullable Severity severity);
-
-  /**
-   * Primary location for this issue.
-   * @since 5.2
-   */
-  NewIssue at(NewIssueLocation primaryLocation);
-
-  /**
-   * Add a secondary location for this issue. Several secondary locations can be registered.
-   * @since 5.2
-   */
-  NewIssue addLocation(NewIssueLocation secondaryLocation);
-
-  /**
-   * Register if a QuickFix would be available on SonarLint for this issue.
-   * @since 9.2
-   */
-  NewIssue setQuickFixAvailable(boolean quickFixAvailable);
-
-  /**
-   * Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue.
-   * It should be a <b>path that backtracks the issue from its primary location to the start of the flow</b>. 
-   * Several flows can be registered.
-   * @since 5.2
-   */
-  NewIssue addFlow(Iterable<NewIssueLocation> flowLocations);
-
-  /**
-   * Create a new location for this issue. First registered location is considered as primary location.
-   * @since 5.2
-   */
-  NewIssueLocation newLocation();
-
-  /**
-   * Save the issue. If rule key is unknown or rule not enabled in the current quality profile then a warning is logged but no exception
-   * is thrown.
-   */
-  void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssueLocation.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/NewIssueLocation.java
deleted file mode 100644 (file)
index 5eb9066..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * Represents one issue location. See {@link NewIssue#newLocation()}.
- *
- * @since 5.2
- */
-public interface NewIssueLocation {
-
-  /**
-   * Maximum number of characters in the message.
-   */
-  int MESSAGE_MAX_SIZE = 4000;
-
-  /**
-   * The {@link InputComponent} the issue location belongs to. Mandatory.
-   */
-  NewIssueLocation on(InputComponent component);
-
-  /**
-   * Position in the file. Only applicable when {@link #on(InputComponent)} has been called with an InputFile. 
-   * See {@link InputFile#newRange(org.sonar.api.batch.fs.TextPointer, org.sonar.api.batch.fs.TextPointer)}
-   */
-  NewIssueLocation at(TextRange location);
-
-  /**
-   * Optional, but recommended, plain-text message for this location.
-   * <br>
-   * Formats like Markdown or HTML are not supported. Size must not be greater than {@link #MESSAGE_MAX_SIZE} characters.
-   */
-  NewIssueLocation message(String message);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/package-info.java
deleted file mode 100644 (file)
index af51182..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.issue;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java
deleted file mode 100644 (file)
index 212f47d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.measure;
-
-import java.io.Serializable;
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.measure.Metric;
-
-/**
- * Measure on File, Directory or Project.
- * Should not be implemented by client.
- * @since 5.1
- */
-public interface Measure<G extends Serializable> {
-
-  /**
-   * The {@link InputComponent} this measure belongs to.
-   */
-  InputComponent inputComponent();
-
-  /**
-   * The metric this measure belong to.
-   */
-  Metric<G> metric();
-
-  /**
-   * Value of the measure.
-   */
-  G value();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/NewMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/NewMeasure.java
deleted file mode 100644 (file)
index 537eb94..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.measure;
-
-import java.io.Serializable;
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.measure.Metric;
-import org.sonar.api.batch.measure.MetricFinder;
-
-/**
- * Builder to create new Measure.
- * Should not be implemented by client.
- * @since 5.2
- */
-public interface NewMeasure<G extends Serializable> {
-
-  /**
-   * The {@link InputComponent} the measure belongs to. Mandatory.
-   */
-  NewMeasure<G> on(InputComponent component);
-
-  /**
-   * Set the metric this measure belong to. To find a metric based on its key you can use {@link MetricFinder}.
-   */
-  NewMeasure<G> forMetric(Metric<G> metric);
-
-  /**
-   * Value of the measure.
-   */
-  NewMeasure<G> withValue(G value);
-
-  /**
-   * Save the measure. It is not permitted so save several measures of the same metric on the same file/project.
-   */
-  void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/package-info.java
deleted file mode 100644 (file)
index f0de90b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.measure;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/package-info.java
deleted file mode 100644 (file)
index 9d7d5f0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/AdHocRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/AdHocRule.java
deleted file mode 100644 (file)
index 5fca377..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.rules.RuleType;
-
-/**
- * Represents a rule imported from an external rule engine by a {@link Sensor}.
- * @since 7.4
- */
-public interface AdHocRule {
-
-  /**
-   * Unique identifier of the external analyzer (e.g. eslint, pmd, ...)
-   */
-  String engineId();
-
-  /**
-   * Unique rule identifier for a given {@link #engineId()}
-   */
-  String ruleId();
-
-  /**
-   * Name of the rule.
-   */
-  String name();
-
-  /**
-   * Description of the rule.
-   */
-  @CheckForNull
-  String description();
-
-  /**
-   * Default severity of the rule.
-   */
-  Severity severity();
-
-  /**
-   * Type of the rule.
-   */
-  RuleType type();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/NewAdHocRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/NewAdHocRule.java
deleted file mode 100644 (file)
index 59f6061..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import javax.annotation.Nullable;
-import org.sonar.api.batch.rule.Severity;
-import org.sonar.api.batch.sensor.Sensor;
-import org.sonar.api.rules.RuleType;
-
-/**
- * Builder for a rule imported from an external rule engine by a {@link Sensor}. This allows to provide more metadata
- * for rules associated to {@link org.sonar.api.batch.sensor.issue.ExternalIssue}.
- * Don't forget to {@link #save()} after setting the fields.
- * 
- * @since 7.4
- */
-public interface NewAdHocRule {
-
-  /**
-   * Unique identifier of the external analyzer (e.g. eslint, pmd, ...)
-   */
-  NewAdHocRule engineId(String engineId);
-
-  /**
-   * Unique rule identifier for a given {@link #engineId(String)}
-   */
-  NewAdHocRule ruleId(String ruleId);
-
-  /**
-   * The name of the rule.
-   */
-  NewAdHocRule name(String name);
-
-  /**
-   * The description of the rule.
-   */
-  NewAdHocRule description(@Nullable String description);
-
-  /**
-   * Type of the rule.
-   */
-  NewAdHocRule type(RuleType type);
-
-  /**
-   * Set the severity of the rule.
-   */
-  NewAdHocRule severity(Severity severity);
-
-  /**
-   * Save the rule. There is almost no validation, except that no duplicated ad hoc rule keys are permitted.
-   */
-  void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/package-info.java
deleted file mode 100644 (file)
index e7b4e49..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.rule;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbol.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbol.java
deleted file mode 100644 (file)
index 0a07165..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.symbol;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * This builder is used to define symbol references on files.
- * @since 5.6
- */
-public interface NewSymbol {
-  /**
-   * Register a new symbol.
-   * @param range Range of text for the symbol declaration. See for example {@link InputFile#newRange(int, int, int, int)}.
-   */
-  NewSymbol newReference(TextRange range);
-
-  /**
-   * Shortcut to avoid calling {@link InputFile#newRange(int, int, int, int)}
-   */
-  NewSymbol newReference(int startLine, int startLineOffset, int endLine, int endLineOffset);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbolTable.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/NewSymbolTable.java
deleted file mode 100644 (file)
index c228620..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.symbol;
-
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.TextRange;
-
-/**
- * This builder is used to define symbol references on files.
- * 
- * Example:
- * 
- * <pre>
- *   NewSymbolTable symbolTable = sensorContext.newSymbolTable().onFile(inputFile);
- *   symbolTable.newSymbol(1, 10, 1, 15)
- *     .newReference(10, 12, 10, 17)
- *     .newReference(11, 11, 11, 16);
- *     
- *   // Add more symbols if needed
- *     
- *   symbolTable.save();
- *     
- * </pre>
- * 
- * @since 5.6
- */
-public interface NewSymbolTable {
-
-  /**
-   * The file the symbol table belongs to.
-   */
-  NewSymbolTable onFile(InputFile inputFile);
-
-  /**
-   * Register a new symbol declaration.
-   * @param range Range of text for the symbol declaration. See for example {@link InputFile#newRange(int, int, int, int)}.
-   */
-  NewSymbol newSymbol(TextRange range);
-
-  /**
-   * Shortcut to avoid calling {@link InputFile#newRange(int, int, int, int)}
-   */
-  NewSymbol newSymbol(int startLine, int startLineOffset, int endLine, int endLineOffset);
-
-  /**
-   * Call this method only once when your are done with defining all symbols of the file. It is not permitted to save a symbol table twice for the same file.
-   * @throws IllegalStateException if you have defined overlapping symbols
-   */
-  void save();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/package-info.java
deleted file mode 100644 (file)
index 516ee9b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.batch.sensor.symbol;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/ComputeEngineSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/ComputeEngineSide.java
deleted file mode 100644 (file)
index 80a1243..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Same as {@link ScannerSide} but for components for the Compute Engine Server.
- *
- * @since 5.5
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ComputeEngineSide {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Component.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Component.java
deleted file mode 100644 (file)
index caa7ce4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import javax.annotation.CheckForNull;
-
-/**
- * Component that can be used in a {@link MeasureComputer}
- *
- * @since 5.2
- */
-public interface Component {
-
-  enum Type {
-    PROJECT, MODULE, DIRECTORY, FILE, VIEW, SUBVIEW
-  }
-
-  Type getType();
-
-  String getKey();
-
-  /**
-   * The attributes of the Component if it's type is File.
-   *
-   * @throws IllegalStateException if the Component's type is not {@link Type#FILE}
-   */
-  FileAttributes getFileAttributes();
-
-  interface FileAttributes {
-
-    boolean isUnitTest();
-
-    @CheckForNull
-    String getLanguageKey();
-
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Issue.java
deleted file mode 100644 (file)
index 827574f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import javax.annotation.CheckForNull;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.utils.Duration;
-
-/**
- * Issue that can be used in a {@link MeasureComputer}
- *
- * @since 5.2
- */
-public interface Issue {
-
-  String key();
-
-  RuleKey ruleKey();
-
-  /**
-   * Available list of status can be found in {@link org.sonar.api.issue.Issue#STATUSES}
-   */
-  String status();
-
-  /**
-   * Available list of resolutions can be found in {@link org.sonar.api.issue.Issue#RESOLUTIONS}
-   */
-  @CheckForNull
-  String resolution();
-
-  /**
-   * See constants in {@link org.sonar.api.rule.Severity}.
-   */
-  String severity();
-
-  /**
-   * @since 5.5
-   */
-  @CheckForNull
-  Duration effort();
-
-  RuleType type();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Measure.java
deleted file mode 100644 (file)
index 862c645..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-/**
- * Measure used in {@link MeasureComputer}
- *
- * @since 5.2
- */
-public interface Measure {
-
-  /**
-   * The value of this measure as a integer.
-   *
-   * @throws IllegalStateException if the value type of the metric is not an Integer as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}
-   *         To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}).
-   */
-  int getIntValue();
-
-  /**
-   * The value of this measure as a long.
-   *
-   * @throws IllegalStateException if the value type of the metric is not a Long as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}
-   *         To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}).
-   */
-  long getLongValue();
-
-  /**
-   * The value of this measure as a double.
-   *
-   * @throws IllegalStateException if the value type of the metric is not a Double as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}.
-   *         To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}).
-   */
-  double getDoubleValue();
-
-  /**
-   * The value of this measure as a string.
-   *
-   * @throws IllegalStateException if the value type of the metric is not a String as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}
-   *         To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}).
-   */
-  String getStringValue();
-
-  /**
-   * The value of this measure as a boolean.
-   *
-   * @throws IllegalStateException if the value type of the metric is not a Boolean as defined by {@link org.sonar.api.measures.Metric.ValueType#valueClass}
-   *         To find out the value type of a metric, check it's definition (eg., core metrics are defined in {@link org.sonar.api.measures.CoreMetrics}).
-   */
-  boolean getBooleanValue();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java
deleted file mode 100644 (file)
index f002b85..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import java.util.List;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition.Builder;
-
-/**
- * Define how to compute new measures on some metrics declared by {@link org.sonar.api.measures.Metrics}.
- * <p>
- * This interface replaces the deprecated class org.sonar.api.batch.Decorator.
- * <p>
- * <h3>How to use</h3>
- * <pre>
- * public class MyMeasureComputer implements MeasureComputer {
- *
- *   {@literal @}Override
- *   public MeasureComputerDefinition define(MeasureComputerDefinitionContext defContext) {
- *     return defContext.newDefinitionBuilder()
- *
- *     // Input metrics can be empty, for instance if only issues will be read
- *     .setInputMetrics("ncloc")
- *
- *     // Output metrics must contains at least one metric
- *     .setOutputMetrics("my_new_metric")
- *
- *     .build();
- *   }
- *
- *   {@literal @}Override
- *   public void compute(MeasureComputerContext context) {
- *     int ncloc = context.getMeasure("ncloc");
- *     List&lt;Issue&gt; issues = context.getIssues();
- *     if (ncloc != null &amp;&amp; !issues.isEmpty()) {
- *       double value = issues.size() / ncloc;
- *       context.addMeasure("my_new_metric", value);
- *     }
- *   }
- * }
- * </pre>
- * <p>
- * <h3>How to test</h3>
- * <pre>
- * public class MyMeasureComputerTest {
- *
- *   MyMeasureComputer underTest = new MyMeasureComputer();
- *
- *   {@literal @}Test
- *   public void test_definition() {
- *     TestMeasureComputerDefinitionContext defContext = new TestMeasureComputerDefinitionContext();
- *     MeasureComputerDefinition def = underTest.define(defContext);
- *     assertThat(def).isNotNull();
- *     assertThat(def.getInputMetrics()).containsOnly("ncloc");
- *     assertThat(def.getOutputMetrics()).containsOnly("my_new_metric");
- *   }
- *
- *   {@literal @}Test
- *   public void sum_ncloc_and_issues() {
- *     TestMeasureComputerContext context = new TestMeasureComputerContext(underTest);
- *     context.addMeasure("ncloc", 2);
- *     context.setIssues(Arrays.asList(new TestIssue.Builder().setKey("ABCD").build()));
- *     underTest.compute(context);
- *
- *     assertThat(context.getMeasureValue("my_new_metric")).isEqualTo(0.5);
- *   }
- * </pre>
- *
- * @since 5.2
- */
-@ComputeEngineSide
-@ExtensionPoint
-public interface MeasureComputer {
-
-  /**
-   * Use to define which metrics are required to compute some measures on some given metrics
-   */
-  MeasureComputerDefinition define(MeasureComputerDefinitionContext defContext);
-
-  /**
-   * Context specific to the definition of the measure computer
-   */
-  @FunctionalInterface
-  interface MeasureComputerDefinitionContext {
-    Builder newDefinitionBuilder();
-  }
-
-  interface MeasureComputerDefinition {
-    /**
-     * Return the metric keys that can be read using {@link MeasureComputerContext}.
-     * Can be empty for instance when the computer only need to access to issues.
-     */
-    Set<String> getInputMetrics();
-
-    /**
-     * Return the metric keys that can be create using {@link MeasureComputerContext}.
-     * Can never ne empty.
-     */
-    Set<String> getOutputMetrics();
-
-    interface Builder {
-
-      /**
-       * List of metric keys of the measures that will be loaded by this computer. It can be empty (for instance when only issues are needed).
-       * A metric must be either a {@link org.sonar.api.measures.CoreMetrics} or a metric provided by {@link org.sonar.api.measures.Metrics}
-       *
-       * @throws NullPointerException if inputMetrics is null
-       * @throws NullPointerException if the metrics contains a {@code null}
-       * */
-      Builder setInputMetrics(String... inputMetrics);
-
-      /**
-       * List of metric keys of the measures that can be added by this computer. At least one metric key must be defined.
-       *
-       * At runtime, the following conditions will be validated :
-       * <ul>
-       *   <li>A metric must be defined by {@link org.sonar.api.measures.Metrics}</li>
-       *   <li>A metric cannot be a {@link org.sonar.api.measures.CoreMetrics}</li>
-       *   <li>A metric must be generated by only one {@link MeasureComputer}</li>
-       * </ul>
-       *
-       * @throws NullPointerException if outputMetrics is null
-       * @throws IllegalArgumentException if there's not at least one output metrics
-       * @throws NullPointerException if the metrics contains a {@code null}
-       */
-      Builder setOutputMetrics(String... outputMetrics);
-
-      /**
-       * @throws NullPointerException if inputMetrics is null
-       * @throws NullPointerException if inputs metrics contains a {@code null}
-       * @throws NullPointerException if outputMetrics is null
-       * @throws IllegalArgumentException if there's not at least one output metrics
-       * @throws NullPointerException if outputs metrics contains a {@code null}
-       */
-      MeasureComputerDefinition build();
-    }
-  }
-
-  /**
-   * This method will be called on each component of the projects.
-   */
-  void compute(MeasureComputerContext context);
-
-  /**
-   * Context specific to the computation of the measure(s) of a given component
-   */
-  interface MeasureComputerContext {
-    /**
-     * Returns the current component.
-     */
-    Component getComponent();
-
-    /**
-     * Returns settings of the current component.
-     */
-    Settings getSettings();
-
-    /**
-     * Returns the measure from a given metric on the current component.
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getInputMetrics()}
-     */
-    @CheckForNull
-    Measure getMeasure(String metric);
-
-    /**
-     * Returns measures from a given metric on children of the current component.
-     * It no measure is found for a child, this measure is ignored
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getInputMetrics()} 
-     * or in {@link MeasureComputerDefinition#getOutputMetrics()}
-     */
-    Iterable<Measure> getChildrenMeasures(String metric);
-
-    /**
-     * Add a new measure of a given metric which measure type will be int
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getOutputMetrics()}
-     * @throws UnsupportedOperationException if a measure for the specified metric already exists for the current component
-     */
-    void addMeasure(String metric, int value);
-
-    /**
-     * Add a new measure of a given metric which measure type will be double
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getOutputMetrics()}
-     * @throws UnsupportedOperationException if a measure for the specified metric already exists for the current component
-     */
-    void addMeasure(String metric, double value);
-
-    /**
-     * Add a new measure of a given metric which measure type will be long
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getOutputMetrics()}
-     * @throws UnsupportedOperationException if a measure for the specified metric already exists for the current component
-     */
-    void addMeasure(String metric, long value);
-
-    /**
-     * Add a new measure of a given metric which measure type will be string
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getOutputMetrics()}
-     * @throws UnsupportedOperationException if a measure for the specified metric already exists for the current component
-     */
-    void addMeasure(String metric, String value);
-
-    /**
-     * Add a new measure of a given metric which measure type will be boolean
-     *
-     * @throws IllegalArgumentException if the metric is not listed in {@link MeasureComputerDefinition#getOutputMetrics()}
-     * @throws UnsupportedOperationException if a measure for the specified metric already exists for the current component
-     */
-    void addMeasure(String metric, boolean value);
-
-    /**
-     * Return list of all issues (open, closed, etc.) of current component.
-     */
-    List<? extends Issue> getIssues();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java
deleted file mode 100644 (file)
index 0793875..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import javax.annotation.CheckForNull;
-import org.sonar.api.utils.KeyValueFormat;
-
-/**
- * Utility to build a distribution based on defined ranges
- * <p>
- * <p>An example of usage : you wish to record the percentage of lines of code that belong to method
- * with pre-defined ranges of complexity.
- *
- * @since 5.2
- */
-public class RangeDistributionBuilder {
-
-  private Map<Number, Integer> distributionSet;
-  private boolean isEmpty = true;
-  private Number[] bottomLimits;
-  private boolean isValid = true;
-
-  public RangeDistributionBuilder() {
-    // Nothing to be done here, bottom limits will be automatically calculated when adding the first value
-  }
-
-  /**
-   * RangeDistributionBuilder for a defined range
-   * Each entry is initialized at zero
-   *
-   * @param bottomLimits the bottom limits of ranges to be used
-   */
-  public RangeDistributionBuilder(Number[] bottomLimits) {
-    init(bottomLimits);
-  }
-
-  /**
-   * Increments an entry by 1
-   *
-   * @param value the value to use to pick the entry to increment
-   */
-  public RangeDistributionBuilder add(Number value) {
-    return add(value, 1);
-  }
-
-  /**
-   * Increments an entry
-   *
-   * @param value the value to use to pick the entry to increment
-   * @param count the number by which to increment
-   */
-  public RangeDistributionBuilder add(Number value, int count) {
-    if (greaterOrEqualsThan(value, bottomLimits[0])) {
-      addValue(value, count);
-      isEmpty = false;
-    }
-    return this;
-  }
-
-  /**
-   * Adds an existing Distribution to the current one.
-   * It will create the entries if they don't exist.
-   * Can be used to add the values of children resources for example
-   * <br>
-   * The returned distribution will be invalidated in case the given value does not use the same bottom limits
-   *
-   * @param data the data to add to the current one
-   */
-  public RangeDistributionBuilder add(String data) {
-    Map<Double, Double> map = KeyValueFormat.parse(data, KeyValueFormat.newDoubleConverter(), KeyValueFormat.newDoubleConverter());
-    if (bottomLimits == null) {
-      Number[] limits = map.keySet().toArray(new Number[map.size()]);
-      init(limits);
-
-    } else if (!areSameLimits(bottomLimits, map.keySet())) {
-      isValid = false;
-    }
-
-    if (isValid) {
-      for (Map.Entry<Double, Double> entry : map.entrySet()) {
-        addLimitCount(entry.getKey(), entry.getValue().intValue());
-      }
-    }
-    return this;
-  }
-
-  private void init(Number[] bottomLimits) {
-    this.bottomLimits = new Number[bottomLimits.length];
-    System.arraycopy(bottomLimits, 0, this.bottomLimits, 0, this.bottomLimits.length);
-    Arrays.sort(this.bottomLimits);
-    changeDoublesToInts();
-    distributionSet = new TreeMap<>(NumberComparator.INSTANCE);
-    for (Number n : this.bottomLimits) {
-      distributionSet.put(n, 0);
-    }
-  }
-
-  private void changeDoublesToInts() {
-    for (Number bottomLimit : bottomLimits) {
-      if (NumberComparator.INSTANCE.compare(bottomLimit.intValue(), bottomLimit.doubleValue()) != 0) {
-        // it's not only ints
-        return;
-      }
-    }
-    for (int i = 0; i < bottomLimits.length; i++) {
-      bottomLimits[i] = bottomLimits[i].intValue();
-    }
-  }
-
-  private static boolean areSameLimits(Number[] bottomLimits, Set<Double> limits) {
-    if (limits.size() == bottomLimits.length) {
-      for (Number l : bottomLimits) {
-        if (!limits.contains(l.doubleValue())) {
-          return false;
-        }
-      }
-      return true;
-    }
-    return false;
-  }
-
-  private RangeDistributionBuilder addLimitCount(Number limit, int count) {
-    for (Number bottomLimit : bottomLimits) {
-      if (NumberComparator.INSTANCE.compare(bottomLimit.doubleValue(), limit.doubleValue()) == 0) {
-        addValue(limit, count);
-        isEmpty = false;
-        return this;
-      }
-    }
-    isValid = false;
-    return this;
-  }
-
-  private void addValue(Number value, int count) {
-    for (int i = bottomLimits.length - 1; i >= 0; i--) {
-      if (greaterOrEqualsThan(value, bottomLimits[i])) {
-        this.distributionSet.compute(bottomLimits[i], (k, v) -> v + count);
-        return;
-      }
-    }
-  }
-
-  /**
-   * @return whether the current object is empty or not
-   */
-  public boolean isEmpty() {
-    return isEmpty;
-  }
-
-  /**
-   * Used to build a measure from the current object
-   *
-   * @return the built measure
-   */
-  @CheckForNull
-  public String build() {
-    if (isValid) {
-      return KeyValueFormat.format(toMap());
-    }
-    return null;
-  }
-
-  private Map<Number, Integer> toMap() {
-    if (bottomLimits == null || bottomLimits.length == 0) {
-      return Collections.emptyMap();
-    }
-    return distributionSet;
-  }
-
-  private static boolean greaterOrEqualsThan(Number n1, Number n2) {
-    return NumberComparator.INSTANCE.compare(n1, n2) >= 0;
-  }
-
-  private enum NumberComparator implements Comparator<Number> {
-    INSTANCE;
-
-    @Override
-    public int compare(Number n1, Number n2) {
-      return Double.compare(n1.doubleValue(), n2.doubleValue());
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/Settings.java
deleted file mode 100644 (file)
index 35e85ce..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import javax.annotation.CheckForNull;
-
-/**
- * Settings of the current component used in {@link MeasureComputer}
- *
- * @since 5.2
- */
-public interface Settings {
-
-  /**
-   * Returns the property as a string
-   * Matching on key is case sensitive
-   */
-  @CheckForNull
-  String getString(String key);
-
-  /**
-   * Returns the property as a an array
-   * Returns an empty array if no property is found for this key
-   * Matching on key is case sensitive
-   */
-  String[] getStringArray(String key);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/package-info.java
deleted file mode 100644 (file)
index cad38e4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestComponent.java
deleted file mode 100644 (file)
index 2c7942d..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.ce.measure.Component;
-
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-@Immutable
-public class TestComponent implements Component {
-
-  private final String key;
-
-  private final Type type;
-
-  @CheckForNull
-  private final FileAttributes fileAttributes;
-
-  public TestComponent(String key, Type type, @Nullable FileAttributes fileAttributes) {
-    this.key = requireNonNull(key, "Key cannot be null");
-    this.type = requireNonNull(type, "Type cannot be null");
-    this.fileAttributes = checkFileAttributes(fileAttributes);
-  }
-
-  @CheckForNull
-  private FileAttributes checkFileAttributes(@Nullable FileAttributes fileAttributes) {
-    if (fileAttributes == null && type == Type.FILE) {
-      throw new IllegalArgumentException("Component of type FILE must have a FileAttributes object");
-    } else if (fileAttributes != null && type != Type.FILE) {
-      throw new IllegalArgumentException("Only component of type FILE have a FileAttributes object");
-    }
-    return fileAttributes;
-  }
-
-  @Override
-  public Type getType() {
-    return type;
-  }
-
-  @Override
-  public String getKey() {
-    return key;
-  }
-
-  @Override
-  public FileAttributes getFileAttributes() {
-    checkState(this.type == Component.Type.FILE, "Only component of type FILE have a FileAttributes object");
-    return fileAttributes;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    TestComponent component = (TestComponent) o;
-
-    return key.equals(component.key);
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return "ComponentImpl{" +
-      "key=" + key +
-      ", type='" + type + '\'' +
-      ", fileAttributes=" + fileAttributes +
-      '}';
-  }
-
-  @Immutable
-  public static class FileAttributesImpl implements FileAttributes {
-
-    private final boolean unitTest;
-    private final String languageKey;
-
-    public FileAttributesImpl(@Nullable String languageKey, boolean unitTest) {
-      this.languageKey = languageKey;
-      this.unitTest = unitTest;
-    }
-
-    @Override
-    public boolean isUnitTest() {
-      return unitTest;
-    }
-
-    @Override
-    @CheckForNull
-    public String getLanguageKey() {
-      return languageKey;
-    }
-
-    @Override
-    public String toString() {
-      return "FileAttributesImpl{" +
-        "languageKey='" + languageKey + '\'' +
-        ", unitTest=" + unitTest +
-        '}';
-    }
-  }
-}
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestIssue.java
deleted file mode 100644 (file)
index ad1e33c..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.ce.measure.Issue;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.utils.Duration;
-
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-@Immutable
-public class TestIssue implements Issue {
-
-  private String key;
-  private String status;
-  private String resolution;
-  private String severity;
-  private RuleKey ruleKey;
-  private Duration effort;
-  private RuleType type;
-
-  private TestIssue(Builder builder) {
-    this.key = builder.key;
-    this.status = builder.status;
-    this.resolution = builder.resolution;
-    this.severity = builder.severity;
-    this.ruleKey = builder.ruleKey;
-    this.effort = builder.effort;
-    this.type = builder.type;
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  @Override
-  public RuleKey ruleKey() {
-    return ruleKey;
-  }
-
-  @Override
-  public String status() {
-    return status;
-  }
-
-  @Override
-  @CheckForNull
-  public String resolution() {
-    return resolution;
-  }
-
-  @Override
-  public String severity() {
-    return severity;
-  }
-
-  /**
-   * @since 5.5
-   */
-  @Override
-  public Duration effort() {
-    return effort;
-  }
-
-  /**
-   * @since 5.5
-   */
-  @Override
-  public RuleType type() {
-    return type;
-  }
-
-  public static class Builder {
-    private String key;
-    private String status;
-    private String resolution;
-    private String severity;
-    private RuleKey ruleKey;
-    private Duration effort;
-    private RuleType type;
-
-    public Builder setKey(String key) {
-      this.key = validateKey(key);
-      return this;
-    }
-
-    public Builder setResolution(@Nullable String resolution) {
-      this.resolution = validateResolution(resolution);
-      return this;
-    }
-
-    public Builder setSeverity(String severity) {
-      this.severity = validateSeverity(severity);
-      return this;
-    }
-
-    public Builder setStatus(String status) {
-      this.status = validateStatus(status);
-      return this;
-    }
-
-    public Builder setRuleKey(RuleKey ruleKey) {
-      this.ruleKey = validateRuleKey(ruleKey);
-      return this;
-    }
-
-    /**
-     * @since 5.5
-     */
-    public Builder setEffort(@Nullable Duration effort) {
-      this.effort = effort;
-      return this;
-    }
-
-    /**
-     * @since 5.5
-     */
-    public Builder setType(RuleType type) {
-      this.type = validateType(type);
-      return this;
-    }
-
-    private static String validateKey(String key) {
-      requireNonNull(key, "key cannot be null");
-      return key;
-    }
-
-    private static RuleKey validateRuleKey(RuleKey ruleKey) {
-      requireNonNull(ruleKey, "ruleKey cannot be null");
-      return ruleKey;
-    }
-
-    private static String validateResolution(@Nullable String resolution) {
-      checkArgument(resolution == null || org.sonar.api.issue.Issue.RESOLUTIONS.contains(resolution), String.format("resolution '%s' is invalid", resolution));
-      return resolution;
-    }
-
-    private static String validateSeverity(String severity) {
-      requireNonNull(severity, "severity cannot be null");
-      checkArgument(Severity.ALL.contains(severity), String.format("severity '%s' is invalid", severity));
-      return severity;
-    }
-
-    private static String validateStatus(String status) {
-      requireNonNull(status, "status cannot be null");
-      checkArgument(org.sonar.api.issue.Issue.STATUSES.contains(status), String.format("status '%s' is invalid", status));
-      return status;
-    }
-
-    private static RuleType validateType(RuleType type) {
-      requireNonNull(type, "type cannot be null");
-      return type;
-    }
-
-    public Issue build() {
-      validateKey(key);
-      validateResolution(resolution);
-      validateSeverity(severity);
-      validateStatus(status);
-      validateRuleKey(ruleKey);
-      validateType(type);
-      return new TestIssue(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java
deleted file mode 100644 (file)
index 5fd21be..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.ce.measure.Measure;
-
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-@Immutable
-public class TestMeasure implements Measure {
-
-  private Integer intValue;
-  private Long longValue;
-  private Double doubleValue;
-  private String stringValue;
-  private Boolean booleanValue;
-
-  public static TestMeasure createMeasure(double doubleValue){
-    TestMeasure measure = new TestMeasure();
-    measure.doubleValue = doubleValue;
-    return measure;
-  }
-
-  public static TestMeasure createMeasure(int intValue) {
-    TestMeasure measure = new TestMeasure();
-    measure.intValue = intValue;
-    return measure;
-  }
-
-  public static TestMeasure createMeasure(long longValue) {
-    TestMeasure measure = new TestMeasure();
-    measure.longValue = longValue;
-    return measure;
-  }
-
-  public static TestMeasure createMeasure(String stringValue) {
-    TestMeasure measure = new TestMeasure();
-    measure.stringValue = requireNonNull(stringValue, "Value cannot be null");
-    return measure;
-  }
-
-  public static TestMeasure createMeasure(boolean booleanValue) {
-    TestMeasure measure = new TestMeasure();
-    measure.booleanValue = booleanValue;
-    return measure;
-  }
-
-  @Override
-  public int getIntValue() {
-    checkState(intValue != null, "Not an integer measure");
-    return intValue;
-  }
-
-  @Override
-  public long getLongValue() {
-    checkState(longValue != null, "Not a long measure");
-    return longValue;
-  }
-
-  @Override
-  public double getDoubleValue() {
-    checkState(doubleValue != null, "Not a double measure");
-    return doubleValue;
-  }
-
-  @Override
-  public String getStringValue() {
-    checkState(stringValue != null, "Not a string measure");
-    return stringValue;
-  }
-
-  @Override
-  public boolean getBooleanValue() {
-    checkState(booleanValue != null, "Not a boolean measure");
-    return booleanValue;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerContext.java
deleted file mode 100644 (file)
index f0969e5..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import org.sonar.api.ce.measure.Component;
-import org.sonar.api.ce.measure.Issue;
-import org.sonar.api.ce.measure.Measure;
-import org.sonar.api.ce.measure.Settings;
-
-import static org.sonar.api.ce.measure.MeasureComputer.MeasureComputerContext;
-import static org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-public class TestMeasureComputerContext implements MeasureComputerContext {
-
-  private final Component component;
-  private final MeasureComputerDefinition definition;
-  private final Settings settings;
-
-  private Map<String, Measure> componentMeasureByMetricKey = new HashMap<>();
-  private Map<String, List<Measure>> childrenComponentMeasureByMetricKey = new HashMap<>();
-  private List<Issue> issues = new ArrayList<>();
-
-  public TestMeasureComputerContext(Component component, Settings settings, MeasureComputerDefinition definition) {
-    this.settings = settings;
-    this.component = component;
-    this.definition = definition;
-  }
-
-  @Override
-  public Component getComponent() {
-    return component;
-  }
-
-  @Override
-  public Settings getSettings() {
-    return settings;
-  }
-
-  @Override
-  @CheckForNull
-  public Measure getMeasure(String metric) {
-    validateInputMetric(metric);
-    return componentMeasureByMetricKey.get(metric);
-  }
-
-  @Override
-  public Iterable<Measure> getChildrenMeasures(String metric) {
-    validateInputMetric(metric);
-    return childrenComponentMeasureByMetricKey.getOrDefault(metric, Collections.emptyList());
-  }
-
-  @Override
-  public void addMeasure(String metricKey, int value) {
-    validateAddMeasure(metricKey);
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addInputMeasure(String metricKey, int value) {
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addChildrenMeasures(String metricKey, Integer... values) {
-    for (Integer value : values) {
-      childrenComponentMeasureByMetricKey.computeIfAbsent(metricKey, x -> new ArrayList<>()).add(TestMeasure.createMeasure(value));
-    }
-  }
-
-  @Override
-  public void addMeasure(String metricKey, double value) {
-    validateAddMeasure(metricKey);
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addInputMeasure(String metricKey, double value) {
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addChildrenMeasures(String metricKey, Double... values) {
-    for (Double value : values) {
-      childrenComponentMeasureByMetricKey.computeIfAbsent(metricKey, x -> new ArrayList<>()).add(TestMeasure.createMeasure(value));
-    }
-  }
-
-  @Override
-  public void addMeasure(String metricKey, long value) {
-    validateAddMeasure(metricKey);
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addInputMeasure(String metricKey, long value) {
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addChildrenMeasures(String metricKey, Long... values) {
-    for (Long value : values) {
-      childrenComponentMeasureByMetricKey.computeIfAbsent(metricKey, x -> new ArrayList<>()).add(TestMeasure.createMeasure(value));
-    }
-  }
-
-  @Override
-  public void addMeasure(String metricKey, String value) {
-    validateAddMeasure(metricKey);
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  @Override
-  public void addMeasure(String metricKey, boolean value) {
-    validateAddMeasure(metricKey);
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addInputMeasure(String metricKey, boolean value) {
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addInputMeasure(String metricKey, String value) {
-    componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value));
-  }
-
-  public void addChildrenMeasures(String metricKey, String... values) {
-    for (String value : values) {
-      childrenComponentMeasureByMetricKey.computeIfAbsent(metricKey, x -> new ArrayList<>()).add(TestMeasure.createMeasure(value));
-    }
-  }
-
-  @Override
-  public List<Issue> getIssues() {
-    return issues;
-  }
-
-  public void setIssues(List<Issue> issues) {
-    this.issues = issues;
-  }
-
-  private void validateInputMetric(String metric) {
-    Set<String> allowedMetrics = new HashSet<>();
-    allowedMetrics.addAll(definition.getInputMetrics());
-    allowedMetrics.addAll(definition.getOutputMetrics());
-    checkArgument(allowedMetrics.contains(metric), "Only metrics in %s can be used to load measures", definition.getInputMetrics());
-  }
-
-  private void validateAddMeasure(String metricKey) {
-    checkArgument(definition.getOutputMetrics().contains(metricKey), "Only metrics in %s can be used to add measures. Metric '%s' is not allowed.",
-      definition.getOutputMetrics(), metricKey);
-    if (componentMeasureByMetricKey.get(metricKey) != null) {
-      throw new UnsupportedOperationException(String.format("A measure on metric '%s' already exists", metricKey));
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinition.java
deleted file mode 100644 (file)
index d53926f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.sonar.api.ce.measure.MeasureComputer;
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Metric;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableSet;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-public class TestMeasureComputerDefinition implements MeasureComputer.MeasureComputerDefinition {
-
-  private final Set<String> inputMetricKeys;
-  private final Set<String> outputMetrics;
-
-  private TestMeasureComputerDefinition(MeasureComputerDefinitionBuilderImpl builder) {
-    this.inputMetricKeys = unmodifiableSet(new HashSet<>(asList(builder.inputMetricKeys)));
-    this.outputMetrics = unmodifiableSet(new HashSet<>(asList(builder.outputMetrics)));
-  }
-
-  @Override
-  public Set<String> getInputMetrics() {
-    return inputMetricKeys;
-  }
-
-  @Override
-  public Set<String> getOutputMetrics() {
-    return outputMetrics;
-  }
-
-  public static class MeasureComputerDefinitionBuilderImpl implements Builder {
-
-    private String[] inputMetricKeys = new String[] {};
-    private String[] outputMetrics;
-
-    @Override
-    public Builder setInputMetrics(String... inputMetrics) {
-      this.inputMetricKeys = validateInputMetricKeys(inputMetrics);
-      return this;
-    }
-
-    @Override
-    public Builder setOutputMetrics(String... outputMetrics) {
-      this.outputMetrics = validateOutputMetricKeys(outputMetrics);
-      return this;
-    }
-
-    @Override
-    public MeasureComputer.MeasureComputerDefinition build() {
-      validateInputMetricKeys(this.inputMetricKeys);
-      validateOutputMetricKeys(this.outputMetrics);
-      return new TestMeasureComputerDefinition(this);
-    }
-
-    private static String[] validateInputMetricKeys(String[] inputMetrics) {
-      requireNonNull(inputMetrics, "Input metrics cannot be null");
-      checkNotNull(inputMetrics);
-      return inputMetrics;
-    }
-
-    private static String[] validateOutputMetricKeys(String[] outputMetrics) {
-      requireNonNull(outputMetrics, "Output metrics cannot be null");
-      checkArgument(outputMetrics.length > 0, "At least one output metric must be defined");
-
-      List<String> outputMetricKeys = asList(outputMetrics);
-      CoreMetrics.getMetrics().stream()
-        .map(Metric::getKey)
-        .forEach(metricKey -> checkArgument(!outputMetricKeys.contains(metricKey), "Core metrics are not allowed"));
-      checkNotNull(outputMetrics);
-      return outputMetrics;
-    }
-
-    private static void checkNotNull(String[] metrics) {
-      for (String metric : metrics) {
-        requireNonNull(metric, "Null metric is not allowed");
-      }
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionContext.java
deleted file mode 100644 (file)
index 715ed22..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.sonar.api.ce.measure.MeasureComputer;
-
-public class TestMeasureComputerDefinitionContext implements MeasureComputer.MeasureComputerDefinitionContext {
-  @Override
-  public MeasureComputer.MeasureComputerDefinition.Builder newDefinitionBuilder() {
-    return new TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestSettings.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestSettings.java
deleted file mode 100644 (file)
index cfd7520..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ce.measure.Settings;
-
-public class TestSettings implements Settings {
-
-  private Map<String, String> valuesByKey = new HashMap<>();
-
-  public Settings setValue(String key, String value){
-    valuesByKey.put(key, value);
-    return this;
-  }
-
-  @Override
-  @CheckForNull
-  public String getString(String key) {
-    return valuesByKey.get(key);
-  }
-
-  @Override
-  public String[] getStringArray(String key) {
-    String value = getString(key);
-    if (value != null) {
-      String[] strings = StringUtils.splitByWholeSeparator(value, ",");
-      String[] result = new String[strings.length];
-      for (int index = 0; index < strings.length; index++) {
-        result[index] = StringUtils.trim(strings[index]);
-      }
-      return result;
-    }
-    return ArrayUtils.EMPTY_STRING_ARRAY;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/package-info.java
deleted file mode 100644 (file)
index 0152d1e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/package-info.java
deleted file mode 100644 (file)
index d1ba2c5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Analysis.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Analysis.java
deleted file mode 100644 (file)
index 4e8388c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Date;
-import java.util.Optional;
-
-public interface Analysis {
-  /**
-   * UUID of the analysis
-   */
-  String getAnalysisUuid();
-
-  /**
-   * Date of the analysis.
-   */
-  Date getDate();
-
-  /**
-   * SCM revision, if declared during analysis
-   * @since 7.8
-   */
-  Optional<String> getRevision();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Branch.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Branch.java
deleted file mode 100644 (file)
index f5b192c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Optional;
-
-/**
- * @since 6.6
- */
-public interface Branch {
-
-  enum Type {
-    BRANCH, PULL_REQUEST
-  }
-
-  boolean isMain();
-
-  Optional<String> getName();
-
-  Type getType();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/CeTask.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/CeTask.java
deleted file mode 100644 (file)
index be3a2ed..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-/**
- * @since 5.5
- */
-public interface CeTask {
-  /**
-   * Id of the Compute Engine task.
-   * <p>
-   * This is the id under which the processing of the project analysis report has been added to the Compute Engine
-   * queue.
-   * 
-   */
-  String getId();
-
-  /**
-   * Indicates whether the Compute Engine task ended successfully or not.
-   */
-  Status getStatus();
-
-  enum Status {
-    SUCCESS, FAILED
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Organization.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Organization.java
deleted file mode 100644 (file)
index cff97fc..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-public interface Organization {
-  String getName();
-
-  String getKey();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTask.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTask.java
deleted file mode 100644 (file)
index c8684e2..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-
-/**
- * Extension point of which any plugin can provide an implementation and will allow them to be notified whenever some
- * analysis report processing ends in the Compute Engine.
- *
- * <p>
- * If more then one implementation of {@link PostProjectAnalysisTask} is found, they will be executed in no specific order.
- *
- * <p>
- * Class {@link PostProjectAnalysisTaskTester} is provided to write unit tests of implementations of this interface.
- *
- * @since 5.5
- * @see PostProjectAnalysisTaskTester
- */
-@ExtensionPoint
-@ComputeEngineSide
-public interface PostProjectAnalysisTask {
-
-  /**
-   * A short description or name for the task.
-   * <p>
-   * This will be used (but not limited to) in logs reporting the execution of the task.
-   * @since 8.0
-   */
-  default String getDescription() {
-    return this.getClass().getSimpleName();
-  }
-
-  /**
-   * This method is called whenever the processing of a Project analysis has finished, whether successfully or not.
-   *
-   * @deprecated in 8.0. Implement {@link #finished(Context)} instead
-   */
-  @Deprecated
-  default void finished(ProjectAnalysis analysis) {
-    throw new IllegalStateException("Provide an implementation of method finished(Context)");
-  }
-
-  /**
-   * @since 8.0
-   */
-  default void finished(Context context) {
-    finished(context.getProjectAnalysis());
-  }
-
-  interface Context {
-    ProjectAnalysis getProjectAnalysis();
-
-    LogStatistics getLogStatistics();
-  }
-
-  /**
-   * Each key-value paar will be added to the log describing the end of the
-   */
-  interface LogStatistics {
-    /**
-     * @return this
-     * @throws NullPointerException if key or value is null
-     * @throws IllegalArgumentException if key has already been set
-     * @throws IllegalArgumentException if key is "status", to avoid conflict with field with same name added by the executor
-     * @throws IllegalArgumentException if key is "time", to avoid conflict with the profiler field with same name
-     */
-    LogStatistics add(String key, Object value);
-  }
-
-  /**
-   * @since 5.5
-   */
-  interface ProjectAnalysis {
-    /**
-     * When organizations are enabled in SonarQube, the organization the project belongs to.
-     *
-     * @since 7.0
-     * @return a non empty value when organizations are enabled, otherwise empty
-     */
-    Optional<Organization> getOrganization();
-
-    /**
-     * Details of the Compute Engine task in which the project analysis was run.
-     */
-    CeTask getCeTask();
-
-    /**
-     * Details of the analyzed project.
-     */
-    Project getProject();
-
-    /**
-     * The branch that is being analyzed.
-     *
-     * @since 6.6
-     */
-    Optional<Branch> getBranch();
-
-    /**
-     * Status and details of the Quality Gate of the project (if any was configured on the project).
-     */
-    @CheckForNull
-    QualityGate getQualityGate();
-
-    /**
-     * Analysis containing the UUID of the analysis and the date
-     *
-     * <p>
-     * This Analysis can be missing when the status of the task is
-     * {@link org.sonar.api.ce.posttask.CeTask.Status#FAILED FAILED}.
-     * </p>
-     */
-    Optional<Analysis> getAnalysis();
-
-    /**
-     * Context as defined by scanner through {@link org.sonar.api.batch.sensor.SensorContext#addContextProperty(String, String)}.
-     * It does not contain the settings used by scanner.
-     *
-     * @since 6.1
-     */
-    ScannerContext getScannerContext();
-
-    /**
-     * Revision Id that has been analysed. May return null.
-     * @since 7.6
-     * @deprecated in 7.8, replaced by {@code Analysis#getRevision()}
-     * @see #getAnalysis()
-     */
-    @Deprecated
-    String getScmRevisionId();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTester.java
deleted file mode 100644 (file)
index c6d0e84..0000000
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.lang.String.format;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-/**
- * This class can be used to test {@link PostProjectAnalysisTask} implementations, see example below:
- * <pre>
- * import static org.assertj.core.api.Assertions.assertThat;
- * import static org.sonar.api.ce.posttask.PostProjectAnalysisTaskTester.newCeTaskBuilder;
- * import static org.sonar.api.ce.posttask.PostProjectAnalysisTaskTester.newConditionBuilder;
- * import static org.sonar.api.ce.posttask.PostProjectAnalysisTaskTester.newProjectBuilder;
- * import static org.sonar.api.ce.posttask.PostProjectAnalysisTaskTester.newQualityGateBuilder;
- * public class CaptorPostProjectAnalysisTaskTest {
- *   private class CaptorPostProjectAnalysisTask implements PostProjectAnalysisTask {
- *     private ProjectAnalysis projectAnalysis;
- *    {@literal @}Override
- *     public void finished(ProjectAnalysis analysis) {
- *       this.projectAnalysis = analysis;
- *     }
- *   }
- *  {@literal @}Test
- *   public void execute_is_passed_a_non_null_ProjectAnalysis_object() {
- *     CaptorPostProjectAnalysisTask postProjectAnalysisTask = new CaptorPostProjectAnalysisTask();
- *     PostProjectAnalysisTaskTester.of(postProjectAnalysisTask)
- *       .withCeTask(
- *           newCeTaskBuilder()
- *               .setId("id")
- *               .setStatus(CeTask.Status.SUCCESS)
- *               .build())
- *       .withProject(
- *         PostProjectAnalysisTaskTester.newProjectBuilder()
- *           .setUuid("uuid")
- *           .setKey("key")
- *           .setName("name")
- *           .build())
- *       .at(new Date())
- *       .withAnalysisUuid("uuid")
- *       .withQualityGate(
- *         newQualityGateBuilder()
- *           .setId("id")
- *           .setName("name")
- *           .setStatus(QualityGate.Status.OK)
- *           .add(
- *             newConditionBuilder()
- *               .setMetricKey("metric key")
- *               .setOperator(QualityGate.Operator.GREATER_THAN)
- *               .setErrorThreshold("12")
- *               .build(QualityGate.EvaluationStatus.OK, "value"))
- *           .build())
- *       .execute();
- *     assertThat(postProjectAnalysisTask.projectAnalysis).isNotNull();
- *   }
- * }
- * </pre>
- *
- * @since 5.5
- */
-public class PostProjectAnalysisTaskTester {
-  private static final String DATE_CAN_NOT_BE_NULL = "date cannot be null";
-  private static final String PROJECT_CAN_NOT_BE_NULL = "project cannot be null";
-  private static final String CE_TASK_CAN_NOT_BE_NULL = "ceTask cannot be null";
-  private static final String STATUS_CAN_NOT_BE_NULL = "status cannot be null";
-  private static final String SCANNER_CONTEXT_CAN_NOT_BE_NULL = "scannerContext cannot be null";
-  private static final String KEY_CAN_NOT_BE_NULL = "key cannot be null";
-  private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
-
-  private final PostProjectAnalysisTask underTest;
-  @CheckForNull
-  private CeTask ceTask;
-  @CheckForNull
-  private Project project;
-  @CheckForNull
-  private Date date;
-  @CheckForNull
-  private QualityGate qualityGate;
-  @CheckForNull
-  private Branch branch;
-  private ScannerContext scannerContext;
-  private String analysisUuid;
-  @Nullable
-  private String revision;
-  @CheckForNull
-  private Map<String, Object> stats;
-
-  private PostProjectAnalysisTaskTester(PostProjectAnalysisTask underTest) {
-    this.underTest = requireNonNull(underTest, "PostProjectAnalysisTask instance cannot be null");
-  }
-
-  public static PostProjectAnalysisTaskTester of(PostProjectAnalysisTask underTest) {
-    return new PostProjectAnalysisTaskTester(underTest);
-  }
-
-  /**
-   * @since 7.0
-   */
-  public static CeTaskBuilder newCeTaskBuilder() {
-    return new CeTaskBuilder();
-  }
-
-  public static ProjectBuilder newProjectBuilder() {
-    return new ProjectBuilder();
-  }
-
-  public static BranchBuilder newBranchBuilder() {
-    return new BranchBuilder();
-  }
-
-  public static QualityGateBuilder newQualityGateBuilder() {
-    return new QualityGateBuilder();
-  }
-
-  public static ConditionBuilder newConditionBuilder() {
-    return new ConditionBuilder();
-  }
-
-  public static ScannerContextBuilder newScannerContextBuilder() {
-    return new ScannerContextBuilder();
-  }
-
-  public PostProjectAnalysisTaskTester withCeTask(CeTask ceTask) {
-    this.ceTask = requireNonNull(ceTask, CE_TASK_CAN_NOT_BE_NULL);
-    return this;
-  }
-
-  public PostProjectAnalysisTaskTester withProject(Project project) {
-    this.project = requireNonNull(project, PROJECT_CAN_NOT_BE_NULL);
-    return this;
-  }
-
-  /**
-   * @since 6.1
-   */
-  public PostProjectAnalysisTaskTester withScannerContext(ScannerContext scannerContext) {
-    this.scannerContext = requireNonNull(scannerContext, SCANNER_CONTEXT_CAN_NOT_BE_NULL);
-    return this;
-  }
-
-  public PostProjectAnalysisTaskTester at(Date date) {
-    this.date = requireNonNull(date, DATE_CAN_NOT_BE_NULL);
-    return this;
-  }
-
-  public PostProjectAnalysisTaskTester withQualityGate(@Nullable QualityGate qualityGate) {
-    this.qualityGate = qualityGate;
-    return this;
-  }
-
-  public PostProjectAnalysisTaskTester withBranch(@Nullable Branch b) {
-    this.branch = b;
-    return this;
-  }
-
-  /**
-   * @since 6.6
-   */
-  public PostProjectAnalysisTaskTester withAnalysisUuid(@Nullable String analysisUuid) {
-    this.analysisUuid = analysisUuid;
-    return this;
-  }
-
-  /**
-   * @since 8.7
-   */
-  public PostProjectAnalysisTaskTester withRevision(@Nullable String revision) {
-    this.revision = revision;
-    return this;
-  }
-
-  public PostProjectAnalysisTask.ProjectAnalysis execute() {
-    requireNonNull(ceTask, CE_TASK_CAN_NOT_BE_NULL);
-    requireNonNull(project, PROJECT_CAN_NOT_BE_NULL);
-    requireNonNull(date, DATE_CAN_NOT_BE_NULL);
-
-    Analysis analysis = null;
-    if (analysisUuid != null) {
-      analysis = new AnalysisBuilder()
-        .setDate(date)
-        .setAnalysisUuid(analysisUuid)
-        .setRevision(revision)
-        .build();
-    }
-
-    PostProjectAnalysisTask.ProjectAnalysis projectAnalysis = new ProjectAnalysisBuilder()
-      .setCeTask(ceTask)
-      .setProject(project)
-      .setBranch(branch)
-      .setQualityGate(qualityGate)
-      .setAnalysis(analysis)
-      .setScannerContext(scannerContext)
-      .setDate(date)
-      .build();
-
-    stats = new HashMap<>();
-    PostProjectAnalysisTask.LogStatistics logStatistics = new PostProjectAnalysisTask.LogStatistics() {
-      @Override
-      public PostProjectAnalysisTask.LogStatistics add(String key, Object value) {
-        requireNonNull(key, "Statistic has null key");
-        requireNonNull(value, () -> format("Statistic with key [%s] has null value", key));
-        checkArgument(!key.equalsIgnoreCase("time"), "Statistic with key [time] is not accepted");
-        checkArgument(!stats.containsKey(key), "Statistic with key [%s] is already present", key);
-        stats.put(key, value);
-        return this;
-      }
-    };
-
-    this.underTest.finished(new PostProjectAnalysisTask.Context() {
-      @Override
-      public PostProjectAnalysisTask.ProjectAnalysis getProjectAnalysis() {
-        return projectAnalysis;
-      }
-
-      @Override
-      public PostProjectAnalysisTask.LogStatistics getLogStatistics() {
-        return logStatistics;
-      }
-    });
-
-    return projectAnalysis;
-  }
-
-  public Map<String, Object> getLogStatistics() {
-    checkState(stats != null, "execute must be called first");
-    return stats;
-  }
-
-  public static final class CeTaskBuilder {
-    private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
-
-    @CheckForNull
-    private String id;
-    @CheckForNull
-    private CeTask.Status status;
-
-    private CeTaskBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public CeTaskBuilder setId(String id) {
-      this.id = requireNonNull(id, ID_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public CeTaskBuilder setStatus(CeTask.Status status) {
-      this.status = requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public CeTask build() {
-      requireNonNull(id, ID_CAN_NOT_BE_NULL);
-      requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
-      return new CeTask() {
-        @Override
-        public String getId() {
-          return id;
-        }
-
-        @Override
-        public Status getStatus() {
-          return status;
-        }
-
-        @Override
-        public String toString() {
-          return "CeTask{" +
-            "id='" + id + '\'' +
-            ", status=" + status +
-            '}';
-        }
-      };
-    }
-  }
-
-  public static final class ProjectBuilder {
-    private static final String UUID_CAN_NOT_BE_NULL = "uuid cannot be null";
-    private String uuid;
-    private String key;
-    private String name;
-
-    private ProjectBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public ProjectBuilder setUuid(String uuid) {
-      this.uuid = requireNonNull(uuid, UUID_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public ProjectBuilder setKey(String key) {
-      this.key = requireNonNull(key, KEY_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public ProjectBuilder setName(String name) {
-      this.name = requireNonNull(name, NAME_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public Project build() {
-      requireNonNull(uuid, UUID_CAN_NOT_BE_NULL);
-      requireNonNull(key, KEY_CAN_NOT_BE_NULL);
-      requireNonNull(name, NAME_CAN_NOT_BE_NULL);
-      return new Project() {
-        @Override
-        public String getUuid() {
-          return uuid;
-        }
-
-        @Override
-        public String getKey() {
-          return key;
-        }
-
-        @Override
-        public String getName() {
-          return name;
-        }
-
-        @Override
-        public String toString() {
-          return "Project{" +
-            "uuid='" + uuid + '\'' +
-            ", key='" + key + '\'' +
-            ", name='" + name + '\'' +
-            '}';
-        }
-
-      };
-    }
-  }
-
-  public static final class BranchBuilder {
-    private boolean isMain = true;
-    private String name = null;
-    private Branch.Type type = Branch.Type.BRANCH;
-
-    private BranchBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public BranchBuilder setName(@Nullable String s) {
-      this.name = s;
-      return this;
-    }
-
-    public BranchBuilder setType(Branch.Type t) {
-      this.type = Objects.requireNonNull(t);
-      return this;
-    }
-
-    public BranchBuilder setIsMain(boolean b) {
-      this.isMain = b;
-      return this;
-    }
-
-    public Branch build() {
-      return new Branch() {
-
-        @Override
-        public boolean isMain() {
-          return isMain;
-        }
-
-        @Override
-        public Optional<String> getName() {
-          return Optional.ofNullable(name);
-        }
-
-        @Override
-        public Type getType() {
-          return type;
-        }
-      };
-    }
-  }
-
-  public static final class QualityGateBuilder {
-    private static final String ID_CAN_NOT_BE_NULL = "id cannot be null";
-    private static final String NAME_CAN_NOT_BE_NULL = "name cannot be null";
-
-    private String id;
-    private String name;
-    private QualityGate.Status status;
-    private final List<QualityGate.Condition> conditions = new ArrayList<>();
-
-    private QualityGateBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public QualityGateBuilder setId(String id) {
-      this.id = requireNonNull(id, ID_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public QualityGateBuilder setName(String name) {
-      this.name = requireNonNull(name, NAME_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public QualityGateBuilder setStatus(QualityGate.Status status) {
-      this.status = requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public QualityGateBuilder add(QualityGate.Condition condition) {
-      conditions.add(requireNonNull(condition, "condition cannot be null"));
-      return this;
-    }
-
-    public QualityGateBuilder clearConditions() {
-      this.conditions.clear();
-      return this;
-    }
-
-    public QualityGate build() {
-      requireNonNull(id, ID_CAN_NOT_BE_NULL);
-      requireNonNull(name, NAME_CAN_NOT_BE_NULL);
-      requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
-
-      return new QualityGate() {
-        @Override
-        public String getId() {
-          return id;
-        }
-
-        @Override
-        public String getName() {
-          return name;
-        }
-
-        @Override
-        public Status getStatus() {
-          return status;
-        }
-
-        @Override
-        public Collection<Condition> getConditions() {
-          return conditions;
-        }
-
-        @Override
-        public String toString() {
-          return "QualityGate{" +
-            "id='" + id + '\'' +
-            ", name='" + name + '\'' +
-            ", status=" + status +
-            ", conditions=" + conditions +
-            '}';
-        }
-      };
-    }
-  }
-
-  public static final class ConditionBuilder {
-    private static final String METRIC_KEY_CAN_NOT_BE_NULL = "metricKey cannot be null";
-    private static final String OPERATOR_CAN_NOT_BE_NULL = "operator cannot be null";
-    private static final String ERROR_THRESHOLD_CAN_NOT_BE_NULL = "errorThreshold cannot be null";
-
-    private String metricKey;
-    private QualityGate.Operator operator;
-    private String errorThreshold;
-
-    private ConditionBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public ConditionBuilder setMetricKey(String metricKey) {
-      this.metricKey = requireNonNull(metricKey, METRIC_KEY_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public ConditionBuilder setOperator(QualityGate.Operator operator) {
-      this.operator = requireNonNull(operator, OPERATOR_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    public ConditionBuilder setErrorThreshold(String errorThreshold) {
-      this.errorThreshold = requireNonNull(errorThreshold, ERROR_THRESHOLD_CAN_NOT_BE_NULL);
-      return this;
-    }
-
-    /**
-     * @deprecated in 7.6. This method has no longer any effect.
-     */
-    @Deprecated
-    public ConditionBuilder setWarningThreshold(@Nullable String warningThreshold) {
-      return this;
-    }
-
-    /**
-     * @deprecated in 7.6. This method has no longer any effect.
-     * Conditions "on leak period" were removed. Use "New X" conditions instead.
-     */
-    @Deprecated
-    public ConditionBuilder setOnLeakPeriod(boolean onLeakPeriod) {
-      return this;
-    }
-
-    public QualityGate.Condition buildNoValue() {
-      checkCommonProperties();
-      return new QualityGate.Condition() {
-        @Override
-        public QualityGate.EvaluationStatus getStatus() {
-          return QualityGate.EvaluationStatus.NO_VALUE;
-        }
-
-        @Override
-        public String getMetricKey() {
-          return metricKey;
-        }
-
-        @Override
-        public QualityGate.Operator getOperator() {
-          return operator;
-        }
-
-        @Override
-        public String getErrorThreshold() {
-          return errorThreshold;
-        }
-
-        @Deprecated
-        @Override
-        public String getWarningThreshold() {
-          return null;
-        }
-
-        /**
-         * @deprecated in 7.6. Conditions "on leak period" were removed. Use "New X" conditions instead.
-         */
-        @Deprecated
-        @Override
-        public boolean isOnLeakPeriod() {
-          return false;
-        }
-
-        @Override
-        public String getValue() {
-          throw new IllegalStateException("There is no value when status is NO_VALUE");
-        }
-
-        @Override
-        public String toString() {
-          return "Condition{" +
-            "status=" + QualityGate.EvaluationStatus.NO_VALUE +
-            ", metricKey='" + metricKey + '\'' +
-            ", operator=" + operator +
-            ", errorThreshold='" + errorThreshold + '\'' +
-            '}';
-        }
-      };
-    }
-
-    public QualityGate.Condition build(final QualityGate.EvaluationStatus status, final String value) {
-      checkCommonProperties();
-      requireNonNull(status, STATUS_CAN_NOT_BE_NULL);
-      checkArgument(status != QualityGate.EvaluationStatus.NO_VALUE, "status cannot be NO_VALUE, use method buildNoValue() instead");
-      requireNonNull(value, "value cannot be null, use method buildNoValue() instead");
-      return new QualityGate.Condition() {
-        @Override
-        public QualityGate.EvaluationStatus getStatus() {
-          return status;
-        }
-
-        @Override
-        public String getMetricKey() {
-          return metricKey;
-        }
-
-        @Override
-        public QualityGate.Operator getOperator() {
-          return operator;
-        }
-
-        @Override
-        public String getErrorThreshold() {
-          return errorThreshold;
-        }
-
-        @Deprecated
-        @Override
-        public String getWarningThreshold() {
-          return null;
-        }
-
-        /**
-         * @deprecated in 7.6. Conditions "on leak period" were removed. Use "New X" conditions instead.
-         */
-        @Deprecated
-        @Override
-        public boolean isOnLeakPeriod() {
-          return false;
-        }
-
-        @Override
-        public String getValue() {
-          return value;
-        }
-
-        @Override
-        public String toString() {
-          return "Condition{" +
-            "status=" + status +
-            ", metricKey='" + metricKey + '\'' +
-            ", operator=" + operator +
-            ", errorThreshold='" + errorThreshold + '\'' +
-            ", value='" + value + '\'' +
-            '}';
-        }
-      };
-    }
-
-    private void checkCommonProperties() {
-      requireNonNull(metricKey, METRIC_KEY_CAN_NOT_BE_NULL);
-      requireNonNull(operator, OPERATOR_CAN_NOT_BE_NULL);
-      requireNonNull(errorThreshold, ERROR_THRESHOLD_CAN_NOT_BE_NULL);
-    }
-  }
-
-  public static final class ScannerContextBuilder {
-    private final Map<String, String> properties = new HashMap<>();
-
-    private ScannerContextBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public ScannerContextBuilder addProperties(Map<String, String> map) {
-      properties.putAll(map);
-      return this;
-    }
-
-    public ScannerContext build() {
-      return () -> properties;
-    }
-  }
-
-  public static final class ProjectAnalysisBuilder {
-    private CeTask ceTask;
-    private Project project;
-    private Branch branch;
-    private QualityGate qualityGate;
-    private Analysis analysis;
-    private ScannerContext scannerContext;
-    private Date date;
-
-    private ProjectAnalysisBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public ProjectAnalysisBuilder setCeTask(CeTask ceTask) {
-      this.ceTask = ceTask;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setProject(Project project) {
-      this.project = project;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setBranch(@Nullable Branch branch) {
-      this.branch = branch;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setQualityGate(QualityGate qualityGate) {
-      this.qualityGate = qualityGate;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setAnalysis(@Nullable Analysis analysis) {
-      this.analysis = analysis;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setScannerContext(ScannerContext scannerContext) {
-      this.scannerContext = scannerContext;
-      return this;
-    }
-
-    public ProjectAnalysisBuilder setDate(Date date) {
-      this.date = date;
-      return this;
-    }
-
-    public PostProjectAnalysisTask.ProjectAnalysis build() {
-      return new PostProjectAnalysisTask.ProjectAnalysis() {
-        @Override
-        public Optional<Organization> getOrganization() {
-          return Optional.empty();
-        }
-
-        @Override
-        public CeTask getCeTask() {
-          return ceTask;
-        }
-
-        @Override
-        public Project getProject() {
-          return project;
-        }
-
-        @Override
-        public Optional<Branch> getBranch() {
-          return Optional.ofNullable(branch);
-        }
-
-        @CheckForNull
-        @Override
-        public QualityGate getQualityGate() {
-          return qualityGate;
-        }
-
-        @Override
-        public Optional<Analysis> getAnalysis() {
-          return Optional.ofNullable(analysis);
-        }
-
-        @Override
-        public ScannerContext getScannerContext() {
-          return scannerContext;
-        }
-
-        @Override
-        public String getScmRevisionId() {
-          return null;
-        }
-
-        @Override
-        public String toString() {
-          return "ProjectAnalysis{" +
-            "ceTask=" + ceTask +
-            ", project=" + project +
-            ", date=" + date.getTime() +
-            ", analysisDate=" + date.getTime() +
-            ", qualityGate=" + qualityGate +
-            '}';
-        }
-      };
-    }
-  }
-
-  public static final class AnalysisBuilder {
-    private String analysisUuid;
-    private Date date;
-    @Nullable
-    private String revision;
-
-    private AnalysisBuilder() {
-      // prevents instantiation outside PostProjectAnalysisTaskTester
-    }
-
-    public AnalysisBuilder setAnalysisUuid(String analysisUuid) {
-      this.analysisUuid = analysisUuid;
-      return this;
-    }
-
-    public AnalysisBuilder setDate(Date date) {
-      this.date = date;
-      return this;
-    }
-
-    public AnalysisBuilder setRevision(@Nullable String s) {
-      this.revision = s;
-      return this;
-    }
-
-    public Analysis build() {
-      return new Analysis() {
-
-        @Override
-        public String getAnalysisUuid() {
-          return analysisUuid;
-        }
-
-        @Override
-        public Date getDate() {
-          return date;
-        }
-
-        @Override
-        public Optional<String> getRevision() {
-          return Optional.ofNullable(revision);
-        }
-      };
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Project.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/Project.java
deleted file mode 100644 (file)
index 0e981c6..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-/**
- * @since 5.5
- */
-public interface Project {
-  /**
-   * The UUID of the project.
-   */
-  String getUuid();
-
-  /**
-   * The key of the project.
-   */
-  String getKey();
-
-  /**
-   * The name of the project.
-   */
-  String getName();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/QualityGate.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/QualityGate.java
deleted file mode 100644 (file)
index 89e95c8..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import org.sonar.api.measures.Metric;
-
-/**
- * @since 5.5
- */
-public interface QualityGate {
-  /**
-   * The unique identifier of the Quality Gate.
-   */
-  String getId();
-
-  /**
-   * Name of the Quality Gate.
-   */
-  String getName();
-
-  /**
-   * Status of the Quality Gate for the current project processing.
-   */
-  Status getStatus();
-
-  /**
-   * Conditions of the Quality Gate.
-   */
-  Collection<Condition> getConditions();
-
-  enum Status {
-    /** at least one threshold is defined, no threshold is reached */
-    OK,
-    /**
-     * @deprecated in 7.6.
-     */
-    @Deprecated
-    WARN,
-    /** at least one error threshold is reached */
-    ERROR
-  }
-
-  interface Condition {
-    /**
-     * Evaluation status of this condition
-     */
-    EvaluationStatus getStatus();
-
-    /**
-     * The key of the metric this condition has been evaluated on.
-     * <p>
-     * The {@link org.sonar.api.measures.Metric} for the returned key can be retrieved using a
-     * {@link org.sonar.api.measures.MetricFinder} instance.
-     * 
-     *
-     * @see org.sonar.api.batch.measure.MetricFinder#findByKey(String)
-     */
-    String getMetricKey();
-
-    /**
-     * The operator used to evaluate the error threshold against the value of the measure
-     */
-    Operator getOperator();
-
-    /**
-     * The threshold value which makes the quality gates status change to {@link EvaluationStatus#ERROR} when it's reached.
-     */
-    String getErrorThreshold();
-
-    /**
-     * @deprecated in 7.6. Implementations should always return null.
-     */
-    @Deprecated
-    @CheckForNull
-    String getWarningThreshold();
-
-    /**
-     * Whether this condition is defined on the leak period or on an absolute value.
-     * @deprecated in 7.6. Implementations should always return false.
-     * Conditions "on leak period" were removed. Use "New X" conditions instead.
-     */
-    @Deprecated
-    boolean isOnLeakPeriod();
-
-    /**
-     * The value of the measure.
-     * <p>
-     * If the type of the metric (which key is provided by {@link #getMetricKey()}) is numerical, the value can be parsed
-     * using {@link Integer#valueOf(String)}, {@link Long#valueOf(String)} or {@link Double#valueOf(String)}.
-     * 
-     *
-     * @throws IllegalStateException if {@link #getStatus()} is {@link EvaluationStatus#NO_VALUE}
-     *
-     * @see Metric#getType() 
-     */
-    String getValue();
-
-  }
-
-  /**
-   * Quality Gate condition operator.
-   */
-  enum Operator {
-    /**
-     * @deprecated in 7.6. Using this operator will have no effect.
-     */
-    @Deprecated
-    EQUALS,
-    /**
-     * @deprecated in 7.6.  Using this operator will have no effect.
-     */
-    @Deprecated
-    NOT_EQUALS,
-    GREATER_THAN,
-    LESS_THAN
-  }
-
-  /**
-   * Quality gate condition evaluation status.
-   */
-  enum EvaluationStatus {
-    /**
-     * No measure found or measure had no value. The condition has not been evaluated and therefor ignored in
-     * the computation of the Quality Gate status.
-     */
-    NO_VALUE,
-    /**
-     * Condition evaluated as OK, error thresholds has not been reached.
-     */
-    OK,
-    /**
-     * Condition evaluated as WARN, only warning thresholds has been reached.
-     * @deprecated in 7.6
-     */
-    @Deprecated
-    WARN,
-    /**
-     * Condition evaluated as ERROR, error thresholds has been reached (and most likely warning thresholds too).
-     */
-    ERROR
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/ScannerContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/ScannerContext.java
deleted file mode 100644 (file)
index 21c0c42..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Map;
-
-/**
- * @since 6.1
- */
-public interface ScannerContext {
-
-  /**
-   * @return immutable map of properties sent by scanner
-   */
-  Map<String, String> getProperties();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/posttask/package-info.java
deleted file mode 100644 (file)
index ffc5ecd..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Category.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Category.java
deleted file mode 100644 (file)
index e73144c..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.Locale;
-
-/**
- * @since 3.7
- */
-public class Category {
-
-  private final String originalKey;
-  private final boolean special;
-
-  Category(String originalKey) {
-    this(originalKey, false);
-  }
-
-  Category(String originalKey, boolean special) {
-    this.originalKey = originalKey;
-    this.special = special;
-  }
-
-  public String originalKey() {
-    return originalKey;
-  }
-
-  public String key() {
-    return StringUtils.lowerCase(originalKey, Locale.ENGLISH);
-  }
-
-  public boolean isSpecial() {
-    return special;
-  }
-
-  @Override
-  public int hashCode() {
-    return key().hashCode();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof Category)) {
-      return false;
-    }
-    return StringUtils.equalsIgnoreCase(((Category) obj).originalKey, this.originalKey);
-  }
-
-  @Override
-  public String toString() {
-    return this.originalKey;
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Configuration.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Configuration.java
deleted file mode 100644 (file)
index 81040aa..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.Optional;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * Component to get effective configuration. Values of properties depend on the runtime environment:
- * <ul>
- *   <li>immutable project configuration in scanner.</li>
- *   <li>global configuration in web server. It does not allow to get the settings overridden on projects.</li>
- *   <li>project configuration in Compute Engine.</li>
- * </ul>
- *
- * <h3>Usage</h3>
- * <pre>
- * public class MyExtension {
- *
- *   private final Configuration config;
- *
- *   public MyExtension(Configuration config) {
- *     this.config = config;
- *   }
- *   public void doSomething() {
- *     String fooValue = config.get("sonar.foo").orElse(null);
- *     // ..
- *   }
- * }
- * </pre>
- *
- * <h3>Scanner example</h3>
- * Scanner sensor can get the reference on Configuration directly through SensorContext,
- * without injecting the component into constructor.
- *
- * <pre>
- * public class MySensor implements Sensor {
- *   {@literal @}Override
- *   public void execute(SensorContext context) {
- *     String fooValue = context.config().get("sonar.foo").orElse(null);
- *     // ..
- *   }
- * }
- * </pre>
- *
- * <p>
- * For testing, and only for testing, the in-memory implementation MapSettings can be used.
- * <pre>
- * {@literal @}Test
- * public void my_test() {
- *   MapSettings settings = new MapSettings();
- *   settings.setProperty("foo", "bar");
- *   MyExtension underTest = new MyExtension(settings.asConfig());
- *   // ...
- * }
- * </pre>
- *
- * @see PropertyDefinition
- * @since 6.5
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-@SonarLintSide
-public interface Configuration {
-
-  /**
-   * The effective value of the specified property. Can return {@code Optional#empty()} if the property is not set and has no defined default value.
-   * <p>
-   * If the property is encrypted with a secret key, then the returned value is decrypted.
-   * </p>
-   *
-   * @throws IllegalStateException if value is encrypted but fails to be decrypted.
-   */
-  Optional<String> get(String key);
-
-  /**
-   * @return {@code true} if the property has a non-default value, else {@code false}.
-   */
-  boolean hasKey(String key);
-
-  /**
-   * Used to read multi-valued properties. 
-   * <p>
-   * See {@link PropertyDefinition.Builder#multiValues(boolean)}
-   * Multi-valued properties coming from scanner are parsed as CSV lines (ie comma separator and optional double quotes to escape values).
-   * Non quoted values are trimmed and empty fields are ignored.
-   * <br>
-   * Examples :
-   * <ul>
-   * <li>"one,two,three " -&gt; ["one", "two", "three"]</li>
-   * <li>"  one, two, three " -&gt; ["one", "two", "three"]</li>
-   * <li>"one, three" -&gt; ["one", "three"]</li>
-   * <li>"one,"", three" -&gt; ["one", "", "three"]</li>
-   * <li>"one,  "  " , three" -&gt; ["one", "  ", "three"]</li>
-   * <li>"one,\"two,three\",\" four \"" -&gt; ["one", "two,three", " four "]</li>
-   * </ul>
-   */
-  String[] getStringArray(String key);
-
-  /**
-   * Effective value as boolean. It is {@code empty} if {@link #get(String)} is empty or if it
-   * does not return {@code "true"}, even if it's not a boolean representation.
-   * @return {@code true} if the effective value is {@code "true"}, {@code false} for any other non empty value. 
-   * If the property does not have value nor default value, then {@code empty} is returned.
-   */
-  default Optional<Boolean> getBoolean(String key) {
-    return get(key).map(String::trim).map(Boolean::parseBoolean);
-  }
-
-  /**
-   * Effective value as {@code int}.
-   * @return the value as {@code int}. If the property does not have value nor default value, then {@code empty} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable integer
-   */
-  default Optional<Integer> getInt(String key) {
-    try {
-      return get(key).map(String::trim).map(Integer::parseInt);
-    } catch (NumberFormatException e) {
-      throw new IllegalStateException(String.format("The property '%s' is not an int value: %s", key, e.getMessage()));
-    }
-  }
-
-  /**
-   * Effective value as {@code long}.
-   * @return the value as {@code long}. If the property does not have value nor default value, then {@code empty} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable {@code long}
-   */
-  default Optional<Long> getLong(String key) {
-    try {
-      return get(key).map(String::trim).map(Long::parseLong);
-    } catch (NumberFormatException e) {
-      throw new IllegalStateException(String.format("The property '%s' is not an long value: %s", key, e.getMessage()));
-    }
-  }
-
-  /**
-   * Effective value as {@code Float}.
-   * @return the value as {@code Float}. If the property does not have value nor default value, then {@code empty} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable number
-   */
-  default Optional<Float> getFloat(String key) {
-    try {
-      return get(key).map(String::trim).map(Float::valueOf);
-    } catch (NumberFormatException e) {
-      throw new IllegalStateException(String.format("The property '%s' is not an float value: %s", key, e.getMessage()));
-    }
-  }
-
-  /**
-   * Effective value as {@code Double}.
-   * @return the value as {@code Double}. If the property does not have value nor default value, then {@code empty} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable number
-   */
-  default Optional<Double> getDouble(String key) {
-    try {
-      return get(key).map(String::trim).map(Double::valueOf);
-    } catch (NumberFormatException e) {
-      throw new IllegalStateException(String.format("The property '%s' is not an double value: %s", key, e.getMessage()));
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java
deleted file mode 100644 (file)
index aa8e049..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.List;
-import org.sonar.api.PropertyType;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.platform.Server;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Arrays.asList;
-import static org.sonar.api.CoreProperties.CATEGORY_GENERAL;
-import static org.sonar.api.CoreProperties.SUBCATEGORY_EMAIL;
-import static org.sonar.api.PropertyType.INTEGER;
-import static org.sonar.api.PropertyType.SINGLE_SELECT_LIST;
-
-/**
- * @since 3.2
- */
-@ServerSide
-@ComputeEngineSide
-public class EmailSettings {
-  public static final String SMTP_HOST = "email.smtp_host.secured";
-  public static final String SMTP_HOST_DEFAULT = "";
-  public static final String SMTP_PORT = "email.smtp_port.secured";
-  public static final String SMTP_PORT_DEFAULT = "25";
-  public static final String SMTP_SECURE_CONNECTION = "email.smtp_secure_connection.secured";
-  public static final String SMTP_SECURE_CONNECTION_DEFAULT = "";
-  public static final String SMTP_USERNAME = "email.smtp_username.secured";
-  public static final String SMTP_USERNAME_DEFAULT = "";
-  public static final String SMTP_PASSWORD = "email.smtp_password.secured";
-  public static final String SMTP_PASSWORD_DEFAULT = "";
-  public static final String FROM = "email.from";
-  public static final String FROM_DEFAULT = "noreply@nowhere";
-  public static final String FROM_NAME = "email.fromName";
-  public static final String FROM_NAME_DEFAULT = "SonarQube";
-  public static final String PREFIX = "email.prefix";
-  public static final String PREFIX_DEFAULT = "[SONARQUBE]";
-
-  private final Configuration config;
-  private final Server server;
-
-  public EmailSettings(Configuration config, Server server) {
-    this.config = config;
-    this.server = server;
-  }
-
-  public String getSmtpHost() {
-    return get(SMTP_HOST, SMTP_HOST_DEFAULT);
-  }
-
-  public int getSmtpPort() {
-    return Integer.parseInt(get(SMTP_PORT, SMTP_PORT_DEFAULT));
-  }
-
-  public String getSecureConnection() {
-    return get(SMTP_SECURE_CONNECTION, SMTP_SECURE_CONNECTION_DEFAULT);
-  }
-
-  public String getSmtpUsername() {
-    return get(SMTP_USERNAME, SMTP_USERNAME_DEFAULT);
-  }
-
-  public String getSmtpPassword() {
-    return get(SMTP_PASSWORD, SMTP_PASSWORD_DEFAULT);
-  }
-
-  public String getFrom() {
-    return get(FROM, FROM_DEFAULT);
-  }
-
-  public String getFromName() {
-    return get(FROM_NAME, FROM_NAME_DEFAULT);
-  }
-
-  public String getPrefix() {
-    return get(PREFIX, PREFIX_DEFAULT);
-  }
-
-  public String getServerBaseURL() {
-    return server.getPublicRootUrl();
-  }
-
-  private String get(String key, String defaultValue) {
-    return config.get(key).orElse(defaultValue);
-  }
-
-  /**
-   * @since 6.1
-   */
-  public static List<PropertyDefinition> definitions() {
-    return asList(
-      PropertyDefinition.builder(SMTP_HOST)
-        .name("SMTP host")
-        .description("For example \"smtp.gmail.com\". Leave blank to disable email sending.")
-        .defaultValue(SMTP_HOST_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(0)
-        .build(),
-      PropertyDefinition.builder(SMTP_PORT)
-        .name("SMTP port")
-        .description("Port number to connect with SMTP server.")
-        .defaultValue(SMTP_PORT_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .type(INTEGER)
-        .index(1)
-        .build(),
-      PropertyDefinition.builder(SMTP_SECURE_CONNECTION)
-        .name("Secure connection")
-        .description("Type of secure connection. Leave empty to not use secure connection.")
-        .defaultValue(SMTP_SECURE_CONNECTION_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .type(SINGLE_SELECT_LIST)
-        .options("ssl", "starttls")
-        .index(2)
-        .build(),
-      PropertyDefinition.builder(SMTP_USERNAME)
-        .name("SMTP username")
-        .description("Username to use with authenticated SMTP.")
-        .defaultValue(SMTP_USERNAME_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(3)
-        .build(),
-      PropertyDefinition.builder(SMTP_PASSWORD)
-        .name("SMTP password")
-        .description("Password to use with authenticated SMTP.")
-        .defaultValue(SMTP_PASSWORD_DEFAULT)
-        .type(PropertyType.PASSWORD)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(4)
-        .build(),
-      PropertyDefinition.builder(FROM)
-        .name("From address")
-        .description("Emails will come from this address. For example - \"noreply@sonarsource.com\". Note that the mail server may ignore this setting.")
-        .defaultValue(FROM_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(5)
-        .build(),
-      PropertyDefinition.builder(FROM_NAME)
-        .name("From name")
-        .description("Emails will come from this address name. For example - \"SonarQube\". Note that the mail server may ignore this setting.")
-        .defaultValue(FROM_NAME_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(6)
-        .build(),
-      PropertyDefinition.builder(PREFIX)
-        .name("Email prefix")
-        .description("Prefix will be prepended to all outgoing email subjects.")
-        .defaultValue(PREFIX_DEFAULT)
-        .category(CATEGORY_GENERAL)
-        .subCategory(SUBCATEGORY_EMAIL)
-        .index(7)
-        .build());
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java
deleted file mode 100644 (file)
index 31f245f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import javax.annotation.Nullable;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Observe changes of global properties done from web application. It does not support:
- * <ul>
- * <li>changes done by end-users from the page "Project Settings"</li>
- * <li>changes done in file conf/sonar.properties</li>
- * <li>change of default values</li>
-  * </ul>
- *
- * @since 3.0
- */
-@ServerSide
-@ExtensionPoint
-public abstract class GlobalPropertyChangeHandler {
-
-  public static final class PropertyChange {
-    private String key;
-    private String newValue;
-
-    private PropertyChange(String key, @Nullable String newValue) {
-      this.key = key;
-      this.newValue = newValue;
-    }
-
-    public static PropertyChange create(String key, @Nullable String newValue) {
-      return new PropertyChange(key, newValue);
-    }
-
-    public String getKey() {
-      return key;
-    }
-
-    public String getNewValue() {
-      return newValue;
-    }
-
-    @Override
-    public String toString() {
-      return String.format("[key=%s, newValue=%s]", key, newValue);
-    }
-  }
-
-  /**
-   * This method gets called when a property is changed.
-   */
-  public abstract void onChange(PropertyChange change);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
deleted file mode 100644 (file)
index 1f949b1..0000000
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.Property;
-import org.sonar.api.PropertyType;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableSet;
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang.StringUtils.isBlank;
-import static org.apache.commons.lang.StringUtils.isEmpty;
-import static org.sonar.api.PropertyType.BOOLEAN;
-import static org.sonar.api.PropertyType.FLOAT;
-import static org.sonar.api.PropertyType.INTEGER;
-import static org.sonar.api.PropertyType.JSON;
-import static org.sonar.api.PropertyType.LONG;
-import static org.sonar.api.PropertyType.PROPERTY_SET;
-import static org.sonar.api.PropertyType.REGULAR_EXPRESSION;
-import static org.sonar.api.PropertyType.SINGLE_SELECT_LIST;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Declare a plugin property. Values are available at runtime through the component {@link Configuration}.
- * <br>
- * It's the programmatic alternative to the annotation {@link org.sonar.api.Property}. It is more
- * testable and adds new features like sub-categories and ordering.
- * <br>
- * Example:
- * <pre><code>
- *   public class MyPlugin extends SonarPlugin {
- *     public List getExtensions() {
- *       return Arrays.asList(
- *         PropertyDefinition.builder("sonar.foo").name("Foo").build(),
- *         PropertyDefinition.builder("sonar.bar").name("Bar").defaultValue("123").type(PropertyType.INTEGER).build()
- *       );
- *     }
- *   }
- * </code></pre>
- * <br>
- * Keys in localization bundles are:
- * <ul>
- * <li>{@code property.<key>.name} is the label of the property</li>
- * <li>{@code property.<key>.description} is the optional description of the property</li>
- * <li>{@code property.category.<category>} is the category label</li>
- * <li>{@code property.category.<category>.description} is the category description</li>
- * <li>{@code property.category.<category>.<subcategory>} is the sub-category label</li>
- * <li>{@code property.category.<category>.<subcategory>.description} is the sub-category description</li>
- * </ul>
- *
- * @since 3.6
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-@SonarLintSide
-@ExtensionPoint
-public final class PropertyDefinition {
-
-  private static final Set<String> SUPPORTED_QUALIFIERS = unmodifiableSet(new LinkedHashSet<>(
-    asList(Qualifiers.PROJECT, Qualifiers.VIEW, Qualifiers.MODULE, Qualifiers.SUBVIEW, Qualifiers.APP)));
-
-  private String key;
-  private String defaultValue;
-  private String name;
-  private PropertyType type;
-  private List<String> options;
-  private String description;
-  /**
-   * @see org.sonar.api.config.PropertyDefinition.Builder#category(String)
-   */
-  private String category;
-  private List<String> qualifiers;
-  private boolean global;
-  private boolean multiValues;
-  private String deprecatedKey;
-  private List<PropertyFieldDefinition> fields;
-  /**
-   * @see org.sonar.api.config.PropertyDefinition.Builder#subCategory(String)
-   */
-  private String subCategory;
-  private int index;
-
-  private PropertyDefinition(Builder builder) {
-    this.key = builder.key;
-    this.name = builder.name;
-    this.description = builder.description;
-    this.defaultValue = builder.defaultValue;
-    this.category = builder.category;
-    this.subCategory = builder.subCategory;
-    this.global = builder.global;
-    this.type = builder.type;
-    this.options = builder.options;
-    this.multiValues = builder.multiValues;
-    this.fields = builder.fields;
-    this.deprecatedKey = builder.deprecatedKey;
-    this.qualifiers = builder.onQualifiers;
-    this.qualifiers.addAll(builder.onlyOnQualifiers);
-    this.index = builder.index;
-  }
-
-  /**
-   * @param key the unique property key. If it ends with ".secured" then users need the
-   *            administration permission to access the value.
-   */
-  public static Builder builder(String key) {
-    return new Builder(key);
-  }
-
-  static PropertyDefinition create(Property annotation) {
-    Builder builder = PropertyDefinition.builder(annotation.key())
-      .name(annotation.name())
-      .defaultValue(annotation.defaultValue())
-      .description(annotation.description())
-      .category(annotation.category())
-      .type(annotation.type())
-      .options(asList(annotation.options()))
-      .multiValues(annotation.multiValues())
-      .fields(PropertyFieldDefinition.create(annotation.fields()))
-      .deprecatedKey(annotation.deprecatedKey());
-    List<String> qualifiers = new ArrayList<>();
-    if (annotation.project()) {
-      qualifiers.add(Qualifiers.PROJECT);
-    }
-    if (annotation.module()) {
-      qualifiers.add(Qualifiers.MODULE);
-    }
-    if (annotation.global()) {
-      builder.onQualifiers(qualifiers);
-    } else {
-      builder.onlyOnQualifiers(qualifiers);
-    }
-    return builder.build();
-  }
-
-  public static Result validate(PropertyType type, @Nullable String value, List<String> options) {
-    if (isBlank(value)) {
-      return Result.SUCCESS;
-    }
-
-    EnumMap<PropertyType, Function<String, Result>> validations = createValidations(options);
-    return validations.getOrDefault(type, aValue -> Result.SUCCESS).apply(value);
-  }
-
-  private static EnumMap<PropertyType, Function<String, Result>> createValidations(List<String> options) {
-    EnumMap<PropertyType, Function<String, Result>> map = new EnumMap<>(PropertyType.class);
-    map.put(BOOLEAN, validateBoolean());
-    map.put(INTEGER, validateInteger());
-    map.put(LONG, validateInteger());
-    map.put(FLOAT, validateFloat());
-    map.put(REGULAR_EXPRESSION, validateRegexp());
-    map.put(SINGLE_SELECT_LIST,
-      aValue -> options.contains(aValue) ? Result.SUCCESS : Result.newError("notInOptions"));
-    return map;
-  }
-
-  private static Function<String, Result> validateBoolean() {
-    return value -> {
-      if (!StringUtils.equalsIgnoreCase(value, "true") && !StringUtils.equalsIgnoreCase(value, "false")) {
-        return Result.newError("notBoolean");
-      }
-      return Result.SUCCESS;
-    };
-  }
-
-  private static Function<String, Result> validateInteger() {
-    return value -> {
-      if (!NumberUtils.isDigits(value)) {
-        return Result.newError("notInteger");
-      }
-      return Result.SUCCESS;
-    };
-  }
-
-  private static Function<String, Result> validateFloat() {
-    return value -> {
-      try {
-        Double.parseDouble(value);
-        return Result.SUCCESS;
-      } catch (NumberFormatException e) {
-        return Result.newError("notFloat");
-      }
-    };
-  }
-
-  private static Function<String, Result> validateRegexp() {
-    return value -> {
-      try {
-        Pattern.compile(value);
-        return Result.SUCCESS;
-      } catch (PatternSyntaxException e) {
-        return Result.newError("notRegexp");
-      }
-    };
-  }
-
-  public Result validate(@Nullable String value) {
-    return validate(type, value, options);
-  }
-
-  /**
-   * Unique key within all plugins. It's recommended to prefix the key by 'sonar.' and the plugin name. Examples :
-   * 'sonar.cobertura.reportPath' and 'sonar.cpd.minimumTokens'.
-   */
-  public String key() {
-    return key;
-  }
-
-  public String defaultValue() {
-    return defaultValue;
-  }
-
-  public String name() {
-    return name;
-  }
-
-  public PropertyType type() {
-    return type;
-  }
-
-  /**
-   * Options for *_LIST types
-   * <br>
-   * Options for property of type {@link PropertyType#SINGLE_SELECT_LIST}.<br>
-   * For example {"property_1", "property_3", "property_3"}).
-   * <br>
-   * Options for property of type {@link PropertyType#METRIC}.<br>
-   * If no option is specified, any metric will match.
-   * If options are specified, all must match for the metric to be displayed.
-   * Three types of filter are supported <code>key:REGEXP</code>, <code>domain:REGEXP</code> and <code>type:comma_separated__list_of_types</code>.
-   * For example <code>key:new_.*</code> will match any metric which key starts by <code>new_</code>.
-   * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>.
-   * For example <code>type:NUMERIC</code> will match any metric of numerictype.
-   */
-  public List<String> options() {
-    return options;
-  }
-
-  public String description() {
-    return description;
-  }
-
-  /**
-   * Category where the property appears in settings pages. By default equal to plugin name.
-   */
-  public String category() {
-    return category;
-  }
-
-  /**
-   * Sub-category where property appears in settings pages. By default sub-category is the category.
-   */
-  public String subCategory() {
-    return subCategory;
-  }
-
-  /**
-   * Qualifiers that can display this property
-   */
-  public List<String> qualifiers() {
-    return qualifiers;
-  }
-
-  /**
-   * Is the property displayed in global settings page ?
-   */
-  public boolean global() {
-    return global;
-  }
-
-  public boolean multiValues() {
-    return multiValues;
-  }
-
-  public List<PropertyFieldDefinition> fields() {
-    return fields;
-  }
-
-  public String deprecatedKey() {
-    return deprecatedKey;
-  }
-
-  /**
-   * Order to display properties in Sonar UI. When two properties have the same index then it is sorted by
-   * lexicographic order of property name.
-   */
-  public int index() {
-    return index;
-  }
-
-  @Override
-  public String toString() {
-    return key;
-  }
-
-  public static final class Result {
-    private static final Result SUCCESS = new Result(null);
-    private String errorKey;
-
-    @Nullable
-    private Result(@Nullable String errorKey) {
-      this.errorKey = errorKey;
-    }
-
-    private static Result newError(String key) {
-      return new Result(key);
-    }
-
-    public boolean isValid() {
-      return StringUtils.isBlank(errorKey);
-    }
-
-    @Nullable
-    public String getErrorKey() {
-      return errorKey;
-    }
-  }
-
-  public static class Builder {
-    private final String key;
-    private String name = "";
-    private String description = "";
-    private String defaultValue = "";
-    /**
-     * @see PropertyDefinition.Builder#category(String)
-     */
-    private String category = "";
-    /**
-     * @see PropertyDefinition.Builder#subCategory(String)
-     */
-    private String subCategory = "";
-    private List<String> onQualifiers = new ArrayList<>();
-    private List<String> onlyOnQualifiers = new ArrayList<>();
-    private boolean global = true;
-    private PropertyType type = PropertyType.STRING;
-    private List<String> options = new ArrayList<>();
-    private boolean multiValues = false;
-    private List<PropertyFieldDefinition> fields = new ArrayList<>();
-    private String deprecatedKey = "";
-    private boolean hidden = false;
-    private int index = 999;
-
-    private Builder(String key) {
-      this.key = key;
-    }
-
-    public Builder description(String description) {
-      this.description = description;
-      return this;
-    }
-
-    /**
-     * @see PropertyDefinition#name()
-     */
-    public Builder name(String name) {
-      this.name = name;
-      return this;
-    }
-
-    /**
-     * @see PropertyDefinition#defaultValue()
-     */
-    public Builder defaultValue(String defaultValue) {
-      this.defaultValue = defaultValue;
-      return this;
-    }
-
-    /**
-     * @see PropertyDefinition#category()
-     */
-    public Builder category(String category) {
-      this.category = category;
-      return this;
-    }
-
-    /**
-     * @see PropertyDefinition#subCategory()
-     */
-    public Builder subCategory(String subCategory) {
-      this.subCategory = subCategory;
-      return this;
-    }
-
-    /**
-     * The property will be available in General Settings AND in the components
-     * with the given qualifiers.
-     * <br>
-     * For example @{code onQualifiers(Qualifiers.PROJECT)} allows to configure the
-     * property in General Settings and in Project Settings.
-     * <br>
-     * See supported constant values in {@link Qualifiers}. By default property is available
-     * only in General Settings.
-     *
-     * @throws IllegalArgumentException only qualifiers {@link Qualifiers#PROJECT PROJECT}, {@link Qualifiers#MODULE MODULE}, {@link Qualifiers#APP APP},
-     *                                  {@link Qualifiers#VIEW VIEW} and {@link Qualifiers#SUBVIEW SVW} are allowed.
-     */
-    public Builder onQualifiers(String first, String... rest) {
-      addQualifiers(this.onQualifiers, first, rest);
-      this.global = true;
-      return this;
-    }
-
-    /**
-     * The property will be available in General Settings AND in the components
-     * with the given qualifiers.
-     * <br>
-     * For example @{code onQualifiers(Arrays.asList(Qualifiers.PROJECT))} allows to configure the
-     * property in General Settings and in Project Settings.
-     * <br>
-     * See supported constant values in {@link Qualifiers}. By default property is available
-     * only in General Settings.
-     *
-     * @throws IllegalArgumentException only qualifiers {@link Qualifiers#PROJECT PROJECT}, {@link Qualifiers#MODULE MODULE}, {@link Qualifiers#APP APP},
-     *                                  {@link Qualifiers#VIEW VIEW} and {@link Qualifiers#SUBVIEW SVW} are allowed.
-     * @throws IllegalArgumentException only qualifiers {@link Qualifiers#PROJECT PROJECT}, {@link Qualifiers#MODULE MODULE},
-     *                                  {@link Qualifiers#VIEW VIEW} and {@link Qualifiers#SUBVIEW SVW} are allowed.
-     */
-    public Builder onQualifiers(List<String> qualifiers) {
-      addQualifiers(this.onQualifiers, qualifiers);
-      this.global = true;
-      return this;
-    }
-
-    /**
-     * The property will be available in the components
-     * with the given qualifiers, but NOT in General Settings.
-     * <br>
-     * For example @{code onlyOnQualifiers(Qualifiers.PROJECT)} allows to configure the
-     * property in Project Settings only.
-     * <br>
-     * See supported constant values in {@link Qualifiers}. By default property is available
-     * only in General Settings.
-     *
-     * @throws IllegalArgumentException only qualifiers {@link Qualifiers#PROJECT PROJECT}, {@link Qualifiers#MODULE MODULE}, {@link Qualifiers#APP APP},
-     *                                  {@link Qualifiers#VIEW VIEW} and {@link Qualifiers#SUBVIEW SVW} are allowed.
-     */
-    public Builder onlyOnQualifiers(String first, String... rest) {
-      addQualifiers(this.onlyOnQualifiers, first, rest);
-      this.global = false;
-      return this;
-    }
-
-    /**
-     * The property will be available in the components
-     * with the given qualifiers, but NOT in General Settings.
-     * <br>
-     * For example @{code onlyOnQualifiers(Arrays.asList(Qualifiers.PROJECT))} allows to configure the
-     * property in Project Settings only.
-     * <br>
-     * See supported constant values in {@link Qualifiers}. By default property is available
-     * only in General Settings.
-     *
-     * @throws IllegalArgumentException only qualifiers {@link Qualifiers#PROJECT PROJECT}, {@link Qualifiers#MODULE MODULE}, {@link Qualifiers#APP APP},
-     *                                  {@link Qualifiers#VIEW VIEW} and {@link Qualifiers#SUBVIEW SVW} are allowed.
-     */
-    public Builder onlyOnQualifiers(List<String> qualifiers) {
-      addQualifiers(this.onlyOnQualifiers, qualifiers);
-      this.global = false;
-      return this;
-    }
-
-    private static void addQualifiers(List<String> target, String first, String... rest) {
-      List<String> qualifiers = new ArrayList<>();
-      qualifiers.add(first);
-      qualifiers.addAll(Arrays.asList(rest));
-      addQualifiers(target, qualifiers);
-    }
-
-    private static void addQualifiers(List<String> target, List<String> qualifiers) {
-      qualifiers.forEach(PropertyDefinition.Builder::validateQualifier);
-      target.addAll(qualifiers);
-    }
-
-    private static void validateQualifier(@Nullable String qualifier) {
-      requireNonNull(qualifier, "Qualifier cannot be null");
-      checkArgument(SUPPORTED_QUALIFIERS.contains(qualifier), "Qualifier must be one of %s", SUPPORTED_QUALIFIERS);
-    }
-
-    /**
-     * @see org.sonar.api.config.PropertyDefinition#type()
-     */
-    public Builder type(PropertyType type) {
-      this.type = type;
-      return this;
-    }
-
-    public Builder options(String first, String... rest) {
-      this.options.add(first);
-      options.addAll(asList(rest));
-      return this;
-    }
-
-    public Builder options(List<String> options) {
-      this.options.addAll(options);
-      return this;
-    }
-
-    public Builder multiValues(boolean multiValues) {
-      this.multiValues = multiValues;
-      return this;
-    }
-
-    public Builder fields(PropertyFieldDefinition first, PropertyFieldDefinition... rest) {
-      this.fields.add(first);
-      this.fields.addAll(asList(rest));
-      return this;
-    }
-
-    public Builder fields(List<PropertyFieldDefinition> fields) {
-      this.fields.addAll(fields);
-      return this;
-    }
-
-    public Builder deprecatedKey(String deprecatedKey) {
-      this.deprecatedKey = deprecatedKey;
-      return this;
-    }
-
-    /**
-     * Flag the property as hidden. Hidden properties are not displayed in Settings pages
-     * but allow plugins to benefit from type and default values when calling {@link Settings}.
-     */
-    public Builder hidden() {
-      this.hidden = true;
-      return this;
-    }
-
-    /**
-     * Set the order index in Settings pages. A property with a lower index is displayed
-     * before properties with higher index.
-     */
-    public Builder index(int index) {
-      this.index = index;
-      return this;
-    }
-
-    public PropertyDefinition build() {
-      checkArgument(!isEmpty(key), "Key must be set");
-      fixType(key, type);
-      checkArgument(onQualifiers.isEmpty() || onlyOnQualifiers.isEmpty(), "Cannot define both onQualifiers and onlyOnQualifiers");
-      checkArgument(!hidden || (onQualifiers.isEmpty() && onlyOnQualifiers.isEmpty()), "Cannot be hidden and defining qualifiers on which to display");
-      checkArgument(!JSON.equals(type) || !multiValues, "Multivalues are not allowed to be defined for JSON-type property.");
-      if (hidden) {
-        global = false;
-      }
-      if (!fields.isEmpty()) {
-        type = PROPERTY_SET;
-      }
-      return new PropertyDefinition(this);
-    }
-
-    private void fixType(String key, PropertyType type) {
-      // Auto-detect passwords and licenses for old versions of plugins that
-      // do not declare property types
-      if (type == PropertyType.STRING) {
-        if (StringUtils.endsWith(key, ".password.secured")) {
-          this.type = PropertyType.PASSWORD;
-        } else if (StringUtils.endsWith(key, ".license.secured")) {
-          this.type = PropertyType.LICENSE;
-        }
-      }
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
deleted file mode 100644 (file)
index 43c6744..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.AnnotationUtils;
-import org.sonar.api.utils.System2;
-
-import static java.util.Objects.requireNonNull;
-import static java.util.Optional.ofNullable;
-
-/**
- * Metadata of all the properties declared by plugins
- *
- * @since 2.12
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public final class PropertyDefinitions {
-
-  private final Map<String, PropertyDefinition> definitions = new HashMap<>();
-  private final Map<String, String> propertyValueFromEnvironment = new HashMap<>();
-  private final Map<String, Category> categories = new HashMap<>();
-  private final Map<String, SubCategory> subcategories = new HashMap<>();
-
-  // deprecated key -> new key
-  private final Map<String, String> deprecatedKeys = new HashMap<>();
-
-  private final System2 system;
-
-  public PropertyDefinitions(System2 system, Object... components) {
-    this.system = system;
-    addComponents(Arrays.asList(components));
-  }
-
-  public PropertyDefinitions(System2 system, Collection<PropertyDefinition> components) {
-    this.system = system;
-    addComponents(components);
-  }
-
-  public PropertyDefinitions addComponents(Collection components) {
-    return addComponents(components, "");
-  }
-
-  public PropertyDefinitions addComponents(Collection components, String defaultCategory) {
-    for (Object component : components) {
-      addComponent(component, defaultCategory);
-    }
-    return this;
-  }
-
-  public PropertyDefinitions addComponent(Object object) {
-    return addComponent(object, "");
-  }
-
-  public PropertyDefinitions addComponent(Object component, String defaultCategory) {
-    addComponentFromAnnotationProperty(component, defaultCategory);
-    if (component instanceof PropertyDefinition) {
-      PropertyDefinition propertyDefinition = (PropertyDefinition) component;
-      add(propertyDefinition, defaultCategory);
-    }
-    return this;
-  }
-
-  private PropertyDefinitions addComponentFromAnnotationProperty(Object component, String defaultCategory) {
-    Properties annotations = AnnotationUtils.getAnnotation(component, Properties.class);
-    if (annotations != null) {
-      for (Property property : annotations.value()) {
-        addProperty(property, defaultCategory);
-      }
-    }
-    Property annotation = AnnotationUtils.getAnnotation(component, Property.class);
-    if (annotation != null) {
-      addProperty(annotation, defaultCategory);
-    }
-    return this;
-  }
-
-  private PropertyDefinitions addProperty(Property property, String defaultCategory) {
-    PropertyDefinition definition = PropertyDefinition.create(property);
-    return add(definition, defaultCategory);
-  }
-
-  private PropertyDefinitions add(PropertyDefinition definition, String defaultCategory) {
-    if (!definitions.containsKey(definition.key())) {
-      definitions.put(definition.key(), definition);
-      String envVar = definition.key().toUpperCase(Locale.ENGLISH).replace('.', '_').replace('-', '_');
-      ofNullable(system.envVariable(envVar)).ifPresent(value -> propertyValueFromEnvironment.put(definition.key(), value));
-      String category = StringUtils.defaultIfBlank(definition.category(), defaultCategory);
-      categories.put(definition.key(), new Category(category));
-      String subcategory = StringUtils.defaultIfBlank(definition.subCategory(), category);
-      subcategories.put(definition.key(), new SubCategory(subcategory));
-      if (!StringUtils.isEmpty(definition.deprecatedKey()) && !definition.deprecatedKey().equals(definition.key())) {
-        deprecatedKeys.put(definition.deprecatedKey(), definition.key());
-      }
-    }
-    return this;
-  }
-
-  @CheckForNull
-  public PropertyDefinition get(String key) {
-    return definitions.get(validKey(key));
-  }
-
-  public Optional<String> getValueFromEnv(String key) {
-    return ofNullable(propertyValueFromEnvironment.get(key));
-  }
-
-  public Map<String, String> getAllPropertiesSetInEnv() {
-    return new HashMap<>(propertyValueFromEnvironment);
-  }
-
-  public Collection<PropertyDefinition> getAll() {
-    return definitions.values();
-  }
-
-  public String validKey(String key) {
-    requireNonNull(key, "key can't be null");
-    String trimmedKey = key.trim();
-    return StringUtils.defaultString(deprecatedKeys.get(trimmedKey), trimmedKey);
-  }
-
-  /**
-   * @since 3.7
-   */
-  public Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> propertiesByCategory(@Nullable String qualifier) {
-    Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> byCategory = new HashMap<>();
-    if (qualifier == null) {
-      // Special categories on global page
-      Map<SubCategory, Collection<PropertyDefinition>> emailSubCategories = new HashMap<>();
-      emailSubCategories.put(new SubCategory("email", true), new ArrayList<>());
-      byCategory.put(new Category(CoreProperties.CATEGORY_GENERAL, false), emailSubCategories);
-
-      HashMap<SubCategory, Collection<PropertyDefinition>> licenseSubCategories = new HashMap<>();
-      licenseSubCategories.put(new SubCategory("server_id", true), new ArrayList<>());
-      byCategory.put(new Category(CoreProperties.CATEGORY_LICENSES, false), licenseSubCategories);
-
-      HashMap<SubCategory, Collection<PropertyDefinition>> encryptionSubCategories = new HashMap<>();
-      encryptionSubCategories.put(new SubCategory("encryption", true), new ArrayList<>());
-      byCategory.put(new Category(CoreProperties.CATEGORY_SECURITY, false), encryptionSubCategories);
-    }
-    for (PropertyDefinition definition : getAll()) {
-      if (qualifier == null ? definition.global() : definition.qualifiers().contains(qualifier)) {
-        Category category = categories.get(definition.key());
-        if (!byCategory.containsKey(category)) {
-          byCategory.put(category, new HashMap<>());
-        }
-        SubCategory subCategory = subcategories.get(definition.key());
-        if (!byCategory.get(category).containsKey(subCategory)) {
-          byCategory.get(category).put(subCategory, new ArrayList<>());
-        }
-        byCategory.get(category).get(subCategory).add(definition);
-      }
-    }
-    return byCategory;
-  }
-
-  @CheckForNull
-  public String getDefaultValue(String key) {
-    PropertyDefinition def = get(key);
-    if (def == null) {
-      return null;
-    }
-    return StringUtils.defaultIfEmpty(def.defaultValue(), null);
-  }
-
-  public String getCategory(String key) {
-    return categories.get(validKey(key)).toString();
-  }
-
-  public String getSubCategory(String key) {
-    return subcategories.get(validKey(key)).toString();
-  }
-
-  public String getCategory(Property prop) {
-    return getCategory(prop.key());
-  }
-
-  public String getNewKey(String deprecatedKey) {
-    return deprecatedKeys.get(deprecatedKey);
-  }
-
-  public String getDeprecatedKey(String key) {
-    PropertyDefinition def = get(key);
-    if (def == null) {
-      return null;
-    }
-    return StringUtils.defaultIfEmpty(def.deprecatedKey(), null);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java
deleted file mode 100644 (file)
index c5836a8..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.PropertyField;
-import org.sonar.api.PropertyType;
-
-import static java.util.Arrays.asList;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 3.3
- */
-public final class PropertyFieldDefinition {
-  private final String key;
-  private final String name;
-  private final String description;
-  private final PropertyType type;
-  private final List<String> options;
-
-  private PropertyFieldDefinition(Builder builder) {
-    this.key = builder.key;
-    this.name = builder.name;
-    this.description = builder.description;
-    this.type = builder.type;
-    this.options = builder.options;
-  }
-
-  static List<PropertyFieldDefinition> create(PropertyField[] fields) {
-    List<PropertyFieldDefinition> definitions = new ArrayList<>();
-    for (PropertyField field : fields) {
-      definitions.add(PropertyFieldDefinition.build(field.key())
-        .name(field.name())
-        .description(field.description())
-        .type(field.type())
-        .options(field.options())
-        .build());
-    }
-    return definitions;
-  }
-
-  public static Builder build(String key) {
-    return new Builder(key);
-  }
-
-  public String key() {
-    return key;
-  }
-
-  public String name() {
-    return name;
-  }
-
-  public String description() {
-    return description;
-  }
-
-  public PropertyType type() {
-    return type;
-  }
-
-  public List<String> options() {
-    return options;
-  }
-
-  public PropertyDefinition.Result validate(@Nullable String value) {
-    return PropertyDefinition.validate(type, value, options);
-  }
-
-  public static class Builder {
-    private String key;
-    private String name;
-    private String description;
-    private PropertyType type;
-    private List<String> options;
-
-    private Builder(String key) {
-      this.key = key;
-      this.name = "";
-      this.description = "";
-      this.type = PropertyType.STRING;
-      this.options = new ArrayList<>();
-    }
-
-    public Builder name(String name) {
-      this.name = name;
-      return this;
-    }
-
-    public Builder description(String description) {
-      this.description = description;
-      return this;
-    }
-
-    public Builder type(PropertyType type) {
-      this.type = type;
-      return this;
-    }
-
-    public Builder options(String... options) {
-      this.options.addAll(asList(options));
-      return this;
-    }
-
-    public Builder options(List<String> options) {
-      this.options.addAll(options);
-      return this;
-    }
-
-    public PropertyFieldDefinition build() {
-      checkArgument(!StringUtils.isEmpty(key), "Key must be set");
-      checkArgument(!StringUtils.isEmpty(name), "Name must be set");
-      return new PropertyFieldDefinition(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
deleted file mode 100644 (file)
index ade6114..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.Date;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.DateUtils;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * @deprecated since 6.5 use {@link Configuration}. Implementation moved out of the API in 8.3. Only remains minimal interface to make some outdated plugins happy.
- */
-@ServerSide
-@ComputeEngineSide
-@ScannerSide
-@SonarLintSide
-@Deprecated
-public abstract class Settings {
-
-  /**
-   * @return {@code true} if the property has a non-default value, else {@code false}.
-   */
-  public abstract boolean hasKey(String key);
-
-  /**
-   * The effective value of the specified property. Can return
-   * {@code null} if the property is not set and has no
-   * defined default value.
-   * <p>
-   * If the property is encrypted with a secret key,
-   * then the returned value is decrypted.
-   * </p>
-   *
-   * @throws IllegalStateException if value is encrypted but fails to be decrypted.
-   */
-  @CheckForNull
-  public abstract String getString(String key);
-
-  /**
-   * Effective value as boolean. It is {@code false} if {@link #getString(String)}
-   * does not return {@code "true"}, even if it's not a boolean representation.
-   *
-   * @return {@code true} if the effective value is {@code "true"}, else {@code false}.
-   */
-  public abstract boolean getBoolean(String key);
-
-  /**
-   * Effective value as {@code int}.
-   *
-   * @return the value as {@code int}. If the property does not have value nor default value, then {@code 0} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable integer
-   */
-  public abstract int getInt(String key);
-
-  /**
-   * Effective value as {@code long}.
-   *
-   * @return the value as {@code long}. If the property does not have value nor default value, then {@code 0L} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable {@code long}
-   */
-  public abstract long getLong(String key);
-
-  /**
-   * Effective value as {@link Date}, without time fields. Format is {@link DateUtils#DATE_FORMAT}.
-   *
-   * @return the value as a {@link Date}. If the property does not have value nor default value, then {@code null} is returned.
-   * @throws RuntimeException if value is not empty and is not in accordance with {@link DateUtils#DATE_FORMAT}.
-   */
-  @CheckForNull
-  public abstract Date getDate(String key);
-
-  /**
-   * Effective value as {@link Date}, with time fields. Format is {@link DateUtils#DATETIME_FORMAT}.
-   *
-   * @return the value as a {@link Date}. If the property does not have value nor default value, then {@code null} is returned.
-   * @throws RuntimeException if value is not empty and is not in accordance with {@link DateUtils#DATETIME_FORMAT}.
-   */
-  @CheckForNull
-  public abstract Date getDateTime(String key);
-
-  /**
-   * Effective value as {@code Float}.
-   *
-   * @return the value as {@code Float}. If the property does not have value nor default value, then {@code null} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable number
-   */
-  @CheckForNull
-  public abstract Float getFloat(String key);
-
-  /**
-   * Effective value as {@code Double}.
-   *
-   * @return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned.
-   * @throws NumberFormatException if value is not empty and is not a parsable number
-   */
-  @CheckForNull
-  public abstract Double getDouble(String key);
-
-  /**
-   * Value is split by comma and trimmed. Never returns null.
-   * <br>
-   * Examples :
-   * <ul>
-   * <li>"one,two,three " -&gt; ["one", "two", "three"]</li>
-   * <li>"  one, two, three " -&gt; ["one", "two", "three"]</li>
-   * <li>"one, , three" -&gt; ["one", "", "three"]</li>
-   * </ul>
-   */
-  public abstract String[] getStringArray(String key);
-
-  /**
-   * Value is split by carriage returns.
-   *
-   * @return non-null array of lines. The line termination characters are excluded.
-   * @since 3.2
-   */
-  public abstract String[] getStringLines(String key);
-
-  /**
-   * Value is split and trimmed.
-   */
-  public abstract String[] getStringArrayBySeparator(String key, String separator);
-
-  public abstract List<String> getKeysStartingWith(String prefix);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/SubCategory.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/SubCategory.java
deleted file mode 100644 (file)
index c0cc989..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-/**
- * @since 3.7
- */
-public class SubCategory extends Category {
-
-  SubCategory(String originalKey) {
-    super(originalKey);
-  }
-
-  SubCategory(String originalKey, boolean special) {
-    super(originalKey, special);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/package-info.java
deleted file mode 100644 (file)
index 3b0343e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/BaseIdentifiable.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/BaseIdentifiable.java
deleted file mode 100644 (file)
index 72b4daa..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database;
-
-/**
- * @deprecated since 7.8
- */
-@Deprecated
-public class BaseIdentifiable<G> {
-
-  private Integer id;
-
-  public Integer getId() {
-    return id;
-  }
-
-  public G setId(Integer id) {
-    this.id = id;
-    return (G) this;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java
deleted file mode 100644 (file)
index 7a75dbe..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database;
-
-/**
- * @deprecated since 7.1, plugins don't connect to database
- */
-@Deprecated
-public interface DatabaseProperties {
-
-  String PROP_URL = "sonar.jdbc.url";
-  String PROP_DRIVER = "sonar.jdbc.driverClassName";
-  String PROP_USER = "sonar.jdbc.username";
-
-  String PROP_USER_DEFAULT_VALUE = "";
-  String PROP_PASSWORD = "sonar.jdbc.password";
-  String PROP_PASSWORD_DEFAULT_VALUE = "";
-
-  /**
-   * @since 3.2
-   */
-  String PROP_EMBEDDED_PORT = "sonar.embeddedDatabase.port";
-
-  /**
-   * @since 3.2
-   */
-  String PROP_EMBEDDED_PORT_DEFAULT_VALUE = "9092";
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java
deleted file mode 100644 (file)
index a6d8905..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database.model;
-
-import org.sonar.api.database.BaseIdentifiable;
-
-/**
- * @since 2.2
- * @deprecated since 7.8
- */
-@Deprecated
-public class User extends BaseIdentifiable {
-
-  private String login;
-  private String name;
-  private String email;
-
-  public String getLogin() {
-    return login;
-  }
-
-  public User setLogin(String login) {
-    this.login = login;
-    return this;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public User setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public String getEmail() {
-    return email;
-  }
-
-  public User setEmail(String email) {
-    this.email = email;
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    User user = (User) o;
-    return login.equals(user.login);
-  }
-
-  @Override
-  public int hashCode() {
-    return login.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("User{");
-    sb.append("login='").append(login).append('\'');
-    sb.append(", name='").append(name).append('\'');
-    sb.append(", email='").append(email).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/package-info.java
deleted file mode 100644 (file)
index d3741cb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database.model;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/package-info.java
deleted file mode 100644 (file)
index 87f7481..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java
deleted file mode 100644 (file)
index 2a4beca..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.i18n;
-
-import java.util.Date;
-import java.util.Locale;
-import javax.annotation.Nullable;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Main component that provides translation facilities.
- *
- * @since 2.10
- * @deprecated since 7.8 as plugins have no reason to use it anymore
- */
-@ServerSide
-@ComputeEngineSide
-@Deprecated
-public interface I18n {
-
-  /**
-   * Searches the message of the <code>key</code> for the <code>locale</code> in the list of available bundles.
-   * <br>
-   * If not found in any bundle, <code>defaultValue</code> is returned.
-   * <br>
-   * If additional parameters are given (in the objects list), the result is used as a message pattern
-   * to use in a MessageFormat object along with the given parameters.
-   *
-   * @param locale       the locale to translate into
-   * @param key          the key of the pattern to translate
-   * @param defaultValue the default pattern returned when the key is not found in any bundle
-   * @param parameters   the parameters used to format the message from the translated pattern.
-   * @return the message formatted with the translated pattern and the given parameters
-   */
-  String message(final Locale locale, final String key, @Nullable final String defaultValue, final Object... parameters);
-
-  /**
-   * Return the distance in time for a duration in milliseconds.
-   * <br>
-   * Examples :
-   * <ul>
-   * <li>age(Locale.ENGLISH, 1000) -&gt; less than a minute</li>
-   * <li>age(Locale.ENGLISH, 60000) -&gt; about a minute</li>
-   * <li>age(Locale.ENGLISH, 120000) -&gt; 2 minutes</li>
-   * <li>age(Locale.ENGLISH, 3600000) -&gt; about an hour</li>
-   * <li>age(Locale.ENGLISH, 7200000) -&gt; 2 hours</li>
-   * <li>age(Locale.ENGLISH, 86400000) -&gt; a day</li>
-   * <li>age(Locale.ENGLISH, 172800000) -&gt; 2 days</li>
-   * </ul>
-   *
-   * @since 4.2
-   */
-  String age(Locale locale, long durationInMillis);
-
-  /**
-   * Return the distance in time between two dates.
-   *
-   * @see I18n#age(Locale, long durationInMillis)
-   * @since 4.2
-   */
-  String age(Locale locale, Date fromDate, Date toDate);
-
-  /**
-   * Reports the distance in time a date and now.
-   *
-   * @see I18n#age(Locale, Date, Date)
-   * @since 4.2
-   */
-  String ageFromNow(Locale locale, Date date);
-
-  /**
-   * Return the formatted datetime.
-   * <p>
-   * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))}
-   * returns {@code "Jan 22, 2014 7:10 PM"}.
-   * </p>
-   *
-   * @since 4.2
-   */
-  String formatDateTime(Locale locale, Date date);
-
-  /**
-   * Return the formatted date.
-   * <br>
-   * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22"))}
-   * returns {@code "Jan 22, 2014"}.
-   *
-   * @since 4.2
-   */
-  String formatDate(Locale locale, Date date);
-
-  /**
-   * Return the formatted decimal, with always one fraction digit.
-   * <br>
-   * Example: {@code formatDouble(Locale.FRENCH, 10.56)} returns {@code "10,6"}.
-   *
-   * @since 4.4
-   */
-  String formatDouble(Locale locale, Double value);
-
-  /**
-   * Return the formatted integer.
-   * <br>
-   * Example: {@code formatInteger(Locale.ENGLISH, 100000)} returns {@code "100,000"}.
-   *
-   * @since 4.4
-   */
-  String formatInteger(Locale locale, Integer value);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/package-info.java
deleted file mode 100644 (file)
index 2b0335c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.i18n;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/DefaultTransitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/DefaultTransitions.java
deleted file mode 100644 (file)
index 87a35c1..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.List;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableList;
-
-/**
- * @since 3.6
- */
-public interface DefaultTransitions {
-
-  String CONFIRM = "confirm";
-  String UNCONFIRM = "unconfirm";
-  String REOPEN = "reopen";
-  String RESOLVE = "resolve";
-  String FALSE_POSITIVE = "falsepositive";
-  String CLOSE = "close";
-
-  /**
-   * @since 5.1
-   */
-  String WONT_FIX = "wontfix";
-
-  /**
-   * @deprecated since 8.1, transition has no effect
-   */
-  String SET_AS_IN_REVIEW = "setinreview";
-
-  /**
-   * @since 7.8
-   * @deprecated since 8.1, security hotspots can no longer be converted to vulnerabilities
-   */
-  @Deprecated
-  String OPEN_AS_VULNERABILITY = "openasvulnerability";
-
-  /**
-   * @since 7.8
-   */
-  String RESOLVE_AS_REVIEWED = "resolveasreviewed";
-
-  /**
-   * @since 8.1
-   */
-  String RESOLVE_AS_SAFE = "resolveassafe";
-
-  /**
-   * @since 9.4
-   */
-  String RESOLVE_AS_ACKNOWLEDGED = "resolveasacknowledged";
-
-  /**
-   * @since 7.8
-   */
-  String RESET_AS_TO_REVIEW = "resetastoreview";
-
-  /**
-   * @since 4.4
-   */
-  List<String> ALL = unmodifiableList(asList(CONFIRM, UNCONFIRM, REOPEN, RESOLVE, FALSE_POSITIVE, WONT_FIX, CLOSE,
-    SET_AS_IN_REVIEW, RESOLVE_AS_REVIEWED, RESET_AS_TO_REVIEW));
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java
deleted file mode 100644 (file)
index eff01cf..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.Duration;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableList;
-
-/**
- * @since 3.6
- */
-public interface Issue extends Serializable {
-
-  /**
-   * Maximum number of characters in the message.
-   * In theory it should be 4_000 UTF-8 characters but unfortunately
-   * Oracle DB does not support more than 4_000 bytes, even if column
-   * issues.message is created with type VARCHAR2(4000 CHAR).
-   * In order to have the same behavior on all databases, message
-   * is truncated to 4_000 / 3 (maximum bytes per UTF-8 character)
-   * = 1_333 characters.
-   */
-  int MESSAGE_MAX_SIZE = 1_333;
-
-  /**
-   * Default status when creating an issue.
-   */
-  String STATUS_OPEN = "OPEN";
-  String STATUS_CONFIRMED = "CONFIRMED";
-  String STATUS_REOPENED = "REOPENED";
-  String STATUS_RESOLVED = "RESOLVED";
-  String STATUS_CLOSED = "CLOSED";
-
-  String RESOLUTION_FIXED = "FIXED";
-
-  /**
-   * Resolution when issue is flagged as false positive.
-   */
-  String RESOLUTION_FALSE_POSITIVE = "FALSE-POSITIVE";
-
-  /**
-   * Resolution when rule has been uninstalled or disabled in the Quality profile.
-    */
-  String RESOLUTION_REMOVED = "REMOVED";
-
-  /**
-   * Issue is irrelevant in the context and was muted by user.
-   * @since 5.1
-   */
-  String RESOLUTION_WONT_FIX = "WONTFIX";
-
-  /**
-   * Security Hotspot has been reviewed and resolved as safe.
-   * @since 8.1
-   */
-  String RESOLUTION_SAFE = "SAFE";
-
-  /**
-   * Security Hotspot has been reviewed and acknowledged that it poses a risk.
-   * @since 9.4
-   */
-  String RESOLUTION_ACKNOWLEDGED = "ACKNOWLEDGED";
-
-  List<String> RESOLUTIONS = unmodifiableList(asList(RESOLUTION_FALSE_POSITIVE, RESOLUTION_WONT_FIX, RESOLUTION_FIXED, RESOLUTION_REMOVED));
-
-  List<String> SECURITY_HOTSPOT_RESOLUTIONS = unmodifiableList(asList(RESOLUTION_FIXED, RESOLUTION_SAFE, RESOLUTION_ACKNOWLEDGED));
-
-  /**
-   * @since 7.8
-   */
-  String STATUS_TO_REVIEW = "TO_REVIEW";
-
-  /**
-   * @deprecated since 8.1, status has been mapped as `TO_REVIEW`
-   */
-  @Deprecated
-  String STATUS_IN_REVIEW = "IN_REVIEW";
-
-  /**
-   * @since 7.8
-   */
-  String STATUS_REVIEWED = "REVIEWED";
-
-  /**
-   * Return all available statuses
-   *
-   * @since 4.4
-   */
-  List<String> STATUSES = unmodifiableList(asList(STATUS_OPEN, STATUS_CONFIRMED, STATUS_REOPENED, STATUS_RESOLVED, STATUS_CLOSED,
-    STATUS_TO_REVIEW, STATUS_REVIEWED));
-
-  /**
-   * Unique generated key. It looks like "d2de809c-1512-4ae2-9f34-f5345c9f1a13".
-   */
-  String key();
-
-  /**
-   * Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c").
-   * Keys of Java packages and classes are currently in a special format: "my_project:com.company" and "my_project:com.company.Foo".
-   */
-  String componentKey();
-
-  RuleKey ruleKey();
-
-  String language();
-
-  /**
-   * See constants in {@link org.sonar.api.rule.Severity}.
-   */
-  String severity();
-
-  @CheckForNull
-  String message();
-
-  /**
-   * Optional line number. If set, then it's greater than or equal 1.
-   */
-  @CheckForNull
-  Integer line();
-
-  /**
-   * Arbitrary distance to threshold for resolving the issue.
-   * <br>
-   * For examples:
-   * <ul>
-   *   <li>for the rule "Avoid too complex methods" : current complexity - max allowed complexity</li>
-   *   <li>for the rule "Avoid Duplications" : number of duplicated blocks</li>
-   *   <li>for the rule "Insufficient Line Coverage" : number of lines to cover to reach the accepted threshold</li>
-   * </ul>
-   *
-   * @since 5.5
-   */
-  @CheckForNull
-  Double gap();
-
-  /**
-   * See constant values in {@link Issue}.
-   */
-  String status();
-
-  /**
-   * The type of resolution, or null if the issue is not resolved. See constant values in {@link Issue}.
-   */
-  @CheckForNull
-  String resolution();
-
-  /**
-   * UUID of the user who is assigned to this issue. Null if the issue is not assigned.
-   */
-  @CheckForNull
-  String assignee();
-
-  Date creationDate();
-
-  Date updateDate();
-
-  /**
-   * Date when status was set to {@link Issue#STATUS_CLOSED}, else null.
-   */
-  @CheckForNull
-  Date closeDate();
-
-  /**
-   * @deprecated since 9.4, attribute was already not returning any element since 5.2
-   */
-  @Deprecated
-  @CheckForNull
-  String attribute(String key);
-
-  /**
-   * Empty on batch side since version 5.2. Attributes are moved to server's Compute Engine. No use-case for keeping them
-   * on batch side for now
-   */
-  /**
-   * @deprecated since 9.4, attribute was already not returning any element since 5.2
-   */
-  @Deprecated
-  Map<String, String> attributes();
-
-  /**
-   * Login of the SCM account that introduced this issue. Requires the
-   * <a href="http://www.sonarsource.com/products/plugins/developer-tools/developer-cockpit/">Developer Cockpit Plugin</a> to be installed.
-   */
-  @CheckForNull
-  String authorLogin();
-
-  /**
-   * Non-null list of comments, ordered by chronological order.
-   *
-   * @deprecated since 7.2, comments are not more available
-   */
-  @Deprecated
-  List<IssueComment> comments();
-
-  /**
-   * During a scan return if the current issue is a new one.
-   * @return always false on server side
-   * @since 4.0
-   */
-  boolean isNew();
-
-  /**
-   * During a scan returns true if the issue is copied from another branch.
-   * @since 6.6
-   */
-  boolean isCopied();
-
-  /**
-   * @since 5.5
-   */
-  @CheckForNull
-  Duration effort();
-
-  /**
-   * @since 5.0
-   */
-  String projectKey();
-
-  /**
-   * @since 5.0
-   */
-  String projectUuid();
-
-  /**
-   * @since 5.0
-   */
-  String componentUuid();
-
-  /**
-   * @since 5.1
-   */
-  Collection<String> tags();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueComment.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueComment.java
deleted file mode 100644 (file)
index 7ee1930..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.Date;
-import javax.annotation.CheckForNull;
-
-/**
- * @deprecated since 7.2, comments are no more available
- */
-@Deprecated
-public interface IssueComment {
-  String markdownText();
-
-  String key();
-
-  String issueKey();
-
-  @CheckForNull
-  String userLogin();
-
-  Date createdAt();
-
-  Date updatedAt();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java
deleted file mode 100644 (file)
index 243dfe4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.Set;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Issue filter used to ignore issues created on lines commented with the tag "NOSONAR".
- * <br>
- * Plugins, via {@link org.sonar.api.batch.sensor.Sensor}s, must feed this filter by registering the
- * lines that contain "NOSONAR". Note that filters are disabled for the issues reported by
- * end-users from UI or web services.
- *
- * @since 3.6
- */
-@ScannerSide
-public abstract class NoSonarFilter {
-
-  /**
-   * Register lines in a file that contains the NOSONAR flag.
-   *
-   * @param inputFile
-   * @param noSonarLines Line number starts at 1 in a file
-   * @since 5.0
-   * @since 7.6 the method can be called multiple times by different sensors, and NOSONAR lines are merged
-   */
-  public abstract NoSonarFilter noSonarInFile(InputFile inputFile, Set<Integer> noSonarLines);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/package-info.java
deleted file mode 100644 (file)
index f0dcc74..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
deleted file mode 100644 (file)
index dcde928..0000000
+++ /dev/null
@@ -1,1860 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.NoSuchElementException;
-import org.sonar.api.utils.SonarException;
-
-import static org.sonar.api.measures.Metric.ValueType.BOOL;
-
-/**
- * @since 1.10
- */
-public final class CoreMetrics {
-
-  // the following fields are not final to avoid compile-time constants used by plugins
-  public static String DOMAIN_SIZE = "Size";
-  public static String DOMAIN_COVERAGE = "Coverage";
-
-  public static String DOMAIN_COMPLEXITY = "Complexity";
-  /**
-   * @deprecated since 6.2. Merged into {@link #DOMAIN_SIZE}
-   */
-  @Deprecated
-  public static String DOMAIN_DOCUMENTATION = "Documentation";
-  public static String DOMAIN_SCM = "SCM";
-  public static String DOMAIN_ISSUES = "Issues";
-  public static String DOMAIN_GENERAL = "General";
-  public static String DOMAIN_DUPLICATIONS = "Duplications";
-
-  /**
-   * @deprecated in 5.5. Renamed to {@link #DOMAIN_DUPLICATIONS}
-   */
-  @Deprecated
-  public static String DOMAIN_DUPLICATION = "Duplication";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static String DOMAIN_MAINTAINABILITY = "Maintainability";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static String DOMAIN_RELIABILITY = "Reliability";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static String DOMAIN_SECURITY = "Security";
-
-  /**
-   * @since 8.2
-   */
-  public static String DOMAIN_SECURITY_REVIEW = "SecurityReview";
-
-  /**
-   * @since 5.5
-   */
-  public static String DOMAIN_RELEASABILITY = "Releasability";
-
-  /**
-   * Computed by the platform since SQ 5.1
-   */
-  public static final String LINES_KEY = "lines";
-  public static final Metric<Integer> LINES = new Metric.Builder(LINES_KEY, "Lines", Metric.ValueType.INT)
-    .setDescription("Lines")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  public static final String GENERATED_LINES_KEY = "generated_lines";
-  public static final Metric<Integer> GENERATED_LINES = new Metric.Builder(GENERATED_LINES_KEY, "Generated Lines", Metric.ValueType.INT)
-    .setDescription("Number of generated lines")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String NCLOC_KEY = "ncloc";
-  public static final Metric<Integer> NCLOC = new Metric.Builder(NCLOC_KEY, "Lines of Code", Metric.ValueType.INT)
-    .setDescription("Non commenting lines of code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * @since 6.1
-   */
-  public static final String NEW_LINES_KEY = "new_lines";
-  /**
-   * @since 6.1
-   */
-  public static final Metric<Integer> NEW_LINES = new Metric.Builder(NEW_LINES_KEY, "New Lines", Metric.ValueType.INT)
-    .setDescription("New lines")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * @since 4.4
-   */
-  public static final String NCLOC_LANGUAGE_DISTRIBUTION_KEY = "ncloc_language_distribution";
-
-  /**
-   * @since 4.4
-   */
-  public static final Metric<String> NCLOC_LANGUAGE_DISTRIBUTION = new Metric.Builder(NCLOC_LANGUAGE_DISTRIBUTION_KEY, "Lines of Code Per Language", Metric.ValueType.DATA)
-    .setDescription("Non Commenting Lines of Code Distributed By Language")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  public static final String GENERATED_NCLOC_KEY = "generated_ncloc";
-  public static final Metric<Integer> GENERATED_NCLOC = new Metric.Builder(GENERATED_NCLOC_KEY, "Generated Lines of Code", Metric.ValueType.INT)
-    .setDescription("Generated non Commenting Lines of Code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String CLASSES_KEY = "classes";
-  public static final Metric<Integer> CLASSES = new Metric.Builder(CLASSES_KEY, "Classes", Metric.ValueType.INT)
-    .setDescription("Classes")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  public static final String FILES_KEY = "files";
-  /**
-   * Computed by the platform.
-   */
-  public static final Metric<Integer> FILES = new Metric.Builder(FILES_KEY, "Files", Metric.ValueType.INT)
-    .setDescription("Number of files")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * @deprecated since 7.7 - no longer computed
-   */
-  @Deprecated
-  public static final String DIRECTORIES_KEY = "directories";
-
-  /**
-   * @deprecated since 7.7 - no longer computed
-   */
-  @Deprecated
-  public static final Metric<Integer> DIRECTORIES = new Metric.Builder(DIRECTORIES_KEY, "Directories", Metric.ValueType.INT)
-    .setDescription("Directories")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * Computed by the platform.
-   */
-  public static final String FUNCTIONS_KEY = "functions";
-  public static final Metric<Integer> FUNCTIONS = new Metric.Builder(FUNCTIONS_KEY, "Functions", Metric.ValueType.INT)
-    .setDescription("Functions")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  public static final String STATEMENTS_KEY = "statements";
-  public static final Metric<Integer> STATEMENTS = new Metric.Builder(STATEMENTS_KEY, "Statements", Metric.ValueType.INT)
-    .setDescription("Number of statements")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a>
-   * @deprecated since 6.2
-   */
-  @Deprecated
-  public static final String PUBLIC_API_KEY = "public_api";
-  public static final Metric<Integer> PUBLIC_API = new Metric.Builder(PUBLIC_API_KEY, "Public API", Metric.ValueType.INT)
-    .setDescription("Public API")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_DOCUMENTATION)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 3.0
-   */
-  public static final String PROJECTS_KEY = "projects";
-
-  /**
-   * @since 3.0
-   */
-  public static final Metric<Integer> PROJECTS = new Metric.Builder(PROJECTS_KEY, "Project branches", Metric.ValueType.INT)
-    .setDescription("Number of project branches")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * Moved to Size domain since 6.2
-   */
-  public static final String COMMENT_LINES_KEY = "comment_lines";
-  public static final Metric<Integer> COMMENT_LINES = new Metric.Builder(COMMENT_LINES_KEY, "Comment Lines", Metric.ValueType.INT)
-    .setDescription("Number of comment lines")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * Moved to Size domain since 6.2
-   */
-  public static final String COMMENT_LINES_DENSITY_KEY = "comment_lines_density";
-  public static final Metric<Double> COMMENT_LINES_DENSITY = new Metric.Builder(COMMENT_LINES_DENSITY_KEY, "Comments (%)", Metric.ValueType.PERCENT)
-    .setDescription("Comments balanced by ncloc + comment lines")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // DOCUMENTATION
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a>
-   * @deprecated since 6.2
-   */
-  @Deprecated
-  public static final String PUBLIC_DOCUMENTED_API_DENSITY_KEY = "public_documented_api_density";
-  public static final Metric<Double> PUBLIC_DOCUMENTED_API_DENSITY = new Metric.Builder(PUBLIC_DOCUMENTED_API_DENSITY_KEY, "Public Documented API (%)", Metric.ValueType.PERCENT)
-    .setDescription("Public documented classes and functions balanced by ncloc")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DOCUMENTATION)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .setOptimizedBestValue(true)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @see <a href="https://jira.sonarsource.com/browse/SONAR-8328">SONAR-8328</a>
-   * @deprecated since 6.2
-   */
-  @Deprecated
-  public static final String PUBLIC_UNDOCUMENTED_API_KEY = "public_undocumented_api";
-  public static final Metric<Integer> PUBLIC_UNDOCUMENTED_API = new Metric.Builder(PUBLIC_UNDOCUMENTED_API_KEY, "Public Undocumented API", Metric.ValueType.INT)
-    .setDescription("Public undocumented classes, functions and variables")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DOCUMENTATION)
-    .setBestValue(0.0)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setHidden(true)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // COMPLEXITY
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  public static final String COMPLEXITY_KEY = "complexity";
-  public static final Metric<Integer> COMPLEXITY = new Metric.Builder(COMPLEXITY_KEY, "Cyclomatic Complexity", Metric.ValueType.INT)
-    .setDescription("Cyclomatic complexity")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .create();
-
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String FILE_COMPLEXITY_KEY = "file_complexity";
-  /**
-   * Information about the cyclomatic complexity per file, calculated by divided the {@link #COMPLEXITY} by the number of {@link #FILES}.
-   *
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<Double> FILE_COMPLEXITY = new Metric.Builder(FILE_COMPLEXITY_KEY, "Complexity / File", Metric.ValueType.FLOAT)
-    .setDescription("Complexity average by file")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 3.6
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String COMPLEXITY_IN_CLASSES_KEY = "complexity_in_classes";
-
-  /**
-   * @since 3.6
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<Integer> COMPLEXITY_IN_CLASSES = new Metric.Builder(COMPLEXITY_IN_CLASSES_KEY, "Complexity in Classes", Metric.ValueType.INT)
-    .setDescription("Cyclomatic complexity in classes")
-    .setHidden(true)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setDeleteHistoricalData(true)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String CLASS_COMPLEXITY_KEY = "class_complexity";
-  /**
-   * Information about the cyclomatic complexity per class, calculated by divided the {@link #COMPLEXITY_IN_CLASSES} by the number of {@link #CLASSES}.
-   *
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<Double> CLASS_COMPLEXITY = new Metric.Builder(CLASS_COMPLEXITY_KEY, "Complexity / Class", Metric.ValueType.FLOAT)
-    .setDescription("Complexity average by class")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 3.6
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String COMPLEXITY_IN_FUNCTIONS_KEY = "complexity_in_functions";
-  /**
-   * @since 3.6
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<Integer> COMPLEXITY_IN_FUNCTIONS = new Metric.Builder(COMPLEXITY_IN_FUNCTIONS_KEY, "Complexity in Functions", Metric.ValueType.INT)
-    .setDescription("Cyclomatic complexity in functions")
-    .setHidden(true)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setDeleteHistoricalData(true)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String FUNCTION_COMPLEXITY_KEY = "function_complexity";
-  /**
-   * Information about the cyclomatic complexity per function, calculated by divided the {@link #COMPLEXITY_IN_FUNCTIONS} by the number of {@link #FUNCTIONS}.
-   *
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<Double> FUNCTION_COMPLEXITY = new Metric.Builder(FUNCTION_COMPLEXITY_KEY, "Complexity / Function", Metric.ValueType.FLOAT)
-    .setDescription("Complexity average by function")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String FUNCTION_COMPLEXITY_DISTRIBUTION_KEY = "function_complexity_distribution";
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<String> FUNCTION_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FUNCTION_COMPLEXITY_DISTRIBUTION_KEY, "Function Distribution / Complexity",
-    Metric.ValueType.DISTRIB)
-      .setDescription("Functions distribution /complexity")
-      .setDirection(Metric.DIRECTION_NONE)
-      .setQualitative(true)
-      .setDomain(DOMAIN_COMPLEXITY)
-      .setHidden(true)
-      .create();
-
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final String FILE_COMPLEXITY_DISTRIBUTION_KEY = "file_complexity_distribution";
-  /**
-   * @deprecated since 6.7
-   */
-  @Deprecated
-  public static final Metric<String> FILE_COMPLEXITY_DISTRIBUTION = new Metric.Builder(FILE_COMPLEXITY_DISTRIBUTION_KEY, "File Distribution / Complexity",
-    Metric.ValueType.DISTRIB)
-      .setDescription("Files distribution /complexity")
-      .setDirection(Metric.DIRECTION_NONE)
-      .setQualitative(true)
-      .setDomain(DOMAIN_COMPLEXITY)
-      .setHidden(true)
-      .create();
-
-  public static final String COGNITIVE_COMPLEXITY_KEY = "cognitive_complexity";
-  public static final Metric<Integer> COGNITIVE_COMPLEXITY = new Metric.Builder(COGNITIVE_COMPLEXITY_KEY, "Cognitive Complexity", Metric.ValueType.INT)
-    .setDescription("Cognitive complexity")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COMPLEXITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // UNIT TESTS
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  public static final String TESTS_KEY = "tests";
-
-  /**
-   * Value of measure for this metric can be saved from Sensor, taking into account following rules:
-   * <ul>
-   * <li>Non-zero value should be saved for resources representing tests. And Sonar provides default Decorator, which will decorate parent resources.</li>
-   * <li>Should include {@link #TEST_FAILURES} and {@link #TEST_ERRORS}, but should not include {@link #SKIPPED_TESTS}.</li>
-   * </ul>
-   */
-  public static final Metric<Integer> TESTS = new Metric.Builder(TESTS_KEY, "Unit Tests", Metric.ValueType.INT)
-    .setDescription("Number of unit tests")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COVERAGE)
-    .create();
-
-  public static final String TEST_EXECUTION_TIME_KEY = "test_execution_time";
-  public static final Metric<Long> TEST_EXECUTION_TIME = new Metric.Builder(TEST_EXECUTION_TIME_KEY, "Unit Test Duration", Metric.ValueType.MILLISEC)
-    .setDescription("Execution duration of unit tests")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COVERAGE)
-    .create();
-
-  public static final String TEST_ERRORS_KEY = "test_errors";
-  public static final Metric<Integer> TEST_ERRORS = new Metric.Builder(TEST_ERRORS_KEY, "Unit Test Errors", Metric.ValueType.INT)
-    .setDescription("Number of unit test errors")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String SKIPPED_TESTS_KEY = "skipped_tests";
-  public static final Metric<Integer> SKIPPED_TESTS = new Metric.Builder(SKIPPED_TESTS_KEY, "Skipped Unit Tests", Metric.ValueType.INT)
-    .setDescription("Number of skipped unit tests")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String TEST_FAILURES_KEY = "test_failures";
-  public static final Metric<Integer> TEST_FAILURES = new Metric.Builder(TEST_FAILURES_KEY, "Unit Test Failures", Metric.ValueType.INT)
-    .setDescription("Number of unit test failures")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String TEST_SUCCESS_DENSITY_KEY = "test_success_density";
-  public static final Metric<Double> TEST_SUCCESS_DENSITY = new Metric.Builder(TEST_SUCCESS_DENSITY_KEY, "Unit Test Success (%)", Metric.ValueType.PERCENT)
-    .setDescription("Density of successful unit tests")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String COVERAGE_KEY = "coverage";
-  public static final Metric<Double> COVERAGE = new Metric.Builder(COVERAGE_KEY, "Coverage", Metric.ValueType.PERCENT)
-    .setDescription("Coverage by tests")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .create();
-
-  public static final String NEW_COVERAGE_KEY = "new_coverage";
-  public static final Metric<Double> NEW_COVERAGE = new Metric.Builder(NEW_COVERAGE_KEY, "Coverage on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Coverage of new/changed code")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String LINES_TO_COVER_KEY = "lines_to_cover";
-
-  public static final Metric<Integer> LINES_TO_COVER = new Metric.Builder(LINES_TO_COVER_KEY, "Lines to Cover", Metric.ValueType.INT)
-    .setDescription("Lines to cover")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COVERAGE)
-    .create();
-
-  public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover";
-  public static final Metric<Integer> NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "Lines to Cover on New Code", Metric.ValueType.INT)
-    .setDescription("Lines to cover on new code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_COVERAGE)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String UNCOVERED_LINES_KEY = "uncovered_lines";
-
-  public static final Metric<Integer> UNCOVERED_LINES = new Metric.Builder(UNCOVERED_LINES_KEY, "Uncovered Lines", Metric.ValueType.INT)
-    .setDescription("Uncovered lines")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .create();
-
-  public static final String NEW_UNCOVERED_LINES_KEY = "new_uncovered_lines";
-  public static final Metric<Integer> NEW_UNCOVERED_LINES = new Metric.Builder(NEW_UNCOVERED_LINES_KEY, "Uncovered Lines on New Code", Metric.ValueType.INT)
-    .setDescription("Uncovered lines on new code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String LINE_COVERAGE_KEY = "line_coverage";
-  public static final Metric<Double> LINE_COVERAGE = new Metric.Builder(LINE_COVERAGE_KEY, "Line Coverage", Metric.ValueType.PERCENT)
-    .setDescription("Line coverage")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .create();
-
-  public static final String NEW_LINE_COVERAGE_KEY = "new_line_coverage";
-  public static final Metric<Double> NEW_LINE_COVERAGE = new Metric.Builder(NEW_LINE_COVERAGE_KEY, "Line Coverage on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Line coverage of added/changed code")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .setDomain(DOMAIN_COVERAGE)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String CONDITIONS_TO_COVER_KEY = "conditions_to_cover";
-
-  public static final Metric<Integer> CONDITIONS_TO_COVER = new Metric.Builder(CONDITIONS_TO_COVER_KEY, "Conditions to Cover", Metric.ValueType.INT)
-    .setDescription("Conditions to cover")
-    .setDomain(DOMAIN_COVERAGE)
-    .setDirection(Metric.DIRECTION_WORST)
-    .create();
-
-  public static final String NEW_CONDITIONS_TO_COVER_KEY = "new_conditions_to_cover";
-  public static final Metric<Integer> NEW_CONDITIONS_TO_COVER = new Metric.Builder(NEW_CONDITIONS_TO_COVER_KEY, "Conditions to Cover on New Code", Metric.ValueType.INT)
-    .setDescription("Conditions to cover on new code")
-    .setDomain(DOMAIN_COVERAGE)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String UNCOVERED_CONDITIONS_KEY = "uncovered_conditions";
-
-  public static final Metric<Integer> UNCOVERED_CONDITIONS = new Metric.Builder(UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions", Metric.ValueType.INT)
-    .setDescription("Uncovered conditions")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .create();
-
-  public static final String NEW_UNCOVERED_CONDITIONS_KEY = "new_uncovered_conditions";
-  public static final Metric<Integer> NEW_UNCOVERED_CONDITIONS = new Metric.Builder(NEW_UNCOVERED_CONDITIONS_KEY, "Uncovered Conditions on New Code", Metric.ValueType.INT)
-    .setDescription("Uncovered conditions on new code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_COVERAGE)
-    .setBestValue(0.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String BRANCH_COVERAGE_KEY = "branch_coverage";
-  public static final Metric<Double> BRANCH_COVERAGE = new Metric.Builder(BRANCH_COVERAGE_KEY, "Condition Coverage", Metric.ValueType.PERCENT)
-    .setDescription("Condition coverage")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .create();
-
-  public static final String NEW_BRANCH_COVERAGE_KEY = "new_branch_coverage";
-  public static final Metric<Double> NEW_BRANCH_COVERAGE = new Metric.Builder(NEW_BRANCH_COVERAGE_KEY, "Condition Coverage on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Condition coverage of new/changed code")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // DUPLICATIONS
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  public static final String DUPLICATED_LINES_KEY = "duplicated_lines";
-  public static final Metric<Integer> DUPLICATED_LINES = new Metric.Builder(DUPLICATED_LINES_KEY, "Duplicated Lines", Metric.ValueType.INT)
-    .setDescription("Duplicated lines")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 6.1
-   */
-  public static final String NEW_DUPLICATED_LINES_KEY = "new_duplicated_lines";
-
-  /**
-   * @since 6.1
-   */
-  public static final Metric<Integer> NEW_DUPLICATED_LINES = new Metric.Builder(NEW_DUPLICATED_LINES_KEY, "Duplicated Lines on New Code", Metric.ValueType.INT)
-    .setDescription("Duplicated Lines on New Code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setBestValue(0.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String DUPLICATED_BLOCKS_KEY = "duplicated_blocks";
-  public static final Metric<Integer> DUPLICATED_BLOCKS = new Metric.Builder(DUPLICATED_BLOCKS_KEY, "Duplicated Blocks", Metric.ValueType.INT)
-    .setDescription("Duplicated blocks")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 6.1
-   */
-  public static final String NEW_BLOCKS_DUPLICATED_KEY = "new_duplicated_blocks";
-  /**
-   * @since 6.1
-   */
-  public static final Metric<Integer> NEW_BLOCKS_DUPLICATED = new Metric.Builder(NEW_BLOCKS_DUPLICATED_KEY, "Duplicated Blocks on New Code", Metric.ValueType.INT)
-    .setDescription("Duplicated blocks on new code")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setBestValue(0.0)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String DUPLICATED_FILES_KEY = "duplicated_files";
-
-  /**
-   * For files: if it contains duplicates, then 1, otherwise 0.
-   * For other resources: amount of files under this resource with duplicates.
-   */
-  public static final Metric<Integer> DUPLICATED_FILES = new Metric.Builder(DUPLICATED_FILES_KEY, "Duplicated Files", Metric.ValueType.INT)
-    .setDescription("Duplicated files")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String DUPLICATED_LINES_DENSITY_KEY = "duplicated_lines_density";
-
-  public static final Metric<Double> DUPLICATED_LINES_DENSITY = new Metric.Builder(DUPLICATED_LINES_DENSITY_KEY, "Duplicated Lines (%)", Metric.ValueType.PERCENT)
-    .setDescription("Duplicated lines balanced by statements")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setWorstValue(50.0)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 6.1
-   */
-  public static final String NEW_DUPLICATED_LINES_DENSITY_KEY = "new_duplicated_lines_density";
-
-  /**
-   * @since 6.1
-   */
-  public static final Metric<Integer> NEW_DUPLICATED_LINES_DENSITY = new Metric.Builder(NEW_DUPLICATED_LINES_DENSITY_KEY, "Duplicated Lines (%) on New Code",
-    Metric.ValueType.PERCENT)
-      .setDescription("Duplicated lines (%) on new code balanced by statements")
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(true)
-      .setDomain(DOMAIN_DUPLICATIONS)
-      .setBestValue(0.0)
-      .setDeleteHistoricalData(true)
-      .create();
-
-  /**
-   * @deprecated since 4.5. Internal storage of duplication is not an API.
-   */
-  @Deprecated
-  public static final String DUPLICATIONS_DATA_KEY = "duplications_data";
-
-  /**
-   * Information about duplications, which is represented as an XML string.
-   * <p>
-   * Here is the format (since Sonar 2.12):
-   * <pre>
-   * {@literal
-   * <duplications>
-   *   <!-- Multiple groups: -->
-   *   <g>
-   *     <!-- Multiple blocks: -->
-   *     <b r="[resource key]" s="[first line]" l="[number of lines]" />
-   *     ...
-   *   </g>
-   *   ...
-   * </duplications>
-   * }
-   * </pre>
-   *
-   * @deprecated since 4.5. Internal storage of duplication is not an API.
-   */
-  @Deprecated
-  public static final Metric<String> DUPLICATIONS_DATA = new Metric.Builder(DUPLICATIONS_DATA_KEY, "Duplication Details", Metric.ValueType.DATA)
-    .setDescription("Duplications details")
-    .setDirection(Metric.DIRECTION_NONE)
-    .setQualitative(false)
-    .setDomain(DOMAIN_DUPLICATIONS)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // CODING RULES
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  public static final String VIOLATIONS_KEY = "violations";
-  public static final Metric<Integer> VIOLATIONS = new Metric.Builder(VIOLATIONS_KEY, "Issues", Metric.ValueType.INT)
-    .setDescription("Issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String BLOCKER_VIOLATIONS_KEY = "blocker_violations";
-  public static final Metric<Integer> BLOCKER_VIOLATIONS = new Metric.Builder(BLOCKER_VIOLATIONS_KEY, "Blocker Issues", Metric.ValueType.INT)
-    .setDescription("Blocker issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String CRITICAL_VIOLATIONS_KEY = "critical_violations";
-  public static final Metric<Integer> CRITICAL_VIOLATIONS = new Metric.Builder(CRITICAL_VIOLATIONS_KEY, "Critical Issues", Metric.ValueType.INT)
-    .setDescription("Critical issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String MAJOR_VIOLATIONS_KEY = "major_violations";
-  public static final Metric<Integer> MAJOR_VIOLATIONS = new Metric.Builder(MAJOR_VIOLATIONS_KEY, "Major Issues", Metric.ValueType.INT)
-    .setDescription("Major issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String MINOR_VIOLATIONS_KEY = "minor_violations";
-  public static final Metric<Integer> MINOR_VIOLATIONS = new Metric.Builder(MINOR_VIOLATIONS_KEY, "Minor Issues", Metric.ValueType.INT)
-    .setDescription("Minor issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String INFO_VIOLATIONS_KEY = "info_violations";
-  public static final Metric<Integer> INFO_VIOLATIONS = new Metric.Builder(INFO_VIOLATIONS_KEY, "Info Issues", Metric.ValueType.INT)
-    .setDescription("Info issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  public static final String NEW_VIOLATIONS_KEY = "new_violations";
-  public static final Metric<Integer> NEW_VIOLATIONS = new Metric.Builder(NEW_VIOLATIONS_KEY, "New Issues", Metric.ValueType.INT)
-    .setDescription("New issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String NEW_BLOCKER_VIOLATIONS_KEY = "new_blocker_violations";
-  public static final Metric<Integer> NEW_BLOCKER_VIOLATIONS = new Metric.Builder(NEW_BLOCKER_VIOLATIONS_KEY, "New Blocker Issues", Metric.ValueType.INT)
-    .setDescription("New Blocker issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String NEW_CRITICAL_VIOLATIONS_KEY = "new_critical_violations";
-  public static final Metric<Integer> NEW_CRITICAL_VIOLATIONS = new Metric.Builder(NEW_CRITICAL_VIOLATIONS_KEY, "New Critical Issues", Metric.ValueType.INT)
-    .setDescription("New Critical issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String NEW_MAJOR_VIOLATIONS_KEY = "new_major_violations";
-  public static final Metric<Integer> NEW_MAJOR_VIOLATIONS = new Metric.Builder(NEW_MAJOR_VIOLATIONS_KEY, "New Major Issues", Metric.ValueType.INT)
-    .setDescription("New Major issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String NEW_MINOR_VIOLATIONS_KEY = "new_minor_violations";
-  public static final Metric<Integer> NEW_MINOR_VIOLATIONS = new Metric.Builder(NEW_MINOR_VIOLATIONS_KEY, "New Minor Issues", Metric.ValueType.INT)
-    .setDescription("New Minor issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  public static final String NEW_INFO_VIOLATIONS_KEY = "new_info_violations";
-  public static final Metric<Integer> NEW_INFO_VIOLATIONS = new Metric.Builder(NEW_INFO_VIOLATIONS_KEY, "New Info Issues", Metric.ValueType.INT)
-    .setDescription("New Info issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * @since 3.6
-   */
-  public static final String FALSE_POSITIVE_ISSUES_KEY = "false_positive_issues";
-
-  /**
-   * @since 3.6
-   */
-  public static final Metric<Integer> FALSE_POSITIVE_ISSUES = new Metric.Builder(FALSE_POSITIVE_ISSUES_KEY, "False Positive Issues", Metric.ValueType.INT)
-    .setDescription("False positive issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 5.6
-   */
-  public static final String WONT_FIX_ISSUES_KEY = "wont_fix_issues";
-
-  /**
-   * @since 5.6
-   */
-  public static final Metric<Integer> WONT_FIX_ISSUES = new Metric.Builder(WONT_FIX_ISSUES_KEY, "Won't Fix Issues", Metric.ValueType.INT)
-    .setDescription("Won't fix issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 3.6
-   */
-  public static final String OPEN_ISSUES_KEY = "open_issues";
-
-  /**
-   * @since 3.6
-   */
-  public static final Metric<Integer> OPEN_ISSUES = new Metric.Builder(OPEN_ISSUES_KEY, "Open Issues", Metric.ValueType.INT)
-    .setDescription("Open issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 3.6
-   */
-  public static final String REOPENED_ISSUES_KEY = "reopened_issues";
-
-  /**
-   * @since 3.6
-   */
-  public static final Metric<Integer> REOPENED_ISSUES = new Metric.Builder(REOPENED_ISSUES_KEY, "Reopened Issues", Metric.ValueType.INT)
-    .setDescription("Reopened issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 3.6
-   */
-  public static final String CONFIRMED_ISSUES_KEY = "confirmed_issues";
-
-  /**
-   * @since 3.6
-   */
-  public static final Metric<Integer> CONFIRMED_ISSUES = new Metric.Builder(CONFIRMED_ISSUES_KEY, "Confirmed Issues", Metric.ValueType.INT)
-    .setDescription("Confirmed issues")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_ISSUES)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String CODE_SMELLS_KEY = "code_smells";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> CODE_SMELLS = new Metric.Builder(CODE_SMELLS_KEY, "Code Smells", Metric.ValueType.INT)
-    .setDescription("Code Smells")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String NEW_CODE_SMELLS_KEY = "new_code_smells";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> NEW_CODE_SMELLS = new Metric.Builder(NEW_CODE_SMELLS_KEY, "New Code Smells", Metric.ValueType.INT)
-    .setDescription("New Code Smells")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String BUGS_KEY = "bugs";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> BUGS = new Metric.Builder(BUGS_KEY, "Bugs", Metric.ValueType.INT)
-    .setDescription("Bugs")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_RELIABILITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String NEW_BUGS_KEY = "new_bugs";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> NEW_BUGS = new Metric.Builder(NEW_BUGS_KEY, "New Bugs", Metric.ValueType.INT)
-    .setDescription("New Bugs")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_RELIABILITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String VULNERABILITIES_KEY = "vulnerabilities";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> VULNERABILITIES = new Metric.Builder(VULNERABILITIES_KEY, "Vulnerabilities", Metric.ValueType.INT)
-    .setDescription("Vulnerabilities")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SECURITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final String NEW_VULNERABILITIES_KEY = "new_vulnerabilities";
-
-  /**
-   * SonarQube Quality Model
-   *
-   * @since 5.5
-   */
-  public static final Metric<Integer> NEW_VULNERABILITIES = new Metric.Builder(NEW_VULNERABILITIES_KEY, "New Vulnerabilities", Metric.ValueType.INT)
-    .setDescription("New Vulnerabilities")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_SECURITY)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * @since 7.8
-   */
-  public static final String SECURITY_HOTSPOTS_KEY = "security_hotspots";
-
-  /**
-   * @since 7.8
-   */
-  public static final Metric<Integer> SECURITY_HOTSPOTS = new Metric.Builder(SECURITY_HOTSPOTS_KEY, "Security Hotspots", Metric.ValueType.INT)
-    .setDescription("Security Hotspots")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(false)
-    .setDomain(DOMAIN_SECURITY_REVIEW)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .create();
-
-  /**
-   * @since 7.8
-   */
-  public static final String NEW_SECURITY_HOTSPOTS_KEY = "new_security_hotspots";
-
-  /**
-   * @since 7.8
-   */
-  public static final Metric<Integer> NEW_SECURITY_HOTSPOTS = new Metric.Builder(NEW_SECURITY_HOTSPOTS_KEY, "New Security Hotspots", Metric.ValueType.INT)
-    .setDescription("New Security Hotspots")
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setDomain(DOMAIN_SECURITY_REVIEW)
-    .setBestValue(0.0)
-    .setOptimizedBestValue(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // MAINTAINABILITY CHARACTERISTIC
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @since 4.0
-   */
-  // TODO should be renamed to MAINTAINABILITY_REMEDIATION_EFFORT_KEY = "maintainability_remediation_effort"
-  public static final String TECHNICAL_DEBT_KEY = "sqale_index";
-
-  /**
-   * @since 4.0
-   */
-  // TODO should be renamed to MAINTAINABILITY_REMEDIATION_EFFORT
-  public static final Metric<Long> TECHNICAL_DEBT = new Metric.Builder(TECHNICAL_DEBT_KEY, "Technical Debt", Metric.ValueType.WORK_DUR)
-    .setDescription("Total effort (in hours) to fix all the issues on the component and therefore to comply to all the requirements.")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .create();
-
-  /**
-   * @since 4.1
-   */
-  // TODO should be renamed to NEW_MAINTAINABILITY_REMEDIATION_EFFORT_KEY = "new_maintainability_remediation_effort"
-  public static final String NEW_TECHNICAL_DEBT_KEY = "new_technical_debt";
-
-  /**
-   * @since 4.1
-   */
-  // TODO should be renamed to NEW_MAINTAINABILITY_REMEDIATION_EFFORT
-  public static final Metric<Long> NEW_TECHNICAL_DEBT = new Metric.Builder(NEW_TECHNICAL_DEBT_KEY, "Added Technical Debt", Metric.ValueType.WORK_DUR)
-    .setDescription("Added technical debt")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .setDeleteHistoricalData(true)
-    .create();
-
-  /**
-   * @since 4.5
-   */
-  // TODO should be renamed to MAINTAINABILITY_RATING_KEY = "maintainability_rating"
-  public static final String SQALE_RATING_KEY = "sqale_rating";
-
-  /**
-   * @since 4.5
-   */
-  // TODO should be renamed to MAINTAINABILITY_RATING
-  public static final Metric<Integer> SQALE_RATING = new Metric.Builder(SQALE_RATING_KEY, "Maintainability Rating", Metric.ValueType.RATING)
-    .setDescription("A-to-E rating based on the technical debt ratio")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  /**
-   * @since 6.2
-   */
-  public static final String NEW_MAINTAINABILITY_RATING_KEY = "new_maintainability_rating";
-
-  /**
-   * @since 6.2
-   */
-  public static final Metric<Integer> NEW_MAINTAINABILITY_RATING = new Metric.Builder(NEW_MAINTAINABILITY_RATING_KEY, "Maintainability Rating on New Code", Metric.ValueType.RATING)
-    .setDescription("Maintainability rating on new code")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDeleteHistoricalData(true)
-    .setOptimizedBestValue(true)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  /**
-   * @since 4.5
-   */
-  public static final String DEVELOPMENT_COST_KEY = "development_cost";
-
-  /**
-   * @since 4.5
-   */
-  public static final Metric<String> DEVELOPMENT_COST = new Metric.Builder(DEVELOPMENT_COST_KEY, "Development Cost", Metric.ValueType.STRING)
-    .setDescription("Development cost")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 7.0
-   */
-  public static final String NEW_DEVELOPMENT_COST_KEY = "new_development_cost";
-
-  /**
-   * @since 7.0
-   */
-  public static final Metric<String> NEW_DEVELOPMENT_COST = new Metric.Builder(NEW_DEVELOPMENT_COST_KEY, "Development Cost on New Code", Metric.ValueType.FLOAT)
-    .setDescription("Development cost on new code")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 4.5
-   */
-  // TODO should be renamed to TECHNICALDEBT_RATIO_KEY = "technicaldebt_ratio"
-  public static final String SQALE_DEBT_RATIO_KEY = "sqale_debt_ratio";
-
-  /**
-   * @since 4.5
-   */
-  // TODO should be renamed to TECHNICALDEBT_RATIO
-  public static final Metric<Double> SQALE_DEBT_RATIO = new Metric.Builder(SQALE_DEBT_RATIO_KEY, "Technical Debt Ratio", Metric.ValueType.PERCENT)
-    .setDescription("Ratio of the actual technical debt compared to the estimated cost to develop the whole source code from scratch")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .create();
-
-  /**
-   * @since 5.2
-   */
-  // TODO should be renamed to TECHNICALDEBT_RATIO_ON_NEW_CODE_KEY = "technicaldebt_ratio_on_new_code"
-  public static final String NEW_SQALE_DEBT_RATIO_KEY = "new_sqale_debt_ratio";
-
-  /**
-   * @since 5.2
-   */
-  // TODO should be renamed to TECHNICALDEBT_RATIO_ON_NEW_CODE
-  public static final Metric<Double> NEW_SQALE_DEBT_RATIO = new Metric.Builder(NEW_SQALE_DEBT_RATIO_KEY, "Technical Debt Ratio on New Code", Metric.ValueType.PERCENT)
-    .setDescription("Technical Debt Ratio of new/changed code.")
-    .setDomain(DOMAIN_MAINTAINABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY = "effort_to_reach_maintainability_rating_a";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Long> EFFORT_TO_REACH_MAINTAINABILITY_RATING_A = new Metric.Builder(EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_KEY,
-    "Effort to Reach Maintainability Rating A", Metric.ValueType.WORK_DUR)
-      .setDescription("Effort to reach maintainability rating A")
-      .setDomain(DOMAIN_MAINTAINABILITY)
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(true)
-      .setBestValue(0.0)
-      .setOptimizedBestValue(true)
-      .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // RELIABILITY CHARACTERISTIC
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @since 5.5
-   */
-  public static final String RELIABILITY_REMEDIATION_EFFORT_KEY = "reliability_remediation_effort";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort",
-    Metric.ValueType.WORK_DUR)
-      .setDescription("Reliability Remediation Effort")
-      .setDomain(DOMAIN_RELIABILITY)
-      .setDirection(Metric.DIRECTION_WORST)
-      .setOptimizedBestValue(true)
-      .setBestValue(0.0)
-      .setQualitative(true)
-      .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String NEW_RELIABILITY_REMEDIATION_EFFORT_KEY = "new_reliability_remediation_effort";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability Remediation Effort on New Code",
-    Metric.ValueType.WORK_DUR)
-      .setDescription("Reliability remediation effort on new code")
-      .setDomain(DOMAIN_RELIABILITY)
-      .setDirection(Metric.DIRECTION_WORST)
-      .setOptimizedBestValue(true)
-      .setBestValue(0.0)
-      .setQualitative(true)
-      .setDeleteHistoricalData(true)
-      .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String RELIABILITY_RATING_KEY = "reliability_rating";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Integer> RELIABILITY_RATING = new Metric.Builder(RELIABILITY_RATING_KEY, "Reliability Rating", Metric.ValueType.RATING)
-    .setDescription("Reliability rating")
-    .setDomain(DOMAIN_RELIABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  /**
-   * @since 6.2
-   */
-  public static final String NEW_RELIABILITY_RATING_KEY = "new_reliability_rating";
-
-  /**
-   * @since 6.2
-   */
-  public static final Metric<Integer> NEW_RELIABILITY_RATING = new Metric.Builder(NEW_RELIABILITY_RATING_KEY, "Reliability Rating on New Code", Metric.ValueType.RATING)
-    .setDescription("Reliability rating on new code")
-    .setDomain(DOMAIN_RELIABILITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDeleteHistoricalData(true)
-    .setOptimizedBestValue(true)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // SECURITY CHARACTERISTIC
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @since 5.5
-   */
-  public static final String SECURITY_REMEDIATION_EFFORT_KEY = "security_remediation_effort";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Long> SECURITY_REMEDIATION_EFFORT = new Metric.Builder(SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort", Metric.ValueType.WORK_DUR)
-    .setDescription("Security remediation effort")
-    .setDomain(DOMAIN_SECURITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setOptimizedBestValue(true)
-    .setBestValue(0.0)
-    .setQualitative(true)
-    .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String NEW_SECURITY_REMEDIATION_EFFORT_KEY = "new_security_remediation_effort";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security Remediation Effort on New Code",
-    Metric.ValueType.WORK_DUR)
-      .setDescription("Security remediation effort on new code")
-      .setDomain(DOMAIN_SECURITY)
-      .setDirection(Metric.DIRECTION_WORST)
-      .setOptimizedBestValue(true)
-      .setBestValue(0.0)
-      .setQualitative(true)
-      .setDeleteHistoricalData(true)
-      .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String SECURITY_RATING_KEY = "security_rating";
-
-  /**
-   * @since 5.5
-   */
-  public static final Metric<Integer> SECURITY_RATING = new Metric.Builder(SECURITY_RATING_KEY, "Security Rating", Metric.ValueType.RATING)
-    .setDescription("Security rating")
-    .setDomain(DOMAIN_SECURITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  /**
-   * @since 6.2
-   */
-  public static final String NEW_SECURITY_RATING_KEY = "new_security_rating";
-
-  /**
-   * @since 6.2
-   */
-  public static final Metric<Integer> NEW_SECURITY_RATING = new Metric.Builder(NEW_SECURITY_RATING_KEY, "Security Rating on New Code", Metric.ValueType.RATING)
-    .setDescription("Security rating on new code")
-    .setDomain(DOMAIN_SECURITY)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setDeleteHistoricalData(true)
-    .setOptimizedBestValue(true)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // SECURITY REVIEW
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @since 7.8
-   */
-  public static final String SECURITY_REVIEW_RATING_KEY = "security_review_rating";
-
-  /**
-   * @since 7.8
-   */
-  public static final Metric<Integer> SECURITY_REVIEW_RATING = new Metric.Builder(SECURITY_REVIEW_RATING_KEY, "Security Review Rating", Metric.ValueType.RATING)
-    .setDescription("Security Review Rating")
-    .setDomain(DOMAIN_SECURITY_REVIEW)
-    .setDirection(Metric.DIRECTION_WORST)
-    .setQualitative(true)
-    .setBestValue(1.0)
-    .setWorstValue(5.0)
-    .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String NEW_SECURITY_REVIEW_RATING_KEY = "new_security_review_rating";
-
-  /**
-   * @since 8.2
-   */
-  public static final Metric<Integer> NEW_SECURITY_REVIEW_RATING = new Metric.Builder(NEW_SECURITY_REVIEW_RATING_KEY, "Security Review Rating on New Code",
-    Metric.ValueType.RATING)
-      .setDescription("Security Review Rating on New Code")
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setDirection(Metric.DIRECTION_WORST)
-      .setDeleteHistoricalData(true)
-      .setOptimizedBestValue(true)
-      .setQualitative(true)
-      .setBestValue(1.0)
-      .setWorstValue(5.0)
-      .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String SECURITY_HOTSPOTS_REVIEWED_KEY = "security_hotspots_reviewed";
-
-  /**
-   * @since 8.2
-   */
-  public static final Metric<Integer> SECURITY_HOTSPOTS_REVIEWED = new Metric.Builder(SECURITY_HOTSPOTS_REVIEWED_KEY, "Security Hotspots Reviewed", Metric.ValueType.PERCENT)
-    .setDescription("Percentage of Security Hotspots Reviewed")
-    .setDomain(DOMAIN_SECURITY_REVIEW)
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setWorstValue(0.0)
-    .setBestValue(100.0)
-    .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String NEW_SECURITY_HOTSPOTS_REVIEWED_KEY = "new_security_hotspots_reviewed";
-
-  /**
-   * @since 8.2
-   */
-  public static final Metric<Integer> NEW_SECURITY_HOTSPOTS_REVIEWED = new Metric.Builder(NEW_SECURITY_HOTSPOTS_REVIEWED_KEY, "Security Hotspots Reviewed on New Code",
-    Metric.ValueType.PERCENT)
-      .setDescription("Percentage of Security Hotspots Reviewed on New Code")
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setDirection(Metric.DIRECTION_BETTER)
-      .setDeleteHistoricalData(true)
-      .setQualitative(true)
-      .setWorstValue(0.0)
-      .setBestValue(100.0)
-      .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String SECURITY_HOTSPOTS_REVIEWED_STATUS_KEY = "security_hotspots_reviewed_status";
-
-  /**
-   * @since 8.2
-   *
-   * This hidden metric is only needed to compute 'security_review_rating' and 'security_hotspots_reviewed' on Applications.
-   */
-  public static final Metric<Integer> SECURITY_HOTSPOTS_REVIEWED_STATUS = new Metric.Builder(SECURITY_HOTSPOTS_REVIEWED_STATUS_KEY, "Security Review Reviewed Status",
-    Metric.ValueType.INT)
-      .setDescription("Security Review Reviewed Status")
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(false)
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setBestValue(0.0)
-      .setOptimizedBestValue(true)
-      .setDeleteHistoricalData(true)
-      .setHidden(true)
-      .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String SECURITY_HOTSPOTS_TO_REVIEW_STATUS_KEY = "security_hotspots_to_review_status";
-
-  /**
-   * @since 8.2
-   *
-   * This hidden metric is only needed to compute 'security_review_rating' and 'security_hotspots_reviewed' on Applications.
-   */
-  public static final Metric<Integer> SECURITY_HOTSPOTS_TO_REVIEW_STATUS = new Metric.Builder(SECURITY_HOTSPOTS_TO_REVIEW_STATUS_KEY, "Security Review To Review Status",
-    Metric.ValueType.INT)
-      .setDescription("Security Review To Review Status")
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(false)
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setBestValue(0.0)
-      .setOptimizedBestValue(true)
-      .setDeleteHistoricalData(true)
-      .setHidden(true)
-      .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String NEW_SECURITY_HOTSPOTS_REVIEWED_STATUS_KEY = "new_security_hotspots_reviewed_status";
-
-  /**
-   * @since 8.2
-   *
-   * This hidden metric is only needed to compute 'new_security_review_rating' and 'new_security_hotspots_reviewed' on Applications.
-   */
-  public static final Metric<Integer> NEW_SECURITY_HOTSPOTS_REVIEWED_STATUS = new Metric.Builder(NEW_SECURITY_HOTSPOTS_REVIEWED_STATUS_KEY,
-    "Security Review Reviewed Status on New Code", Metric.ValueType.INT)
-      .setDescription("Security Review Reviewed Status on New Code")
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(false)
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setBestValue(0.0)
-      .setOptimizedBestValue(true)
-      .setDeleteHistoricalData(true)
-      .setHidden(true)
-      .create();
-
-  /**
-   * @since 8.2
-   */
-  public static final String NEW_SECURITY_HOTSPOTS_TO_REVIEW_STATUS_KEY = "new_security_hotspots_to_review_status";
-
-  /**
-   * @since 8.2
-   *
-   * This hidden metric is only needed to compute 'new_security_review_rating' and 'new_security_hotspots_reviewed' on Applications.
-   */
-  public static final Metric<Integer> NEW_SECURITY_HOTSPOTS_TO_REVIEW_STATUS = new Metric.Builder(NEW_SECURITY_HOTSPOTS_TO_REVIEW_STATUS_KEY,
-    "Security Review To Review Status on New Code", Metric.ValueType.INT)
-      .setDescription("Security Review To Review Status on New Code")
-      .setDirection(Metric.DIRECTION_WORST)
-      .setQualitative(false)
-      .setDomain(DOMAIN_SECURITY_REVIEW)
-      .setBestValue(0.0)
-      .setOptimizedBestValue(true)
-      .setDeleteHistoricalData(true)
-      .setHidden(true)
-      .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // FILE DATA
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  /**
-   * @since 2.14
-   */
-  public static final String NCLOC_DATA_KEY = "ncloc_data";
-
-  /**
-   * Information about lines of code in file.
-   * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains code (1) or not (0).
-   * If a line number is missing in the map it is equivalent to the default value (0).
-   *
-   * @see org.sonar.api.measures.FileLinesContext
-   * @since 2.14
-   */
-  public static final Metric<String> NCLOC_DATA = new Metric.Builder(NCLOC_DATA_KEY, "ncloc_data", Metric.ValueType.DATA)
-    .setHidden(true)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * @since 2.14
-   * @deprecated in 7.3. Measures are no longer sent within analysis reports, and by consequence no
-   * longer persisted nor available from web API.
-   */
-  @Deprecated
-  public static final String COMMENT_LINES_DATA_KEY = "comment_lines_data";
-
-  /**
-   * Information about comments in file.
-   * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains comment (1) or not (0).
-   * If a line number is missing in the map it is equivalent to the default value (0).
-   *
-   * @see org.sonar.api.measures.FileLinesContext
-   * @since 2.14
-   * @deprecated in 7.3. Measures are no longer sent within analysis reports, and by consequence no
-   * longer persisted nor available from web API.
-   */
-  @Deprecated
-  public static final Metric<String> COMMENT_LINES_DATA = new Metric.Builder(COMMENT_LINES_DATA_KEY, "comment_lines_data", Metric.ValueType.DATA)
-    .setHidden(true)
-    .setDomain(DOMAIN_SIZE)
-    .create();
-
-  /**
-   * @since 5.5
-   */
-  public static final String EXECUTABLE_LINES_DATA_KEY = "executable_lines_data";
-
-  /**
-   * Information about executable lines of code in file.
-   * Key-value pairs, where key - is a number of line, and value - is an indicator of whether line contains executable code (1) or not (0).
-   * If a line number is missing in the map it is equivalent to the default value (0).
-   *
-   * @see org.sonar.api.measures.FileLinesContext
-   * @since 5.5
-   */
-  public static final Metric<String> EXECUTABLE_LINES_DATA = new Metric.Builder(EXECUTABLE_LINES_DATA_KEY, "executable_lines_data", Metric.ValueType.DATA)
-    .setHidden(true)
-    .setDomain(DOMAIN_COVERAGE)
-    .create();
-
-  // --------------------------------------------------------------------------------------------------------------------
-  //
-  // OTHERS
-  //
-  // --------------------------------------------------------------------------------------------------------------------
-
-  public static final String ALERT_STATUS_KEY = "alert_status";
-  public static final Metric<Metric.Level> ALERT_STATUS = new Metric.Builder(ALERT_STATUS_KEY, "Quality Gate Status", Metric.ValueType.LEVEL)
-    .setDescription("The project status with regard to its quality gate.")
-    .setDirection(Metric.DIRECTION_BETTER)
-    .setQualitative(true)
-    .setDomain(DOMAIN_RELEASABILITY)
-    .create();
-
-  /**
-   * @since 4.4
-   */
-  public static final String QUALITY_GATE_DETAILS_KEY = "quality_gate_details";
-  /**
-   * The project detailed status with regard to its quality gate.
-   * Storing the global quality gate status, along with all evaluated conditions, into a JSON object.
-   *
-   * @since 4.4
-   */
-  public static final Metric<String> QUALITY_GATE_DETAILS = new Metric.Builder(QUALITY_GATE_DETAILS_KEY, "Quality Gate Details", Metric.ValueType.DATA)
-    .setDescription("The project detailed status with regard to its quality gate")
-    .setDomain(DOMAIN_GENERAL)
-    .create();
-
-  /**
-   * @since 4.4
-   * @deprecated since 5.5
-   */
-  @Deprecated
-  public static final String QUALITY_PROFILES_KEY = "quality_profiles";
-
-  /**
-   * @since 4.4
-   * @deprecated since 5.5
-   */
-  @Deprecated
-  public static final Metric<String> QUALITY_PROFILES = new Metric.Builder(QUALITY_PROFILES_KEY, "Profiles", Metric.ValueType.DATA)
-    .setDescription("Details of quality profiles used during analysis")
-    .setQualitative(false)
-    .setDomain(DOMAIN_GENERAL)
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 5.2
-   */
-  public static final String LAST_COMMIT_DATE_KEY = "last_commit_date";
-
-  /**
-   * Date of the most recent commit. Current implementation is based on commits touching lines of source code. It
-   * ignores other changes like file renaming or file deletion.
-   *
-   * @since 5.2
-   */
-  public static final Metric LAST_COMMIT_DATE = new Metric.Builder(LAST_COMMIT_DATE_KEY, "Date of Last Commit", Metric.ValueType.MILLISEC)
-    .setDomain(CoreMetrics.DOMAIN_SCM)
-    // waiting for type "datetime" to be correctly handled
-    .setHidden(true)
-    .create();
-
-  /**
-   * @since 9.4
-   */
-  public static final String ANALYSIS_FROM_SONARQUBE_9_4_KEY = "analysis_from_sonarqube_9_4";
-
-  /**
-   * @since 9.4
-   *
-   * This hidden metric that is only needed to fully fix the issue with identifying new issues when using reference branch
-   * that was haunting us in 9.3 and before. More details in the ticket SONAR-16039
-   */
-  public static final Metric<Integer> ANALYSIS_FROM_SONARQUBE_9_4 = new Metric.Builder(ANALYSIS_FROM_SONARQUBE_9_4_KEY,
-    "Analysis From SonarQube 9.4", BOOL)
-    .setDescription("Indicates whether the analysis has been run after the upgrade to SonarQube 9.4. It affects how the issues " +
-      "will be detected for branches that use reference branch as the strategy for detecting new code.")
-    .setDomain(CoreMetrics.DOMAIN_ISSUES)
-    .setHidden(true)
-    .create();
-
-  private static final List<Metric> METRICS;
-
-  static {
-    METRICS = new LinkedList<>();
-    for (Field field : CoreMetrics.class.getFields()) {
-      if (!Modifier.isTransient(field.getModifiers()) && Metric.class.isAssignableFrom(field.getType())) {
-        try {
-          Metric metric = (Metric) field.get(null);
-          METRICS.add(metric);
-        } catch (IllegalAccessException e) {
-          throw new SonarException("can not introspect " + CoreMetrics.class + " to get metrics", e);
-        }
-      }
-    }
-  }
-
-  private CoreMetrics() {
-    // only static stuff
-  }
-
-  public static List<Metric> getMetrics() {
-    return METRICS;
-  }
-
-  public static Metric getMetric(final String key) {
-    return METRICS.stream().filter(metric -> metric != null && metric.getKey().equals(key)).findFirst().orElseThrow(NoSuchElementException::new);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContext.java
deleted file mode 100644 (file)
index 8d2d4f9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * Provides facility to store measures for the lines of file.
- * Examples:
- * <ul>
- * <li>line 1 is a line of code</li>
- * <li>line 2 contains comment</li>
- * <li>line 3 contains 2 branches</li>
- * <li>author of line 4 is Simon</li>
- * </ul>
- * Numbering of lines starts from 1.
- * Also note that you can't update what already was saved, however it is safe to call {@link #save()} several times.
- * <p>
- * Instances of this interface can be obtained using {@link FileLinesContextFactory}.
- * <br>
- * This interface is not intended to be implemented by clients.
- *
- * @since 2.14
- */
-public interface FileLinesContext {
-
-  /**
-   * @throws UnsupportedOperationException on attempt to update already saved data
-   */
-  void setIntValue(String metricKey, int line, int value);
-
-  /**
-   * @throws UnsupportedOperationException on attempt to update already saved data
-   */
-  void setStringValue(String metricKey, int line, String value);
-
-  /**
-   * Saves unsaved values.
-   */
-  void save();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java
deleted file mode 100644 (file)
index 2664bac..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.batch.fs.InputFile;
-
-/**
- * <p>This interface is not intended to be implemented by clients.
- *
- * @since 2.14
- */
-@ScannerSide
-public interface FileLinesContextFactory {
-
-  /**
-   * @since 4.2
-   */
-  FileLinesContext createFor(InputFile inputFile);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
deleted file mode 100644 (file)
index c8fb2d5..0000000
+++ /dev/null
@@ -1,766 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Used to define a metric in a plugin. Should be used with {@link Metrics} extension point.
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public class Metric<G extends Serializable> implements Serializable, org.sonar.api.batch.measure.Metric<G> {
-
-  /**
-   * @since 5.3
-   */
-  public static final int DEFAULT_DECIMAL_SCALE = 1;
-
-  /**
-   * The maximum supported value of scale for decimal metrics
-   *
-   * @since 5.3
-   */
-  public static final int MAX_DECIMAL_SCALE = 5;
-
-  /**
-   * A metric bigger value means a degradation
-   */
-  public static final int DIRECTION_WORST = -1;
-  /**
-   * A metric bigger value means an improvement
-   */
-  public static final int DIRECTION_BETTER = 1;
-  /**
-   * The metric direction has no meaning
-   */
-  public static final int DIRECTION_NONE = 0;
-
-  public enum ValueType {
-    INT(Integer.class),
-    FLOAT(Double.class),
-    PERCENT(Double.class),
-    BOOL(Boolean.class),
-    STRING(String.class),
-    MILLISEC(Long.class),
-    DATA(String.class),
-    LEVEL(Metric.Level.class),
-    DISTRIB(String.class),
-    RATING(Integer.class),
-    WORK_DUR(Long.class);
-
-    private final Class valueClass;
-
-    ValueType(Class valueClass) {
-      this.valueClass = valueClass;
-    }
-
-    private Class valueType() {
-      return valueClass;
-    }
-
-    public static String[] names() {
-      ValueType[] values = values();
-      String[] names = new String[values.length];
-      for (int i = 0; i < values.length; i += 1) {
-        names[i] = values[i].name();
-      }
-
-      return names;
-    }
-  }
-
-  public enum Level {
-    OK("Green"),
-    /**
-     * @deprecated in 7.6.
-     */
-    @Deprecated
-    WARN("Orange"),
-    ERROR("Red");
-
-    private static final List<String> NAMES = Arrays.stream(values())
-      .map(Level::name)
-      .collect(Collectors.toList());
-
-    private String colorName;
-
-    Level(String colorName) {
-      this.colorName = colorName;
-    }
-
-    public String getColorName() {
-      return colorName;
-    }
-
-    public static List<String> names() {
-      return NAMES;
-    }
-  }
-
-  private String uuid;
-  private String key;
-  private String description;
-  private ValueType type;
-  private Integer direction;
-  private String domain;
-  private String name;
-  private Boolean qualitative = Boolean.FALSE;
-  private Boolean userManaged = Boolean.FALSE;
-  private Boolean enabled = Boolean.TRUE;
-  private Double worstValue;
-  private Double bestValue;
-  private Boolean optimizedBestValue;
-  private Boolean hidden = Boolean.FALSE;
-  private Boolean deleteHistoricalData;
-  private Integer decimalScale;
-
-  private Metric(Builder builder) {
-    this.key = builder.key;
-    this.name = builder.name;
-    this.description = builder.description;
-    this.type = builder.type;
-    this.direction = builder.direction;
-    this.domain = builder.domain;
-    this.qualitative = builder.qualitative;
-    this.enabled = Boolean.TRUE;
-    this.worstValue = builder.worstValue;
-    this.optimizedBestValue = builder.optimizedBestValue;
-    this.bestValue = builder.bestValue;
-    this.hidden = builder.hidden;
-    this.userManaged = builder.userManaged;
-    this.deleteHistoricalData = builder.deleteHistoricalData;
-    this.decimalScale = builder.decimalScale;
-  }
-
-  /**
-   * Creates an empty metric
-   *
-   * @deprecated in 1.12. Use the {@link Builder} factory.
-   */
-  @Deprecated
-  public Metric() {
-  }
-
-  /**
-   * Creates a metric based on its key. Shortcut to Metric(key, ValueType.INT)
-   *
-   * @param key the metric key
-   * @deprecated since 2.7 use the {@link Builder} factory.
-   */
-  @Deprecated
-  public Metric(String key) {
-    this(key, ValueType.INT);
-  }
-
-  /**
-   * Creates a metric based on a key and a type. Shortcut to
-   * Metric(key, key, key, type, -1, Boolean.FALSE, null, false)
-   *
-   * @param key  the key
-   * @param type the type
-   * @deprecated since 2.7 use the {@link Builder} factory.
-   */
-  @Deprecated
-  public Metric(String key, ValueType type) {
-    this(key, key, key, type, -1, Boolean.FALSE, null, false);
-  }
-
-  /**
-   * @deprecated since 2.7 use the {@link Builder} factory.
-   */
-  @Deprecated
-  public Metric(String key, String name, String description, ValueType type, Integer direction, Boolean qualitative, String domain) {
-    this(key, name, description, type, direction, qualitative, domain, false);
-  }
-
-  /**
-   * Creates a fully qualified metric.
-   *
-   * @param key         the metric key
-   * @param name        the metric name
-   * @param description the metric description
-   * @param type        the metric type
-   * @param direction   the metric direction
-   * @param qualitative whether the metric is qualitative
-   * @param domain      the metric domain
-   * @param userManaged whether the metric is user managed
-   */
-  private Metric(String key, String name, String description, ValueType type, Integer direction, Boolean qualitative, @Nullable String domain,
-    boolean userManaged) {
-    this.key = key;
-    this.description = description;
-    this.type = type;
-    this.direction = direction;
-    this.domain = domain;
-    this.name = name;
-    this.qualitative = qualitative;
-    this.userManaged = userManaged;
-    if (ValueType.PERCENT == this.type) {
-      this.bestValue = (direction == DIRECTION_BETTER) ? 100.0 : 0.0;
-      this.worstValue = (direction == DIRECTION_BETTER) ? 0.0 : 100.0;
-      this.decimalScale = DEFAULT_DECIMAL_SCALE;
-    } else if (ValueType.FLOAT == this.type) {
-      this.decimalScale = DEFAULT_DECIMAL_SCALE;
-    }
-  }
-
-  /**
-   * For internal use only
-   */
-  public String getUuid() {
-    return uuid;
-  }
-
-  /**
-   * For internal use only
-   */
-  public Metric<G> setUuid(@Nullable String uuid) {
-    this.uuid = uuid;
-    return this;
-  }
-
-  /**
-   * @return wether the metric is qualitative
-   */
-  public Boolean getQualitative() {
-    return qualitative;
-  }
-
-  /**
-   * Sets whether the metric is qualitative
-   *
-   * @param qualitative whether the metric is qualitative
-   * @return this
-   */
-  public Metric<G> setQualitative(Boolean qualitative) {
-    this.qualitative = qualitative;
-    return this;
-  }
-
-  /**
-   * @return the metric key
-   */
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * Sets the metric key
-   *
-   * @param key the key
-   * @return this
-   */
-  public Metric<G> setKey(String key) {
-    this.key = key;
-    return this;
-  }
-
-  /**
-   * @return the metric type
-   */
-  public ValueType getType() {
-    return type;
-  }
-
-  /**
-   * Sets the metric type
-   *
-   * @param type the type
-   * @return this
-   */
-  public Metric<G> setType(ValueType type) {
-    this.type = type;
-    return this;
-  }
-
-  /**
-   * @return the metric description
-   */
-  @CheckForNull
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * Sets the metric description
-   *
-   * @param description the description
-   * @return this
-   */
-  public Metric<G> setDescription(@Nullable String description) {
-    this.description = description;
-    return this;
-  }
-
-  /**
-   * @return whether the metric is a managed by the users ("manual metric")
-   */
-  @Deprecated
-  public Boolean getUserManaged() {
-    return userManaged;
-  }
-
-  /**
-   * Sets whether the metric is managed by users ("manual metric")
-   *
-   * @param userManaged whether the metric is user managed
-   * @return this
-   */
-  public Metric<G> setUserManaged(Boolean userManaged) {
-    this.userManaged = userManaged;
-    return this;
-  }
-
-  /**
-   * @return whether the metric is enabled
-   */
-  public Boolean getEnabled() {
-    return enabled;
-  }
-
-  /**
-   * Sets whether the metric is enabled
-   *
-   * @param enabled whether the metric is enabled
-   * @return this
-   */
-  public Metric<G> setEnabled(Boolean enabled) {
-    this.enabled = enabled;
-    return this;
-  }
-
-  /**
-   * @return the metric direction
-   */
-  public Integer getDirection() {
-    return direction;
-  }
-
-  /**
-   * Sets the metric direction.
-   *
-   * @param direction the direction
-   */
-  public Metric<G> setDirection(Integer direction) {
-    this.direction = direction;
-    return this;
-  }
-
-  /**
-   * @return the domain of the metric
-   */
-  public String getDomain() {
-    return domain;
-  }
-
-  /**
-   * Sets the domain for the metric (General, Complexity...)
-   *
-   * @param domain the domain
-   * @return this
-   */
-  public Metric<G> setDomain(String domain) {
-    this.domain = domain;
-    return this;
-  }
-
-  /**
-   * @return the metric name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Sets the metric name
-   *
-   * @param name the name
-   * @return this
-   */
-  public Metric<G> setName(String name) {
-    this.name = name;
-    return this;
-  }
-
-  public Double getWorstValue() {
-    return worstValue;
-  }
-
-  @CheckForNull
-  public Double getBestValue() {
-    return bestValue;
-  }
-
-  /**
-   * @return this
-   */
-  public Metric<G> setWorstValue(@Nullable Double d) {
-    this.worstValue = d;
-    return this;
-  }
-
-  /**
-   * @param bestValue the best value. It can be null.
-   * @return this
-   */
-  public Metric<G> setBestValue(@Nullable Double bestValue) {
-    this.bestValue = bestValue;
-    return this;
-  }
-
-  /**
-   * @return whether the metric is of a numeric type (int, percentage...)
-   */
-  public boolean isNumericType() {
-    return ValueType.INT.equals(type)
-      || ValueType.FLOAT.equals(type)
-      || ValueType.PERCENT.equals(type)
-      || ValueType.BOOL.equals(type)
-      || ValueType.MILLISEC.equals(type)
-      || ValueType.RATING.equals(type)
-      || ValueType.WORK_DUR.equals(type);
-  }
-
-  /**
-   * @return whether the metric is of type data
-   */
-  public boolean isDataType() {
-    return ValueType.DATA.equals(type) || ValueType.DISTRIB.equals(type);
-  }
-
-  /**
-   * @return whether the metric is of type percentage
-   */
-  public boolean isPercentageType() {
-    return ValueType.PERCENT.equals(type);
-  }
-
-  public Metric<G> setOptimizedBestValue(@Nullable Boolean b) {
-    this.optimizedBestValue = b;
-    return this;
-  }
-
-  /**
-   * @return null for manual metrics
-   */
-  @CheckForNull
-  public Boolean isOptimizedBestValue() {
-    return optimizedBestValue;
-  }
-
-  public Boolean isHidden() {
-    return hidden;
-  }
-
-  public Metric<G> setHidden(Boolean hidden) {
-    this.hidden = hidden;
-    return this;
-  }
-
-  public Boolean getDeleteHistoricalData() {
-    return deleteHistoricalData;
-  }
-
-  /**
-   * Return the number scale if metric type is {@link ValueType#FLOAT}, else {@code null}
-   *
-   * @since 5.3
-   */
-  @CheckForNull
-  public Integer getDecimalScale() {
-    return decimalScale;
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof Metric)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    Metric other = (Metric) obj;
-    return key.equals(other.getKey());
-  }
-
-  @Override
-  public String toString() {
-    return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
-  }
-
-  /**
-   * Merge with fields from other metric. All fields are copied, except the id.
-   *
-   * @return this
-   */
-  public Metric<G> merge(final Metric with) {
-    this.description = with.description;
-    this.domain = with.domain;
-    this.enabled = with.enabled;
-    this.qualitative = with.qualitative;
-    this.worstValue = with.worstValue;
-    this.bestValue = with.bestValue;
-    this.optimizedBestValue = with.optimizedBestValue;
-    this.direction = with.direction;
-    this.key = with.key;
-    this.type = with.type;
-    this.name = with.name;
-    this.userManaged = with.userManaged;
-    this.hidden = with.hidden;
-    this.deleteHistoricalData = with.deleteHistoricalData;
-    return this;
-  }
-
-  /**
-   * Metric.Builder is used to create metric definitions. It must be preferred to creating new instances of the Metric class directly.
-   *
-   * @since 2.7
-   */
-  public static final class Builder {
-    private String key;
-    private Metric.ValueType type;
-    private String name;
-    private String description;
-    private Integer direction = DIRECTION_NONE;
-    private Boolean qualitative = Boolean.FALSE;
-    private String domain = null;
-    private Double worstValue;
-    private Double bestValue;
-    private boolean optimizedBestValue = false;
-    private boolean hidden = false;
-    private boolean userManaged = false;
-    private boolean deleteHistoricalData = false;
-    private Integer decimalScale = null;
-
-    /**
-     * Creates a new {@link Builder} object.
-     *
-     * @param key  the metric key, should be unique among all metrics
-     * @param name the metric name
-     * @param type the metric type
-     */
-    public Builder(String key, String name, ValueType type) {
-      checkArgument(isNotBlank(key), "Metric key can not be blank");
-      checkArgument(isNotBlank(name), "Name of metric %s must be set", key);
-      checkArgument(type != null, "Type of metric %s must be set", key);
-      this.key = key;
-      this.name = name;
-      this.type = type;
-    }
-
-    /**
-     * Sets the metric description.
-     *
-     * @param d the description
-     * @return the builder
-     */
-    public Builder setDescription(String d) {
-      this.description = d;
-      return this;
-    }
-
-    /**
-     * Sets the metric direction (used for numeric values only), which is used in the Web UI to show if the trend of a metric is good or not.
-     * <ul>
-     * <li>Metric.DIRECTION_WORST: indicates that an increase of the metric value is not a good thing (example: the complexity of a function)</li>
-     * <li>Metric.DIRECTION_BETTER: indicates that an increase of the metric value is a good thing (example: the code coverage of a function)</li>
-     * <li>Metric.DIRECTION_NONE: indicates that the variation of the metric value is neither good nor bad (example: number of files).</li>
-     * </ul>
-     * Metric.DIRECTION_NONE is the default value.
-     *
-     * @param d the direction
-     * @return the builder
-     * @see Metric#DIRECTION_WORST
-     * @see Metric#DIRECTION_BETTER
-     * @see Metric#DIRECTION_NONE
-     */
-    public Builder setDirection(Integer d) {
-      this.direction = d;
-      return this;
-    }
-
-    /**
-     * Sets whether the metric is qualitative or not. Default value is false.
-     * <br>
-     * If set to true, then variations of this metric will be highlighted in the Web UI (for instance, trend icons will be red or green instead of default grey).
-     *
-     * @param b Boolean.TRUE if the metric is qualitative
-     * @return the builder
-     */
-    public Builder setQualitative(Boolean b) {
-      this.qualitative = b;
-      return this;
-    }
-
-    /**
-     * Sets the domain for the metric (General, Complexity...). This is used to group metrics in the Web UI.
-     * <br>
-     * By default, the metric belongs to no specific domain.
-     *
-     * @param d the domain
-     * @return the builder
-     */
-    public Builder setDomain(String d) {
-      this.domain = d;
-      return this;
-    }
-
-    /**
-     * Sets the worst value that the metric can get (example: 0.0 for code coverage). No worst value is set by default.
-     *
-     * @param d the worst value
-     * @return the builder
-     */
-    public Builder setWorstValue(Double d) {
-      this.worstValue = d;
-      return this;
-    }
-
-    /**
-     * Sets the best value that the metric can get (example: 100.0 for code coverage). No best value is set by default.
-     * <br>
-     * Resources would be hidden on drilldown page, if the value of measure equals to best value.
-     *
-     * @param d the best value
-     * @return the builder
-     */
-    public Builder setBestValue(Double d) {
-      this.bestValue = d;
-      return this;
-    }
-
-    /**
-     * Specifies whether file-level measures that equal to the defined best value are stored or not. Default is false.
-     * <br>
-     * Example with the metric that stores the number of violation ({@link CoreMetrics#VIOLATIONS}):
-     * if a file has no violation, then the value '0' won't be stored in the database.
-     *
-     * @param b true if the measures must not be stored when they equal to the best value
-     * @return the builder
-     */
-    public Builder setOptimizedBestValue(boolean b) {
-      this.optimizedBestValue = b;
-      return this;
-    }
-
-    /**
-     * Sets whether the metric should be hidden in Web UI. Default is false.
-     *
-     * @param b true if the metric should be hidden.
-     * @return the builder
-     */
-    public Builder setHidden(boolean b) {
-      this.hidden = b;
-      return this;
-    }
-
-    /**
-     * Specifies whether this metric can be edited online in the "Manual measures" page. Default is false.
-     *
-     * @param b true if the metric can be edited online.
-     * @return the builder
-     * @since 2.10
-     */
-    @Deprecated
-    public Builder setUserManaged(boolean b) {
-      this.userManaged = b;
-      return this;
-    }
-
-    /**
-     * Specifies whether measures from the past can be automatically deleted to minimize database volume.
-     * <br>
-     * By default, historical data are kept.
-     *
-     * @param b true if measures from the past can be deleted automatically.
-     * @return the builder
-     * @since 2.14
-     */
-    public Builder setDeleteHistoricalData(boolean b) {
-      this.deleteHistoricalData = b;
-      return this;
-    }
-
-    /**
-     * Scale to be used if the metric has decimal type ({@link ValueType#FLOAT} or {@link ValueType#PERCENT}).
-     * Default is 1. It is not set (({@code null}) on non-decimal metrics.
-     *
-     * @since 5.3
-     */
-    public Builder setDecimalScale(int scale) {
-      checkArgument(scale >= 0, "Scale of decimal metric %s must be positive: %d", key, scale);
-      checkArgument(scale <= MAX_DECIMAL_SCALE, "Scale of decimal metric [%s] must be less than or equal %s: %s", key, MAX_DECIMAL_SCALE, scale);
-      this.decimalScale = scale;
-      return this;
-    }
-
-    /**
-     * Creates a new metric definition based on the properties set on this metric builder.
-     *
-     * @return a new {@link Metric} object
-     */
-    public <G extends Serializable> Metric<G> create() {
-      if (ValueType.PERCENT == this.type) {
-        this.bestValue = (direction == DIRECTION_BETTER) ? 100.0 : 0.0;
-        this.worstValue = (direction == DIRECTION_BETTER) ? 0.0 : 100.0;
-        this.decimalScale = coalesce(decimalScale, DEFAULT_DECIMAL_SCALE);
-
-      } else if (ValueType.FLOAT == this.type) {
-        this.decimalScale = coalesce(decimalScale, DEFAULT_DECIMAL_SCALE);
-      }
-      return new Metric<>(this);
-    }
-  }
-
-  @CheckForNull
-  private static <T> T coalesce(@Nullable T a, @Nullable T b) {
-    return a == null ? b : a;
-  }
-
-  @Override
-  public String key() {
-    return getKey();
-  }
-
-  @Override
-  public Class<G> valueType() {
-    return getType().valueType();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java
deleted file mode 100644 (file)
index b61179d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.List;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * This is the extension point used by plugins to declare new metrics.
- * @since 1.10
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-@ExtensionPoint
-public interface Metrics {
-  List<Metric> getMetrics();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/package-info.java
deleted file mode 100644 (file)
index 34c78a8..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.measures;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/AnalysisWarnings.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/AnalysisWarnings.java
deleted file mode 100644 (file)
index 906fb11..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.notifications;
-
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Record user-friendly warnings that will be visible on SonarQube
- * to users with browse access to the project.
- *
- * @since 7.4
- */
-@ScannerSide
-public interface AnalysisWarnings {
-
-  /**
-   * Add a single message, if it was not already added.
-   */
-  void addUnique(String text);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java
deleted file mode 100644 (file)
index fa7ed61..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.notifications;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-/**
- * This class represents a notification that will be delivered to users. This is a general concept and it has no
- * knowledge of the possible ways to be delivered (see {@link NotificationChannel}).
- * <p>
- * When creating a new notification, it is strongly advised to give a default message that can be  used by channels
- * that don't want to specifically format messages for different notification types. You can use
- * {@link Notification#setDefaultMessage(String)} for that purpose.
- * 
- *
- * @since 2.10
- * @deprecated in 7.8. See {@link NotificationChannel}.
- */
-@Deprecated
-public class Notification implements Serializable {
-
-  private static final String DEFAULT_MESSAGE_KEY = "default_message";
-
-  private final String type;
-  private final Map<String, String> fields = new HashMap<>();
-
-  /**
-   * <p>
-   * Create a new {@link Notification} of the given type.
-   * 
-   * Example: type = "new-violations"
-   *
-   * @param type the type of notification
-   */
-  public Notification(String type) {
-    this.type = type;
-  }
-
-  /**
-   * Returns the type of the notification
-   *
-   * @return the type
-   */
-  public String getType() {
-    return type;
-  }
-
-  /**
-   * <p>
-   * When creating a new notification, it is strongly advised to give a default message that can be
-   * used by channels that don't want to specifically format messages for different notification types.
-   * 
-   * <p>
-   * This method is equivalent to setting a value for the field {@link #DEFAULT_MESSAGE_KEY} with
-   * {@link #setFieldValue(String, String)}.
-   * 
-   *
-   * @since 3.5
-   */
-  public Notification setDefaultMessage(String value) {
-    setFieldValue(DEFAULT_MESSAGE_KEY, value);
-    return this;
-  }
-
-  /**
-   * Returns the default message to display for this notification.
-   */
-  public String getDefaultMessage() {
-    String defaultMessage = getFieldValue(DEFAULT_MESSAGE_KEY);
-    if (defaultMessage == null) {
-      defaultMessage = this.toString();
-    }
-    return defaultMessage;
-  }
-
-  /**
-   * Adds a field (kind of property) to the notification
-   *
-   * @param field the name of the field (= the key)
-   * @param value the value of the field
-   * @return the notification itself
-   */
-  public Notification setFieldValue(String field, @Nullable String value) {
-    fields.put(field, value);
-    return this;
-  }
-
-  /**
-   * Returns the value of a field.
-   *
-   * @param field the field
-   * @return the value of the field
-   */
-  @CheckForNull
-  public String getFieldValue(String field) {
-    return fields.get(field);
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof Notification)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    Notification other = (Notification) obj;
-    return this.type.equals(other.type) && this.fields.equals(other.fields);
-  }
-
-  @Override
-  public int hashCode() {
-    return type.hashCode() * 31 + fields.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("Notification{");
-    sb.append("type='").append(type).append('\'');
-    sb.append(", fields=").append(fields);
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java
deleted file mode 100644 (file)
index e2789e6..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.notifications;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * <p>
- * Plugins should extend this class to provide implementation on a specific way to deliver notifications.
- * 
- * For example:
- * <ul>
- * <li>email - sends email as soon as possible</li>
- * <li>email (digest) - collects notifications and sends them together once a day</li>
- * <li>gtalk - sends a chat message as soon as possible</li>
- * </ul>
- * 
- * @since 2.10
- * @deprecated in 7.8. This API is not usable, incomplete and suffers from significant performance hotspots.
- */
-@ServerSide
-@ComputeEngineSide
-@ExtensionPoint
-@Deprecated
-public abstract class NotificationChannel {
-
-  /**
-   * Returns the unique key of this channel. 
-   * 
-   * @return the key
-   */
-  public String getKey() {
-    return getClass().getSimpleName();
-  }
-
-  /**
-   * Implements the delivery of the given notification to the given user.
-   * 
-   * @param notification the notification to deliver
-   * @param userlogin the login of the user who should receive the notification
-   * @return whether the notification was sent or not
-   */
-  public abstract boolean deliver(Notification notification, String userlogin);
-
-  @Override
-  public String toString() {
-    return getKey();
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/package-info.java
deleted file mode 100644 (file)
index f745a68..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.notifications;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/package-info.java
deleted file mode 100644 (file)
index 0c8ab8a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java
deleted file mode 100644 (file)
index dcddf64..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import javax.annotation.Nullable;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * @since 3.2
- */
-@ServerSide
-@ExtensionPoint
-public interface NewUserHandler {
-
-  final class Context {
-    private String login;
-    private String name;
-    private String email;
-
-    private Context(String login, String name, @Nullable String email) {
-      requireNonNull(login);
-      requireNonNull(name);
-      this.login = login;
-      this.name = name;
-      this.email = email;
-    }
-
-    public String getLogin() {
-      return login;
-    }
-
-    public String getName() {
-      return name;
-    }
-
-    public String getEmail() {
-      return email;
-    }
-
-    public static Builder builder() {
-      return new Builder();
-    }
-
-    public static final class Builder {
-      private String login;
-      private String name;
-      private String email;
-
-      private Builder() {
-      }
-
-      public Builder setLogin(String s) {
-        this.login = s;
-        return this;
-      }
-
-      public Builder setName(String s) {
-        this.name = s;
-        return this;
-      }
-
-      public Builder setEmail(@Nullable String s) {
-        this.email = s;
-        return this;
-      }
-
-      public Context build() {
-        return new Context(login, name, email);
-      }
-    }
-  }
-
-  void doOnNewUser(Context context);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java
deleted file mode 100644 (file)
index e7c0e18..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import java.util.Date;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Runtime information about server
- *
- * @since 2.2
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public abstract class Server {
-
-  /**
-   * UUID identifying the installation. It is persisted
-   * so that it does not change over time, even after
-   * a restart.
-   * In the context of cluster, the value is shared
-   * by all the nodes.
-   *
-   * @return a non-null UUID. Format can change over versions.
-   */
-  public abstract String getId();
-
-  /**
-   * Since 6.7, it returns exactly {@link #getId()}. In previous
-   * versions it returned ab UUID generated on demand by system
-   * administrators and may be null.
-   *
-   * @deprecated replaced by {@link #getId()} in 6.7.
-   * @since 2.10
-   */
-  @Deprecated
-  public abstract String getPermanentServerId();
-
-  /**
-   * Non-null version of SonarQube at runtime
-   */
-  public abstract String getVersion();
-
-  /**
-   * Date when server started. In the context of cluster, this is the
-   * date of the startup of the first node. Value is the same on all
-   * cluster nodes.
-   */
-  public abstract Date getStartedAt();
-
-  /**
-   * 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
-   * not end with slash {@code '/'}, for instance {@code "/sonarqube"}.
-   *
-   * @return non-null but possibly blank path
-   */
-  public abstract String getContextPath();
-
-  /**
-   * Return the public root url, without trailing slash, for instance : https://nemo.sonarqube.org.
-   *
-   * @since 5.4
-   */
-  public abstract String getPublicRootUrl();
-
-  /**
-   * Return whether or not the {#getPublicRootUrl} is started with https.
-   *
-   * @since 5.4
-   * @deprecated since 5.6, use instead {@link javax.servlet.http.HttpServletRequest#getHeader(String)} and check that X-Forwarded-Proto header is set to "https".
-   */
-  @Deprecated
-  public abstract boolean isSecured();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
deleted file mode 100644 (file)
index b337de6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import java.io.File;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 2.3
- */
-@ServerSide
-@ComputeEngineSide
-public interface ServerFileSystem {
-
-  /**
-   * Root directory of the server installation
-   * @return an existing directory
-   */
-  File getHomeDir();
-
-  /**
-   * Temporary directory, clean up on restarts
-   * @return an existing directory
-   */
-  File getTempDir();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java
deleted file mode 100644 (file)
index 887bcea..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 2.2
- */
-@ServerSide
-@ComputeEngineSide
-@ExtensionPoint
-public interface ServerStartHandler {
-
-  void onServerStart(Server server);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java
deleted file mode 100644 (file)
index 7a11d70..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 2.2
- */
-@ServerSide
-@ComputeEngineSide
-@ExtensionPoint
-public interface ServerStopHandler {
-
-  void onServerStop(Server server);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java
deleted file mode 100644 (file)
index 1af94c6..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 2.5
- */
-@ServerSide
-@ComputeEngineSide
-public interface ServerUpgradeStatus {
-
-  /**
-   * Has the database been upgraded during the current startup ? Return false when {@link #isFreshInstall()} is true.
-   */
-  boolean isUpgraded();
-
-  /**
-   * Has the database been created from scratch during the current startup ?
-   */
-  boolean isFreshInstall();
-
-  /**
-   * The database version before the server startup. Returns a non-zero negative value if db created from scratch.
-   */
-  int getInitialDbVersion();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/package-info.java
deleted file mode 100644 (file)
index 9c8e665..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
deleted file mode 100644 (file)
index 9ca0a97..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.Writer;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Export quality profile rules to a file
- *
- * @since 2.3
- * @deprecated since 9.1. Web services should be used instead.
- */
-@ServerSide
-@ExtensionPoint
-@Deprecated
-public abstract class ProfileExporter {
-
-  private String[] supportedLanguages = new String[0];
-  private String key;
-  private String name;
-  private String mimeType = "text/plain";
-
-  protected ProfileExporter(String key, String name) {
-    this.key = key;
-    this.name = name;
-  }
-
-  /**
-   * Export activated rule from a quality profile to a writer
-   *
-   * Note that the quality profile can contain some rules from other plugins. It should not fail in this case.
-   */
-  public abstract void exportProfile(RulesProfile profile, Writer writer);
-
-  public String getKey() {
-    return key;
-  }
-
-  public final ProfileExporter setKey(String s) {
-    this.key = s;
-    return this;
-  }
-
-  public final String getName() {
-    return name;
-  }
-
-  public final ProfileExporter setName(String s) {
-    this.name = s;
-    return this;
-  }
-
-  /**
-   * Set the list of languages supported
-   * An empty value means that it will be available for every languages.
-   */
-  protected final ProfileExporter setSupportedLanguages(String... languages) {
-    supportedLanguages = (languages != null) ? languages : new String[0];
-    return this;
-  }
-
-  public String getMimeType() {
-    return mimeType;
-  }
-
-  /**
-   * Set the mime type of the exported file
-   */
-  public final ProfileExporter setMimeType(String s) {
-    if (StringUtils.isNotBlank(s)) {
-      this.mimeType = s;
-    }
-    return this;
-  }
-
-  /**
-   * @return if empty, then any languages are supported.
-   */
-  public String[] getSupportedLanguages() {
-    return supportedLanguages;
-  }
-
-  @Override
-  public final boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    ProfileExporter that = (ProfileExporter) o;
-    return !((key != null) ? !key.equals(that.key) : (that.key != null));
-  }
-
-  @Override
-  public final int hashCode() {
-    return key != null ? key.hashCode() : 0;
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
-      .append("key", key)
-      .append("name", name)
-      .append("mimeType", mimeType)
-      .append("languages", supportedLanguages)
-      .toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java
deleted file mode 100644 (file)
index 183aa91..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.Reader;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.ValidationMessages;
-
-/**
- * Create a quality profile from an external rules file.
- *
- * @since 2.3
- * @deprecated since 9.1. Web services should be used instead.
- */
-@ServerSide
-@ExtensionPoint
-@Deprecated
-public abstract class ProfileImporter {
-
-  private String[] supportedLanguages = new String[0];
-  private String importerKey;
-  private String importerName;
-
-  protected ProfileImporter(String key, String name) {
-    this.importerKey = key;
-    this.importerName = name;
-  }
-
-  /**
-   * Import the profile from a reader.
-   *
-   * {@link ValidationMessages#warnings} can be used to return some warnings to the user, for instance when some rules doesn't exist.
-   * {@link ValidationMessages#errors} can be used when an unrecoverable error is generating during import. No quality profile will be created.
-   */
-  public abstract RulesProfile importProfile(Reader reader, ValidationMessages messages);
-
-  public String getKey() {
-    return importerKey;
-  }
-
-  public final ProfileImporter setKey(String s) {
-    this.importerKey = s;
-    return this;
-  }
-
-  public final String getName() {
-    return importerName;
-  }
-
-  public final ProfileImporter setName(String s) {
-    this.importerName = s;
-    return this;
-  }
-
-  /**
-   * Set the list of languages supported
-   * An empty value means that it will be available for every languages.
-   */
-  protected final ProfileImporter setSupportedLanguages(String... languages) {
-    supportedLanguages = (languages != null) ? languages : new String[0];
-    return this;
-  }
-
-  /**
-   * @return if empty, then any languages are supported.
-   */
-  public String[] getSupportedLanguages() {
-    return supportedLanguages;
-  }
-
-  @Override
-  public final boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    ProfileImporter that = (ProfileImporter) o;
-    return !((importerKey != null) ? !importerKey.equals(that.importerKey) : (that.importerKey != null));
-  }
-
-  @Override
-  public final int hashCode() {
-    return (importerKey != null) ? importerKey.hashCode() : 0;
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
-      .append("key", importerKey)
-      .append("name", importerName)
-      .append("languages", supportedLanguages)
-      .toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
deleted file mode 100644 (file)
index 677bdd2..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ArrayList;
-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.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.sonar.api.rules.ActiveRule;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RulePriority;
-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 {
-  private String name;
-  private Boolean defaultProfile = Boolean.FALSE;
-  private String language;
-  private List<ActiveRule> activeRules = new ArrayList<>();
-
-  /**
-   * @deprecated use the factory method create()
-   */
-  @Deprecated
-  public RulesProfile() {
-  }
-
-  /**
-   * @deprecated since 2.3. Use the factory method create()
-   */
-  @Deprecated
-  public RulesProfile(String name, String language) {
-    this.name = name;
-    this.language = language;
-    this.activeRules = new ArrayList<>();
-  }
-
-  /**
-   * @deprecated since 2.3. Use the factory method create()
-   */
-  @Deprecated
-  public RulesProfile(String name, String language, boolean defaultProfile, /* kept for backward-compatibility */boolean provided) {
-    this(name, language);
-    this.defaultProfile = defaultProfile;
-  }
-
-  public Integer getId() {
-    return null;
-  }
-
-  /**
-   * @return the profile name, unique by language.
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Set the profile name.
-   */
-  public RulesProfile setName(String s) {
-    this.name = s;
-    return this;
-  }
-
-  /**
-   * @deprecated profile versioning is dropped in 4.4. Always returns -1.
-   */
-  @Deprecated
-  public int getVersion() {
-    return -1;
-  }
-
-  /**
-   * @deprecated profile versioning is dropped in 4.4. Always returns -1.
-   */
-  @Deprecated
-  public RulesProfile setVersion(int version) {
-    // ignore
-    return this;
-  }
-
-  /**
-   * @deprecated profile versioning is dropped in 4.4. Always returns null.
-   */
-  @CheckForNull
-  @Deprecated
-  public Boolean getUsed() {
-    return null;
-  }
-
-  /**
-   * @deprecated profile versioning is dropped in 4.4. Always returns -1.
-   */
-  @Deprecated
-  public RulesProfile setUsed(Boolean used) {
-    return this;
-  }
-
-  /**
-   * @return the list of active rules
-   */
-  public List<ActiveRule> getActiveRules() {
-    return getActiveRules(false);
-  }
-
-  /**
-   * @return the list of active rules
-   */
-  public List<ActiveRule> getActiveRules(boolean acceptDisabledRules) {
-    if (acceptDisabledRules) {
-      return activeRules;
-    }
-    List<ActiveRule> result = new ArrayList<>();
-    for (ActiveRule activeRule : activeRules) {
-      if (activeRule.isEnabled()) {
-        result.add(activeRule);
-      }
-    }
-    return result;
-  }
-
-  public RulesProfile removeActiveRule(ActiveRule activeRule) {
-    activeRules.remove(activeRule);
-    return this;
-  }
-
-  public RulesProfile addActiveRule(ActiveRule activeRule) {
-    activeRules.add(activeRule);
-    return this;
-  }
-
-  /**
-   * Set the list of active rules
-   */
-  public void setActiveRules(List<ActiveRule> activeRules) {
-    this.activeRules = activeRules;
-  }
-
-  /**
-   * @return whether this is the default profile for the language
-   */
-  public Boolean getDefaultProfile() {
-    return defaultProfile;
-  }
-
-  /**
-   * Set whether this is the default profile for the language. The default profile is used when none is explicitly defined when auditing a
-   * project.
-   */
-  public void setDefaultProfile(Boolean b) {
-    this.defaultProfile = b;
-  }
-
-  /**
-   * @return the profile language
-   */
-  public String getLanguage() {
-    return language;
-  }
-
-  /**
-   * Set the profile language
-   */
-  public RulesProfile setLanguage(String s) {
-    this.language = s;
-    return this;
-  }
-
-  /**
-   * Note: disabled rules are excluded.
-   *
-   * @return the list of active rules for a given severity
-   */
-  public List<ActiveRule> getActiveRules(RulePriority severity) {
-    List<ActiveRule> result = new ArrayList<>();
-    for (ActiveRule activeRule : activeRules) {
-      if (activeRule.getSeverity().equals(severity) && activeRule.isEnabled()) {
-        result.add(activeRule);
-      }
-    }
-    return result;
-  }
-
-  /**
-   * Get the active rules of a specific repository.
-   * Only enabled rules are selected. Disabled rules are excluded.
-   */
-  public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) {
-    List<ActiveRule> result = new ArrayList<>();
-    for (ActiveRule activeRule : activeRules) {
-      if (repositoryKey.equals(activeRule.getRepositoryKey()) && activeRule.isEnabled()) {
-        result.add(activeRule);
-      }
-    }
-    return result;
-  }
-
-  /**
-   * Note: disabled rules are excluded.
-   *
-   * @return an active rule from a plugin key and a rule key if the rule is activated, null otherwise
-   */
-  @CheckForNull
-  public ActiveRule getActiveRule(String repositoryKey, String ruleKey) {
-    for (ActiveRule activeRule : activeRules) {
-      if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getRuleKey(), ruleKey) && activeRule.isEnabled()) {
-        return activeRule;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Note: disabled rules are excluded.
-   */
-  @CheckForNull
-  public ActiveRule getActiveRuleByConfigKey(String repositoryKey, String configKey) {
-    for (ActiveRule activeRule : activeRules) {
-      if (StringUtils.equals(activeRule.getRepositoryKey(), repositoryKey) && StringUtils.equals(activeRule.getConfigKey(), configKey) && activeRule.isEnabled()) {
-        return activeRule;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Note: disabled rules are excluded.
-   */
-  @CheckForNull
-  public ActiveRule getActiveRule(Rule rule) {
-    return getActiveRule(rule.getRepositoryKey(), rule.getKey());
-  }
-
-  /**
-   * @param optionalSeverity if null, then the default rule severity is used
-   */
-  public ActiveRule activateRule(final Rule rule, @Nullable RulePriority optionalSeverity) {
-    if (activeRules.stream().anyMatch(ar -> ar.getRule().equals(rule))) {
-      throw MessageException.of(String.format(
-        "The definition of the profile '%s' (language '%s') contains multiple occurrences of the '%s:%s' rule. The plugin which declares this profile should fix this.",
-        getName(), getLanguage(), rule.getRepositoryKey(), rule.getKey()));
-    }
-    ActiveRule activeRule = new ActiveRule(this, rule, optionalSeverity);
-    activeRules.add(activeRule);
-    return activeRule;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof RulesProfile)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    RulesProfile other = (RulesProfile) obj;
-    return new EqualsBuilder().append(language, other.getLanguage()).append(name, other.getName()).isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(17, 37).append(language).append(name).toHashCode();
-  }
-
-  @Override
-  public Object clone() {
-    RulesProfile clone = RulesProfile.create(getName(), getLanguage());
-    clone.setDefaultProfile(getDefaultProfile());
-    if (activeRules != null && !activeRules.isEmpty()) {
-      clone.setActiveRules(activeRules.stream()
-        .map(ar -> (ActiveRule) ar.clone())
-        .collect(Collectors.toList()));
-    }
-    return clone;
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder().append("[name=").append(name).append(",language=").append(language).append("]").toString();
-  }
-
-  public static RulesProfile create(String name, String language) {
-    return new RulesProfile().setName(name).setLanguage(language);
-  }
-
-  public static RulesProfile create() {
-    return new RulesProfile();
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
deleted file mode 100644 (file)
index d5e4035..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Nullable;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.rules.ActiveRule;
-import org.sonar.api.rules.Rule;
-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;
-
-/**
- * @since 2.3
- * @deprecated since 7.8 use {@link BuiltInQualityProfileAnnotationLoader}
- */
-@Deprecated
-@ServerSide
-@ComputeEngineSide
-public class XMLProfileParser {
-
-  private static final String ELEMENT_PROFILE = "profile";
-  private static final String ELEMENT_RULES = "rules";
-  private static final String ELEMENT_RULE = "rule";
-  private static final String ELEMENT_PARAMETERS = "parameters";
-  private static final String ELEMENT_PARAMETER = "parameter";
-  private final RuleFinder ruleFinder;
-
-  /**
-   * For backward compatibility.
-   *
-   * @deprecated since 2.5. Plugins shouldn't directly instantiate this class,
-   * because it should be retrieved as an IoC dependency.
-   */
-  @Deprecated
-  public XMLProfileParser(RuleFinder ruleFinder) {
-    this.ruleFinder = ruleFinder;
-  }
-
-  public RulesProfile parseResource(ClassLoader classloader, String xmlClassPath, ValidationMessages messages) {
-    try (Reader reader = new InputStreamReader(classloader.getResourceAsStream(xmlClassPath), StandardCharsets.UTF_8)) {
-      return parse(reader, messages);
-    } catch (IOException e) {
-      throw new IllegalStateException("Unable to close stream", e);
-    }
-  }
-
-  public RulesProfile parse(Reader inputReader, ValidationMessages messages) {
-    RulesProfile profile = RulesProfile.create();
-    XMLInputFactory inputFactory = initStax();
-    try {
-      final XMLEventReader reader = inputFactory.createXMLEventReader(inputReader);
-      while (reader.hasNext()) {
-        final XMLEvent event = reader.nextEvent();
-        if (event.isStartElement() && event.asStartElement().getName()
-          .getLocalPart().equals(ELEMENT_PROFILE)) {
-          parseProfile(profile, reader, messages);
-        }
-      }
-    } catch (XMLStreamException e) {
-      messages.addErrorText("XML is not valid: " + e.getMessage());
-    }
-    checkProfile(profile, messages);
-    return profile;
-  }
-
-  private void parseProfile(RulesProfile profile, final XMLEventReader reader, ValidationMessages messages) throws XMLStreamException {
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_PROFILE)) {
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if (ELEMENT_RULES.equals(elementName)) {
-          parseRules(profile, reader, messages);
-        } else if ("name".equals(elementName)) {
-          profile.setName(StringUtils.trim(reader.getElementText()));
-        } else if ("language".equals(elementName)) {
-          profile.setLanguage(StringUtils.trim(reader.getElementText()));
-        }
-      }
-    }
-  }
-
-  private void parseRules(RulesProfile profile, XMLEventReader reader, ValidationMessages messages) throws XMLStreamException {
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_RULES)) {
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if (ELEMENT_RULE.equals(elementName)) {
-          parseRule(profile, reader, messages);
-        }
-      }
-    }
-  }
-
-  private static void checkProfile(RulesProfile profile, ValidationMessages messages) {
-    if (StringUtils.isBlank(profile.getName())) {
-      messages.addErrorText("The mandatory node <name> is missing.");
-    }
-    if (StringUtils.isBlank(profile.getLanguage())) {
-      messages.addErrorText("The mandatory node <language> is missing.");
-    }
-  }
-
-  private static XMLInputFactory initStax() {
-    XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
-    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
-    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
-    // just so it won't try to load DTD in if there's DOCTYPE
-    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
-    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
-    return xmlFactory;
-  }
-
-  private void parseRule(RulesProfile profile, XMLEventReader reader, ValidationMessages messages) throws XMLStreamException {
-    Map<String, String> parameters = new HashMap<>();
-    String repositoryKey = null;
-    String key = null;
-    RulePriority priority = null;
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_RULE)) {
-        buildRule(profile, messages, parameters, repositoryKey, key, priority);
-        return;
-      }
-
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if ("repositoryKey".equals(elementName)) {
-          repositoryKey = StringUtils.trim(reader.getElementText());
-        } else if ("key".equals(elementName)) {
-          key = StringUtils.trim(reader.getElementText());
-        } else if ("priority".equals(elementName)) {
-          priority = RulePriority.valueOf(StringUtils.trim(reader.getElementText()));
-        } else if (ELEMENT_PARAMETERS.equals(elementName)) {
-          processParameters(parameters, reader);
-        }
-      }
-    }
-  }
-
-  private void buildRule(RulesProfile profile, ValidationMessages messages, Map<String, String> parameters, String repositoryKey, String key, @Nullable RulePriority priority) {
-    Rule rule = ruleFinder.findByKey(repositoryKey, key);
-    if (rule == null) {
-      messages.addWarningText("Rule not found: " + ruleToString(repositoryKey, key));
-    } else {
-      ActiveRule activeRule = profile.activateRule(rule, priority);
-      for (Map.Entry<String, String> entry : parameters.entrySet()) {
-        if (rule.getParam(entry.getKey()) == null) {
-          messages.addWarningText("The parameter '" + entry.getKey() + "' does not exist in the rule: " + ruleToString(repositoryKey, key));
-        } else {
-          activeRule.setParameter(entry.getKey(), entry.getValue());
-        }
-      }
-    }
-  }
-
-  private static String ruleToString(String repositoryKey, String key) {
-    return "[repository=" + repositoryKey + ", key=" + key + "]";
-  }
-
-  private static void processParameters(Map<String, String> parameters, XMLEventReader reader) throws XMLStreamException {
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_PARAMETERS)) {
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if (ELEMENT_PARAMETER.equals(elementName)) {
-          processParameter(parameters, reader);
-        }
-      }
-    }
-  }
-
-  private static void processParameter(Map<String, String> parameters, XMLEventReader reader) throws XMLStreamException {
-    String key = null;
-    String value = null;
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_PARAMETER)) {
-        if (key != null) {
-          parameters.put(key, value);
-        }
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if ("key".equals(elementName)) {
-          key = StringUtils.trim(reader.getElementText());
-        } else if ("value".equals(elementName)) {
-          value = StringUtils.trim(reader.getElementText());
-        }
-      }
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java
deleted file mode 100644 (file)
index 9e81c1b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.IOException;
-import java.io.Writer;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.rules.ActiveRule;
-import org.sonar.api.rules.ActiveRuleParam;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.SonarException;
-
-/**
- * @since 2.3
- * @deprecated since 7.8
- */
-@Deprecated
-@ServerSide
-@ComputeEngineSide
-public class XMLProfileSerializer {
-
-  public void write(RulesProfile profile, Writer writer) {
-    try {
-      appendHeader(profile, writer);
-      appendRules(profile, writer);
-      appendFooter(writer);
-
-    } catch (IOException e) {
-      throw new SonarException("Fail to export the profile " + profile, e);
-    }
-  }
-
-  private static void appendHeader(RulesProfile profile, Writer writer) throws IOException {
-    writer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-      + "<!-- Generated by SonarQube -->"
-      + "<profile><name>");
-    StringEscapeUtils.escapeXml(writer, profile.getName());
-    writer.append("</name><language>");
-    StringEscapeUtils.escapeXml(writer, profile.getLanguage());
-    writer.append("</language>");
-  }
-
-  private static void appendRules(RulesProfile profile, Writer writer) throws IOException {
-    if (!profile.getActiveRules().isEmpty()) {
-      writer.append("<rules>");
-      for (ActiveRule activeRule : profile.getActiveRules()) {
-        appendRule(activeRule, writer);
-      }
-      writer.append("</rules>");
-    }
-  }
-
-  private static void appendRule(ActiveRule activeRule, Writer writer) throws IOException {
-    writer.append("<rule><repositoryKey>");
-    writer.append(activeRule.getRepositoryKey());
-    writer.append("</repositoryKey><key>");
-    StringEscapeUtils.escapeXml(writer, activeRule.getRuleKey());
-    writer.append("</key>");
-    if (activeRule.getSeverity() != null) {
-      writer.append("<priority>");
-      writer.append(activeRule.getSeverity().name());
-      writer.append("</priority>");
-    }
-    appendRuleParameters(activeRule, writer);
-    writer.append("</rule>");
-  }
-
-  private static void appendRuleParameters(ActiveRule activeRule, Writer writer) throws IOException {
-    if (activeRule.getActiveRuleParams() != null && !activeRule.getActiveRuleParams().isEmpty()) {
-      writer.append("<parameters>");
-      for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) {
-        appendRuleParameter(writer, activeRuleParam);
-      }
-      writer.append("</parameters>");
-    }
-  }
-
-  private static void appendRuleParameter(Writer writer, ActiveRuleParam activeRuleParam) throws IOException {
-    if (StringUtils.isNotBlank(activeRuleParam.getValue())) {
-      writer.append("<parameter><key>");
-      StringEscapeUtils.escapeXml(writer, activeRuleParam.getKey());
-      writer.append("</key><value>");
-      StringEscapeUtils.escapeXml(writer, activeRuleParam.getValue());
-      writer.append("</value>");
-      writer.append("</parameter>");
-    }
-  }
-
-  private static void appendFooter(Writer writer) throws IOException {
-    writer.append("</profile>");
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/package-info.java
deleted file mode 100644 (file)
index 91f1dd9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.profiles;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/AbstractLanguage.java
deleted file mode 100644 (file)
index 807b25f..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.Locale;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Inherit this class to define a new language like PLSQL, PHP or C#
- *
- * @since 1.10
- */
-public abstract class AbstractLanguage implements Language {
-  private final String key;
-  private String name;
-
-  /**
-   * Better to use AbstractLanguage(key, name). In this case, key and name will be the same
-   *
-   * @param key The key of the language. Must not be more than 20 chars.
-   */
-  public AbstractLanguage(String key) {
-    this(key, key);
-  }
-
-  /**
-   * Should be the constructor used to build an AbstractLanguage.
-   *
-   * @param key  the key that will be used to retrieve the language. Must not be more than 20 chars. This key is important as it will be used to teint rules repositories...
-   * @param name the display name of the language in the interface
-   */
-  public AbstractLanguage(String key, String name) {
-    checkArgument(key.length() <= 20, "The following language key exceeds 20 characters: '" + key + "'");
-    this.key = key.toLowerCase(Locale.ENGLISH);
-    this.name = name;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Sets the language name
-   */
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || !(o instanceof Language)) {
-      return false;
-    }
-    Language that = (Language) o;
-    return key.equals(that.getKey());
-
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return name;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
deleted file mode 100644 (file)
index 697767c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * The extension point to define a new language
- *
- * @since 1.10
- */
-@ScannerSide
-@ServerSide
-@SonarLintSide
-@ComputeEngineSide
-@ExtensionPoint
-public interface Language {
-
-  /**
-   * For example "java". Should not be more than 20 chars.
-   */
-  String getKey();
-
-  /**
-   * For example "Java"
-   */
-  String getName();
-
-  /**
-   * For example ["jav", "java"].
-   * If empty, then all files in source directories are considered as sources.
-   */
-  String[] getFileSuffixes();
-
-  /**
-   * Whether all files identified with this language should be sent to SonarQube, even if no data is reported for them
-   * @since 9.3
-   */
-  default boolean publishAllFiles() {
-    return true;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java
deleted file mode 100644 (file)
index 122cc43..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A class to store the list of languages
- *
- * @since 1.10
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public class Languages {
-
-  private static final Logger LOG = Loggers.get(Languages.class);
-
-  private final Map<String, Language> map = new LinkedHashMap<>();
-
-  /**
-   * Creates a list of languages
-   */
-  public Languages(Language... languages) {
-    LOG.debug("Available languages:");
-    for (Language language : languages) {
-      map.put(language.getKey(), language);
-      LOG.debug("  * " + language.getName() + " => \"" + language.getKey() + "\"");
-    }
-  }
-
-  /**
-   * No languages are installed
-   */
-  public Languages() {
-    LOG.debug("No language available");
-  }
-
-  /**
-   * @param keys the languages keys
-   * @return the list of suffix files associates to languages included in the current object
-   */
-  public String[] getSuffixes(String... keys) {
-    List<String> suffixes = new ArrayList<>();
-
-    for (Map.Entry<String, Language> entry : map.entrySet()) {
-      if (ArrayUtils.isEmpty(keys) || ArrayUtils.contains(keys, entry.getKey())) {
-        suffixes.addAll(Arrays.asList(entry.getValue().getFileSuffixes()));
-      }
-    }
-    return suffixes.toArray(new String[suffixes.size()]);
-  }
-
-  /**
-   * Return a language from the current object based on its key
-   */
-  public Language get(String key) {
-    return map.get(key);
-  }
-
-  /**
-   * Adds a language to the current object
-   */
-  public void add(Language language) {
-    map.put(language.getKey(), language);
-  }
-
-  /**
-   * @since 4.2
-   */
-  public Language[] all() {
-    Collection<Language> languages = map.values();
-    return languages.toArray(new Language[languages.size()]);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Qualifiers.java
deleted file mode 100644 (file)
index 5174195..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.List;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableList;
-
-/**
- * The qualifier determines the exact type of a resource.
- * Plugins can define their own qualifiers.
- *
- * @since 2.6
- */
-public final class Qualifiers {
-
-  /**
-   * Root portfolios. Scope of portfolios is Scopes.PROJECT
-   */
-  public static final String VIEW = "VW";
-
-  /**
-   * Sub-portfolios, defined in root portfolios. Scope of sub-portfolios is Scopes.PROJECT
-   */
-  public static final String SUBVIEW = "SVW";
-
-  /**
-   * Application portfolios. Scope of application is Scopes.PROJECT
-   */
-  public static final String APP = "APP";
-
-  /**
-   * Library, for example a JAR dependency of Java projects.
-   * Scope of libraries is Scopes.PROJECT
-   * @deprecated since 5.2 No more design features
-   */
-  @Deprecated
-  public static final String LIBRARY = "LIB";
-
-  /**
-   * Project
-   * Scope is Scopes.PROJECT
-   */
-  public static final String PROJECT = "TRK";
-
-  /**
-   * Module of a multi-modules project. It's sometimes called "sub-project".
-   * Scope of modules is Scopes.PROJECT
-   *
-   * @deprecated since 7.7 as modules doesn't exist anymore
-   */
-  @Deprecated
-  public static final String MODULE = "BRC";
-
-  public static final String DIRECTORY = "DIR";
-  public static final String FILE = "FIL";
-
-  // ugly, should be replaced by "natures"
-  public static final String UNIT_TEST_FILE = "UTS";
-
-  /**
-   * List of qualifiers, ordered from bottom to up regarding position
-   * in tree of components
-   *
-   * @since 7.0
-   */
-  public static final List<String> ORDERED_BOTTOM_UP = unmodifiableList(asList(
-    FILE, UNIT_TEST_FILE, DIRECTORY, MODULE, PROJECT, APP, SUBVIEW, VIEW));
-
-  private Qualifiers() {
-    // only static methods
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java
deleted file mode 100644 (file)
index 1f758bc..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang.StringUtils.isEmpty;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * <p>Experimental extension to declare types of resources.
- * <p>
- * Since 3.0, ResourceType object can declare properties that give information about the capabilities of the
- * resource type. Those properties may be used, of instance, to adapt the Web UI according to the type of
- * the resource being displayed.
- * <br>
- * Currently, the following properties can be defined:
- * <ul>
- * <li>"deletable": if set to "true", then this resource can be deleted/purged.</li>
- * <li>"supportsMeasureFilters": if set to "true", then this resource can be displayed in measure filters</li>
- * <li>"modifiable_history": if set to "true", then the history of this resource may be modified (deletion of snapshots, modification of events, ...)</li>
- * <li>"updatable_key" (since 3.2): if set to "true", then it is possible to update the key of this resource</li>
- * <li>"supportsGlobalDashboards" (since 3.2): if true, this resource can be displayed in global dashboards</li>
- * <li>"hasRolePolicy" : if true, roles configuration is available in sidebar</li>
- * <li>"comparable" (since 3.4) : if true, the resource can be compared to other resources</li>
- * <li>"configurable" (since 3.6) : if true, the settings page can be displayed on the resource</li>
- * </ul>
- *
- * @since 2.14
- */
-@Immutable
-public class ResourceType {
-
-  private final String qualifier;
-  private final String iconPath;
-  private final boolean hasSourceCode;
-  private Map<String, String> properties;
-
-  private ResourceType(Builder builder) {
-    this.qualifier = builder.qualifier;
-    this.iconPath = builder.iconPath;
-    this.hasSourceCode = builder.hasSourceCode;
-    this.properties = new HashMap<>(builder.properties);
-  }
-
-  /**
-   * Qualifier is the unique key.
-   *
-   * @return the qualifier
-   */
-  public String getQualifier() {
-    return qualifier;
-  }
-
-  /**
-   * Returns the relative path of the icon used to represent the resource type
-   *
-   * @return the relative path.
-   */
-  public String getIconPath() {
-    return iconPath;
-  }
-
-  /**
-   * Tells whether resources of this type has source code or not.
-   *
-   * @return true if the type has source code
-   */
-  public boolean hasSourceCode() {
-    return hasSourceCode;
-  }
-
-  public boolean hasProperty(String key) {
-    requireNonNull(key);
-    return properties.containsKey(key);
-  }
-
-  /**
-   * Returns the value of the property for this resource type.
-   *
-   * @return the String value of the property, or NULL if the property hasn't been set.
-   * @since 3.0
-   */
-  public String getStringProperty(String key) {
-    requireNonNull(key);
-    return properties.get(key);
-  }
-
-  /**
-   * Returns the value of the property for this resource type.
-   *
-   * @return the Boolean value of the property. If the property hasn't been set, False is returned.
-   * @since 3.0
-   */
-  public boolean getBooleanProperty(String key) {
-    requireNonNull(key);
-    String value = properties.get(key);
-    return value != null && Boolean.parseBoolean(value);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    ResourceType that = (ResourceType) o;
-    return qualifier.equals(that.qualifier);
-  }
-
-  @Override
-  public int hashCode() {
-    return qualifier.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return qualifier;
-  }
-
-  /**
-   * Creates a new {@link Builder}
-   */
-  public static Builder builder(String qualifier) {
-    requireNonNull(qualifier);
-    checkArgument(qualifier.length() <= 10, "Qualifier is limited to 10 characters");
-    return new Builder(qualifier);
-  }
-
-  /**
-   * Builder used to create {@link ResourceType} objects.
-   */
-  public static class Builder {
-    private String qualifier;
-    private String iconPath;
-    private boolean hasSourceCode = false;
-    private final Map<String, String> properties = new HashMap<>();
-
-    /**
-     * Creates a new {@link Builder}
-     */
-    public Builder(String qualifier) {
-      this.qualifier = qualifier;
-    }
-
-    /**
-     * Relative path of the icon used to represent the resource type.
-     *
-     * @param iconPath path to icon, relative to context of web-application (e.g. "/images/q/DIR.png")
-     */
-    public Builder setIconPath(@Nullable String iconPath) {
-      this.iconPath = iconPath;
-      return this;
-    }
-
-    /**
-     * @deprecated since 3.0. Use {@link #setProperty(String, String)} with "supportsMeasureFilters" set to "true".
-     */
-    @Deprecated
-    public Builder availableForFilters() {
-      return this;
-    }
-
-    /**
-     * Tells that the resources of this type will have source code.
-     */
-    public Builder hasSourceCode() {
-      this.hasSourceCode = true;
-      return this;
-    }
-
-    /**
-     * Sets a property on the resource type. See the description of {@link ResourceType} class for more information.
-     *
-     * @since 3.0
-     */
-    public Builder setProperty(String key, String value) {
-      requireNonNull(key);
-      requireNonNull(value);
-      properties.put(key, value);
-      return this;
-    }
-
-    /**
-     * @since 3.2
-     */
-    public Builder setProperty(String key, boolean value) {
-      return setProperty(key, String.valueOf(value));
-    }
-
-    /**
-     * Creates an instance of {@link ResourceType} based on all information given to the builder.
-     */
-    public ResourceType build() {
-      if (isEmpty(iconPath)) {
-        iconPath = "/images/q/" + qualifier + ".png";
-      }
-      return new ResourceType(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
deleted file mode 100644 (file)
index b373a14..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Collections.unmodifiableList;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 2.14
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public class ResourceTypeTree {
-
-  private final List<ResourceType> types;
-  private final Map<String, List<String>> relations;
-  private final ResourceType root;
-
-  private ResourceTypeTree(Builder builder) {
-    this.types = unmodifiableList(new ArrayList<>(builder.types));
-    this.relations = Collections.unmodifiableMap(builder.relations);
-    this.root = builder.root;
-  }
-
-  public List<ResourceType> getTypes() {
-    return types;
-  }
-
-  public List<String> getChildren(String qualifier) {
-    return relations.getOrDefault(qualifier, Collections.emptyList());
-  }
-
-  public ResourceType getRootType() {
-    return root;
-  }
-
-  public List<String> getLeaves() {
-    return relations.values()
-      .stream()
-      .flatMap(Collection::stream)
-      .filter(qualifier -> !relations.containsKey(qualifier))
-      .collect(Collectors.toList());
-  }
-
-  @Override
-  public String toString() {
-    return root.getQualifier();
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static final class Builder {
-    private List<ResourceType> types = new ArrayList<>();
-    private Map<String, List<String>> relations = new HashMap<>();
-    private List<String> children = new ArrayList<>();
-    private ResourceType root;
-
-    private Builder() {
-    }
-
-    public Builder addType(ResourceType type) {
-      requireNonNull(type);
-      checkArgument(!types.contains(type), String.format("%s is already registered", type.getQualifier()));
-      types.add(type);
-      return this;
-    }
-
-    public Builder addRelations(String parentQualifier, String... childrenQualifiers) {
-      requireNonNull(parentQualifier);
-      requireNonNull(childrenQualifiers);
-      checkArgument(childrenQualifiers.length > 0, "childrenQualifiers can't be empty");
-      relations.computeIfAbsent(parentQualifier, x -> new ArrayList<>()).addAll(Arrays.asList(childrenQualifiers));
-      children.addAll(Arrays.asList(childrenQualifiers));
-      return this;
-    }
-
-    public ResourceTypeTree build() {
-      for (ResourceType type : types) {
-        if (!children.contains(type.getQualifier())) {
-          root = type;
-          break;
-        }
-      }
-      return new ResourceTypeTree(this);
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
deleted file mode 100644 (file)
index e5de634..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Collections.unmodifiableList;
-import static java.util.Collections.unmodifiableMap;
-import static java.util.Objects.requireNonNull;
-
-/**
- * @since 2.14
- */
-@ServerSide
-@ComputeEngineSide
-public class ResourceTypes {
-
-  private final Map<String, ResourceTypeTree> treeByQualifier;
-  private final Map<String, ResourceType> typeByQualifier;
-  private final Collection<ResourceType> rootTypes;
-
-  public ResourceTypes(ResourceTypeTree[] trees) {
-    requireNonNull(trees);
-
-    Map<String, ResourceTypeTree> treeMap = new LinkedHashMap<>();
-    Map<String, ResourceType> typeMap = new LinkedHashMap<>();
-    Collection<ResourceType> rootsSet = new LinkedHashSet<>();
-
-    for (ResourceTypeTree tree : trees) {
-      rootsSet.add(tree.getRootType());
-      for (ResourceType type : tree.getTypes()) {
-        if (treeMap.containsKey(type.getQualifier())) {
-          throw new IllegalStateException("Qualifier " + type.getQualifier() + " is defined in several trees");
-        }
-        treeMap.put(type.getQualifier(), tree);
-        typeMap.put(type.getQualifier(), type);
-      }
-    }
-    treeByQualifier = unmodifiableMap(new LinkedHashMap<>(treeMap));
-    typeByQualifier = unmodifiableMap(new LinkedHashMap<>(typeMap));
-    rootTypes = unmodifiableList(new ArrayList<>(rootsSet));
-  }
-
-  public ResourceType get(String qualifier) {
-    ResourceType type = typeByQualifier.get(qualifier);
-    return type != null ? type : ResourceType.builder(qualifier).build();
-  }
-
-  public Collection<ResourceType> getAll() {
-    return typeByQualifier.values();
-  }
-
-  public Collection<ResourceType> getRoots() {
-    return rootTypes;
-  }
-
-  public boolean isQualifierPresent(String qualifier) {
-    return typeByQualifier.get(qualifier) != null;
-  }
-
-  public List<String> getLeavesQualifiers(String qualifier) {
-    ResourceTypeTree tree = getTree(qualifier);
-    if (tree != null) {
-      return tree.getLeaves();
-    }
-    return Collections.emptyList();
-  }
-
-  private ResourceTypeTree getTree(String qualifier) {
-    return treeByQualifier.get(qualifier);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Scopes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Scopes.java
deleted file mode 100644 (file)
index ae7356d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.apache.commons.lang.ArrayUtils;
-
-/**
- * Resource scopes are used to group some types of resources. For example Java methods, Flex methods, C functions
- * and Cobol paragraphs are grouped in the scope "block unit".
- * <br>
- * Scopes are generally used in UI to display/hide some services or in web services.
- * <br>
- * Scopes are not extensible by plugins.
- *
- * @since 2.6
- */
-public final class Scopes {
-
-  /**
-   * For example view, subview, project, module or library. Persisted in database.
-   */
-  public static final String PROJECT = "PRJ";
-
-  /**
-   * For example directory or Java package. Persisted in database. A more generic term for this scope could
-   * be "namespace"
-   */
-  public static final String DIRECTORY = "DIR";
-
-  /**
-   * For example a Java file. Persisted in database. A more generic term for this scope could
-   * be "compilation unit". It's the lowest scope in file system units.
-   */
-  public static final String FILE = "FIL";
-
-  /**
-   * Types like Java classes/interfaces. Not persisted in database.
-   * @deprecated since 4.3 resources under FILE level are no more be supported since 4.2.
-   */
-  @Deprecated
-  public static final String PROGRAM_UNIT = "PGU";
-
-  /**
-   * Block units like methods, functions or Cobol paragraphs.
-   * @deprecated since 4.3 resources under FILE level are no more be supported since 4.2.
-   */
-  @Deprecated
-  public static final String BLOCK_UNIT = "BLU";
-
-  public static final String[] SORTED_SCOPES = {PROJECT, DIRECTORY, FILE, PROGRAM_UNIT, BLOCK_UNIT};
-
-  private Scopes() {
-    // only static methods
-  }
-
-  public static boolean isHigherThan(final String scope, final String than) {
-    int index = ArrayUtils.indexOf(SORTED_SCOPES, scope);
-    int thanIndex = ArrayUtils.indexOf(SORTED_SCOPES, than);
-    return index < thanIndex;
-  }
-
-
-  public static boolean isHigherThanOrEquals(final String scope, final String than) {
-    int index = ArrayUtils.indexOf(SORTED_SCOPES, scope);
-    int thanIndex = ArrayUtils.indexOf(SORTED_SCOPES, than);
-    return index <= thanIndex;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/package-info.java
deleted file mode 100644 (file)
index 75ee8fa..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java
deleted file mode 100644 (file)
index f8eca23..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.io.Serializable;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import static org.apache.commons.lang.StringUtils.isEmpty;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Key of a rule. Unique among all the rule repositories.
- *
- * @since 3.6
- */
-@Immutable
-public class RuleKey implements Serializable, Comparable<RuleKey> {
-
-  public static final String EXTERNAL_RULE_REPO_PREFIX = "external_";
-
-  private final String repository;
-  private final String rule;
-  private final String toString;
-
-  protected RuleKey(String repositoryKey, String ruleKey) {
-    this.repository = repositoryKey;
-    this.rule = ruleKey;
-    this.toString = repositoryKey + ":" + ruleKey;
-  }
-
-  /**
-   * Create a key. Parameters are NOT null.
-   */
-  public static RuleKey of(String repository, String rule) {
-    checkArgument(!isEmpty(repository), "Repository must be set");
-    checkArgument(!isEmpty(rule), "Rule must be set");
-    return new RuleKey(repository, rule);
-  }
-
-  /**
-   * Create a key from a string representation (see {@link #toString()}. An {@link IllegalArgumentException} is raised
-   * if the format is not valid.
-   */
-  public static RuleKey parse(String s) {
-    int semiColonPos = s.indexOf(':');
-    checkArgument(semiColonPos > 0, "Invalid rule key: " + s);
-    String key = s.substring(0, semiColonPos);
-    String repo = s.substring(semiColonPos + 1);
-    return RuleKey.of(key, repo);
-  }
-
-  /**
-   * Never null
-   */
-  public String repository() {
-    return repository;
-  }
-
-  /**
-   * Never null
-   */
-  public String rule() {
-    return rule;
-  }
-
-  @Override
-  public boolean equals(@Nullable Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    RuleKey ruleKey = (RuleKey) o;
-    return repository.equals(ruleKey.repository) && rule.equals(ruleKey.rule);
-  }
-
-  @Override
-  public int hashCode() {
-    int result = repository.hashCode();
-    result = 31 * result + rule.hashCode();
-    return result;
-  }
-
-  /**
-   * Format is "repository:rule", for example "squid:AvoidCycle"
-   */
-  @Override
-  public String toString() {
-    return toString;
-  }
-
-  @Override
-  public int compareTo(RuleKey o) {
-    int compareRepositories = this.repository.compareTo(o.repository);
-    if (compareRepositories == 0) {
-      return this.rule.compareTo(o.rule);
-    }
-    return compareRepositories;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleScope.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleScope.java
deleted file mode 100644 (file)
index 2ed39ce..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-/**
- * @since 7.1
- *
- */
-public enum RuleScope {
-  MAIN, TEST, ALL;
-
-  public static RuleScope defaultScope() {
-    return MAIN;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleStatus.java
deleted file mode 100644 (file)
index e2e8d29..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-/**
- * @since 4.2
- */
-public enum RuleStatus {
-  BETA, DEPRECATED, READY, REMOVED;
-
-  public static RuleStatus defaultStatus() {
-    return READY;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/Severity.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/Severity.java
deleted file mode 100644 (file)
index 37c9111..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import java.util.List;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableList;
-
-/**
- * @since 3.6
- */
-public final class Severity {
-
-  public static final String INFO = "INFO";
-  public static final String MINOR = "MINOR";
-  public static final String MAJOR = "MAJOR";
-  public static final String CRITICAL = "CRITICAL";
-  public static final String BLOCKER = "BLOCKER";
-
-  /**
-   * All the supported severity values, ordered from {@link #INFO} to {@link #BLOCKER}.
-   */
-  public static final List<String> ALL = unmodifiableList(asList(INFO, MINOR, MAJOR, CRITICAL, BLOCKER));
-
-  private Severity() {
-    // utility
-  }
-
-  public static String defaultSeverity() {
-    return MAJOR;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/package-info.java
deleted file mode 100644 (file)
index 3922827..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRule.java
deleted file mode 100644 (file)
index fa70393..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.sonar.api.profiles.RulesProfile;
-
-public class ActiveRule implements Cloneable {
-
-  public static final String INHERITED = "INHERITED";
-  public static final String OVERRIDES = "OVERRIDES";
-
-  private Integer id;
-  private Rule rule;
-  private RulePriority severity;
-  private RulePriority overriddenSeverity;
-  private RulesProfile rulesProfile;
-  private List<ActiveRuleParam> activeRuleParams = new ArrayList<>();
-  private String inheritance;
-
-  /**
-   * @deprecated visibility should be reduced to protected or package
-   */
-  @Deprecated
-  public ActiveRule() {
-  }
-
-  /**
-   * @deprecated visibility should be reduced to protected or package
-   */
-  @Deprecated
-  public ActiveRule(RulesProfile profile, Rule rule, @Nullable RulePriority severity) {
-    this.rule = rule;
-    this.overriddenSeverity = severity;
-    if (severity == null && rule != null) {
-      this.severity = rule.getSeverity();
-    } else {
-      this.severity = severity;
-    }
-
-    this.rulesProfile = profile;
-  }
-
-  public Integer getId() {
-    return id;
-  }
-
-  /**
-   * For internal use only.
-   *
-   * @since 2.5
-   */
-  public String getInheritance() {
-    return inheritance;
-  }
-
-  /**
-   * For internal use only.
-   *
-   * @since 2.5
-   */
-  public void setInheritance(String s) {
-    this.inheritance = s;
-  }
-
-  public boolean isInherited() {
-    return StringUtils.equals(INHERITED, inheritance);
-  }
-
-  public boolean doesOverride() {
-    return StringUtils.equals(OVERRIDES, inheritance);
-  }
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  public void setId(Integer id) {
-    this.id = id;
-  }
-
-  public Rule getRule() {
-    return rule;
-  }
-
-  /**
-   * @deprecated visibility should be reduced to protected or package
-   */
-  @Deprecated
-  public void setRule(Rule rule) {
-    this.rule = rule;
-  }
-
-  /**
-   * @since 2.5
-   */
-  public RulePriority getSeverity() {
-    return severity;
-  }
-
-  /**
-   * For internal use
-   * @since 6.6
-   * @deprecated
-   */
-  @Deprecated
-  public RulePriority getOverriddenSeverity() {
-    return overriddenSeverity;
-  }
-
-  /**
-   * @since 2.5
-   */
-  public void setSeverity(RulePriority severity) {
-    this.severity = severity;
-  }
-
-  public RulesProfile getRulesProfile() {
-    return rulesProfile;
-  }
-
-  /**
-   * @deprecated visibility should be reduced to protected or package
-   */
-  @Deprecated
-  public void setRulesProfile(RulesProfile rulesProfile) {
-    this.rulesProfile = rulesProfile;
-  }
-
-  public List<ActiveRuleParam> getActiveRuleParams() {
-    return activeRuleParams;
-  }
-
-  /**
-   * @deprecated use setParameter()
-   */
-  @Deprecated
-  public void setActiveRuleParams(List<ActiveRuleParam> params) {
-    this.activeRuleParams = params;
-  }
-
-  public ActiveRule setParameter(String key, String value) {
-    RuleParam ruleParameter = rule.getParam(key);
-    if (ruleParameter != null) {
-      activeRuleParams.add(new ActiveRuleParam(this, ruleParameter, value));
-    }
-    return this;
-  }
-
-  public String getParameter(String key) {
-    if (activeRuleParams != null) {
-      for (ActiveRuleParam param : activeRuleParams) {
-        if (StringUtils.equals(key, param.getKey())) {
-          return param.getValue();
-        }
-      }
-    }
-    return null;
-  }
-
-  /**
-   * @deprecated since 2.3 use {@link #getRepositoryKey()} instead
-   */
-  @Deprecated
-  public String getPluginName() {
-    return rule.getRepositoryKey();
-  }
-
-  public String getRepositoryKey() {
-    return rule.getRepositoryKey();
-  }
-
-  /**
-   * @return the config key the active rule belongs to
-   */
-  public String getConfigKey() {
-    return rule.getConfigKey();
-  }
-
-  /**
-   * @return the key of the active rule
-   */
-  public String getRuleKey() {
-    return rule.getKey();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    ActiveRule that = (ActiveRule) o;
-
-    if (!rule.equals(that.rule)) {
-      return false;
-    }
-    return !((rulesProfile != null) ? !rulesProfile.equals(that.rulesProfile) : (that.rulesProfile != null));
-
-  }
-
-  @Override
-  public int hashCode() {
-    int result = rule.hashCode();
-    result = 31 * result + (rulesProfile != null ? rulesProfile.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this).append("id", getId()).append("rule", rule).append("priority", severity)
-      .append("params", activeRuleParams).toString();
-  }
-
-  @Override
-  public Object clone() {
-    final ActiveRule clone = new ActiveRule(getRulesProfile(), getRule(), getSeverity());
-    clone.setInheritance(getInheritance());
-    if (activeRuleParams != null && !activeRuleParams.isEmpty()) {
-      clone.setActiveRuleParams(activeRuleParams
-        .stream()
-        .map(input -> {
-          ActiveRuleParam activeRuleParamClone = (ActiveRuleParam) input.clone();
-          activeRuleParamClone.setActiveRule(clone);
-          return activeRuleParamClone;
-        })
-        .collect(Collectors.toList()));
-    }
-    return clone;
-  }
-
-  /**
-   * @since 2.6
-   */
-  public boolean isEnabled() {
-    return getRule() != null && getRule().isEnabled();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParam.java
deleted file mode 100644 (file)
index 29f7e85..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-public class ActiveRuleParam implements Cloneable {
-
-  private Integer id;
-  private ActiveRule activeRule;
-  private RuleParam ruleParam;
-  private String paramKey;
-  private String value;
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  public ActiveRuleParam() {
-  }
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  public ActiveRuleParam(ActiveRule activeRule, RuleParam ruleParam, String value) {
-    this.activeRule = activeRule;
-    this.ruleParam = ruleParam;
-    this.value = value;
-    this.paramKey = ruleParam.getKey();
-  }
-
-  public Integer getId() {
-    return id;
-  }
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  void setId(Integer id) {
-    this.id = id;
-  }
-
-  public ActiveRule getActiveRule() {
-    return activeRule;
-  }
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  public void setActiveRule(ActiveRule activeRule) {
-    this.activeRule = activeRule;
-  }
-
-  public RuleParam getRuleParam() {
-    return ruleParam;
-  }
-
-  /**
-   * @deprecated visibility should be decreased to protected or package
-   */
-  @Deprecated
-  public void setRuleParam(RuleParam ruleParam) {
-    this.ruleParam = ruleParam;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String getParamKey() {
-    return paramKey;
-  }
-
-  public void setParamKey(String paramKey) {
-    this.paramKey = paramKey;
-  }
-
-
-  public String getKey() {
-    return ruleParam.getKey();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof ActiveRuleParam)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    ActiveRuleParam other = (ActiveRuleParam) obj;
-    return other.getKey().equals(getKey());
-  }
-
-  @Override
-  public int hashCode() {
-    return getKey().hashCode();
-  }
-
-  @Override
-  public Object clone() {
-    return new ActiveRuleParam(getActiveRule(), getRuleParam(), getValue());
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java
deleted file mode 100644 (file)
index e4b2071..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.PropertyType;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.AnnotationUtils;
-import org.sonar.api.utils.FieldUtils2;
-import org.sonar.api.utils.SonarException;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-/**
- * @since 2.3
- * @deprecated in 4.2. Replaced by {@link org.sonar.api.server.rule.RulesDefinitionAnnotationLoader}
- */
-@Deprecated
-@ServerSide
-@ComputeEngineSide
-public final class AnnotationRuleParser {
-  private static final Logger LOG = Loggers.get(AnnotationRuleParser.class);
-  private static final Map<Class<?>, PropertyType> TYPE_FOR_CLASS_MAP = new HashMap<>();
-  private static final Function<Class<?>, PropertyType> TYPE_FOR_CLASS = type -> TYPE_FOR_CLASS_MAP.getOrDefault(type, PropertyType.STRING);
-
-  static {
-    TYPE_FOR_CLASS_MAP.put(Integer.class, PropertyType.INTEGER);
-    TYPE_FOR_CLASS_MAP.put(int.class, PropertyType.INTEGER);
-    TYPE_FOR_CLASS_MAP.put(Float.class, PropertyType.FLOAT);
-    TYPE_FOR_CLASS_MAP.put(float.class, PropertyType.FLOAT);
-    TYPE_FOR_CLASS_MAP.put(Boolean.class, PropertyType.BOOLEAN);
-    TYPE_FOR_CLASS_MAP.put(boolean.class, PropertyType.BOOLEAN);
-  }
-
-  public List<Rule> parse(String repositoryKey, Collection<Class> annotatedClasses) {
-    List<Rule> rules = new ArrayList<>();
-    for (Class annotatedClass : annotatedClasses) {
-      rules.add(create(repositoryKey, annotatedClass));
-    }
-    return rules;
-  }
-
-  private static Rule create(String repositoryKey, Class annotatedClass) {
-    org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(annotatedClass, org.sonar.check.Rule.class);
-    if (ruleAnnotation != null) {
-      return toRule(repositoryKey, annotatedClass, ruleAnnotation);
-    }
-    LOG.warn("The class " + annotatedClass.getCanonicalName() + " should be annotated with " + Rule.class);
-    return null;
-  }
-
-  private static Rule toRule(String repositoryKey, Class clazz, org.sonar.check.Rule ruleAnnotation) {
-    String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
-    String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
-    String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);
-    Rule rule = Rule.create(repositoryKey, ruleKey, ruleName);
-    rule.setDescription(description);
-    rule.setSeverity(RulePriority.fromCheckPriority(ruleAnnotation.priority()));
-    rule.setCardinality(ruleAnnotation.cardinality());
-    rule.setStatus(ruleAnnotation.status());
-    rule.setTags(ruleAnnotation.tags());
-
-    List<Field> fields = FieldUtils2.getFields(clazz, true);
-    for (Field field : fields) {
-      addRuleProperty(rule, field);
-    }
-    return rule;
-  }
-
-  private static void addRuleProperty(Rule rule, Field field) {
-    org.sonar.check.RuleProperty propertyAnnotation = field.getAnnotation(org.sonar.check.RuleProperty.class);
-    if (propertyAnnotation != null) {
-      String fieldKey = StringUtils.defaultIfEmpty(propertyAnnotation.key(), field.getName());
-      RuleParam param = rule.createParameter(fieldKey);
-      param.setDescription(propertyAnnotation.description());
-      param.setDefaultValue(propertyAnnotation.defaultValue());
-      if (!StringUtils.isBlank(propertyAnnotation.type())) {
-        try {
-          param.setType(PropertyType.valueOf(propertyAnnotation.type().trim()).name());
-        } catch (IllegalArgumentException e) {
-          throw new SonarException("Invalid property type [" + propertyAnnotation.type() + "]", e);
-        }
-      } else {
-        param.setType(guessType(field.getType()).name());
-      }
-    }
-  }
-
-  static PropertyType guessType(Class<?> type) {
-    return TYPE_FOR_CLASS.apply(type);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java
deleted file mode 100644 (file)
index a6bb411..0000000
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.check.Cardinality;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableSet;
-
-public class Rule {
-
-  /**
-   * @since 3.6
-   */
-  public static final String STATUS_BETA = "BETA";
-  /**
-   * @since 3.6
-   */
-  public static final String STATUS_DEPRECATED = "DEPRECATED";
-  /**
-   * @since 3.6
-   */
-  public static final String STATUS_READY = "READY";
-
-  /**
-   * For internal use only.
-   *
-   * @since 3.6
-   */
-  public static final String STATUS_REMOVED = "REMOVED";
-
-  /**
-   * List of available status
-   *
-   * @since 3.6
-   */
-  private static final Set<String> STATUS_LIST = unmodifiableSet(new LinkedHashSet<>(asList(STATUS_READY, STATUS_BETA, STATUS_DEPRECATED, STATUS_REMOVED)));
-
-  /**
-   * The default priority given to a rule if not explicitly set
-   */
-  public static final RulePriority DEFAULT_PRIORITY = RulePriority.MAJOR;
-
-  private String name;
-  private String key;
-  private String configKey;
-  private RulePriority priority = DEFAULT_PRIORITY;
-  private String description;
-  private String pluginName;
-  private boolean isTemplate = false;
-  private String status = STATUS_READY;
-  private String language;
-  private Rule template = null;
-  private List<RuleParam> params = new ArrayList<>();
-  private Date createdAt;
-  private Date updatedAt;
-  private String tags;
-  private String systemTags;
-
-  /**
-   * @deprecated since 2.3. Use the factory method {@link #create()}
-   */
-  @Deprecated
-  public Rule() {
-  }
-
-  /**
-   * Creates rule with minimum set of info
-   *
-   * @param pluginName the plugin name indicates which plugin the rule belongs to
-   * @param key        the key should be unique within a plugin, but it is even more careful for the time being that it is unique across the
-   *                   application
-   * @deprecated since 2.3. Use the factory method {@link #create()}
-   */
-  @Deprecated
-  public Rule(String pluginName, String key) {
-    this.pluginName = pluginName;
-    this.key = key;
-    this.configKey = key;
-  }
-
-  /**
-   * @deprecated since 8.4. Use {@link #ruleKey()} instead
-   */
-  @Deprecated
-  public Integer getId() {
-    throw new UnsupportedOperationException("This method is no longer supported");
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Sets the rule name
-   */
-  public Rule setName(String name) {
-    this.name = removeNewLineCharacters(name);
-    return this;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * Sets the rule key
-   */
-  public Rule setKey(String key) {
-    this.key = key;
-    return this;
-  }
-
-  public String getConfigKey() {
-    return configKey;
-  }
-
-  /**
-   * Sets the configuration key
-   */
-  public Rule setConfigKey(String configKey) {
-    this.configKey = configKey;
-    return this;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * Sets the rule description
-   */
-  public Rule setDescription(String description) {
-    this.description = StringUtils.strip(description);
-    return this;
-  }
-
-  public Boolean isEnabled() {
-    return !STATUS_REMOVED.equals(status);
-  }
-
-  public List<RuleParam> getParams() {
-    return params;
-  }
-
-  public RuleParam getParam(String key) {
-    for (RuleParam param : params) {
-      if (StringUtils.equals(key, param.getKey())) {
-        return param;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Sets the rule parameters
-   */
-  public Rule setParams(List<RuleParam> params) {
-    this.params.clear();
-    for (RuleParam param : params) {
-      param.setRule(this);
-      this.params.add(param);
-    }
-    return this;
-  }
-
-  public RuleParam createParameter() {
-    RuleParam parameter = new RuleParam()
-      .setRule(this);
-    params.add(parameter);
-    return parameter;
-  }
-
-  public RuleParam createParameter(String key) {
-    RuleParam parameter = new RuleParam()
-      .setKey(key)
-      .setRule(this);
-    params.add(parameter);
-    return parameter;
-  }
-
-  /**
-   * @since 2.5
-   */
-  public RulePriority getSeverity() {
-    return priority;
-  }
-
-  /**
-   * @param severity severity to set, if null, uses the default priority.
-   * @since 2.5
-   */
-  public Rule setSeverity(@Nullable RulePriority severity) {
-    if (severity == null) {
-      this.priority = DEFAULT_PRIORITY;
-    } else {
-      this.priority = severity;
-    }
-    return this;
-  }
-
-  public String getRepositoryKey() {
-    return pluginName;
-  }
-
-  public Rule setRepositoryKey(String s) {
-    this.pluginName = s;
-    return this;
-  }
-
-  public Rule setUniqueKey(String repositoryKey, String key) {
-    return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);
-  }
-
-  /**
-   * @since 4.4
-   */
-  public boolean isTemplate() {
-    return isTemplate;
-  }
-
-  /**
-   * @since 4.4
-   */
-  public Rule setIsTemplate(boolean isTemplate) {
-    this.isTemplate = isTemplate;
-    return this;
-  }
-
-  /**
-   * @deprecated since 4.4, use {@link #isTemplate()}
-   */
-  @Deprecated
-  public Cardinality getCardinality() {
-    return isTemplate ? Cardinality.MULTIPLE : Cardinality.SINGLE;
-  }
-
-  /**
-   * @deprecated since 4.4, use {@link #setIsTemplate(boolean)}
-   */
-  @Deprecated
-  public Rule setCardinality(Cardinality c) {
-    this.isTemplate = Cardinality.MULTIPLE.equals(c);
-    return this;
-  }
-
-  /**
-   * @deprecated since 4.4, use {@link #getTemplate()}
-   */
-  @Deprecated
-  public Rule getParent() {
-    return getTemplate();
-  }
-
-  /**
-   * @deprecated since 4.4, use {@link #setTemplate(Rule)}}
-   */
-  @Deprecated
-  public Rule setParent(Rule parent) {
-    return setTemplate(parent);
-  }
-
-  /**
-   * @since 4.4
-   */
-  public Rule getTemplate() {
-    return template;
-  }
-
-  /**
-   * @since 4.4
-   */
-  public Rule setTemplate(Rule template) {
-    this.template = template;
-    return this;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public String getStatus() {
-    return status;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public Rule setStatus(String status) {
-    if (!STATUS_LIST.contains(status)) {
-      throw new IllegalStateException("The status of a rule can only contain : " + String.join(", ", STATUS_LIST));
-    }
-    this.status = status;
-    return this;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public Date getCreatedAt() {
-    return createdAt;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public Rule setCreatedAt(Date d) {
-    this.createdAt = d;
-    return this;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public Date getUpdatedAt() {
-    return updatedAt;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public Rule setUpdatedAt(Date updatedAt) {
-    this.updatedAt = updatedAt;
-    return this;
-  }
-
-  /**
-   * @since 3.6
-   */
-  public String getLanguage() {
-    return language;
-  }
-
-  /**
-   * For internal use only.
-   *
-   * @since 3.6
-   */
-  public Rule setLanguage(String language) {
-    this.language = language;
-    return this;
-  }
-
-  /**
-   * For definition of rule only
-   */
-  public String[] getTags() {
-    return tags == null ? new String[0] : StringUtils.split(tags, ',');
-  }
-
-  /**
-   * For definition of rule only
-   */
-  public Rule setTags(String[] tags) {
-    this.tags = tags == null ? null : StringUtils.join(tags, ',');
-    return this;
-  }
-
-  /**
-   * For internal use
-   */
-  public String[] getSystemTags() {
-    return systemTags == null ? new String[0] : StringUtils.split(systemTags, ',');
-  }
-
-  public Rule setSystemTags(String[] tags) {
-    this.systemTags = tags == null ? null : StringUtils.join(tags, ',');
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof Rule)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    Rule other = (Rule) obj;
-    return new EqualsBuilder()
-      .append(pluginName, other.getRepositoryKey())
-      .append(key, other.getKey())
-      .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    return new HashCodeBuilder(17, 37)
-      .append(pluginName)
-      .append(key)
-      .toHashCode();
-  }
-
-  @Override
-  public String toString() {
-    // Note that ReflectionToStringBuilder will not work here - see SONAR-3077
-    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
-      .append("name", name)
-      .append("key", key)
-      .append("configKey", configKey)
-      .append("plugin", pluginName)
-      .append("severity", priority)
-      .append("isTemplate", isTemplate())
-      .append("status", status)
-      .append("language", language)
-      .append("template", template)
-      .toString();
-  }
-
-  @CheckForNull
-  private static String removeNewLineCharacters(@Nullable String text) {
-    String removedCRLF = StringUtils.remove(text, "\n");
-    removedCRLF = StringUtils.remove(removedCRLF, "\r");
-    removedCRLF = StringUtils.remove(removedCRLF, "\n\r");
-    removedCRLF = StringUtils.remove(removedCRLF, "\r\n");
-    return removedCRLF;
-  }
-
-  public static Rule create() {
-    return new Rule();
-  }
-
-  /**
-   * Create with all required fields
-   */
-  public static Rule create(String repositoryKey, String key, String name) {
-    return new Rule().setUniqueKey(repositoryKey, key).setName(name);
-  }
-
-  /**
-   * Create with all required fields
-   *
-   * @since 2.10
-   */
-  public static Rule create(String repositoryKey, String key) {
-    return new Rule().setUniqueKey(repositoryKey, key);
-  }
-
-  /**
-   * @since 3.6
-   */
-  public RuleKey ruleKey() {
-    return RuleKey.of(getRepositoryKey(), getKey());
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleAnnotationUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleAnnotationUtils.java
deleted file mode 100644 (file)
index 92b0b36..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.utils.AnnotationUtils;
-
-/**
- * @since 2.3
- */
-public final class RuleAnnotationUtils {
-
-  private RuleAnnotationUtils() {
-    // only static methods
-  }
-
-  public static String getRuleKey(Class annotatedClass) {
-    String key = null;
-    org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(annotatedClass, org.sonar.check.Rule.class);
-    if (ruleAnnotation != null) {
-      key = ruleAnnotation.key();
-    }
-    return StringUtils.defaultIfEmpty(key, annotatedClass.getCanonicalName());
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java
deleted file mode 100644 (file)
index 89a6894..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import org.sonar.api.batch.rule.ActiveRules;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Used in {@link org.sonar.api.profiles.ProfileExporter} and {@link org.sonar.api.profiles.ProfileImporter}
- * Use {@link ActiveRules} on scanner side.
- * @since 2.3
- */
-@ServerSide
-@ComputeEngineSide
-public interface RuleFinder {
-
-  @CheckForNull
-  Rule findByKey(String repositoryKey, String key);
-
-  @CheckForNull
-  Rule findByKey(RuleKey key);
-
-  /**
-   * @throws IllegalArgumentException if more than one result
-   */
-  @CheckForNull
-  Rule find(RuleQuery query);
-
-  Collection<Rule> findAll(RuleQuery query);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleParam.java
deleted file mode 100644 (file)
index 093ebda..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-public class RuleParam {
-
-  private Integer id;
-  private Rule rule;
-  private String key;
-  private String description;
-  private String type = "STRING";
-  private String defaultValue;
-
-  /**
-   * @deprecated since 2.3 use the factory method Rule.setParameter()
-   */
-  @Deprecated
-  public RuleParam() {
-  }
-
-  /**
-   * @deprecated since 2.3 use the factory method setParameter()
-   */
-  @Deprecated
-  public RuleParam(Rule rule, String key, String description, String type) {
-    this.rule = rule;
-    this.key = key;
-    this.description = description;
-    this.type = type;
-  }
-
-  public Integer getId() {
-    return id;
-  }
-
-  public Rule getRule() {
-    return rule;
-  }
-
-  RuleParam setRule(Rule rule) {
-    this.rule = rule;
-    return this;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public RuleParam setKey(String key) {
-    this.key = key;
-    return this;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public RuleParam setDescription(String s) {
-    this.description = StringUtils.defaultString(s, "");
-    return this;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public RuleParam setType(String type) {
-    this.type = type;
-    return this;
-  }
-
-  public String getDefaultValue() {
-    return defaultValue;
-  }
-
-  public Boolean getDefaultValueAsBoolean() {
-    if (defaultValue != null) {
-      return Boolean.parseBoolean(defaultValue);
-    }
-    return null;
-  }
-
-  public Integer getDefaultValueAsInteger() {
-    if (defaultValue != null) {
-      return Integer.parseInt(defaultValue);
-    }
-    return null;
-  }
-
-  public RuleParam setDefaultValue(String s) {
-    this.defaultValue = s;
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (!(obj instanceof RuleParam)) {
-      return false;
-    }
-    if (this == obj) {
-      return true;
-    }
-    RuleParam other = (RuleParam) obj;
-    return other.key.equals(key);
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this)
-      .append("id", id)
-      .append("key", key)
-      .append("desc", description)
-      .append("type", type)
-      .toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriority.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulePriority.java
deleted file mode 100644 (file)
index f4afa10..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.Locale;
-import org.sonar.check.Priority;
-
-/**
- * @deprecated since 4.2
- * @see org.sonar.api.rule.Severity
- */
-@Deprecated
-public enum RulePriority {
-
-  /**
-   * WARNING : DO NOT CHANGE THE ENUMERATION ORDER
-   * the enum ordinal is used for db persistence
-   */
-  INFO, MINOR, MAJOR, CRITICAL, BLOCKER;
-
-  private static final String UNKNOWN_PRIORITY = "Unknown priority ";
-
-  /**
-   * A class to map priority level prior to Sonar 1.10 to the new ones
-   *
-   * @param level an old priority level : Error or Warning
-   * @return the corresponding RulePriority
-   * @deprecated in 3.6
-   */
-  @Deprecated
-  public static RulePriority valueOfString(String level) {
-    try {
-      return RulePriority.valueOf(level.toUpperCase(Locale.ENGLISH));
-
-    } catch (IllegalArgumentException ex) {
-      // backward compatibility
-      if ("ERROR".equalsIgnoreCase(level)) {
-        return RulePriority.MAJOR;
-      } else if ("WARNING".equalsIgnoreCase(level)) {
-        return RulePriority.INFO;
-      }
-    }
-    throw new IllegalArgumentException(UNKNOWN_PRIORITY + level);
-  }
-
-
-  public static RulePriority fromCheckPriority(Priority checkPriority) {
-    if (checkPriority == Priority.BLOCKER) {
-      return RulePriority.BLOCKER;
-    }
-    if (checkPriority == Priority.CRITICAL) {
-      return RulePriority.CRITICAL;
-    }
-    if (checkPriority == Priority.MAJOR) {
-      return RulePriority.MAJOR;
-    }
-    if (checkPriority == Priority.MINOR) {
-      return RulePriority.MINOR;
-    }
-    if (checkPriority == Priority.INFO) {
-      return RulePriority.INFO;
-    }
-    throw new IllegalArgumentException(UNKNOWN_PRIORITY + checkPriority);
-  }
-
-  public static RulePriority valueOfInt(int ordinal) {
-    return RulePriority.values()[ordinal];
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleQuery.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleQuery.java
deleted file mode 100644 (file)
index 2afafa4..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-/**
- * @since 2.3
- */
-public final class RuleQuery {
-
-  private String repositoryKey = null;
-  private String key = null;
-  private String configKey = null;
-
-  /**
-   * Use the factory method <code>create()</code>
-   */
-  RuleQuery() {
-  }
-
-  public static RuleQuery create() {
-    return new RuleQuery();
-  }
-
-  public RuleQuery withRepositoryKey(String s) {
-    this.repositoryKey = s;
-    return this;
-  }
-
-  public RuleQuery withKey(String s) {
-    this.key = s;
-    return this;
-  }
-
-  public RuleQuery withConfigKey(String s) {
-    this.configKey = s;
-    return this;
-  }
-
-  public String getRepositoryKey() {
-    return repositoryKey;
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public String getConfigKey() {
-    return configKey;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleType.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleType.java
deleted file mode 100644 (file)
index 029db99..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-
-import static java.lang.String.format;
-import static java.util.Arrays.stream;
-import static java.util.Collections.unmodifiableSet;
-import static java.util.stream.Collectors.toList;
-
-public enum RuleType {
-  CODE_SMELL(1), BUG(2), VULNERABILITY(3), SECURITY_HOTSPOT(4);
-
-  private static final Set<String> ALL_NAMES = unmodifiableSet(new LinkedHashSet<>(stream(values())
-    .map(Enum::name)
-    .collect(toList())));
-
-  private final int dbConstant;
-
-  RuleType(int dbConstant) {
-    this.dbConstant = dbConstant;
-  }
-
-  public int getDbConstant() {
-    return dbConstant;
-  }
-
-  public static Set<String> names() {
-    return ALL_NAMES;
-  }
-
-  /**
-   * Returns the enum constant of the specified DB column value.
-   */
-  public static RuleType valueOf(int dbConstant) {
-    // iterating the array is fast-enough as size is small. No need for a map.
-    for (RuleType type : values()) {
-      if (type.getDbConstant() == dbConstant) {
-        return type;
-      }
-    }
-    throw new IllegalArgumentException(format("Unsupported type value : %d", dbConstant));
-  }
-
-  @CheckForNull
-  public static RuleType valueOfNullable(int dbConstant) {
-    // iterating the array is fast-enough as size is small. No need for a map.
-    for (RuleType type : values()) {
-      if (type.getDbConstant() == dbConstant) {
-        return type;
-      }
-    }
-    if (dbConstant == 0) {
-      return null;
-    }
-    throw new IllegalArgumentException(format("Unsupported type value : %d", dbConstant));
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/package-info.java
deleted file mode 100644 (file)
index 63c5fcf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java
deleted file mode 100644 (file)
index 5638872..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.filesystem;
-
-import java.util.Arrays;
-import java.util.stream.Stream;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.ScannerSide;
-import org.sonar.api.config.Configuration;
-
-/**
- * Configuration of file inclusions and exclusions.
- * <p>Plugins must not extend nor instantiate this class. An instance is injected at
- * runtime.
- *
- * @since 3.5
- * @deprecated since 7.6
- */
-@Deprecated
-@ScannerSide
-public class FileExclusions {
-
-  private final Configuration config;
-
-  public FileExclusions(Configuration config) {
-    this.config = config;
-  }
-
-  public String[] sourceInclusions() {
-    return inclusions(CoreProperties.PROJECT_INCLUSIONS_PROPERTY);
-  }
-
-  public String[] testInclusions() {
-    return inclusions(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY);
-  }
-
-  private String[] inclusions(String propertyKey) {
-    return Arrays.stream(config.getStringArray(propertyKey))
-      .map(StringUtils::trim)
-      .filter(s -> !"**/*".equals(s))
-      .filter(s -> !"file:**/*".equals(s))
-      .toArray(String[]::new);
-  }
-
-  public String[] sourceExclusions() {
-    return exclusions(CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY, CoreProperties.PROJECT_EXCLUSIONS_PROPERTY);
-  }
-
-  public String[] testExclusions() {
-    return exclusions(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY, CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY);
-  }
-
-  private String[] exclusions(String globalExclusionsProperty, String exclusionsProperty) {
-    String[] globalExclusions = config.getStringArray(globalExclusionsProperty);
-    String[] exclusions = config.getStringArray(exclusionsProperty);
-    return Stream.concat(Arrays.stream(globalExclusions), Arrays.stream(exclusions))
-      .map(StringUtils::trim)
-      .toArray(String[]::new);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java
deleted file mode 100644 (file)
index 1b2678a..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.filesystem;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-import org.apache.commons.io.FilenameUtils;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.utils.PathUtils;
-
-import static java.util.stream.Collectors.joining;
-
-/**
- * @since 3.5
- */
-@ScannerSide
-@Immutable
-public class PathResolver {
-
-  public File relativeFile(File dir, String path) {
-    return dir.toPath().resolve(path).normalize().toFile();
-  }
-
-  public List<File> relativeFiles(File dir, List<String> paths) {
-    List<File> result = new ArrayList<>();
-    for (String path : paths) {
-      result.add(relativeFile(dir, path));
-    }
-    return result;
-  }
-
-  /**
-   * @deprecated since 6.0 was used when component keys were relative to source dirs
-   */
-  @Deprecated
-  @CheckForNull
-  public RelativePath relativePath(Collection<File> dirs, File file) {
-    List<String> stack = new ArrayList<>();
-    File cursor = file;
-    while (cursor != null) {
-      File parentDir = parentDir(dirs, cursor);
-      if (parentDir != null) {
-        return new RelativePath(parentDir, stack.stream().collect(joining("/")));
-      }
-      stack.add(0, cursor.getName());
-      cursor = cursor.getParentFile();
-    }
-    return null;
-  }
-
-  /**
-   * Similar to {@link Path#relativize(Path)} except that:
-   *   <ul>
-   *   <li>null is returned if file is not a child of dir
-   *   <li>the resulting path is converted to use Unix separators
-   *   </ul> 
-   * @since 6.0
-   */
-  @CheckForNull
-  public String relativePath(Path dir, Path file) {
-    Path baseDir = dir.normalize();
-    Path path = file.normalize();
-    if (!path.startsWith(baseDir)) {
-      return null;
-    }
-    try {
-      Path relativized = baseDir.relativize(path);
-      return FilenameUtils.separatorsToUnix(relativized.toString());
-    } catch (IllegalArgumentException e) {
-      return null;
-    }
-  }
-
-  /**
-   * Similar to {@link Path#relativize(Path)} except that:
-   *   <ul>
-   *   <li>Empty is returned if file is not a child of dir
-   *   <li>the resulting path is converted to use Unix separators
-   *   </ul> 
-   * @since 6.6
-   */
-  public static Optional<String> relativize(Path dir, Path file) {
-    Path baseDir = dir.normalize();
-    Path path = file.normalize();
-    if (!path.startsWith(baseDir)) {
-      return Optional.empty();
-    }
-    try {
-      Path relativized = baseDir.relativize(path);
-      return Optional.of(FilenameUtils.separatorsToUnix(relativized.toString()));
-    } catch (IllegalArgumentException e) {
-      return Optional.empty();
-    }
-  }
-
-  @CheckForNull
-  public String relativePath(File dir, File file) {
-    return relativePath(dir.toPath(), file.toPath());
-  }
-
-  @CheckForNull
-  private static File parentDir(Collection<File> dirs, File cursor) {
-    for (File dir : dirs) {
-      if (PathUtils.canonicalPath(dir).equals(PathUtils.canonicalPath(cursor))) {
-        return dir;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * @deprecated since 6.0 was used when component keys were relative to source dirs
-   */
-  @Deprecated
-  public static final class RelativePath {
-    private File dir;
-    private String path;
-
-    public RelativePath(File dir, String path) {
-      this.dir = dir;
-      this.path = path;
-    }
-
-    public File dir() {
-      return dir;
-    }
-
-    public String path() {
-      return path;
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/package-info.java
deleted file mode 100644 (file)
index c7fd121..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-/**
- * Replaced by {@link org.sonar.api.batch.fs}
- */
-@ParametersAreNonnullByDefault
-package org.sonar.api.scan.filesystem;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/FilterableIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/FilterableIssue.java
deleted file mode 100644 (file)
index 44233c8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.issue.filter;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.ThreadSafe;
-import org.sonar.api.batch.fs.TextRange;
-import org.sonar.api.rule.RuleKey;
-
-/**
- * @since 5.3
- * @deprecated since 7.6
- */
-@ThreadSafe
-@Deprecated
-public interface FilterableIssue {
-
-  /**
-   * @deprecated since 7.6 filtering issue should not depend on the key
-   */
-  @Deprecated
-  String componentKey();
-
-  RuleKey ruleKey();
-
-  String severity();
-
-  String message();
-
-  /**
-   * @deprecated since 7.2. Use {@link #textRange()} instead.
-   */
-  @Deprecated
-  @CheckForNull
-  Integer line();
-
-  /**
-   * @since 7.2 
-   */
-  @CheckForNull
-  TextRange textRange();
-
-  /**
-   * @since 5.5
-   */
-  @CheckForNull
-  Double gap();
-
-  /**
-   * @deprecated since 7.6 filtering issue should not depend on the key
-   */
-  @Deprecated
-  String projectKey();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilter.java
deleted file mode 100644 (file)
index 93bfa62..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.issue.filter;
-
-
-import javax.annotation.concurrent.ThreadSafe;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * @since 5.3
- * @since 7.6 moved to project container
- * @deprecated since 7.6
- */
-@ScannerSide
-@SonarLintSide
-@ExtensionPoint
-@FunctionalInterface
-@ThreadSafe
-@Deprecated
-public interface IssueFilter {
-
-  /**
-   * The <code>accept</code> method is called for each {@link FilterableIssue} created during analysis, to check if it has to be persisted. Examples of use cases are:
-   * <ul>
-   *  <li>Ignoring or enforcing rules on specific resources</li>
-   *  <li>Switching-off an issue based on its context (<code>//NOSONAR</code> comments, semantic annotations)</li>
-   * </ul>
-   * The <code>chain</code> parameter allows for fine control of the filtering logic: it is each filter's duty to either pass the issue to the next filter, by calling
-   * the {@link IssueFilterChain#accept} method, or return directly if the issue has to be accepted or not
-   * 
-   * Implementations should be thread safe.
-   * 
-   * @param issue the issue being filtered
-   * @param chain the rest of the filters
-   * @return <code>true</code> to accept the issue, <code>false</code> to reject it, {@link IssueFilterChain#accept} to let the other filters decide.
-   */
-  boolean accept(FilterableIssue issue, IssueFilterChain chain);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilterChain.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/IssueFilterChain.java
deleted file mode 100644 (file)
index a81aa78..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.issue.filter;
-
-import javax.annotation.concurrent.ThreadSafe;
-
-/**
- * A filter chain is an object provided to issues filters for fine control over the filtering logic. Each filter has the choice to:
- * <ul>
- *  <li>Accept the issue</li>
- *  <li>Reject the issue</li>
- *  <li>Let downstream filters decide by passing the issue to the rest of the chain</li>
- * </ul>
- * 
- * @since 5.3
- */
-@ThreadSafe
-public interface IssueFilterChain {
-  /**
-   * Called by a filter to let downstream filters decide the fate of the issue
-   */
-  boolean accept(FilterableIssue issue);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/issue/filter/package-info.java
deleted file mode 100644 (file)
index 0830c3f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.issue.filter;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/ScannerSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/ScannerSide.java
deleted file mode 100644 (file)
index 20b06ce..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scanner;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation for all the components available in the container of the scanner (code analyzer). Note that
- * injection of dependencies by constructor is used :
- * <pre>
- *   {@literal @}ScannerSide
- *   public class Foo {
- *
- *   }
- *   {@literal @}ScannerSide
- *   public class Bar {
- *     private final Foo foo;
- *     public Bar(Foo f) {
- *       this.foo = f;
- *     }
- *   }
- *
- * </pre>
- *
- * @since 7.6
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ScannerSide {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/InputProject.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/InputProject.java
deleted file mode 100644 (file)
index 869d1df..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scanner.fs;
-
-
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.batch.fs.InputComponent;
-import org.sonar.api.batch.sensor.SensorContext;
-
-/**
- * Used to create issues and measures on project. You can access InputProject using {@link SensorContext#project()}
- *
- * @since 7.6
- */
-@Immutable
-public interface InputProject extends InputComponent {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/fs/package-info.java
deleted file mode 100644 (file)
index 984399b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.scanner.fs;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/package-info.java
deleted file mode 100644 (file)
index f278e17..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.scanner;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/ProjectSensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/ProjectSensor.java
deleted file mode 100644 (file)
index c1ad6a9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scanner.sensor;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.batch.sensor.SensorContext;
-import org.sonar.api.batch.sensor.SensorDescriptor;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-/**
- * <p>
- * A sensor is invoked once for each project analysis. Sensors are mainly used to add measures and issues on {@link org.sonar.api.batch.fs.InputFile}s.
- * <p>
- * For example the Cobertura Sensor parses Cobertura report and saves the first-level of measures on files.
- * 
- * For testing purpose you can use  SensorContextTester
- * @since 7.6
- */
-@ScannerSide
-@SonarLintSide
-@ExtensionPoint
-public interface ProjectSensor {
-
-  /**
-   * Populate {@link SensorDescriptor} of this sensor.
-   */
-  void describe(SensorDescriptor descriptor);
-
-  /**
-   * The actual sensor code.
-   */
-  void execute(SensorContext context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/scanner/sensor/package-info.java
deleted file mode 100644 (file)
index 98e37c1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.
- */
-@javax.annotation.ParametersAreNonnullByDefault
-package org.sonar.api.scanner.sensor;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java
deleted file mode 100644 (file)
index 46cb30a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import javax.annotation.Nullable;
-import javax.servlet.http.HttpServletRequest;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * @see SecurityRealm
- * @since 3.1
- */
-@ServerSide
-@ExtensionPoint
-public abstract class Authenticator {
-
-  /**
-   * @return true if user was successfully authenticated with specified credentials, false otherwise
-   * @throws RuntimeException in case of unexpected error such as connection failure
-   */
-  public abstract boolean doAuthenticate(Context context);
-
-  public static final class Context {
-    private String username;
-    private String password;
-    private HttpServletRequest request;
-
-    public Context(@Nullable String username, @Nullable String password, HttpServletRequest request) {
-      requireNonNull(request);
-      this.request = request;
-      this.username = username;
-      this.password = password;
-    }
-
-    /**
-     * Username can be null, for example when using <a href="http://www.jasig.org/cas">CAS</a>.
-     */
-    public String getUsername() {
-      return username;
-    }
-
-    /**
-     * Password can be null, for example when using <a href="http://www.jasig.org/cas">CAS</a>.
-     */
-    public String getPassword() {
-      return password;
-    }
-
-    public HttpServletRequest getRequest() {
-      return request;
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/DefaultGroups.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/DefaultGroups.java
deleted file mode 100644 (file)
index 5248c88..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import javax.annotation.Nullable;
-
-/**
- * Name of the default user groups
- *
- * @since 3.2
- */
-public final class DefaultGroups {
-
-  public static final String ANYONE = "Anyone";
-  public static final String ADMINISTRATORS = "sonar-administrators";
-  public static final String USERS = "sonar-users";
-
-  private DefaultGroups() {
-    // only statics
-  }
-
-  public static boolean isAnyone(@Nullable String groupName) {
-    return ANYONE.equalsIgnoreCase(groupName);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalGroupsProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalGroupsProvider.java
deleted file mode 100644 (file)
index de89ded..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Note that prefix "do" for names of methods is reserved for future enhancements, thus should not be used in subclasses.
- *
- * @see SecurityRealm
- * @since 2.14
- */
-public abstract class ExternalGroupsProvider {
-
-  /**
-   * Override this method in order to load user group information.
-   *
-   * @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
-   * @since 5.2
-   */
-  @CheckForNull
-  public Collection<String> doGetGroups(Context context) {
-    return null;
-  }
-
-  public static final class Context {
-    private String username;
-    private HttpServletRequest request;
-
-    public Context(String username, HttpServletRequest request) {
-      this.username = username;
-      this.request = request;
-    }
-
-    public String getUsername() {
-      return username;
-    }
-
-    public HttpServletRequest getRequest() {
-      return request;
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalUsersProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/ExternalUsersProvider.java
deleted file mode 100644 (file)
index 2889e16..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import javax.annotation.Nullable;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Note that prefix "do" for names of methods is reserved for future enhancements, thus should not be used in subclasses.
- *
- * @see SecurityRealm
- * @since 2.14
- */
-public abstract class ExternalUsersProvider {
-  /**
-   * Override this method in order load user information.
-   *
-   * @return the user, or null if user doesn't exist
-   * @throws RuntimeException in case of unexpected error such as connection failure
-   * @since 3.1
-   */
-  public UserDetails doGetUserDetails(Context context) {
-    return null;
-  }
-
-  public static final class Context {
-    private String username;
-    private HttpServletRequest request;
-
-    public Context(@Nullable String username, HttpServletRequest request) {
-      this.username = username;
-      this.request = request;
-    }
-
-    public String getUsername() {
-      return username;
-    }
-
-    public HttpServletRequest getRequest() {
-      return request;
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java
deleted file mode 100644 (file)
index ae9c460..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 1.12
- * @see SecurityRealm
- * @deprecated replaced by Authenticator in version 3.1
- */
-@Deprecated
-@ServerSide
-@ExtensionPoint
-public interface LoginPasswordAuthenticator {
-
-  /**
-   * @throws RuntimeException if the authenticator can not be initialized at sonar server startup, eg. if the connection to LDAP server is refused
-   * @deprecated in 2.14, but was left for backward compatibility - when this authenticator is not a part of {@link SecurityRealm}, otherwise has no effect and not invoked
-   */
-  @Deprecated
-  void init();
-
-  /**
-   * @return true, if user was successfully authenticated with specified username and password, false otherwise
-   * @throws RuntimeException in case of unexpected error such as connection failure
-   */
-  boolean authenticate(String username, String password);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java
deleted file mode 100644 (file)
index bde9d3e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 2.14
- */
-@ServerSide
-@ExtensionPoint
-public abstract class SecurityRealm {
-
-  /**
-   * @return unique name of this realm, e.g. "ldap"
-   */
-  public String getName() {
-    return getClass().getSimpleName();
-  }
-
-  /**
-   * Invoked during server startup and can be used to initialize internal state.
-   */
-  public void init() {
-  }
-
-  /**
-   * @return {@link LoginPasswordAuthenticator} associated with this realm, never null
-   * @deprecated replaced by doGetAuthenticator in version 3.1
-   */
-  @Deprecated
-  public LoginPasswordAuthenticator getLoginPasswordAuthenticator() {
-    return null;
-  }
-
-  /**
-   * @since 3.1
-   */
-  public Authenticator doGetAuthenticator() {
-    // this method is not overridden when deprecated getLoginPasswordAuthenticator
-    // is used
-    return new Authenticator() {
-      @Override
-      public boolean doAuthenticate(Context context) {
-        return getLoginPasswordAuthenticator().authenticate(context.getUsername(), context.getPassword());
-      }
-    };
-  }
-
-  /**
-   * @return {@link ExternalUsersProvider} associated with this realm, null if not supported
-   */
-  public ExternalUsersProvider getUsersProvider() {
-    return null;
-  }
-
-  /**
-   * @return {@link ExternalGroupsProvider} associated with this realm, null if not supported
-   */
-  public ExternalGroupsProvider getGroupsProvider() {
-    return null;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserDetails.java
deleted file mode 100644 (file)
index 7ab23ae..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-/**
- * This class is not intended to be subclassed by clients.
- *
- * @see ExternalUsersProvider
- * @since 2.14
- */
-public final class UserDetails {
-
-  private String name = "";
-  private String email = "";
-  private String userId = "";
-
-  public void setEmail(String email) {
-    this.email = email;
-  }
-
-  public String getEmail() {
-    return email;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * @since 5.2
-   */
-  public void setUserId(String userId) {
-    this.userId = userId;
-  }
-
-  /**
-   * @since 5.2
-   */
-  public String getUserId() {
-    return userId;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("UserDetails{");
-    sb.append("name='").append(name).append('\'');
-    sb.append(", email='").append(email).append('\'');
-    sb.append(", userId='").append(userId).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/package-info.java
deleted file mode 100644 (file)
index 6aa376f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ServerSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ServerSide.java
deleted file mode 100644 (file)
index 93dabf6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.sonar.api.scanner.ScannerSide;
-
-/**
- * Same as {@link ScannerSide} but for server-side components.
- *
- * @since 5.2
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface ServerSide {
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/BaseIdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/BaseIdentityProvider.java
deleted file mode 100644 (file)
index 84fe858..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @since 5.4
- */
-public interface BaseIdentityProvider extends IdentityProvider {
-
-  /**
-   * Entry-point of authentication workflow. Executed by core when user
-   * clicks on the related button in login form (GET /sessions/init/{provider key}).
-   */
-  void init(Context context);
-
-  interface Context {
-
-    /**
-     * Get the received HTTP request.
-     * Note - {@code getRequest().getSession()} must not be used in order to support
-     * future clustering of web servers without stateful server sessions.
-     */
-    HttpServletRequest getRequest();
-
-    /**
-     * Get the HTTP response to send
-     */
-    HttpServletResponse getResponse();
-
-    /**
-     * Return the server base URL
-     * @see org.sonar.api.platform.Server#getPublicRootUrl()
-     */
-    String getServerBaseURL();
-
-    /**
-     * Authenticate and register the user into the platform.
-     *
-     * The first time a user is authenticated (and if {@link #allowsUsersToSignUp()} is true), a new user will be registered.
-     * Then, only user's name and email are updated.
-     *
-     * If @link #allowsUsersToSignUp()} is set to false and a new user try to authenticate,
-     * then the user is not authenticated and he's redirected to a dedicated page.
-     *
-     * If the email of the user is already used by an existing user of the platform,
-     * then the user is not authenticated and he's redirected to a dedicated page.
-     */
-    void authenticate(UserIdentity userIdentity);
-
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java
deleted file mode 100644 (file)
index 6beb1f3..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Display information provided by the Identity Provider to be displayed into the login form.
- *
- * @since 5.4
- */
-@Immutable
-public final class Display {
-
-  private final String iconPath;
-  private final String backgroundColor;
-  private final String helpMessage;
-
-  private Display(Builder builder) {
-    this.iconPath = builder.iconPath;
-    this.backgroundColor = builder.backgroundColor;
-    this.helpMessage = builder.helpMessage;
-  }
-
-  /**
-   * URL path to the provider icon, as deployed at runtime, for example "/static/authgithub/github.svg" (in this
-   * case "authgithub" is the plugin key. Source file is "src/main/resources/static/github.svg").
-   * It can also be an external URL, for example "http://www.mydomain/myincon.png".
-   * Must not be blank.
-   * <br>
-   * The recommended format is SVG with a size of 24x24 pixels.
-   * Other supported format is PNG, with a size of 40x40 pixels.
-   */
-  public String getIconPath() {
-    return iconPath;
-  }
-
-  /**
-   * Background color for the provider button displayed in the login form.
-   * It's a Hexadecimal value, for instance #205081.
-   * <br>
-   * If not provided, the default value is #236a97
-   */
-  public String getBackgroundColor() {
-    return backgroundColor;
-  }
-
-  /**
-   * Optional help message to be displayed near the provider button.
-   */
-  @CheckForNull
-  public String getHelpMessage() {
-    return helpMessage;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-
-    private String iconPath;
-    private String backgroundColor = "#236a97";
-    private String helpMessage;
-
-    private Builder() {
-    }
-
-    /**
-     * @see Display#getIconPath()
-     */
-    public Builder setIconPath(String iconPath) {
-      this.iconPath = iconPath;
-      return this;
-    }
-
-    /**
-     * @see Display#getBackgroundColor()
-     */
-    public Builder setBackgroundColor(String backgroundColor) {
-      this.backgroundColor = backgroundColor;
-      return this;
-    }
-
-    /**
-     * @see Display#getHelpMessage()
-     */
-    public Builder setHelpMessage(@CheckForNull String helpMessage) {
-      this.helpMessage = helpMessage;
-      return this;
-    }
-
-    public Display build() {
-      checkArgument(isNotBlank(iconPath), "Icon path must not be blank");
-      validateBackgroundColor();
-      return new Display(this);
-    }
-
-    private void validateBackgroundColor() {
-      checkArgument(isNotBlank(backgroundColor), "Background color must not be blank");
-      checkArgument(backgroundColor.length() == 7 && backgroundColor.indexOf('#') == 0,
-        "Background color must begin with a sharp followed by 6 characters");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java
deleted file mode 100644 (file)
index 24acf5d..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Entry-point to define a new Identity provider.
- * Only one of this two interfaces can be used :
- * <ul>
- *   <li>{@link OAuth2IdentityProvider} for OAuth2 authentication</li>
- *   <li>{@link BaseIdentityProvider} for other kind of authentication</li>
- * </ul>
- *
- * @since 5.4
- */
-@ServerSide
-@ExtensionPoint
-public interface IdentityProvider {
-
-  /**
-   * Unique key of provider, for example "github".
-   * Must not be blank.
-   */
-  String getKey();
-
-  /**
-   * Name displayed in login form.
-   * Must not be blank.
-   */
-  String getName();
-
-  /**
-   * Display information for the login form
-   */
-  Display getDisplay();
-
-  /**
-   * Is the provider fully configured and enabled ? If {@code true}, then
-   * the provider is available in login form.
-   */
-  boolean isEnabled();
-
-  /**
-   * Can users sign-up (connecting with their account for the first time) ? If {@code true},
-   * then users can register and create their account into SonarQube, else only already
-   * registered users can login.
-   */
-  boolean allowsUsersToSignUp();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/OAuth2IdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/OAuth2IdentityProvider.java
deleted file mode 100644 (file)
index bc25ed7..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @since 5.4
- */
-public interface OAuth2IdentityProvider extends IdentityProvider {
-
-  /**
-   * Entry-point of authentication workflow. Executed by core when user
-   * clicks on the related button in login form (GET /sessions/init/{provider key}).
-   */
-  void init(InitContext context);
-
-  /**
-   * This method is called when the identity provider has authenticated a user.
-   */
-  void callback(CallbackContext context);
-
-  interface OAuth2Context {
-
-    /**
-     * The callback URL that must be used by the identity provider
-     */
-    String getCallbackUrl();
-
-    /**
-     * Get the received HTTP request.
-     * Note - {@code getRequest().getSession()} must not be used in order to support
-     * future clustering of web servers without stateful server sessions.
-     */
-    HttpServletRequest getRequest();
-
-    /**
-     * Get the HTTP response to send
-     */
-    HttpServletResponse getResponse();
-  }
-
-  interface InitContext extends OAuth2Context {
-
-    /**
-     * Generate a non-guessable state to prevent Cross Site Request Forgery.
-     */
-    String generateCsrfState();
-
-    /**
-     * Redirect the request to the url.
-     * Can be used to redirect to the identity provider authentication url.
-     */
-    void redirectTo(String url);
-  }
-
-  interface CallbackContext extends OAuth2Context {
-
-    /**
-     * Check that the state is valid.
-     * The state will be read from the 'state' parameter of the HTTP request
-     *
-     * It should only be called If {@link InitContext#generateCsrfState()} was used in the init
-     */
-    void verifyCsrfState();
-
-    /**
-     * Check that the state is valid
-     * The state will be read from the given parameter name of the HTTP request
-     *
-     * It should only be called If {@link InitContext#generateCsrfState()} was used in the init
-     */
-    void verifyCsrfState(String parameterName);
-
-    /**
-     * Redirect the request to the requested page.
-     * Must be called at the end of {@link OAuth2IdentityProvider#callback(CallbackContext)}
-     */
-    void redirectToRequestedPage();
-
-    /**
-     * Authenticate and register the user into the platform.
-     * @see org.sonar.api.server.authentication.BaseIdentityProvider.Context#authenticate(UserIdentity)
-     */
-    void authenticate(UserIdentity userIdentity);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UnauthorizedException.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UnauthorizedException.java
deleted file mode 100644 (file)
index 3898f02..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-/**
- * This exception should be used when a functional error is generated by an Identity Provider plugin.
- * The user will be redirected to an unauthorized page and the exception's message will be displayed in the UI.
- *
- * @since 5.5
- */
-public class UnauthorizedException extends RuntimeException {
-
-  public UnauthorizedException(String message) {
-    super(message);
-  }
-
-  public UnauthorizedException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UserIdentity.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/UserIdentity.java
deleted file mode 100644 (file)
index 58cc835..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.user.UserGroupValidation;
-
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * User information provided by the Identity Provider to be register into the platform.
- *
- * @since 5.4
- */
-@Immutable
-public final class UserIdentity {
-
-  @Nullable
-  private final String id;
-  private final String providerLogin;
-  private final String name;
-  @Nullable
-  private final String email;
-  private final boolean groupsProvided;
-  private final Set<String> groups;
-
-  private UserIdentity(Builder builder) {
-    this.id = builder.id;
-    this.providerLogin = builder.providerLogin;
-    this.name = builder.name;
-    this.email = builder.email;
-    this.groupsProvided = builder.groupsProvided;
-    this.groups = builder.groups;
-  }
-
-  /**
-   * Optional unique ID for the related {@link IdentityProvider}.
-   * If two {@link IdentityProvider} define two users with the same ID, then users are considered as identical.
-   *
-   * When the ID is not provided, the provider login {@link #getProviderLogin()} is used.
-   *
-   * @since 7.2
-   */
-  @CheckForNull
-  public String getProviderId() {
-    return id;
-  }
-
-  /**
-   * Non-blank user login for the related {@link IdentityProvider}.
-   */
-  public String getProviderLogin() {
-    return providerLogin;
-  }
-
-  /**
-   * User login, unique for the SonarQube platform.
-   * If two {@link IdentityProvider} define two users with the same login, then users are considered as identical.
-   *
-   * Since 7.4, a unique login will be generated if result is null and the user referenced by {@link #getProviderId()}
-   * or {@link #getProviderLogin()} does not already exist.
-   *
-   * @deprecated since 8.0, should not be used as it is internal managed field
-   *
-   * @return null
-   */
-  @CheckForNull
-  @Deprecated
-  public String getLogin() {
-    return null;
-  }
-
-  /**
-   * Non-blank display name. Uniqueness is not mandatory, even it's recommended for easier search of users
-   * in webapp.
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Optional non-blank email. If defined, then it must be unique among all the users defined by all
-   * {@link IdentityProvider}. If not unique, then authentication will fail.
-   */
-  @CheckForNull
-  public String getEmail() {
-    return email;
-  }
-
-  /**
-   * Return true if groups should be synchronized for this user.
-   *
-   * @since 5.5
-   */
-  public boolean shouldSyncGroups() {
-    return groupsProvided;
-  }
-
-  /**
-   * List of group membership of the user. Only existing groups in SonarQube will be synchronized.
-   *
-   * @since 5.5
-   */
-  public Set<String> getGroups() {
-    return groups;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private String id;
-    private String providerLogin;
-    private String name;
-    private String email;
-    private boolean groupsProvided = false;
-    private Set<String> groups = new HashSet<>();
-
-    private Builder() {
-    }
-
-    /**
-     * @see UserIdentity#getProviderId()
-     * @since 7.2
-     */
-    public Builder setProviderId(@Nullable String id) {
-      this.id = id;
-      return this;
-    }
-
-    /**
-     * @see UserIdentity#getProviderLogin()
-     */
-    public Builder setProviderLogin(String providerLogin) {
-      this.providerLogin = providerLogin;
-      return this;
-    }
-
-    /**
-     * @see UserIdentity#getLogin()
-     *
-     * @deprecated since 8.0, has no effect as it is internal managed field
-     */
-    @Deprecated
-    public Builder setLogin(@Nullable String login) {
-      return this;
-    }
-
-    /**
-     * @see UserIdentity#getName()
-     */
-    public Builder setName(String name) {
-      this.name = name;
-      return this;
-    }
-
-    /**
-     * @see UserIdentity#getEmail()
-     */
-    public Builder setEmail(@Nullable String email) {
-      this.email = email;
-      return this;
-    }
-
-    /**
-     * Set group membership of the user. This method should only be used when synchronization of groups should be done.
-     * <ul>
-     *   <li>When groups are not empty, group membership is synchronized when user logs in :
-     *   <ul>
-     *     <li>User won't belong anymore to a group that is not in the list (even the default group defined in 'sonar-users')</li>
-     *     <li>User will belong only to groups that exist in SonarQube</li>
-     *     <li>Groups that don't exist in SonarQube are silently ignored</li>
-     *   </ul>
-     *   <li>When groups are empty, user won't belong to any group</li>
-     * </ul>
-     *
-     * @throws NullPointerException when groups is null
-     * @since 5.5
-     */
-    public Builder setGroups(Set<String> groups) {
-      requireNonNull(groups, "Groups cannot be null, please don't use this method if groups should not be synchronized.");
-      groups.forEach(UserGroupValidation::validateGroupName);
-      this.groupsProvided = true;
-      this.groups = groups;
-      return this;
-    }
-
-    public UserIdentity build() {
-      validateId(id);
-      validateProviderLogin(providerLogin);
-      validateName(name);
-      validateEmail(email);
-      return new UserIdentity(this);
-    }
-
-    private static void validateId(@Nullable String id) {
-      checkArgument(id == null || id.length() <= 255, "ID is too big (255 characters max)");
-    }
-
-    private static void validateProviderLogin(String providerLogin) {
-      checkArgument(isNotBlank(providerLogin), "Provider login must not be blank");
-      checkArgument(providerLogin.length() <= 255, "Provider login size is incorrect (maximum 255 characters)");
-    }
-
-    private static void validateName(String name) {
-      checkArgument(isNotBlank(name), "User name must not be blank");
-      checkArgument(name.length() <= 200, "User name size is too big (200 characters max)");
-    }
-
-    private static void validateEmail(@Nullable String email) {
-      checkArgument(email == null || email.length() <= 100, "User email size is too big (100 characters max)");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/package-info.java
deleted file mode 100644 (file)
index 7169f33..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
deleted file mode 100644 (file)
index 8db8bd1..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.debt;
-
-import javax.annotation.CheckForNull;
-
-/**
- * Function used to calculate the remediation cost of an issue. See {@link Type} for details.
- * <p>The gap multiplier and base effort involved in the functions are durations. They are defined in hours, minutes and/or
- * seconds. Examples: "5min", "1h 10min". Supported units are "d" (days), "h" (hour), and "min" (minutes).
- *
- * @since 4.3
- */
-public interface DebtRemediationFunction {
-
-  enum Type {
-
-    /**
-     * The cost to fix an issue of this type depends on the magnitude of the issue.
-     * For instance, an issue related to file size might be linear, with the total cost-to-fix incrementing
-     * (by the gap multiplier amount) for each line of code above the allowed threshold.
-     * The rule must provide the "gap" value when raising an issue.
-     */
-    LINEAR(true, false),
-
-    /**
-     * It takes a certain amount of time to deal with an issue of this type (this is the gap multiplier).
-     * Then, the magnitude of the issue comes in to play. For instance, an issue related to complexity might be linear with offset.
-     * So the total cost to fix is the time to make the basic analysis (the base effort) plus the time required to deal
-     * with each complexity point above the allowed value.
-     * <p>
-     * <code>Total remediation cost = base effort + (number of noncompliance x gap multiplier)</code>
-     * 
-     * <p>The rule must provide the "gap" value when raising an issue. Let's take as a example the "Paragraphs should not be too complex" rule.
-     * If you set the rule threshold to 20, and you have a paragraph with a complexity of 27, you have 7 points of complexity
-     * to remove. Internally, this is called the Gap. In that case, if you use the LINEAR_OFFSET configuration
-     * with an base effort of 4h and a remediation cost of 1mn, the effort for this issue related to a
-     * too-complex block of code will be: (7 complexity points x 1min) + 4h = 4h and 7mn
-     * 
-     */
-    LINEAR_OFFSET(true, true),
-
-    /**
-     * The cost to fix all the issues of the rule is the same whatever the number of issues
-     * of this rule in the file. Total remediation cost by file = constant
-     */
-    CONSTANT_ISSUE(false, true);
-
-    private final boolean usesGapMultiplier;
-    private final boolean usesBaseEffort;
-
-    Type(boolean usesGapMultiplier, boolean usesBaseEffort) {
-      this.usesGapMultiplier = usesGapMultiplier;
-      this.usesBaseEffort = usesBaseEffort;
-    }
-
-    /**
-     * @since 5.5
-     */
-    public boolean usesGapMultiplier() {
-      return usesGapMultiplier;
-    }
-
-    /**
-     * @since 5.5
-     */
-    public boolean usesBaseEffort() {
-      return usesBaseEffort;
-    }
-
-  }
-
-  /**
-   * @since 5.5
-   */
-  Type type();
-
-  /**
-   * Non-null value on {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET} functions, else {@code null}.
-   *
-   * @since 5.5
-   */
-  @CheckForNull
-  String gapMultiplier();
-
-  /**
-   * Non-null value on {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE} functions, else {@code null}.
-   *
-   * @since 5.5
-   */
-  @CheckForNull
-  String baseEffort();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
deleted file mode 100644 (file)
index 19348cd..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.debt.internal;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.utils.Duration;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
-
-  private static final int HOURS_IN_DAY = 24;
-
-  private final Type type;
-  private final String gapMultiplier;
-  private final String baseEffort;
-
-  public DefaultDebtRemediationFunction(@Nullable Type type, @Nullable String gapMultiplier, @Nullable String baseEffort) {
-    this.type = type;
-    this.gapMultiplier = sanitizeValue("gap multiplier", gapMultiplier);
-    this.baseEffort = sanitizeValue("base effort", baseEffort);
-    validate();
-  }
-
-  @CheckForNull
-  private static String sanitizeValue(String label, @Nullable String s) {
-    if (StringUtils.isNotBlank(s)) {
-      try {
-        Duration duration = Duration.decode(s, HOURS_IN_DAY);
-        return duration.encode(HOURS_IN_DAY);
-      } catch (Exception e) {
-        throw new IllegalArgumentException(String.format("Invalid %s: %s (%s)", label, s, e.getMessage()), e);
-      }
-    }
-    return null;
-  }
-
-  @Override
-  public Type type() {
-    return type;
-  }
-
-  @Override
-  @CheckForNull
-  public String gapMultiplier() {
-    return gapMultiplier;
-  }
-
-  @Override
-  public String baseEffort() {
-    return baseEffort;
-  }
-
-  private void validate() {
-    checkArgument(type != null, "Remediation function type cannot be null");
-    switch (type) {
-      case LINEAR:
-        checkArgument(this.gapMultiplier != null && this.baseEffort == null, "Linear functions must only have a non empty gap multiplier");
-        break;
-      case LINEAR_OFFSET:
-        checkArgument(this.gapMultiplier != null && this.baseEffort != null, "Linear with offset functions must have both non null gap multiplier and base effort");
-        break;
-      case CONSTANT_ISSUE:
-        checkArgument(this.gapMultiplier == null && this.baseEffort != null, "Constant/issue functions must only have a non empty base effort");
-        break;
-      default:
-        throw new IllegalArgumentException(String.format("Unknown type on %s", this));
-    }
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (!(o instanceof DefaultDebtRemediationFunction)) {
-      return false;
-    }
-    if (this == o) {
-      return true;
-    }
-    DefaultDebtRemediationFunction other = (DefaultDebtRemediationFunction) o;
-    return new EqualsBuilder()
-      .append(gapMultiplier, other.gapMultiplier())
-      .append(baseEffort, other.baseEffort())
-      .append(type, other.type())
-      .isEquals();
-  }
-
-  @Override
-  public int hashCode() {
-    int result = type.hashCode();
-    result = 31 * result + (gapMultiplier != null ? gapMultiplier.hashCode() : 0);
-    result = 31 * result + (baseEffort != null ? baseEffort.hashCode() : 0);
-    return result;
-  }
-
-  @Override
-  public String toString() {
-    return "DebtRemediationFunction{" +
-      "type=" + type + ", " +
-      "gap multiplier=" + gapMultiplier + ", " +
-      "base effort=" + baseEffort
-      + "}";
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java
deleted file mode 100644 (file)
index 0513658..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.debt.internal;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java
deleted file mode 100644 (file)
index 4c02752..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.debt;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/package-info.java
deleted file mode 100644 (file)
index 81126a1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoader.java
deleted file mode 100644 (file)
index c453381..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.profile;
-
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.rules.RuleAnnotationUtils;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInActiveRule;
-import org.sonar.check.BelongsToProfile;
-
-/**
- * Read definitions of quality profiles based on the annotation {@link BelongsToProfile} provided by sonar-check-api. It is used
- * to feed {@link BuiltInQualityProfilesDefinition}.
- *
- * @see BuiltInQualityProfilesDefinition
- * @since 6.6
- */
-@ServerSide
-public class BuiltInQualityProfileAnnotationLoader {
-
-  public void load(BuiltInQualityProfilesDefinition.NewBuiltInQualityProfile builtInProfile, String repositoryKey, Class... annotatedClasses) {
-    for (Class<?> annotatedClass : annotatedClasses) {
-      loadActiveRule(builtInProfile, repositoryKey, annotatedClass);
-    }
-  }
-
-  void loadActiveRule(BuiltInQualityProfilesDefinition.NewBuiltInQualityProfile profile, String repositoryKey, Class<?> clazz) {
-    BelongsToProfile belongsToProfile = clazz.getAnnotation(BelongsToProfile.class);
-    if ((belongsToProfile != null) && StringUtils.equals(belongsToProfile.title(), profile.name())) {
-      String ruleKey = RuleAnnotationUtils.getRuleKey(clazz);
-      NewBuiltInActiveRule activeRule = profile.activateRule(repositoryKey, ruleKey);
-      activeRule.overrideSeverity(belongsToProfile.priority().name());
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinition.java
deleted file mode 100644 (file)
index 8ac17cf..0000000
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.profile;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.server.ServerSide;
-
-import static java.lang.String.format;
-import static java.util.Collections.unmodifiableList;
-import static java.util.Collections.unmodifiableMap;
-import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Define built-in quality profiles which are automatically registered during SonarQube startup.
- * We no more provide any facility to load profiles from XML file or annotated classes, but it should
- * be straightforward to implement (adapt code of deprecated {@link org.sonar.api.profiles.AnnotationProfileParser}
- * or {@link org.sonar.api.profiles.XMLProfileParser} for example).
- *
- * @since 6.6
- */
-@ServerSide
-@ExtensionPoint
-public interface BuiltInQualityProfilesDefinition {
-
-  /**
-   * Instantiated by core but not by plugins, except for their tests.
-   */
-  class Context {
-
-    private final Map<String, Map<String, BuiltInQualityProfile>> profilesByLanguageAndName = new HashMap<>();
-
-    /**
-     * New builder for {@link BuiltInQualityProfile}.
-     * <br>
-     * A plugin can activate rules in a built in quality profile that is defined by another plugin.
-     */
-    public NewBuiltInQualityProfile createBuiltInQualityProfile(String name, String language)  {
-      return new NewBuiltInQualityProfileImpl(this, name, language);
-    }
-
-    private void registerProfile(NewBuiltInQualityProfileImpl newProfile) {
-      String language = newProfile.language();
-      String name = newProfile.name();
-      checkArgument(!profilesByLanguageAndName.computeIfAbsent(language, l -> new LinkedHashMap<>()).containsKey(name),
-        "There is already a quality profile with name '%s' for language '%s'", name, language);
-      profilesByLanguageAndName.get(language).put(name, new BuiltInQualityProfileImpl(newProfile));
-    }
-
-    public Map<String, Map<String, BuiltInQualityProfile>> profilesByLanguageAndName() {
-      return profilesByLanguageAndName;
-    }
-
-    public BuiltInQualityProfile profile(String language, String name) {
-      return profilesByLanguageAndName.computeIfAbsent(language, l -> new LinkedHashMap<>()).get(name);
-    }
-  }
-
-  interface NewBuiltInQualityProfile {
-
-    /**
-     * Set whether this is the default profile for the language. The default profile is used when none is explicitly defined when analyzing a project.
-     */
-    NewBuiltInQualityProfile setDefault(boolean value);
-
-    /**
-     * Activate a rule with specified key.
-     *
-     * @throws IllegalArgumentException if rule is already activated in this profile.
-     */
-    NewBuiltInActiveRule activateRule(String repoKey, String ruleKey);
-
-    Collection<NewBuiltInActiveRule> activeRules();
-
-    String language();
-
-    String name();
-
-    boolean isDefault();
-
-    void done();
-  }
-
-  class NewBuiltInQualityProfileImpl implements NewBuiltInQualityProfile {
-    private final Context context;
-    private final String name;
-    private final String language;
-    private boolean isDefault;
-    private final Map<RuleKey, NewBuiltInActiveRule> newActiveRules = new HashMap<>();
-
-    private NewBuiltInQualityProfileImpl(Context context, String name, String language) {
-      this.context = context;
-      this.name = name;
-      this.language = language;
-    }
-
-    @Override
-    public NewBuiltInQualityProfile setDefault(boolean value) {
-      this.isDefault = value;
-      return this;
-    }
-
-    @Override
-    public NewBuiltInActiveRule activateRule(String repoKey, String ruleKey) {
-      RuleKey ruleKeyObj = RuleKey.of(repoKey, ruleKey);
-      checkArgument(!newActiveRules.containsKey(ruleKeyObj), "The rule '%s' is already activated", ruleKeyObj);
-      NewBuiltInActiveRule newActiveRule = new NewBuiltInActiveRule(repoKey, ruleKey);
-      newActiveRules.put(ruleKeyObj, newActiveRule);
-      return newActiveRule;
-    }
-
-    @Override
-    public String language() {
-      return language;
-    }
-
-    @Override
-    public String name() {
-      return name;
-    }
-
-    @Override
-    public boolean isDefault() {
-      return isDefault;
-    }
-
-    @Override
-    public Collection<NewBuiltInActiveRule> activeRules() {
-      return newActiveRules.values();
-    }
-
-    @Override
-    public void done() {
-      checkArgument(isNotBlank(name), "Built-In Quality Profile can't have a blank name");
-      checkArgument(isNotBlank(language), "Built-In Quality Profile can't have a blank language");
-
-      context.registerProfile(this);
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("NewBuiltInQualityProfile{");
-      sb.append("name='").append(name).append('\'');
-      sb.append(", language='").append(language).append('\'');
-      sb.append(", default='").append(isDefault).append('\'');
-      sb.append('}');
-      return sb.toString();
-    }
-  }
-
-  interface BuiltInQualityProfile {
-    String name();
-
-    String language();
-
-    boolean isDefault();
-
-    @CheckForNull
-    BuiltInActiveRule rule(RuleKey ruleKey);
-
-    List<BuiltInActiveRule> rules();
-  }
-
-  @Immutable
-  class BuiltInQualityProfileImpl implements BuiltInQualityProfile {
-
-    private final String language;
-    private final String name;
-    private final boolean isDefault;
-    private final Map<RuleKey, BuiltInActiveRule> activeRulesByKey;
-
-    private BuiltInQualityProfileImpl(NewBuiltInQualityProfileImpl newProfile) {
-      this.name = newProfile.name();
-      this.language = newProfile.language();
-      this.isDefault = newProfile.isDefault();
-
-      Map<RuleKey, BuiltInActiveRule> ruleBuilder = new HashMap<>();
-      for (NewBuiltInActiveRule newActiveRule : newProfile.activeRules()) {
-        ruleBuilder.put(RuleKey.of(newActiveRule.repoKey, newActiveRule.ruleKey), new BuiltInActiveRule(newActiveRule));
-      }
-      this.activeRulesByKey = unmodifiableMap(ruleBuilder);
-    }
-
-    @Override
-    public String language() {
-      return language;
-    }
-
-    @Override
-    public String name() {
-      return name;
-    }
-
-    @Override
-    public boolean isDefault() {
-      return isDefault;
-    }
-
-    @Override
-    @CheckForNull
-    public BuiltInActiveRule rule(RuleKey ruleKey) {
-      return activeRulesByKey.get(ruleKey);
-    }
-
-    @Override
-    public List<BuiltInActiveRule> rules() {
-      return unmodifiableList(new ArrayList<>(activeRulesByKey.values()));
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      if (this == o) {
-        return true;
-      }
-      if (o == null || getClass() != o.getClass()) {
-        return false;
-      }
-      BuiltInQualityProfileImpl that = (BuiltInQualityProfileImpl) o;
-      return language.equals(that.language) && name.equals(that.name);
-    }
-
-    @Override
-    public int hashCode() {
-      int result = name.hashCode();
-      result = 31 * result + language.hashCode();
-      return result;
-    }
-
-    @Override
-    public String toString() {
-      StringBuilder sb = new StringBuilder("BuiltInQualityProfile{");
-      sb.append("name='").append(name).append('\'');
-      sb.append(", language='").append(language).append('\'');
-      sb.append(", default='").append(isDefault).append('\'');
-      sb.append('}');
-      return sb.toString();
-    }
-  }
-
-  class NewBuiltInActiveRule {
-    private final String repoKey;
-    private final String ruleKey;
-    private String overriddenSeverity = null;
-    private final Map<String, NewOverriddenParam> paramsByKey = new HashMap<>();
-
-    private NewBuiltInActiveRule(String repoKey, String ruleKey) {
-      this.repoKey = repoKey;
-      this.ruleKey = ruleKey;
-    }
-
-    public String repoKey() {
-      return this.repoKey;
-    }
-
-    public String ruleKey() {
-      return this.ruleKey;
-    }
-
-    /**
-     * Override default rule severity in this quality profile. By default the active rule will have the default rule severity.
-     *
-     * @param severity See {@link Severity} constants.
-     */
-    public NewBuiltInActiveRule overrideSeverity(String severity) {
-      checkArgument(Severity.ALL.contains(severity), "Severity of rule %s is not correct: %s", RuleKey.of(repoKey, ruleKey), severity);
-      this.overriddenSeverity = severity;
-      return this;
-    }
-
-    /**
-     * Create a parameter with given unique key. Max length of key is 128 characters.
-     */
-    public NewOverriddenParam overrideParam(String paramKey, @Nullable String value) {
-      checkArgument(!paramsByKey.containsKey(paramKey), "The parameter '%s' was already overridden on the built in active rule %s", paramKey, this);
-      NewOverriddenParam param = new NewOverriddenParam(paramKey).setOverriddenValue(value);
-      paramsByKey.put(paramKey, param);
-      return param;
-    }
-
-    public Collection<NewOverriddenParam> getOverriddenParams() {
-      return paramsByKey.values();
-    }
-
-    @Override
-    public String toString() {
-      return format("[repository=%s, key=%s]", repoKey, ruleKey);
-    }
-  }
-
-  /**
-   * A rule activated on a built in quality profile.
-   */
-  @Immutable
-  class BuiltInActiveRule {
-    private final String repoKey;
-    private final String ruleKey;
-    private final String overriddenSeverity;
-    private final Map<String, OverriddenParam> overriddenParams;
-
-    private BuiltInActiveRule(NewBuiltInActiveRule newBuiltInActiveRule) {
-      this.repoKey = newBuiltInActiveRule.repoKey();
-      this.ruleKey = newBuiltInActiveRule.ruleKey();
-      this.overriddenSeverity = newBuiltInActiveRule.overriddenSeverity;
-      Map<String, OverriddenParam> paramsBuilder = new HashMap<>();
-      for (NewOverriddenParam newParam : newBuiltInActiveRule.getOverriddenParams()) {
-        paramsBuilder.put(newParam.key, new OverriddenParam(newParam));
-      }
-      this.overriddenParams = Collections.unmodifiableMap(paramsBuilder);
-    }
-
-    public String repoKey() {
-      return repoKey;
-    }
-
-    public String ruleKey() {
-      return ruleKey;
-    }
-
-    @CheckForNull
-    public String overriddenSeverity() {
-      return overriddenSeverity;
-    }
-
-    @CheckForNull
-    public OverriddenParam overriddenParam(String key) {
-      return overriddenParams.get(key);
-    }
-
-    public List<OverriddenParam> overriddenParams() {
-      return unmodifiableList(new ArrayList<>(overriddenParams.values()));
-    }
-
-    @Override
-    public String toString() {
-      return format("[repository=%s, key=%s]", repoKey, ruleKey);
-    }
-  }
-
-  class NewOverriddenParam {
-    private final String key;
-    private String overriddenValue;
-
-    private NewOverriddenParam(String key) {
-      this.key = key;
-    }
-
-    public String key() {
-      return key;
-    }
-
-    /**
-     * Empty default value will be converted to null. Max length is 4000 characters.
-     */
-    public NewOverriddenParam setOverriddenValue(@Nullable String s) {
-      this.overriddenValue = defaultIfEmpty(s, null);
-      return this;
-    }
-  }
-
-  @Immutable
-  class OverriddenParam {
-    private final String key;
-    private final String overriddenValue;
-
-    private OverriddenParam(NewOverriddenParam newOverriddenParam) {
-      this.key = newOverriddenParam.key();
-      this.overriddenValue = newOverriddenParam.overriddenValue;
-    }
-
-    public String key() {
-      return key;
-    }
-
-    @Nullable
-    public String overriddenValue() {
-      return overriddenValue;
-    }
-
-  }
-
-  /**
-   * This method is executed when server is started.
-   */
-  void define(Context context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/profile/package-info.java
deleted file mode 100644 (file)
index 63a9240..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.profile;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java
deleted file mode 100644 (file)
index b99001f..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.PropertyType;
-
-import static java.util.Arrays.asList;
-
-
-/**
- * @since 4.2
- */
-public final class RuleParamType {
-
-  private static final String OPTION_SEPARATOR = ",";
-
-  public static final RuleParamType STRING = new RuleParamType("STRING");
-  public static final RuleParamType TEXT = new RuleParamType("TEXT");
-  public static final RuleParamType BOOLEAN = new RuleParamType("BOOLEAN");
-  public static final RuleParamType INTEGER = new RuleParamType("INTEGER");
-  public static final RuleParamType FLOAT = new RuleParamType("FLOAT");
-
-  private static final String VALUES_PARAM = "values";
-  private static final String MULTIPLE_PARAM = "multiple";
-  private static final String PARAMETER_SEPARATOR = "=";
-
-  private final String type;
-  private final List<String> values;
-  private final boolean multiple;
-
-  // format is "type|comma-separated list of options", for example "INTEGER" or "SINGLE_SELECT_LIST|foo=one,bar,baz=two"
-  private final String key;
-
-  private RuleParamType(String type, String... options) {
-    this(type, false, options);
-  }
-
-  private RuleParamType(String type, boolean multiple, String... values) {
-    this.type = type;
-    this.values = asList(values);
-    StringBuilder sb = new StringBuilder();
-    sb.append(type);
-    if (multiple) {
-      sb.append(OPTION_SEPARATOR);
-      sb.append(MULTIPLE_PARAM + PARAMETER_SEPARATOR);
-      sb.append(multiple);
-    }
-    if (values.length > 0) {
-      sb.append(OPTION_SEPARATOR);
-      sb.append(VALUES_PARAM + PARAMETER_SEPARATOR);
-      sb.append(StringEscapeUtils.escapeCsv(valuesToCsv(values)));
-    }
-    this.key = sb.toString();
-    this.multiple = multiple;
-  }
-
-  private static String valuesToCsv(String... values) {
-    StringBuilder sb = new StringBuilder();
-    for (String value : values) {
-      sb.append(StringEscapeUtils.escapeCsv(value));
-      sb.append(OPTION_SEPARATOR);
-    }
-    return sb.toString();
-  }
-
-  public String type() {
-    return type;
-  }
-
-  public List<String> values() {
-    return values;
-  }
-
-  public boolean multiple() {
-    return multiple;
-  }
-
-  public static RuleParamType singleListOfValues(String... acceptedValues) {
-    // reuse the same type as plugin properties in order to
-    // benefit from shared helpers (validation, HTML component)
-    String type = PropertyType.SINGLE_SELECT_LIST.name();
-    return new RuleParamType(type, acceptedValues);
-  }
-
-  public static RuleParamType multipleListOfValues(String... acceptedValues) {
-    // reuse the same type as plugin properties in order to
-    // benefit from shared helpers (validation, HTML component)
-    String type = PropertyType.SINGLE_SELECT_LIST.name();
-    return new RuleParamType(type, true, acceptedValues);
-  }
-
-  public static RuleParamType parse(String s) {
-    // deprecated formats
-    if ("i".equals(s) || "i{}".equals(s)) {
-      return INTEGER;
-    }
-    if ("s".equals(s) || "s{}".equals(s) || "r".equals(s) || "REGULAR_EXPRESSION".equals(s)) {
-      return STRING;
-    }
-    if ("b".equals(s)) {
-      return BOOLEAN;
-    }
-    if (s.startsWith("s[")) {
-      String values = StringUtils.substringBetween(s, "[", "]");
-      return multipleListOfValues(StringUtils.split(values, ','));
-    }
-
-    // standard format
-    String format = StringUtils.substringBefore(s, OPTION_SEPARATOR);
-    String values = null;
-    boolean multiple = false;
-    String[] options = csvFormatSplit(s);
-    for (String option : options) {
-      String opt = StringEscapeUtils.unescapeCsv(option);
-      if (opt.startsWith(VALUES_PARAM + PARAMETER_SEPARATOR)) {
-        values = StringEscapeUtils.unescapeCsv(StringUtils.substringAfter(opt, VALUES_PARAM + PARAMETER_SEPARATOR));
-      } else if (opt.startsWith(MULTIPLE_PARAM + PARAMETER_SEPARATOR)) {
-        multiple = Boolean.parseBoolean(StringUtils.substringAfter(opt, MULTIPLE_PARAM + PARAMETER_SEPARATOR));
-      }
-    }
-    if (values == null || StringUtils.isBlank(values)) {
-      return new RuleParamType(format);
-    }
-    return new RuleParamType(format, multiple, csvFormatSplit(values));
-  }
-
-  private static String[] csvFormatSplit(String input) {
-    List<String> result = new ArrayList<>();
-    boolean betweenQuote = false;
-    int startIndex = 0;
-    for (int i = 0; i < input.length(); i++) {
-      char c = input.charAt(i);
-      if (c == '"') {
-        betweenQuote = !betweenQuote;
-      } else if (!betweenQuote && c == ',') {
-        result.add(input.substring(startIndex, i));
-        startIndex = i + 1;
-      }
-    }
-    if (startIndex < input.length()) {
-      result.add(input.substring(startIndex));
-    }
-    return result.toArray(new String[0]);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    RuleParamType that = (RuleParamType) o;
-    return key.equals(that.key);
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return key;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagFormat.java
deleted file mode 100644 (file)
index 698d965..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.util.Collection;
-import java.util.Objects;
-import java.util.Set;
-import org.apache.commons.lang.StringUtils;
-
-import static java.lang.String.format;
-import static java.lang.String.join;
-import static java.util.Locale.ENGLISH;
-import static java.util.stream.Collectors.toSet;
-
-/**
- * The characters allowed in rule tags are the same as those on StackOverflow, basically lower-case
- * letters, digits, plus (+), sharp (#), dash (-) and dot (.)
- * See http://meta.stackoverflow.com/questions/22624/what-symbols-characters-are-not-allowed-in-tags
- * @since 4.2
- */
-public class RuleTagFormat {
-
-  private static final String ERROR_MESSAGE_SUFFIX = "Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'";
-
-  private static final String VALID_CHARACTERS_REGEX = "^[a-z0-9\\+#\\-\\.]+$";
-
-  private RuleTagFormat() {
-    // only static methods
-  }
-
-  public static boolean isValid(String tag) {
-    return StringUtils.isNotBlank(tag) && tag.matches(VALID_CHARACTERS_REGEX);
-  }
-
-  public static String validate(String tag) {
-    if (!isValid(tag)) {
-      throw new IllegalArgumentException(format("Tag '%s' is invalid. %s", tag, ERROR_MESSAGE_SUFFIX));
-    }
-    return tag;
-  }
-
-  public static Set<String> validate(Collection<String> tags) {
-    Set<String> sanitizedTags = tags.stream()
-      .filter(Objects::nonNull)
-      .filter(tag -> !tag.isEmpty())
-      .map(tag -> tag.toLowerCase(ENGLISH))
-      .collect(toSet());
-    Set<String> invalidTags = sanitizedTags.stream()
-      .filter(tag -> !isValid(tag))
-      .collect(toSet());
-    if (invalidTags.isEmpty()) {
-      return sanitizedTags;
-    }
-    throw new IllegalArgumentException(format("Tags '%s' are invalid. %s", join(", ", invalidTags), ERROR_MESSAGE_SUFFIX));
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagsToTypeConverter.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleTagsToTypeConverter.java
deleted file mode 100644 (file)
index 8343533..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.sonar.api.rules.RuleType;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableSet;
-
-/**
- * @see org.sonar.api.server.rule.RulesDefinition.NewRule#setType(RuleType)
- * @since 5.5
- */
-public class RuleTagsToTypeConverter {
-
-  public static final String TAG_BUG = "bug";
-  public static final String TAG_SECURITY = "security";
-  public static final Set<String> RESERVED_TAGS = unmodifiableSet(new HashSet<>(asList(TAG_BUG, TAG_SECURITY)));
-
-
-  private RuleTagsToTypeConverter() {
-    // only statics
-  }
-
-  public static RuleType convert(Collection<String> tags) {
-    if (tags.contains(TAG_BUG)) {
-      return RuleType.BUG;
-    }
-    if (tags.contains(TAG_SECURITY)) {
-      return RuleType.VULNERABILITY;
-    }
-    return RuleType.CODE_SMELL;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
deleted file mode 100644 (file)
index e3a8811..0000000
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-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.unmodifiableList;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-/**
- * Defines some coding rules of the same repository. For example the Java Findbugs plugin provides an implementation of
- * this extension point in order to define the rules that it supports.
- * <br>
- * This interface replaces the deprecated class org.sonar.api.rules.RuleRepository.
- * <br>
- * <h3>How to use</h3>
- * <pre>
- * public class MyJsRulesDefinition implements RulesDefinition {
- *   {@literal @}Override
- *   public void define(Context context) {
- *     NewRepository repository = context.createRepository("my_js", "js").setName("My Javascript Analyzer");
- *     // define a rule programmatically. Note that rules
- *     // could be loaded from files (JSON, XML, ...)
- *     NewRule x1Rule = repository.createRule("x1")
- *      .setName("No empty line")
- *      .setHtmlDescription("Generate an issue on empty lines")
- *      // optional tags
- *      .setTags("style", "stupid")
- *     // optional status. Default value is READY.
- *     .setStatus(RuleStatus.BETA)
- *     // default severity when the rule is activated on a Quality profile. Default value is MAJOR.
- *     .setSeverity(Severity.MINOR);
- *     // optional type for SonarQube Quality Model. Default is RulesDefinition.Type.CODE_SMELL.
- *     .setType(RulesDefinition.Type.BUG)
- *     x1Rule
- *       .setDebtRemediationFunction(x1Rule.debtRemediationFunctions().linearWithOffset("1h", "30min"));
- *     x1Rule.createParam("acceptWhitespace")
- *       .setDefaultValue("false")
- *       .setType(RuleParamType.BOOLEAN)
- *       .setDescription("Accept whitespaces on the line");
- *     // don't forget to call done() to finalize the definition
- *     repository.done();
- *   }
- * }
- * </pre>
- * <br>
- * If rules are declared in a XML file with the standard SonarQube format (see
- * {@link org.sonar.api.server.rule.RulesDefinitionXmlLoader}), then it can be loaded by using :
- * <br>
- * <pre>
- * public class MyJsRulesDefinition implements RulesDefinition {
- *   private final RulesDefinitionXmlLoader xmlLoader;
- *   public MyJsRulesDefinition(RulesDefinitionXmlLoader xmlLoader) {
- *     this.xmlLoader = xmlLoader;
- *   }
- *   {@literal @}Override
- *   public void define(Context context) {
- *     NewRepository repository = context.createRepository("my_js", "js").setName("My Javascript Analyzer");
- *     // see javadoc of RulesDefinitionXmlLoader for the format
- *     xmlLoader.load(repository, getClass().getResourceAsStream("/path/to/rules.xml"));
- *     repository.done();
- *   }
- * }
- * </pre>
- * <br>
- * In the above example, XML file must contain name and description of each rule. If it's not the case, then the
- * (deprecated) English bundles can be used :
- * <br>
- * <pre>
- * public class MyJsRulesDefinition implements RulesDefinition {
- *   private final RulesDefinitionXmlLoader xmlLoader;
- *   private final RulesDefinitionI18nLoader i18nLoader;
- *   public MyJsRulesDefinition(RulesDefinitionXmlLoader xmlLoader, RulesDefinitionI18nLoader i18nLoader) {
- *     this.xmlLoader = xmlLoader;
- *     this.i18nLoader = i18nLoader;
- *   }
- *   {@literal @}Override
- *   public void define(Context context) {
- *     NewRepository repository = context.createRepository("my_js", "js").setName("My Javascript Analyzer");
- *     xmlLoader.load(repository, getClass().getResourceAsStream("/path/to/rules.xml"), "UTF-8");
- *     i18nLoader.load(repository);
- *     repository.done();
- *   }
- * }
- * </pre>
- *
- * @since 4.3
- */
-@ServerSide
-@ComputeEngineSide
-@SonarLintSide
-@ExtensionPoint
-public interface RulesDefinition {
-  /**
-   * This implementation will be removed as soon as analyzers stop instantiating it.
-   * Use RulesDefinitionContext in sonar-plugin-api-impl.
-   */
-  class Context extends AbstractContext {
-    private final Map<String, Repository> repositoriesByKey = new HashMap<>();
-    private String currentPluginKey = null;
-
-    @Override
-    public RulesDefinition.NewRepository createRepository(String key, String language) {
-      return new DefaultNewRepository(this, key, language, false);
-    }
-
-    @Override
-    public RulesDefinition.NewRepository createExternalRepository(String engineId, String language) {
-      return new DefaultNewRepository(this, RuleKey.EXTERNAL_RULE_REPO_PREFIX + engineId, language, true);
-    }
-
-    @Override
-    @CheckForNull
-    public RulesDefinition.Repository repository(String key) {
-      return repositoriesByKey.get(key);
-    }
-
-    @Override
-    public List<RulesDefinition.Repository> repositories() {
-      return unmodifiableList(new ArrayList<>(repositoriesByKey.values()));
-    }
-
-    public void registerRepository(DefaultNewRepository newRepository) {
-      RulesDefinition.Repository existing = repositoriesByKey.get(newRepository.key());
-      if (existing != null) {
-        String existingLanguage = existing.language();
-        checkState(existingLanguage.equals(newRepository.language()),
-          "The rule repository '%s' must not be defined for two different languages: %s and %s",
-          newRepository.key(), existingLanguage, newRepository.language());
-      }
-      repositoriesByKey.put(newRepository.key(), new DefaultRepository(newRepository, existing));
-    }
-
-    public String currentPluginKey() {
-      return currentPluginKey;
-    }
-
-    @Override
-    public void setCurrentPluginKey(@Nullable String pluginKey) {
-      this.currentPluginKey = pluginKey;
-    }
-  }
-
-  /**
-   * Instantiated by core but not by plugins, except for their tests.
-   */
-  abstract class AbstractContext {
-    /*
-     * New builder for {@link org.sonar.api.server.rule.RulesDefinition.Repository}.
-     * <br>
-     * A plugin can add rules to a repository that is defined then executed by another plugin. For instance
-     * the FbContrib plugin contributes to the Findbugs plugin rules. In this case no need
-     * to execute {@link org.sonar.api.server.rule.RulesDefinition.NewRepository#setName(String)}
-     */
-    public abstract NewRepository createRepository(String key, String language);
-
-    /**
-     * Creates a repository of rules from external rule engines.
-     * The repository key will be "external_[engineId]".
-     *
-     * @since 7.2
-     */
-    public abstract NewRepository createExternalRepository(String engineId, String language);
-
-    @CheckForNull
-    public abstract Repository repository(String key);
-
-    public abstract List<Repository> repositories();
-
-    public abstract void setCurrentPluginKey(@Nullable String pluginKey);
-  }
-
-  interface NewExtendedRepository {
-    /**
-     * Create a rule with specified key. Max length of key is 200 characters. Key must be unique
-     * among the repository
-     *
-     * @throws IllegalArgumentException is key is not unique. Note a warning was logged up to version 5.4 (included)
-     */
-    NewRule createRule(String ruleKey);
-
-    @CheckForNull
-    NewRule rule(String ruleKey);
-
-    Collection<NewRule> rules();
-
-    String key();
-
-    void done();
-  }
-
-  interface NewRepository extends NewExtendedRepository {
-    NewRepository setName(String s);
-
-    /**
-     * @since 7.2
-     */
-    boolean isExternal();
-  }
-
-  enum CweVersion {
-    Y2020("2020"), Y2021("2021");
-
-    private final String label;
-
-    CweVersion(String label) {
-      this.label = label;
-    }
-
-    public String label() {
-      return label;
-    }
-  }
-
-  enum OwaspTop10Version {
-    Y2017("2017", "owaspTop10"), Y2021("2021", "owaspTop10-2021");
-
-    private final String label;
-    private final String prefix;
-
-    OwaspTop10Version(String label, String prefix) {
-      this.label = label;
-      this.prefix = prefix;
-    }
-
-    public String label() {
-      return label;
-    }
-
-    public String prefix() {
-      return prefix;
-    }
-  }
-
-  enum OwaspTop10 {
-    A1, A2, A3, A4, A5, A6, A7, A8, A9, A10
-  }
-
-  enum PciDssVersion {
-    V3_2("3.2", "pciDss-3.2"), V4_0("4.0", "pciDss-4.0");
-
-    private final String label;
-    private final String prefix;
-
-    PciDssVersion(String label, String prefix) {
-      this.label = label;
-      this.prefix = prefix;
-    }
-
-    public String label() {
-      return label;
-    }
-
-    public String prefix() {
-      return prefix;
-    }
-  }
-
-  interface ExtendedRepository {
-    String key();
-
-    String language();
-
-    @CheckForNull
-    Rule rule(String ruleKey);
-
-    List<Rule> rules();
-  }
-
-  interface Repository extends ExtendedRepository {
-    String name();
-
-    /**
-     * @since 7.2
-     */
-    boolean isExternal();
-  }
-
-  /**
-   * Factory of {@link org.sonar.api.server.debt.DebtRemediationFunction}.
-   */
-  interface DebtRemediationFunctions {
-
-    /**
-     * Shortcut for {@code create(Type.LINEAR, gap multiplier, null)}.
-     *
-     * @param gapMultiplier the duration to fix one issue. See {@link DebtRemediationFunction} for details about format.
-     * @see org.sonar.api.server.debt.DebtRemediationFunction.Type#LINEAR
-     */
-    DebtRemediationFunction linear(String gapMultiplier);
-
-    /**
-     * Shortcut for {@code create(Type.LINEAR_OFFSET, gap multiplier, base effort)}.
-     *
-     * @param gapMultiplier duration to fix one point of complexity. See {@link DebtRemediationFunction} for details and format.
-     * @param baseEffort    duration to make basic analysis. See {@link DebtRemediationFunction} for details and format.
-     * @see org.sonar.api.server.debt.DebtRemediationFunction.Type#LINEAR_OFFSET
-     */
-    DebtRemediationFunction linearWithOffset(String gapMultiplier, String baseEffort);
-
-    /**
-     * Shortcut for {@code create(Type.CONSTANT_ISSUE, null, base effort)}.
-     *
-     * @param baseEffort cost per issue. See {@link DebtRemediationFunction} for details and format.
-     * @see org.sonar.api.server.debt.DebtRemediationFunction.Type#CONSTANT_ISSUE
-     */
-    DebtRemediationFunction constantPerIssue(String baseEffort);
-
-    /**
-     * Flexible way to create a {@link DebtRemediationFunction}. An unchecked exception is thrown if
-     * coefficient and/or offset are not valid according to the given @{code type}.
-     *
-     * @since 5.3
-     */
-    DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String gapMultiplier, @Nullable String baseEffort);
-  }
-
-  abstract class NewRule {
-
-    public abstract String key();
-
-    /**
-     * @since 7.1
-     */
-    @CheckForNull
-    public abstract RuleScope scope();
-
-    /**
-     * @since 7.1
-     */
-    public abstract NewRule setScope(RuleScope scope);
-
-    /**
-     * Required rule name
-     */
-    public abstract NewRule setName(String s);
-
-    public abstract NewRule setTemplate(boolean template);
-
-    /**
-     * Should this rule be enabled by default. For example in SonarLint standalone.
-     *
-     * @since 6.0
-     */
-    public abstract NewRule setActivatedByDefault(boolean activatedByDefault);
-
-    public abstract NewRule setSeverity(String s);
-
-    /**
-     * The type as defined by the SonarQube Quality Model.
-     * <br>
-     * When a plugin does not define rule type, then it is deduced from
-     * tags:
-     * <ul>
-     * <li>if the rule has the "bug" tag then type is {@link RuleType#BUG}</li>
-     * <li>if the rule has the "security" tag then type is {@link RuleType#VULNERABILITY}</li>
-     * <li>if the rule has both tags "bug" and "security", then type is {@link RuleType#BUG}</li>
-     * <li>default type is {@link RuleType#CODE_SMELL}</li>
-     * </ul>
-     * Finally the "bug" and "security" tags are considered as reserved. They
-     * are silently removed from the final state of definition.
-     *
-     * @since 5.5
-     */
-    public abstract NewRule setType(RuleType t);
-
-    /**
-     * The optional description, in HTML format, has no max length. It's exclusive with markdown description
-     * (see {@link #setMarkdownDescription(String)})
-     */
-    public abstract NewRule setHtmlDescription(@Nullable String s);
-
-    /**
-     * Load description from a file available in classpath. Example : <code>setHtmlDescription(getClass().getResource("/myrepo/Rule1234.html")</code>
-     */
-    public abstract NewRule setHtmlDescription(@Nullable URL classpathUrl);
-
-    /**
-     * The optional description, in a restricted Markdown format, has no max length. It's exclusive with HTML description
-     * (see {@link #setHtmlDescription(String)})
-     */
-    public abstract NewRule setMarkdownDescription(@Nullable String s);
-
-    /**
-     * Load description from a file available in classpath. Example : {@code setMarkdownDescription(getClass().getResource("/myrepo/Rule1234.md")}
-     */
-    public abstract NewRule setMarkdownDescription(@Nullable URL classpathUrl);
-
-    /**
-     * Default value is {@link org.sonar.api.rule.RuleStatus#READY}. The value
-     * {@link org.sonar.api.rule.RuleStatus#REMOVED} is not accepted and raises an
-     * {@link java.lang.IllegalArgumentException}.
-     */
-    public abstract NewRule setStatus(RuleStatus status);
-
-    /**
-     * Factory of {@link org.sonar.api.server.debt.DebtRemediationFunction}
-     */
-    public abstract DebtRemediationFunctions debtRemediationFunctions();
-
-    /**
-     * @see #debtRemediationFunctions()
-     */
-    public abstract NewRule setDebtRemediationFunction(@Nullable DebtRemediationFunction fn);
-
-    /**
-     * For rules that use LINEAR or LINEAR_OFFSET remediation functions, the meaning
-     * of the function parameter (= "gap") must be set. This description
-     * explains what 1 point of "gap" represents for the rule.
-     * <br>
-     * Example: for the "Insufficient condition coverage", this description for the
-     * remediation function gap multiplier/base effort would be something like
-     * "Effort to test one uncovered condition".
-     */
-    public abstract NewRule setGapDescription(@Nullable String s);
-
-    /**
-     * Create a parameter with given unique key. Max length of key is 128 characters.
-     */
-    public abstract NewParam createParam(String paramKey);
-
-    @CheckForNull
-    public abstract NewParam param(String paramKey);
-
-    public abstract Collection<NewParam> params();
-
-    /**
-     * @see RuleTagFormat
-     */
-    public abstract NewRule addTags(String... list);
-
-    /**
-     * @see RuleTagFormat
-     */
-    public abstract NewRule setTags(String... list);
-
-    /**
-     * @since 7.3
-     *
-     * @deprecated since 9.3 Supports only OWASP Top 10 2017 standard, use addOwaspTop10(OwaspTop10Version, OwaspTop10...) for 2017,2021...
-     */
-    @Deprecated
-    public abstract NewRule addOwaspTop10(OwaspTop10... standards);
-
-    /**
-     * @since 9.3
-     */
-    public abstract NewRule addOwaspTop10(OwaspTop10Version version, OwaspTop10... standards);
-
-    /**
-     * @since 9.5
-     */
-    public abstract NewRule addPciDss(PciDssVersion version, String... requirements);
-
-    /**
-     * @since 7.3
-     */
-    public abstract NewRule addCwe(int... nums);
-
-    /**
-     * Optional key that can be used by the rule engine. Not displayed
-     * in webapp. For example the Java Checkstyle plugin feeds this field
-     * with the internal path ("Checker/TreeWalker/AnnotationUseStyle").
-     */
-    public abstract NewRule setInternalKey(@Nullable String s);
-
-    /**
-     * Register a repository and key under which this rule used to be known
-     * (see {@link Rule#deprecatedRuleKeys} for details).
-     * <p>
-     * Deprecated keys should be added with this method in order, oldest first, for documentation purpose.
-     *
-     * @throws IllegalArgumentException if {@code repository} or {@code key} is {@code null} or empty.
-     * @see Rule#deprecatedRuleKeys
-     * @since 7.1
-     */
-    public abstract NewRule addDeprecatedRuleKey(String repository, String key);
-  }
-
-  @Immutable
-  abstract class Rule {
-
-    public abstract Repository repository();
-
-    /**
-     * @since 6.6 the plugin the rule was declared in
-     */
-    @CheckForNull
-    public abstract String pluginKey();
-
-    public abstract String key();
-
-    public abstract String name();
-
-    /**
-     * @since 7.1
-     */
-    public abstract RuleScope scope();
-
-    /**
-     * @see NewRule#setType(RuleType)
-     * @since 5.5
-     */
-    public abstract RuleType type();
-
-    public abstract String severity();
-
-    @CheckForNull
-    public abstract String htmlDescription();
-
-    @CheckForNull
-    public abstract String markdownDescription();
-
-    public abstract boolean template();
-
-    /**
-     * Should this rule be enabled by default. For example in SonarLint standalone.
-     *
-     * @since 6.0
-     */
-    public abstract boolean activatedByDefault();
-
-    public abstract RuleStatus status();
-
-    @CheckForNull
-    public abstract DebtRemediationFunction debtRemediationFunction();
-
-    @CheckForNull
-    public abstract String gapDescription();
-
-    @CheckForNull
-    public abstract Param param(String key);
-
-    public abstract List<Param> params();
-
-    public abstract Set<String> tags();
-
-    public abstract Set<String> securityStandards();
-
-    /**
-     * Deprecated rules keys for this rule.
-     * <p>
-     * If you want to rename the key of a rule or change its repository or both, register the rule's previous repository
-     * and key (see {@link NewRule#addDeprecatedRuleKey(String, String) addDeprecatedRuleKey}). This will allow
-     * SonarQube to support "issue re-keying" for this rule.
-     * <p>
-     * If the repository and/or key of an existing rule is changed without declaring deprecated keys, existing issues
-     * for this rule, created under the rule's previous repository and/or key, will be closed and new ones will be
-     * created under the issue's new repository and/or key.
-     * <p>
-     * Several deprecated keys can be provided to allow SonarQube to support several key (and/or repository) changes
-     * across multiple versions of a plugin.
-     * <br>
-     * Consider the following use case scenario:
-     * <ul>
-     * <li>Rule {@code Foo:A} is defined in version 1 of the plugin
-     * <pre>
-     * NewRepository newRepository = context.createRepository("Foo", "my_language");
-     * NewRule r = newRepository.createRule("A");
-     * </pre>
-     * </li>
-     * <li>Rule's key is renamed to B in version 2 of the plugin
-     * <pre>
-     * NewRepository newRepository = context.createRepository("Foo", "my_language");
-     * NewRule r = newRepository.createRule("B")
-     *   .addDeprecatedRuleKey("Foo", "A");
-     * </pre>
-     * </li>
-     * <li>All rules, including {@code Foo:B}, are moved to a new repository Bar in version 3 of the plugin
-     * <pre>
-     * NewRepository newRepository = context.createRepository("Bar", "my_language");
-     * NewRule r = newRepository.createRule("B")
-     *   .addDeprecatedRuleKey("Foo", "A")
-     *   .addDeprecatedRuleKey("Bar", "B");
-     * </pre>
-     * </li>
-     * </ul>
-     * With all deprecated keys defined in version 3 of the plugin, SonarQube will be able to support "issue re-keying"
-     * for this rule in all cases:
-     * <ul>
-     * <li>plugin upgrade from v1 to v2,</li>
-     * <li>plugin upgrade from v2 to v3</li>
-     * <li>AND plugin upgrade from v1 to v3</li>
-     * </ul>
-     * <p>
-     * Finally, repository/key pairs must be unique across all rules and their deprecated keys.
-     * <br>
-     * This implies that no rule can use the same repository and key as the deprecated key of another rule. This
-     * uniqueness applies across plugins.
-     * <p>
-     * Note that, even though this method returns a {@code Set}, its elements are ordered according to calls to
-     * {@link NewRule#addDeprecatedRuleKey(String, String) addDeprecatedRuleKey}. This allows to describe the history
-     * of a rule's repositories and keys over time. Oldest repository and key must be specified first.
-     *
-     * @see NewRule#addDeprecatedRuleKey(String, String)
-     * @since 7.1
-     */
-    public abstract Set<RuleKey> deprecatedRuleKeys();
-
-    /**
-     * @see RulesDefinition.NewRule#setInternalKey(String)
-     */
-    @CheckForNull
-    public abstract String internalKey();
-
-  }
-
-  abstract class NewParam {
-    public abstract String key();
-
-    public abstract NewParam setName(@Nullable String s);
-
-    public abstract NewParam setType(RuleParamType t);
-
-    /**
-     * Plain-text description. Can be null. Max length is 4000 characters.
-     */
-    public abstract NewParam setDescription(@Nullable String s);
-
-    /**
-     * Empty default value will be converted to null. Max length is 4000 characters.
-     */
-    public abstract NewParam setDefaultValue(@Nullable String s);
-  }
-
-  @Immutable
-  interface Param {
-    String key();
-
-    String name();
-
-    @Nullable
-    String description();
-
-    @Nullable
-    String defaultValue();
-
-    RuleParamType type();
-  }
-
-  /**
-   * This method is executed when server is started.
-   */
-  void define(Context context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoader.java
deleted file mode 100644 (file)
index aaa8070..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.utils.AnnotationUtils;
-import org.sonar.api.utils.FieldUtils2;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-import org.sonar.check.Cardinality;
-
-/**
- * Read definitions of rules based on the annotations provided by sonar-check-api. It is used
- * to feed {@link RulesDefinition}.
- *
- * @see org.sonar.api.server.rule.RulesDefinition
- * @since 4.3
- */
-public class RulesDefinitionAnnotationLoader {
-
-  private static final Logger LOG = Loggers.get(RulesDefinitionAnnotationLoader.class);
-
-  private static final Map<Class<?>, RuleParamType> TYPE_FOR_CLASS;
-
-  static {
-    Map<Class<?>, RuleParamType> map = new HashMap<>();
-    map.put(Integer.class, RuleParamType.INTEGER);
-    map.put(int.class, RuleParamType.INTEGER);
-    map.put(Float.class, RuleParamType.FLOAT);
-    map.put(float.class, RuleParamType.FLOAT);
-    map.put(Boolean.class, RuleParamType.BOOLEAN);
-    map.put(boolean.class, RuleParamType.BOOLEAN);
-    TYPE_FOR_CLASS = Collections.unmodifiableMap(map);
-  }
-
-  public void load(RulesDefinition.NewExtendedRepository repo, Class... annotatedClasses) {
-    for (Class annotatedClass : annotatedClasses) {
-      loadRule(repo, annotatedClass);
-    }
-  }
-
-  @CheckForNull
-  RulesDefinition.NewRule loadRule(RulesDefinition.NewExtendedRepository repo, Class clazz) {
-    org.sonar.check.Rule ruleAnnotation = AnnotationUtils.getAnnotation(clazz, org.sonar.check.Rule.class);
-    if (ruleAnnotation != null) {
-      return loadRule(repo, clazz, ruleAnnotation);
-    } else {
-      LOG.warn("The class " + clazz.getCanonicalName() + " should be annotated with " + org.sonar.check.Rule.class);
-      return null;
-    }
-  }
-
-  private static RulesDefinition.NewRule loadRule(RulesDefinition.NewExtendedRepository repo, Class clazz, org.sonar.check.Rule ruleAnnotation) {
-    String ruleKey = StringUtils.defaultIfEmpty(ruleAnnotation.key(), clazz.getCanonicalName());
-    String ruleName = StringUtils.defaultIfEmpty(ruleAnnotation.name(), null);
-    String description = StringUtils.defaultIfEmpty(ruleAnnotation.description(), null);
-
-    RulesDefinition.NewRule rule = repo.createRule(ruleKey);
-    rule.setName(ruleName).setHtmlDescription(description);
-    rule.setSeverity(ruleAnnotation.priority().name());
-    rule.setTemplate(ruleAnnotation.cardinality() == Cardinality.MULTIPLE);
-    rule.setStatus(RuleStatus.valueOf(ruleAnnotation.status()));
-    rule.setTags(ruleAnnotation.tags());
-
-    List<Field> fields = FieldUtils2.getFields(clazz, true);
-    for (Field field : fields) {
-      loadParameters(rule, field);
-    }
-
-    return rule;
-  }
-
-  private static void loadParameters(RulesDefinition.NewRule rule, Field field) {
-    org.sonar.check.RuleProperty propertyAnnotation = field.getAnnotation(org.sonar.check.RuleProperty.class);
-    if (propertyAnnotation != null) {
-      String fieldKey = StringUtils.defaultIfEmpty(propertyAnnotation.key(), field.getName());
-      RulesDefinition.NewParam param = rule.createParam(fieldKey)
-        .setDescription(propertyAnnotation.description())
-        .setDefaultValue(propertyAnnotation.defaultValue());
-
-      if (!StringUtils.isBlank(propertyAnnotation.type())) {
-        try {
-          param.setType(RuleParamType.parse(propertyAnnotation.type().trim()));
-        } catch (IllegalArgumentException e) {
-          throw new IllegalArgumentException("Invalid property type [" + propertyAnnotation.type() + "]", e);
-        }
-      } else {
-        param.setType(guessType(field.getType()));
-      }
-    }
-  }
-
-  static RuleParamType guessType(Class<?> type) {
-    RuleParamType result = TYPE_FOR_CLASS.get(type);
-    return result != null ? result : RuleParamType.STRING;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
deleted file mode 100644 (file)
index 3b71806..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nullable;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.apache.commons.io.ByteOrderMark;
-import org.apache.commons.io.input.BOMInputStream;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.check.Cardinality;
-import org.sonarsource.api.sonarlint.SonarLintSide;
-
-import static java.lang.String.format;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-import static org.apache.commons.lang.StringUtils.trim;
-
-/**
- * Loads definitions of rules from a XML file.
- *
- * <h3>Usage</h3>
- * <pre>
- * public class MyJsRulesDefinition implements RulesDefinition {
- *
- *   private static final String PATH = "my-js-rules.xml";
- *   private final RulesDefinitionXmlLoader xmlLoader;
- *
- *   public MyJsRulesDefinition(RulesDefinitionXmlLoader xmlLoader) {
- *     this.xmlLoader = xmlLoader;
- *   }
- *
- *   {@literal @}Override
- *   public void define(Context context) {
- *     try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(PATH), StandardCharsets.UTF_8)) {
- *       NewRepository repository = context.createRepository("my_js", "js").setName("My Javascript Analyzer");
- *       xmlLoader.load(repository, reader);
- *       repository.done();
- *     } catch (IOException e) {
- *       throw new IllegalStateException(String.format("Fail to read file %s", PATH), e);
- *     }
- *   }
- * }
- * </pre>
- *
- * <h3>XML Format</h3>
- * <pre>
- * &lt;rules&gt;
- *   &lt;rule&gt;
- *     &lt;!-- Required key. Max length is 200 characters. --&gt;
- *     &lt;key&gt;the-rule-key&lt;/key&gt;
- *
- *     &lt;!-- Required name. Max length is 200 characters. --&gt;
- *     &lt;name&gt;The purpose of the rule&lt;/name&gt;
- *
- *     &lt;!-- Required description. No max length. --&gt;
- *     &lt;description&gt;
- *       &lt;![CDATA[The description]]&gt;
- *     &lt;/description&gt;
- *     &lt;!-- Optional format of description. Supported values are HTML (default) and MARKDOWN. --&gt;
- *     &lt;descriptionFormat&gt;HTML&lt;/descriptionFormat&gt;
- *
- *     &lt;!-- Optional key for configuration of some rule engines --&gt;
- *     &lt;internalKey&gt;Checker/TreeWalker/LocalVariableName&lt;/internalKey&gt;
- *
- *     &lt;!-- Default severity when enabling the rule in a Quality profile.  --&gt;
- *     &lt;!-- Possible values are INFO, MINOR, MAJOR (default), CRITICAL, BLOCKER. --&gt;
- *     &lt;severity&gt;BLOCKER&lt;/severity&gt;
- *
- *     &lt;!-- Possible values are SINGLE (default) and MULTIPLE for template rules --&gt;
- *     &lt;cardinality&gt;SINGLE&lt;/cardinality&gt;
- *
- *     &lt;!-- Status displayed in rules console. Possible values are BETA, READY (default), DEPRECATED. --&gt;
- *     &lt;status&gt;BETA&lt;/status&gt;
- *
- *     &lt;!-- Type as defined by the SonarQube Quality Model. Possible values are CODE_SMELL (default), BUG and VULNERABILITY.--&gt;
- *     &lt;type&gt;BUG&lt;/type&gt;
- *
- *     &lt;!-- Optional tags. See org.sonar.api.server.rule.RuleTagFormat. The maximal length of all tags is 4000 characters. --&gt;
- *     &lt;tag&gt;misra&lt;/tag&gt;
- *     &lt;tag&gt;multi-threading&lt;/tag&gt;
- *
- *     &lt;!-- Optional parameters --&gt;
- *     &lt;param&gt;
- *       &lt;!-- Required key. Max length is 128 characters. --&gt;
- *       &lt;key&gt;the-param-key&lt;/key&gt;
- *       &lt;description&gt;
- *         &lt;![CDATA[the optional description, in HTML format. Max length is 4000 characters.]]&gt;
- *       &lt;/description&gt;
- *       &lt;!-- Optional default value, used when enabling the rule in a Quality profile. Max length is 4000 characters. --&gt;
- *       &lt;defaultValue&gt;42&lt;/defaultValue&gt;
- *     &lt;/param&gt;
- *     &lt;param&gt;
- *       &lt;key&gt;another-param&lt;/key&gt;
- *     &lt;/param&gt;
- *
- *     &lt;!-- Quality Model - type of debt remediation function --&gt;
- *     &lt;!-- See enum {@link org.sonar.api.server.debt.DebtRemediationFunction.Type} for supported values --&gt;
- *     &lt;!-- It was previously named 'debtRemediationFunction'. --&gt;
- *     &lt;!-- Since 5.5 --&gt;
- *     &lt;remediationFunction&gt;LINEAR_OFFSET&lt;/remediationFunction&gt;
- *
- *     &lt;!-- Quality Model - raw description of the "gap", used for some types of remediation functions. --&gt;
- *     &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.NewRule#setGapDescription(String)} --&gt;
- *     &lt;!-- It was previously named 'effortToFixDescription'. --&gt;
- *     &lt;!-- Since 5.5 --&gt;
- *     &lt;gapDescription&gt;Effort to test one uncovered condition&lt;/gapFixDescription&gt;
- *
- *     &lt;!-- Quality Model - gap multiplier of debt remediation function. Must be defined only for some function types. --&gt;
- *     &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --&gt;
- *     &lt;!-- It was previously named 'debtRemediationFunctionCoefficient'. --&gt;
- *     &lt;!-- Since 5.5 --&gt;
- *     &lt;remediationFunctionGapMultiplier&gt;10min&lt;/remediationFunctionGapMultiplier&gt;
- *
- *     &lt;!-- Quality Model - base effort of debt remediation function. Must be defined only for some function types. --&gt;
- *     &lt;!-- See {@link org.sonar.api.server.rule.RulesDefinition.DebtRemediationFunctions} --&gt;
- *     &lt;!-- It was previously named 'debtRemediationFunctionOffset'. --&gt;
- *     &lt;!-- Since 5.5 --&gt;
- *     &lt;remediationFunctionBaseEffort&gt;2min&lt;/remediationFunctionBaseEffort&gt;
- *
- *     &lt;!-- Deprecated field, replaced by "internalKey" --&gt;
- *     &lt;configKey&gt;Checker/TreeWalker/LocalVariableName&lt;/configKey&gt;
- *
- *     &lt;!-- Deprecated field, replaced by "severity" --&gt;
- *     &lt;priority&gt;BLOCKER&lt;/priority&gt;
- *
- *   &lt;/rule&gt;
- * &lt;/rules&gt;
- * </pre>
- *
- * <h3>XML Example</h3>
- * <pre>
- * &lt;rules&gt;
- *   &lt;rule&gt;
- *     &lt;key&gt;S1442&lt;/key&gt;
- *     &lt;name&gt;"alert(...)" should not be used&lt;/name&gt;
- *     &lt;description&gt;alert(...) can be useful for debugging during development, but ...&lt;/description&gt;
- *     &lt;tag&gt;cwe&lt;/tag&gt;
- *     &lt;tag&gt;security&lt;/tag&gt;
- *     &lt;tag&gt;user-experience&lt;/tag&gt;
- *     &lt;debtRemediationFunction&gt;CONSTANT_ISSUE&lt;/debtRemediationFunction&gt;
- *     &lt;debtRemediationFunctionBaseOffset&gt;10min&lt;/debtRemediationFunctionBaseOffset&gt;
- *   &lt;/rule&gt;
- *
- *   &lt;!-- another rules... --&gt;
- * &lt;/rules&gt;
- * </pre>
- *
- * @see org.sonar.api.server.rule.RulesDefinition
- * @since 4.3
- * @deprecated since 9.0. Use the sonar-check-api to annotate rule classes instead of loading the metadata from XML files. See {@link org.sonar.check.Rule}.
- */
-@ServerSide
-@ComputeEngineSide
-@SonarLintSide
-@Deprecated
-public class RulesDefinitionXmlLoader {
-
-  private static final String ELEMENT_RULES = "rules";
-  private static final String ELEMENT_RULE = "rule";
-  private static final String ELEMENT_PARAM = "param";
-
-  private enum DescriptionFormat {
-    HTML, MARKDOWN
-  }
-
-  /**
-   * Loads rules by reading the XML input stream. The input stream is not always closed by the method, so it
-   * should be handled by the caller.
-   *
-   * @since 4.3
-   */
-  public void load(RulesDefinition.NewRepository repo, InputStream input, String encoding) {
-    load(repo, input, Charset.forName(encoding));
-  }
-
-  /**
-   * @since 5.1
-   */
-  public void load(RulesDefinition.NewRepository repo, InputStream input, Charset charset) {
-    try (Reader reader = new InputStreamReader(new BOMInputStream(input,
-      ByteOrderMark.UTF_8, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE,
-      ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE), charset)) {
-      load(repo, reader);
-    } catch (IOException e) {
-      throw new IllegalStateException("Error while reading XML rules definition for repository " + repo.key(), e);
-    }
-  }
-
-  /**
-   * Loads rules by reading the XML input stream. The reader is not closed by the method, so it
-   * should be handled by the caller.
-   *
-   * @since 4.3
-   */
-  public void load(RulesDefinition.NewRepository repo, Reader inputReader) {
-    XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
-    xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
-    xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
-    // just so it won't try to load DTD in if there's DOCTYPE
-    xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
-    xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
-    try {
-      final XMLEventReader reader = xmlFactory.createXMLEventReader(inputReader);
-      while (reader.hasNext()) {
-        final XMLEvent event = reader.nextEvent();
-        if (event.isStartElement() && event.asStartElement().getName()
-          .getLocalPart().equals(ELEMENT_RULES)) {
-          parseRules(repo, reader);
-        }
-      }
-    } catch (XMLStreamException e) {
-      throw new IllegalStateException("XML is not valid", e);
-    }
-  }
-
-  private static void parseRules(RulesDefinition.NewRepository repo, XMLEventReader reader) throws XMLStreamException {
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_RULES)) {
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if (ELEMENT_RULE.equals(elementName)) {
-          processRule(repo, element, reader);
-        }
-      }
-    }
-  }
-
-  private static void processRule(RulesDefinition.NewRepository repo, StartElement ruleElement, XMLEventReader reader) throws XMLStreamException {
-    String key = null;
-    String name = null;
-    String description = null;
-    // enum is not used as variable type as we want to raise an exception with the rule key when format is not supported
-    String descriptionFormat = DescriptionFormat.HTML.name();
-    String internalKey = null;
-    String severity = Severity.defaultSeverity();
-    String type = null;
-    RuleStatus status = RuleStatus.defaultStatus();
-    boolean template = false;
-    String gapDescription = null;
-    String debtRemediationFunction = null;
-    String debtRemediationFunctionGapMultiplier = null;
-    String debtRemediationFunctionBaseEffort = null;
-    List<ParamStruct> params = new ArrayList<>();
-    List<String> tags = new ArrayList<>();
-
-    /* BACKWARD COMPATIBILITY WITH VERY OLD FORMAT */
-    Attribute keyAttribute = ruleElement.getAttributeByName(new QName("key"));
-    if (keyAttribute != null && StringUtils.isNotBlank(keyAttribute.getValue())) {
-      key = trim(keyAttribute.getValue());
-    }
-    Attribute priorityAttribute = ruleElement.getAttributeByName(new QName("priority"));
-    if (priorityAttribute != null && StringUtils.isNotBlank(priorityAttribute.getValue())) {
-      severity = trim(priorityAttribute.getValue());
-    }
-
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_RULE)) {
-        buildRule(repo, key, name, description, descriptionFormat, internalKey, severity, type, status, template,
-          gapDescription, debtRemediationFunction, debtRemediationFunctionGapMultiplier, debtRemediationFunctionBaseEffort, params, tags);
-        return;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if ("name".equalsIgnoreCase(elementName)) {
-          name = StringUtils.trim(reader.getElementText());
-        } else if ("type".equalsIgnoreCase(elementName)) {
-          type = StringUtils.trim(reader.getElementText());
-        } else if ("description".equalsIgnoreCase(elementName)) {
-          description = StringUtils.trim(reader.getElementText());
-        } else if ("descriptionFormat".equalsIgnoreCase(elementName)) {
-          descriptionFormat = StringUtils.trim(reader.getElementText());
-        } else if ("key".equalsIgnoreCase(elementName)) {
-          key = StringUtils.trim(reader.getElementText());
-        } else if ("configKey".equalsIgnoreCase(elementName)) {
-          // deprecated field, replaced by internalKey
-          internalKey = StringUtils.trim(reader.getElementText());
-        } else if ("internalKey".equalsIgnoreCase(elementName)) {
-          internalKey = StringUtils.trim(reader.getElementText());
-        } else if ("priority".equalsIgnoreCase(elementName) || "severity".equalsIgnoreCase(elementName)) {
-          // "priority" is deprecated field and has been replaced by "severity"
-          severity = StringUtils.trim(reader.getElementText());
-        } else if ("cardinality".equalsIgnoreCase(elementName)) {
-          template = Cardinality.MULTIPLE == Cardinality.valueOf(StringUtils.trim(reader.getElementText()));
-        } else if ("gapDescription".equalsIgnoreCase(elementName) || "effortToFixDescription".equalsIgnoreCase(elementName)) {
-          gapDescription = StringUtils.trim(reader.getElementText());
-        } else if ("remediationFunction".equalsIgnoreCase(elementName) || "debtRemediationFunction".equalsIgnoreCase(elementName)) {
-          debtRemediationFunction = StringUtils.trim(reader.getElementText());
-        } else if ("remediationFunctionBaseEffort".equalsIgnoreCase(elementName) || "debtRemediationFunctionOffset".equalsIgnoreCase(elementName)) {
-          debtRemediationFunctionGapMultiplier = StringUtils.trim(reader.getElementText());
-        } else if ("remediationFunctionGapMultiplier".equalsIgnoreCase(elementName) || "debtRemediationFunctionCoefficient".equalsIgnoreCase(elementName)) {
-          debtRemediationFunctionBaseEffort = StringUtils.trim(reader.getElementText());
-        } else if ("status".equalsIgnoreCase(elementName)) {
-          String s = StringUtils.trim(reader.getElementText());
-          if (s != null) {
-            status = RuleStatus.valueOf(s);
-          }
-        } else if (ELEMENT_PARAM.equalsIgnoreCase(elementName)) {
-          params.add(processParameter(element, reader));
-        } else if ("tag".equalsIgnoreCase(elementName)) {
-          tags.add(StringUtils.trim(reader.getElementText()));
-        }
-      }
-    }
-  }
-
-  private static void buildRule(RulesDefinition.NewRepository repo, String key, String name, @Nullable String description,
-    String descriptionFormat, @Nullable String internalKey, String severity, @Nullable String type, RuleStatus status,
-    boolean template, @Nullable String gapDescription, @Nullable String debtRemediationFunction, @Nullable String debtRemediationFunctionGapMultiplier,
-    @Nullable String debtRemediationFunctionBaseEffort, List<ParamStruct> params, List<String> tags) {
-    try {
-      RulesDefinition.NewRule rule = repo.createRule(key)
-        .setSeverity(severity)
-        .setName(name)
-        .setInternalKey(internalKey)
-        .setTags(tags.toArray(new String[tags.size()]))
-        .setTemplate(template)
-        .setStatus(status)
-        .setGapDescription(gapDescription);
-      if (type != null) {
-        rule.setType(RuleType.valueOf(type));
-      }
-      fillDescription(rule, descriptionFormat, description);
-      fillRemediationFunction(rule, debtRemediationFunction, debtRemediationFunctionGapMultiplier, debtRemediationFunctionBaseEffort);
-      fillParams(rule, params);
-    } catch (Exception e) {
-      throw new IllegalStateException(format("Fail to load the rule with key [%s:%s]", repo.key(), key), e);
-    }
-  }
-
-  private static void fillDescription(RulesDefinition.NewRule rule, String descriptionFormat, @Nullable String description) {
-    if (isNotBlank(description)) {
-      switch (DescriptionFormat.valueOf(descriptionFormat)) {
-        case HTML:
-          rule.setHtmlDescription(description);
-          break;
-        case MARKDOWN:
-          rule.setMarkdownDescription(description);
-          break;
-        default:
-          throw new IllegalArgumentException("Value of descriptionFormat is not supported: " + descriptionFormat);
-      }
-    }
-  }
-
-  private static void fillRemediationFunction(RulesDefinition.NewRule rule, @Nullable String debtRemediationFunction,
-    @Nullable String functionOffset, @Nullable String functionCoeff) {
-    if (isNotBlank(debtRemediationFunction)) {
-      DebtRemediationFunction.Type functionType = DebtRemediationFunction.Type.valueOf(debtRemediationFunction);
-      rule.setDebtRemediationFunction(rule.debtRemediationFunctions().create(functionType, functionCoeff, functionOffset));
-    }
-  }
-
-  private static void fillParams(RulesDefinition.NewRule rule, List<ParamStruct> params) {
-    for (ParamStruct param : params) {
-      rule.createParam(param.key)
-        .setDefaultValue(param.defaultValue)
-        .setType(param.type)
-        .setDescription(param.description);
-    }
-  }
-
-  private static class ParamStruct {
-
-    String key;
-    String description;
-    String defaultValue;
-    RuleParamType type = RuleParamType.STRING;
-  }
-
-  private static ParamStruct processParameter(StartElement paramElement, XMLEventReader reader) throws XMLStreamException {
-    ParamStruct param = new ParamStruct();
-
-    // BACKWARD COMPATIBILITY WITH DEPRECATED FORMAT
-    Attribute keyAttribute = paramElement.getAttributeByName(new QName("key"));
-    if (keyAttribute != null && StringUtils.isNotBlank(keyAttribute.getValue())) {
-      param.key = StringUtils.trim(keyAttribute.getValue());
-    }
-
-    // BACKWARD COMPATIBILITY WITH DEPRECATED FORMAT
-    Attribute typeAttribute = paramElement.getAttributeByName(new QName("type"));
-    if (typeAttribute != null && StringUtils.isNotBlank(typeAttribute.getValue())) {
-      param.type = RuleParamType.parse(StringUtils.trim(typeAttribute.getValue()));
-    }
-
-    while (reader.hasNext()) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isEndElement() && event.asEndElement().getName().getLocalPart().equals(ELEMENT_PARAM)) {
-        return param;
-      }
-      if (event.isStartElement()) {
-        final StartElement element = event.asStartElement();
-        final String elementName = element.getName().getLocalPart();
-        if ("key".equalsIgnoreCase(elementName)) {
-          param.key = StringUtils.trim(reader.getElementText());
-        } else if ("description".equalsIgnoreCase(elementName)) {
-          param.description = StringUtils.trim(reader.getElementText());
-        } else if ("type".equalsIgnoreCase(elementName)) {
-          param.type = RuleParamType.parse(StringUtils.trim(reader.getElementText()));
-        } else if ("defaultValue".equalsIgnoreCase(elementName)) {
-          param.defaultValue = StringUtils.trim(reader.getElementText());
-        }
-      }
-    }
-    return param;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultDebtRemediationFunctions.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultDebtRemediationFunctions.java
deleted file mode 100644 (file)
index 7799369..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import javax.annotation.Nullable;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.server.debt.internal.DefaultDebtRemediationFunction;
-import org.sonar.api.server.rule.RulesDefinition;
-import org.sonar.api.utils.MessageException;
-
-/**
- * Factory of {@link DebtRemediationFunction} that keeps
- * a context of rule for better error messages. Used only when declaring rules.
- *
- * @see RulesDefinition
- */
-class DefaultDebtRemediationFunctions implements RulesDefinition.DebtRemediationFunctions {
-
-  private final String repoKey;
-  private final String key;
-
-  DefaultDebtRemediationFunctions(String repoKey, String key) {
-    this.repoKey = repoKey;
-    this.key = key;
-  }
-
-  @Override
-  public DebtRemediationFunction linear(String gapMultiplier) {
-    return create(DefaultDebtRemediationFunction.Type.LINEAR, gapMultiplier, null);
-  }
-
-  @Override
-  public DebtRemediationFunction linearWithOffset(String gapMultiplier, String baseEffort) {
-    return create(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET, gapMultiplier, baseEffort);
-  }
-
-  @Override
-  public DebtRemediationFunction constantPerIssue(String baseEffort) {
-    return create(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE, null, baseEffort);
-  }
-
-  @Override
-  public DebtRemediationFunction create(DebtRemediationFunction.Type type, @Nullable String gapMultiplier, @Nullable String baseEffort) {
-    try {
-      return new DefaultDebtRemediationFunction(type, gapMultiplier, baseEffort);
-    } catch (Exception e) {
-      throw MessageException.of(String.format("The rule '%s:%s' is invalid : %s ", this.repoKey, this.key, e.getMessage()));
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewParam.java
deleted file mode 100644 (file)
index 85e6a4f..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.server.rule.RuleParamType;
-import org.sonar.api.server.rule.RulesDefinition;
-
-import static org.apache.commons.lang.StringUtils.defaultIfEmpty;
-
-public class DefaultNewParam extends RulesDefinition.NewParam {
-  private final String key;
-  private String name;
-  private String description;
-  private String defaultValue;
-  private RuleParamType type = RuleParamType.STRING;
-
-  DefaultNewParam(String key) {
-    this.key = this.name = key;
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  @Override
-  public DefaultNewParam setName(@Nullable String s) {
-    // name must never be null.
-    this.name = StringUtils.defaultIfBlank(s, key);
-    return this;
-  }
-
-  @Override
-  public DefaultNewParam setType(RuleParamType t) {
-    this.type = t;
-    return this;
-  }
-
-  @Override
-  public DefaultNewParam setDescription(@Nullable String s) {
-    this.description = StringUtils.defaultIfBlank(s, null);
-    return this;
-  }
-
-  @Override
-  public DefaultNewParam setDefaultValue(@Nullable String s) {
-    this.defaultValue = defaultIfEmpty(s, null);
-    return this;
-  }
-
-  public String name() {
-    return name;
-  }
-
-  public String description() {
-    return description;
-  }
-
-  public String defaultValue() {
-    return defaultValue;
-  }
-
-  public RuleParamType type() {
-    return type;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java
deleted file mode 100644 (file)
index f4979f1..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.server.rule.RulesDefinition;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-public class DefaultNewRepository implements RulesDefinition.NewRepository {
-  private final RulesDefinition.Context context;
-  private final String key;
-  private final boolean isExternal;
-  private final String language;
-  private String name;
-  private final Map<String, RulesDefinition.NewRule> newRules = new HashMap<>();
-
-  public DefaultNewRepository(RulesDefinition.Context context, String key, String language, boolean isExternal) {
-    this.context = context;
-    this.key = key;
-    this.name = key;
-    this.language = language;
-    this.isExternal = isExternal;
-  }
-
-  @Override
-  public boolean isExternal() {
-    return isExternal;
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  public String language() {
-    return language;
-  }
-
-  public Map<String, RulesDefinition.NewRule> newRules() {
-    return newRules;
-  }
-
-  public String name() {
-    return name;
-  }
-
-  @Override
-  public DefaultNewRepository setName(@Nullable String s) {
-    if ("SonarAnalyzer".equals(s)) {
-      this.name = "SonarQube";
-    } else if (StringUtils.isNotEmpty(s)) {
-      this.name = s;
-    }
-    return this;
-  }
-
-  @Override
-  public RulesDefinition.NewRule createRule(String ruleKey) {
-    checkArgument(!newRules.containsKey(ruleKey), "The rule '%s' of repository '%s' is declared several times", ruleKey, key);
-    RulesDefinition.NewRule newRule = new DefaultNewRule(context.currentPluginKey(), key, ruleKey);
-    newRules.put(ruleKey, newRule);
-    return newRule;
-  }
-
-  @CheckForNull
-  @Override
-  public RulesDefinition.NewRule rule(String ruleKey) {
-    return newRules.get(ruleKey);
-  }
-
-  @Override
-  public Collection<RulesDefinition.NewRule> rules() {
-    return newRules.values();
-  }
-
-  @Override
-  public void done() {
-    // note that some validations can be done here, for example for
-    // verifying that at least one rule is declared
-
-    context.registerRepository(this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("NewRepository{");
-    sb.append("key='").append(key).append('\'');
-    sb.append(", language='").append(language).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRule.java
deleted file mode 100644 (file)
index 0bae292..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.io.IOUtils;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.server.rule.RuleTagFormat;
-import org.sonar.api.server.rule.RulesDefinition;
-import org.sonar.api.server.rule.RulesDefinition.OwaspTop10;
-import org.sonar.api.server.rule.RulesDefinition.OwaspTop10Version;
-import org.sonar.api.server.rule.RulesDefinition.PciDssVersion;
-
-import static java.lang.String.format;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang.StringUtils.isEmpty;
-import static org.apache.commons.lang.StringUtils.trimToNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-class DefaultNewRule extends RulesDefinition.NewRule {
-  private final String pluginKey;
-  private final String repoKey;
-  private final String key;
-  private RuleType type;
-  private String name;
-  private String htmlDescription;
-  private String markdownDescription;
-  private String internalKey;
-  private String severity = Severity.MAJOR;
-  private boolean template;
-  private RuleStatus status = RuleStatus.defaultStatus();
-  private DebtRemediationFunction debtRemediationFunction;
-  private String gapDescription;
-  private final Set<String> tags = new TreeSet<>();
-  private final Set<String> securityStandards = new TreeSet<>();
-  private final Map<String, RulesDefinition.NewParam> paramsByKey = new HashMap<>();
-  private final RulesDefinition.DebtRemediationFunctions functions;
-  private boolean activatedByDefault;
-  private RuleScope scope;
-  private final Set<RuleKey> deprecatedRuleKeys = new TreeSet<>();
-
-  DefaultNewRule(@Nullable String pluginKey, String repoKey, String key) {
-    this.pluginKey = pluginKey;
-    this.repoKey = repoKey;
-    this.key = key;
-    this.functions = new DefaultDebtRemediationFunctions(repoKey, key);
-  }
-
-  @Override
-  public String key() {
-    return this.key;
-  }
-
-  @CheckForNull
-  @Override
-  public RuleScope scope() {
-    return this.scope;
-  }
-
-  @Override
-  public DefaultNewRule setScope(RuleScope scope) {
-    this.scope = scope;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setName(String s) {
-    this.name = trimToNull(s);
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setTemplate(boolean template) {
-    this.template = template;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setActivatedByDefault(boolean activatedByDefault) {
-    this.activatedByDefault = activatedByDefault;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setSeverity(String s) {
-    checkArgument(Severity.ALL.contains(s), "Severity of rule %s is not correct: %s", this, s);
-    this.severity = s;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setType(RuleType t) {
-    this.type = t;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setHtmlDescription(@Nullable String s) {
-    checkState(markdownDescription == null, "Rule '%s' already has a Markdown description", this);
-    this.htmlDescription = trimToNull(s);
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setHtmlDescription(@Nullable URL classpathUrl) {
-    if (classpathUrl != null) {
-      try {
-        setHtmlDescription(IOUtils.toString(classpathUrl, UTF_8));
-      } catch (IOException e) {
-        throw new IllegalStateException("Fail to read: " + classpathUrl, e);
-      }
-    } else {
-      this.htmlDescription = null;
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setMarkdownDescription(@Nullable String s) {
-    checkState(htmlDescription == null, "Rule '%s' already has an HTML description", this);
-    this.markdownDescription = trimToNull(s);
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setMarkdownDescription(@Nullable URL classpathUrl) {
-    if (classpathUrl != null) {
-      try {
-        setMarkdownDescription(IOUtils.toString(classpathUrl, UTF_8));
-      } catch (IOException e) {
-        throw new IllegalStateException("Fail to read: " + classpathUrl, e);
-      }
-    } else {
-      this.markdownDescription = null;
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setStatus(RuleStatus status) {
-    checkArgument(RuleStatus.REMOVED != status, "Status 'REMOVED' is not accepted on rule '%s'", this);
-    this.status = status;
-    return this;
-  }
-
-  @Override
-  public RulesDefinition.DebtRemediationFunctions debtRemediationFunctions() {
-    return functions;
-  }
-
-  @Override
-  public DefaultNewRule setDebtRemediationFunction(@Nullable DebtRemediationFunction fn) {
-    this.debtRemediationFunction = fn;
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setGapDescription(@Nullable String s) {
-    this.gapDescription = s;
-    return this;
-  }
-
-  @Override
-  public RulesDefinition.NewParam createParam(String paramKey) {
-    checkArgument(!paramsByKey.containsKey(paramKey), "The parameter '%s' is declared several times on the rule %s", paramKey, this);
-    DefaultNewParam param = new DefaultNewParam(paramKey);
-    paramsByKey.put(paramKey, param);
-    return param;
-  }
-
-  @CheckForNull
-  @Override
-  public RulesDefinition.NewParam param(String paramKey) {
-    return paramsByKey.get(paramKey);
-  }
-
-  @Override
-  public Collection<RulesDefinition.NewParam> params() {
-    return paramsByKey.values();
-  }
-
-  @Override
-  public DefaultNewRule addTags(String... list) {
-    for (String tag : list) {
-      RuleTagFormat.validate(tag);
-      tags.add(tag);
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setTags(String... list) {
-    tags.clear();
-    addTags(list);
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule addOwaspTop10(OwaspTop10... standards) {
-    return addOwaspTop10(OwaspTop10Version.Y2017, standards);
-  }
-
-  @Override
-  public DefaultNewRule addOwaspTop10(OwaspTop10Version owaspTop10Version, OwaspTop10... standards) {
-    requireNonNull(owaspTop10Version, "Owasp version must not be null");
-
-    for (OwaspTop10 owaspTop10 : standards) {
-      String standard = owaspTop10Version.prefix() + ":" + owaspTop10.name().toLowerCase(Locale.ENGLISH);
-      securityStandards.add(standard);
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule addPciDss(PciDssVersion pciDssVersion, String... requirements) {
-    requireNonNull(pciDssVersion, "PCI DSS version must not be null");
-    requireNonNull(requirements, "Requirements for PCI DSS standard must not be null");
-
-    for (String requirement : requirements) {
-      String standard = pciDssVersion.prefix() + ":" + requirement;
-      securityStandards.add(standard);
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule addCwe(int... nums) {
-    for (int num : nums) {
-      String standard = "cwe:" + num;
-      securityStandards.add(standard);
-    }
-    return this;
-  }
-
-  @Override
-  public DefaultNewRule setInternalKey(@Nullable String s) {
-    this.internalKey = s;
-    return this;
-  }
-
-  void validate() {
-    if (isEmpty(name)) {
-      throw new IllegalStateException(format("Name of rule %s is empty", this));
-    }
-    if (isEmpty(htmlDescription) && isEmpty(markdownDescription)) {
-      throw new IllegalStateException(format("One of HTML description or Markdown description must be defined for rule %s", this));
-    }
-  }
-
-  @Override
-  public DefaultNewRule addDeprecatedRuleKey(String repository, String key) {
-    deprecatedRuleKeys.add(RuleKey.of(repository, key));
-    return this;
-  }
-
-  String pluginKey() {
-    return pluginKey;
-  }
-
-  String repoKey() {
-    return repoKey;
-  }
-
-  RuleType type() {
-    return type;
-  }
-
-  String name() {
-    return name;
-  }
-
-  String htmlDescription() {
-    return htmlDescription;
-  }
-
-  String markdownDescription() {
-    return markdownDescription;
-  }
-
-  @CheckForNull
-  String internalKey() {
-    return internalKey;
-  }
-
-  String severity() {
-    return severity;
-  }
-
-  boolean template() {
-    return template;
-  }
-
-  RuleStatus status() {
-    return status;
-  }
-
-  DebtRemediationFunction debtRemediationFunction() {
-    return debtRemediationFunction;
-  }
-
-  String gapDescription() {
-    return gapDescription;
-  }
-
-  Set<String> tags() {
-    return tags;
-  }
-
-  Set<String> securityStandards() {
-    return securityStandards;
-  }
-
-  Map<String, RulesDefinition.NewParam> paramsByKey() {
-    return paramsByKey;
-  }
-
-  boolean activatedByDefault() {
-    return activatedByDefault;
-  }
-
-  Set<RuleKey> deprecatedRuleKeys() {
-    return deprecatedRuleKeys;
-  }
-
-  @Override
-  public String toString() {
-    return format("[repository=%s, key=%s]", repoKey, key);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultParam.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultParam.java
deleted file mode 100644 (file)
index b5c682a..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.server.rule.RuleParamType;
-import org.sonar.api.server.rule.RulesDefinition;
-
-@Immutable
-public class DefaultParam implements RulesDefinition.Param {
-  private final String key;
-  private final String name;
-  private final String description;
-  private final String defaultValue;
-  private final RuleParamType type;
-
-  DefaultParam(DefaultNewParam newParam) {
-    this.key = newParam.key();
-    this.name = newParam.name();
-    this.description = newParam.description();
-    this.defaultValue = newParam.defaultValue();
-    this.type = newParam.type();
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  @Override
-  public String name() {
-    return name;
-  }
-
-  @Override
-  @Nullable
-  public String description() {
-    return description;
-  }
-
-  @Override
-  @Nullable
-  public String defaultValue() {
-    return defaultValue;
-  }
-
-  @Override
-  public RuleParamType type() {
-    return type;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    RulesDefinition.Param that = (RulesDefinition.Param) o;
-    return key.equals(that.key());
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRepository.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRepository.java
deleted file mode 100644 (file)
index 1fa8615..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.server.rule.RulesDefinition;
-import org.sonar.api.utils.log.Loggers;
-
-import static java.lang.String.format;
-import static java.util.Collections.unmodifiableList;
-import static java.util.Collections.unmodifiableMap;
-
-@Immutable
-public class DefaultRepository implements RulesDefinition.Repository {
-  private final String key;
-  private final String language;
-  private final String name;
-  private final boolean isExternal;
-  private final Map<String, RulesDefinition.Rule> rulesByKey;
-
-  public DefaultRepository(DefaultNewRepository newRepository, @Nullable RulesDefinition.Repository mergeInto) {
-    this.key = newRepository.key();
-    this.language = newRepository.language();
-    this.isExternal = newRepository.isExternal();
-    Map<String, RulesDefinition.Rule> ruleBuilder = new HashMap<>();
-    if (mergeInto != null) {
-      if (!StringUtils.equals(newRepository.language(), mergeInto.language()) || !StringUtils.equals(newRepository.key(), mergeInto.key())) {
-        throw new IllegalArgumentException(format("Bug - language and key of the repositories to be merged should be the sames: %s and %s", newRepository, mergeInto));
-      }
-      this.name = StringUtils.defaultIfBlank(mergeInto.name(), newRepository.name());
-      for (RulesDefinition.Rule rule : mergeInto.rules()) {
-        if (!newRepository.key().startsWith("common-") && ruleBuilder.containsKey(rule.key())) {
-          Loggers.get(getClass()).warn("The rule '{}' of repository '{}' is declared several times", rule.key(), mergeInto.key());
-        }
-        ruleBuilder.put(rule.key(), rule);
-      }
-    } else {
-      this.name = newRepository.name();
-    }
-    for (RulesDefinition.NewRule newRule : newRepository.newRules().values()) {
-      DefaultNewRule defaultNewRule = (DefaultNewRule) newRule;
-      defaultNewRule.validate();
-      ruleBuilder.put(newRule.key(), new DefaultRule(this, defaultNewRule));
-    }
-    this.rulesByKey = unmodifiableMap(ruleBuilder);
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  @Override
-  public String language() {
-    return language;
-  }
-
-  @Override
-  public String name() {
-    return name;
-  }
-
-  @Override
-  public boolean isExternal() {
-    return isExternal;
-  }
-
-  @Override
-  @CheckForNull
-  public RulesDefinition.Rule rule(String ruleKey) {
-    return rulesByKey.get(ruleKey);
-  }
-
-  @Override
-  public List<RulesDefinition.Rule> rules() {
-    return unmodifiableList(new ArrayList<>(rulesByKey.values()));
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    DefaultRepository that = (DefaultRepository) o;
-    return key.equals(that.key);
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("Repository{");
-    sb.append("key='").append(key).append('\'');
-    sb.append(", language='").append(language).append('\'');
-    sb.append('}');
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultRule.java
deleted file mode 100644 (file)
index 5d44db2..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.annotation.CheckForNull;
-import javax.annotation.concurrent.Immutable;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.server.rule.RuleTagsToTypeConverter;
-import org.sonar.api.server.rule.RulesDefinition;
-
-import static java.lang.String.format;
-import static java.util.Collections.unmodifiableList;
-
-@Immutable
-public class DefaultRule extends RulesDefinition.Rule {
-  private final String pluginKey;
-  private final RulesDefinition.Repository repository;
-  private final String repoKey;
-  private final String key;
-  private final String name;
-  private final RuleType type;
-  private final String htmlDescription;
-  private final String markdownDescription;
-  private final String internalKey;
-  private final String severity;
-  private final boolean template;
-  private final DebtRemediationFunction debtRemediationFunction;
-  private final String gapDescription;
-  private final Set<String> tags;
-  private final Set<String> securityStandards;
-  private final Map<String, RulesDefinition.Param> params;
-  private final RuleStatus status;
-  private final boolean activatedByDefault;
-  private final RuleScope scope;
-  private final Set<RuleKey> deprecatedRuleKeys;
-
-  DefaultRule(DefaultRepository repository, DefaultNewRule newRule) {
-    this.pluginKey = newRule.pluginKey();
-    this.repository = repository;
-    this.repoKey = newRule.repoKey();
-    this.key = newRule.key();
-    this.name = newRule.name();
-    this.htmlDescription = newRule.htmlDescription();
-    this.markdownDescription = newRule.markdownDescription();
-    this.internalKey = newRule.internalKey();
-    this.severity = newRule.severity();
-    this.template = newRule.template();
-    this.status = newRule.status();
-    this.debtRemediationFunction = newRule.debtRemediationFunction();
-    this.gapDescription = newRule.gapDescription();
-    this.scope = newRule.scope() == null ? RuleScope.MAIN : newRule.scope();
-    this.type = newRule.type() == null ? RuleTagsToTypeConverter.convert(newRule.tags()) : newRule.type();
-    Set<String> tagsBuilder = new TreeSet<>(newRule.tags());
-    tagsBuilder.removeAll(RuleTagsToTypeConverter.RESERVED_TAGS);
-    this.tags = Collections.unmodifiableSet(tagsBuilder);
-    this.securityStandards = Collections.unmodifiableSet(new TreeSet<>(newRule.securityStandards()));
-    Map<String, RulesDefinition.Param> paramsBuilder = new HashMap<>();
-    for (RulesDefinition.NewParam newParam : newRule.paramsByKey().values()) {
-      paramsBuilder.put(newParam.key(), new DefaultParam((DefaultNewParam) newParam));
-    }
-    this.params = Collections.unmodifiableMap(paramsBuilder);
-    this.activatedByDefault = newRule.activatedByDefault();
-    this.deprecatedRuleKeys = Collections.unmodifiableSet(new TreeSet<>(newRule.deprecatedRuleKeys()));
-  }
-
-  @Override
-  public RulesDefinition.Repository repository() {
-    return repository;
-  }
-
-  @Override
-  @CheckForNull
-  public String pluginKey() {
-    return pluginKey;
-  }
-
-  @Override
-  public String key() {
-    return key;
-  }
-
-  @Override
-  public String name() {
-    return name;
-  }
-
-  @Override
-  public RuleScope scope() {
-    return scope;
-  }
-
-  @Override
-  public RuleType type() {
-    return type;
-  }
-
-  @Override
-  public String severity() {
-    return severity;
-  }
-
-  @Override
-  @CheckForNull
-  public String htmlDescription() {
-    return htmlDescription;
-  }
-
-  @Override
-  @CheckForNull
-  public String markdownDescription() {
-    return markdownDescription;
-  }
-
-  @Override
-  public boolean template() {
-    return template;
-  }
-
-  @Override
-  public boolean activatedByDefault() {
-    return activatedByDefault;
-  }
-
-  @Override
-  public RuleStatus status() {
-    return status;
-  }
-
-  @CheckForNull
-  @Override
-  public DebtRemediationFunction debtRemediationFunction() {
-    return debtRemediationFunction;
-  }
-
-  @CheckForNull
-  @Override
-  public String gapDescription() {
-    return gapDescription;
-  }
-
-  @CheckForNull
-  @Override
-  public RulesDefinition.Param param(String key) {
-    return params.get(key);
-  }
-
-  @Override
-  public List<RulesDefinition.Param> params() {
-    return unmodifiableList(new ArrayList<>(params.values()));
-  }
-
-  @Override
-  public Set<String> tags() {
-    return tags;
-  }
-
-  @Override
-  public Set<String> securityStandards() {
-    return securityStandards;
-  }
-
-  @Override
-  public Set<RuleKey> deprecatedRuleKeys() {
-    return deprecatedRuleKeys;
-  }
-
-  @CheckForNull
-  @Override
-  public String internalKey() {
-    return internalKey;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    DefaultRule other = (DefaultRule) o;
-    return key.equals(other.key) && repoKey.equals(other.repoKey);
-  }
-
-  @Override
-  public int hashCode() {
-    int result = repoKey.hashCode();
-    result = 31 * result + key.hashCode();
-    return result;
-  }
-
-  @Override
-  public String toString() {
-    return format("[repository=%s, key=%s]", repoKey, key);
-  }
-}
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/package-info.java
deleted file mode 100644 (file)
index 4e265e4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/package-info.java
deleted file mode 100644 (file)
index 5fbc52c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Change.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Change.java
deleted file mode 100644 (file)
index 8a0098a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import javax.annotation.concurrent.Immutable;
-
-/**
- * Used to describe the changes that occurred on a web service action
- *
- * @since 6.4
- */
-@Immutable
-public class Change {
-  private final String version;
-  private final String description;
-
-  public Change(String version, String description) {
-    this.version = version;
-    this.description = description;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Definable.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Definable.java
deleted file mode 100644 (file)
index a084001..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-public interface Definable<T> {
-
-  void define(T context);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java
deleted file mode 100644 (file)
index 5e1ac64..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import javax.annotation.CheckForNull;
-
-/**
- * This class allows a web service to call another web service through the sonar-ws library.
- * The call is in-process, synchronous and does not involve the HTTP stack.
- * <p>
- * Example of a web service that loads some issues:
- * <pre>
- * import org.sonar.api.server.ws.RequestHandler;
- * import org.sonarqube.ws.client.WsClientFactories;
- *
- * public class MyRequestHandler implements RequestHandler {
- *   {@literal @}Override
- *   public void handle(Request request, Response response) {
- *     WsClient wsClient = WsClientFactories.getLocal().newClient(request.localConnector());
- *     SearchWsResponse issues = wsClient.issues().search(new SearchWsRequest());
- *     // ...
- *   }
- * }
- * </pre>
- * <p>
- * It requires to use the sonar-ws library which Maven ids are:
- * <pre>
- *   &lt;dependency&gt;
- *     &lt;groupId&gt;org.sonarsource.sonarqube&lt;/groupId&gt;
- *     &lt;artifactId&gt;sonar-ws&lt;/artifactId&gt;
- *   &lt;/dependency&gt;
- * </pre>
- *
- * @since 5.5
- */
-public interface LocalConnector {
-
-  LocalResponse call(LocalRequest request);
-
-  interface LocalRequest {
-    /**
-     * URL path, which is the concatenation of controller path and action key, for example "api/issues/search"
-     *
-     * @see org.sonar.api.server.ws.WebService.Controller#path
-     * @see org.sonar.api.server.ws.WebService.Action#key
-     */
-    String getPath();
-
-    /**
-     * @see Request#getMediaType()
-     */
-    String getMediaType();
-
-    /**
-     * HTTP method. Possible values are "GET" and "POST"
-     *
-     * @see Request#method()
-     */
-    String getMethod();
-
-    /**
-     * @see Request#hasParam(String)
-     */
-    boolean hasParam(String key);
-
-    /**
-     * @see Request#param(String)
-     */
-    @CheckForNull
-    String getParam(String key);
-
-    /**
-     * @see Request#multiParam(String)
-     */
-    List<String> getMultiParam(String key);
-
-    /**
-     * @see Request#header(String)
-     * @since 6.6
-     */
-    Optional<String> getHeader(String name);
-
-    Map<String,String[]> getParameterMap();
-  }
-
-  interface LocalResponse {
-    /**
-     * @see org.sonar.api.server.ws.Response.Stream#setStatus(int)
-     */
-    int getStatus();
-
-    /**
-     * @see org.sonar.api.server.ws.Response.Stream#setMediaType(String)
-     */
-    String getMediaType();
-
-    /**
-     * Response body
-     */
-    byte[] getBytes();
-
-    /**
-     * HTTP headers
-     *
-     * @see Response#setHeader(String, String)
-     */
-    Collection<String> getHeaderNames();
-
-    /**
-     * @see Response#setHeader(String, String)
-     */
-    @CheckForNull
-    String getHeader(String name);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java
deleted file mode 100644 (file)
index 9862561..0000000
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.BiFunction;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.DateUtils;
-
-import static java.lang.String.format;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.DateUtils.parseDateQuietly;
-import static org.sonar.api.utils.DateUtils.parseDateTimeQuietly;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 4.2
- */
-public abstract class Request {
-
-  protected static final String MSG_PARAMETER_MISSING = "The '%s' parameter is missing";
-
-  /**
-   * Returns the name of the HTTP method with which this request was made. Possible
-   * values are GET and POST. Others are not supported.
-   */
-  public abstract String method();
-
-  public BufferedReader getReader() {
-    throw new UnsupportedOperationException("getReader not supported");
-  }
-
-  /**
-   * Returns the requested MIME type, or {@code "application/octet-stream"} if not specified.
-   */
-  public abstract String getMediaType();
-
-  /**
-   * Return true of the parameter is set in the request.
-   * Does NOT take into account the deprecated key of a parameter.
-   */
-  public abstract boolean hasParam(String key);
-
-  /**
-   * Returns a non-null value. To be used when parameter is required or has a default value.
-   *
-   * @throws java.lang.IllegalArgumentException is value is null or blank
-   */
-  public String mandatoryParam(String key) {
-    String value = param(key);
-    checkArgument(value != null && !value.isEmpty(), format(MSG_PARAMETER_MISSING, key));
-    return value;
-  }
-
-  /**
-   * Returns a boolean value. To be used when parameter is required or has a default value.
-   *
-   * @throws java.lang.IllegalArgumentException is value is null or blank
-   */
-  public boolean mandatoryParamAsBoolean(String key) {
-    String s = mandatoryParam(key);
-    return parseBoolean(key, s);
-  }
-
-  /**
-   * Returns an int value. To be used when parameter is required or has a default value.
-   *
-   * @throws java.lang.IllegalArgumentException is value is null or blank
-   */
-  public int mandatoryParamAsInt(String key) {
-    String s = mandatoryParam(key);
-    return parseInt(key, s);
-  }
-
-  /**
-   * Returns a long value. To be used when parameter is required or has a default value.
-   *
-   * @throws java.lang.IllegalArgumentException is value is null or blank
-   */
-  public long mandatoryParamAsLong(String key) {
-    String s = mandatoryParam(key);
-    return parseLong(key, s);
-  }
-
-  public <E extends Enum<E>> E mandatoryParamAsEnum(String key, Class<E> enumClass) {
-    return Enum.valueOf(enumClass, mandatoryParam(key));
-  }
-
-  public List<String> mandatoryParamAsStrings(String key) {
-    List<String> values = paramAsStrings(key);
-    checkArgument(values != null, format(MSG_PARAMETER_MISSING, key));
-    return values;
-  }
-
-  public List<String> mandatoryMultiParam(String key) {
-    List<String> values = multiParam(key);
-    checkArgument(!values.isEmpty(), MSG_PARAMETER_MISSING, key);
-    return values;
-  }
-
-  @CheckForNull
-  public abstract List<String> paramAsStrings(String key);
-
-  public abstract Map<String, String[]> getParams();
-
-  @CheckForNull
-  public abstract String param(String key);
-
-  public abstract List<String> multiParam(String key);
-
-  @CheckForNull
-  public abstract InputStream paramAsInputStream(String key);
-
-  @CheckForNull
-  public abstract Part paramAsPart(String key);
-
-  public Part mandatoryParamAsPart(String key) {
-    Part part = paramAsPart(key);
-    checkArgument(part != null, MSG_PARAMETER_MISSING, key);
-    return part;
-  }
-
-  @CheckForNull
-  public Boolean paramAsBoolean(String key) {
-    String value = param(key);
-    return value == null ? null : parseBoolean(key, value);
-  }
-
-  @CheckForNull
-  public Integer paramAsInt(String key) {
-    String s = param(key);
-    return s == null ? null : parseInt(key, s);
-  }
-
-  @CheckForNull
-  public Long paramAsLong(String key) {
-    String s = param(key);
-    return s == null ? null : parseLong(key, s);
-  }
-
-  @CheckForNull
-  public <E extends Enum<E>> E paramAsEnum(String key, Class<E> enumClass) {
-    String s = param(key);
-    return s == null ? null : Enum.valueOf(enumClass, s);
-  }
-
-  @CheckForNull
-  public <E extends Enum<E>> List<E> paramAsEnums(String key, Class<E> enumClass) {
-    String value = param(key);
-    if (value == null) {
-      return null;
-    }
-    return Arrays.stream(value.split(","))
-      .map(String::trim)
-      .filter(s -> !s.isEmpty())
-      .map(x -> Enum.valueOf(enumClass, x))
-      .collect(Collectors.toList());
-  }
-
-  @CheckForNull
-  public Date paramAsDateTime(String key) {
-    String stringDate = param(key);
-    if (stringDate == null) {
-      return null;
-    }
-
-    Date date = parseDateTimeQuietly(stringDate);
-    if (date != null) {
-      return date;
-    }
-
-    date = parseDateQuietly(stringDate);
-    checkArgument(date != null, "'%s' cannot be parsed as either a date or date+time", stringDate);
-
-    return date;
-  }
-
-  @CheckForNull
-  public Date paramAsDate(String key) {
-    String s = param(key);
-    if (s == null) {
-      return null;
-    }
-
-    try {
-      return DateUtils.parseDate(s);
-    } catch (RuntimeException notDateException) {
-      throw new IllegalArgumentException(notDateException);
-    }
-  }
-
-  private static boolean parseBoolean(String key, String value) {
-    if ("true".equals(value) || "yes".equals(value)) {
-      return true;
-    }
-    if ("false".equals(value) || "no".equals(value)) {
-      return false;
-    }
-    throw new IllegalArgumentException(format("Property %s is not a boolean value: %s", key, value));
-  }
-
-  private static int parseInt(String key, String value) {
-    try {
-      return Integer.parseInt(value);
-    } catch (NumberFormatException expection) {
-      throw new IllegalArgumentException(format("The '%s' parameter cannot be parsed as an integer value: %s", key, value));
-    }
-  }
-
-  private static long parseLong(String key, String value) {
-    try {
-      return Long.parseLong(value);
-    } catch (NumberFormatException exception) {
-      throw new IllegalArgumentException(format("The '%s' parameter cannot be parsed as a long value: %s", key, value));
-    }
-  }
-
-  public <T> Param<T> getParam(String key, BiFunction<Request, String, T> retrieveAndValidate) {
-    String param = this.param(key);
-    if (param != null) {
-      return GenericParam.present(retrieveAndValidate.apply(this, key));
-    }
-    return AbsentParam.absent();
-  }
-
-  public StringParam getParam(String key, Consumer<String> validate) {
-    String value = this.param(key);
-    if (value != null) {
-      validate.accept(value);
-      return StringParamImpl.present(value);
-    }
-    return AbsentStringParam.absent();
-  }
-
-  public StringParam getParam(String key) {
-    String value = this.param(key);
-    if (value != null) {
-      return StringParamImpl.present(value);
-    }
-    return AbsentStringParam.absent();
-  }
-
-  /**
-   * Optional value of the HTTP header with specified name.
-   * If present, the result can have an empty string value ({@code ""}).
-   *
-   * @since 6.6
-   */
-  public abstract Optional<String> header(String name);
-
-  public Map<String, String> getHeaders() {
-    return Collections.emptyMap();
-  }
-
-  /**
-   * Allows a web service to call another web service.
-   *
-   * @see LocalConnector
-   * @since 5.5
-   */
-  public abstract LocalConnector localConnector();
-
-  /**
-   * Return path of the request
-   *
-   * @since 6.0
-   */
-  public abstract String getPath();
-
-  /**
-   * @since 6.0
-   */
-  public interface Part {
-    InputStream getInputStream();
-
-    String getFileName();
-  }
-
-  /**
-   * Represents a Request parameter, provides information whether is was specified or not (check {@link #isPresent()})
-   * and utility method to nicely handles cases where the parameter is not present.
-   */
-  public interface Param<T> {
-    boolean isPresent();
-
-    /**
-     * @return the value of the parameter
-     * @throws IllegalStateException if param is not present.
-     */
-    @CheckForNull
-    T getValue();
-
-    @CheckForNull
-    T or(Supplier<T> defaultValueSupplier);
-  }
-
-  /**
-   * Implementation of {@link Param} where the param is not present.
-   */
-  private enum AbsentParam implements Param<Object> {
-    INSTANCE;
-
-    @SuppressWarnings("unchecked")
-    protected static <T> Param<T> absent() {
-      return (Param<T>) INSTANCE;
-    }
-
-    /**
-     * Always returns true.
-     */
-    @Override
-    public boolean isPresent() {
-      return false;
-    }
-
-    /**
-     * Always throws a {@link IllegalStateException}.
-     */
-    @Override
-    public Object getValue() {
-      throw createGetValueISE();
-    }
-
-    /**
-     * Always returns the value supplied by {@code defaultValueSupplier}.
-     */
-    @Override
-    @CheckForNull
-    public Object or(Supplier<Object> defaultValueSupplier) {
-      return checkDefaultValueSupplier(defaultValueSupplier).get();
-    }
-  }
-
-  /**
-   * Implementation of {@link Param} where the param is present.
-   */
-  private static final class GenericParam<T> implements Param<T> {
-    private final T value;
-
-    private GenericParam(T value) {
-      this.value = value;
-    }
-
-    static <T> Param<T> present(T value) {
-      return new GenericParam<>(value);
-    }
-
-    /**
-     * Always returns true.
-     */
-    @Override
-    public boolean isPresent() {
-      return true;
-    }
-
-    /**
-     * @return the value of the parameter
-     * @throws IllegalStateException if param is not present.
-     */
-    @Override
-    @CheckForNull
-    public T getValue() {
-      return value;
-    }
-
-    /**
-     * Always returns value of the parameter.
-     *
-     * @throws NullPointerException As per the inherited contract, {@code defaultValueSupplier} can't be null
-     */
-    @Override
-    @CheckForNull
-    public T or(Supplier<T> defaultValueSupplier) {
-      checkDefaultValueSupplier(defaultValueSupplier);
-      return value;
-    }
-  }
-
-  /**
-   * Extends {@link Param} with convenience methods specific to the type {@link String}.
-   */
-  public interface StringParam extends Param<String> {
-    /**
-     * Returns a {@link StringParam} object which methods {@link #getValue()} and {@link #or(Supplier)} will
-     * return {@code null} rather than an empty String when the param is present and its value is an empty String.
-     */
-    StringParam emptyAsNull();
-  }
-
-  /**
-   * Implementation of {@link StringParam} where the param is not present.
-   */
-  private enum AbsentStringParam implements StringParam {
-    INSTANCE;
-
-    protected static StringParam absent() {
-      return INSTANCE;
-    }
-
-    /**
-     * Always returns false.
-     */
-    @Override
-    public boolean isPresent() {
-      return false;
-    }
-
-    /**
-     * Always throws a {@link IllegalStateException}.
-     */
-    @Override
-    public String getValue() {
-      throw createGetValueISE();
-    }
-
-    /**
-     * Always returns the value supplied by {@code defaultValueSupplier}.
-     */
-    @Override
-    public String or(Supplier<String> defaultValueSupplier) {
-      return checkDefaultValueSupplier(defaultValueSupplier).get();
-    }
-
-    /**
-     * Returns itself.
-     */
-    @Override
-    public StringParam emptyAsNull() {
-      return this;
-    }
-  }
-
-  /**
-   * Implementation of {@link StringParam} where the param is present.
-   */
-  private static final class StringParamImpl implements StringParam {
-    @CheckForNull
-    private final String value;
-    private final boolean emptyAsNull;
-
-    private StringParamImpl(@Nullable String value, boolean emptyAsNull) {
-      this.value = value;
-      this.emptyAsNull = emptyAsNull;
-    }
-
-    static StringParam present(String value) {
-      return new StringParamImpl(value, false);
-    }
-
-    @Override
-    public boolean isPresent() {
-      return true;
-    }
-
-    @Override
-    public String getValue() {
-      if (emptyAsNull && value != null && value.isEmpty()) {
-        return null;
-      }
-      return value;
-    }
-
-    @Override
-    @CheckForNull
-    public String or(Supplier<String> defaultValueSupplier) {
-      checkDefaultValueSupplier(defaultValueSupplier);
-      if (emptyAsNull && value != null && value.isEmpty()) {
-        return null;
-      }
-      return value;
-    }
-
-    @Override
-    public StringParam emptyAsNull() {
-      if (emptyAsNull || (value != null && !value.isEmpty())) {
-        return this;
-      }
-      return new StringParamImpl(value, true);
-    }
-  }
-
-  private static <T> Supplier<T> checkDefaultValueSupplier(Supplier<T> defaultValueSupplier) {
-    return requireNonNull(defaultValueSupplier, "default value supplier can't be null");
-  }
-
-  private static IllegalStateException createGetValueISE() {
-    return new IllegalStateException("Param has no value. Use isPresent() before calling getValue()");
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java
deleted file mode 100644 (file)
index 4854d69..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Extension point to execute a HTTP request.
- * @since 4.2
- * @see WebService
- */
-@ServerSide
-@ExtensionPoint
-public interface RequestHandler {
-
-  void handle(Request request, Response response) throws Exception;
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Response.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Response.java
deleted file mode 100644 (file)
index e95dee5..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import java.io.OutputStream;
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import org.sonar.api.utils.text.JsonWriter;
-import org.sonar.api.utils.text.XmlWriter;
-
-/**
- * HTTP response
- *
- * @since 4.2
- */
-public interface Response {
-
-  interface Stream {
-    Stream setMediaType(String s);
-
-    /**
-     * HTTP status code. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes.
-     * By default value is set to 200.
-     */
-    Stream setStatus(int httpStatus);
-
-    /**
-     * Response stream. Beware that proper error recovery is not possible.
-     */
-    OutputStream output();
-  }
-
-  /**
-   * Non streamable {@link JsonWriter}. Response is effectively written when closing the resource.
-   */
-  JsonWriter newJsonWriter();
-
-  XmlWriter newXmlWriter();
-
-  Response noContent();
-
-  Response setHeader(String name, String value);
-
-  Collection<String> getHeaderNames();
-
-  @CheckForNull
-  String getHeader(String name);
-
-  Stream stream();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
deleted file mode 100644 (file)
index dd20318..0000000
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-import static java.lang.String.format;
-import static java.util.Arrays.asList;
-import static java.util.Arrays.stream;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-import static org.sonar.api.utils.Preconditions.checkState;
-
-/**
- * Defines a web service.
- * <br>
- * <br>
- * The classes implementing this extension point must be declared by {@link org.sonar.api.Plugin}.
- * <br>
- * <h3>How to use</h3>
- * <pre>
- * public class HelloWs implements WebService {
- *   {@literal @}Override
- *   public void define(Context context) {
- *     NewController controller = context.createController("api/hello");
- *     controller.setDescription("Web service example");
- *     // create the URL /api/hello/show
- *     controller.createAction("show")
- *       .setDescription("Entry point")
- *       .setHandler(new RequestHandler() {
- *         {@literal @}Override
- *         public void handle(Request request, Response response) {
- *           // read request parameters and generate response output
- *           response.newJsonWriter()
- *             .beginObject()
- *             .prop("hello", request.mandatoryParam("key"))
- *             .endObject()
- *             .close();
- *         }
- *      })
- *      .createParam("key").setDescription("Example key").setRequired(true);
- *    // important to apply changes
- *    controller.done();
- *   }
- * }
- * </pre>
- * <p>
- * Since version 5.5, a web service can call another web service to get some data. See {@link Request#localConnector()}
- * provided by {@link RequestHandler#handle(Request, Response)}.
- *
- * @since 4.2
- */
-@ServerSide
-@ExtensionPoint
-public interface WebService extends Definable<WebService.Context> {
-
-  class Context {
-    private final Map<String, Controller> controllers = new HashMap<>();
-
-    /**
-     * Create a new controller.
-     * <br>
-     * Structure of request URL is <code>http://&lt;server&gt;/&lt;controller path&gt;/&lt;action path&gt;?&lt;parameters&gt;</code>.
-     *
-     * @param path the controller path must not start or end with "/". It is recommended to start with "api/"
-     *             and to use lower-case format with underscores, for example "api/coding_rules". Usual actions
-     *             are "search", "list", "show", "create" and "delete".
-     *             the plural form is recommended - ex: api/projects
-     */
-    public NewController createController(String path) {
-      return new NewController(this, path);
-    }
-
-    private void register(NewController newController) {
-      if (controllers.containsKey(newController.path)) {
-        throw new IllegalStateException(
-          format("The web service '%s' is defined multiple times", newController.path));
-      }
-      controllers.put(newController.path, new Controller(newController));
-    }
-
-    @CheckForNull
-    public Controller controller(String key) {
-      return controllers.get(key);
-    }
-
-    public List<Controller> controllers() {
-      return Collections.unmodifiableList(new ArrayList<>(controllers.values()));
-    }
-  }
-
-  class NewController {
-    private final Context context;
-    private final String path;
-    private String description;
-    private String since;
-    private final Map<String, NewAction> actions = new HashMap<>();
-
-    private NewController(Context context, String path) {
-      if (StringUtils.isBlank(path)) {
-        throw new IllegalArgumentException("WS controller path must not be empty");
-      }
-      if (StringUtils.startsWith(path, "/") || StringUtils.endsWith(path, "/")) {
-        throw new IllegalArgumentException("WS controller path must not start or end with slash: " + path);
-      }
-      this.context = context;
-      this.path = path;
-    }
-
-    /**
-     * Important - this method must be called in order to apply changes and make the
-     * controller available in {@link org.sonar.api.server.ws.WebService.Context#controllers()}
-     */
-    public void done() {
-      context.register(this);
-    }
-
-    /**
-     * Optional description (accept HTML)
-     */
-    public NewController setDescription(@Nullable String s) {
-      this.description = s;
-      return this;
-    }
-
-    /**
-     * Optional version when the controller was created
-     */
-    public NewController setSince(@Nullable String s) {
-      this.since = s;
-      return this;
-    }
-
-    public NewAction createAction(String actionKey) {
-      if (actions.containsKey(actionKey)) {
-        throw new IllegalStateException(
-          format("The action '%s' is defined multiple times in the web service '%s'", actionKey, path));
-      }
-      NewAction action = new NewAction(actionKey);
-      actions.put(actionKey, action);
-      return action;
-    }
-  }
-
-  @Immutable
-  class Controller {
-    private final String path;
-    private final String description;
-    private final String since;
-    private final Map<String, Action> actions;
-
-    private Controller(NewController newController) {
-      checkState(!newController.actions.isEmpty(), "At least one action must be declared in the web service '%s'", newController.path);
-      this.path = newController.path;
-      this.description = newController.description;
-      this.since = newController.since;
-      Map<String, Action> mapBuilder = new HashMap<>();
-      for (NewAction newAction : newController.actions.values()) {
-        mapBuilder.put(newAction.key, new Action(this, newAction));
-      }
-      this.actions = Collections.unmodifiableMap(mapBuilder);
-    }
-
-    public String path() {
-      return path;
-    }
-
-    @CheckForNull
-    public String description() {
-      return description;
-    }
-
-    @CheckForNull
-    public String since() {
-      return since;
-    }
-
-    @CheckForNull
-    public Action action(String actionKey) {
-      return actions.get(actionKey);
-    }
-
-    public Collection<Action> actions() {
-      return actions.values();
-    }
-
-    /**
-     * Returns true if all the actions are for internal use
-     *
-     * @see org.sonar.api.server.ws.WebService.Action#isInternal()
-     * @since 4.3
-     */
-    public boolean isInternal() {
-      for (Action action : actions()) {
-        if (!action.isInternal()) {
-          return false;
-        }
-      }
-      return true;
-    }
-  }
-
-  class NewAction {
-    private final String key;
-    private static final String PAGE_PARAM_DESCRIPTION = "1-based page number";
-    private String deprecatedKey;
-    private String description;
-    private String since;
-    private String deprecatedSince;
-    private boolean post = false;
-    private boolean isInternal = false;
-    private RequestHandler handler;
-    private Map<String, NewParam> newParams = new HashMap<>();
-    private URL responseExample = null;
-    private List<Change> changelog = new ArrayList<>();
-
-    private NewAction(String key) {
-      this.key = key;
-    }
-
-    public NewAction setDeprecatedKey(@Nullable String s) {
-      this.deprecatedKey = s;
-      return this;
-    }
-
-    /**
-     * Used in Orchestrator
-     */
-    public NewAction setDescription(@Nullable String description) {
-      this.description = description;
-      return this;
-    }
-
-    /**
-     * @since 5.6
-     */
-    public NewAction setDescription(@Nullable String description, Object... descriptionArgument) {
-      this.description = description == null ? null : String.format(description, descriptionArgument);
-      return this;
-    }
-
-    public NewAction setSince(@Nullable String s) {
-      this.since = s;
-      return this;
-    }
-
-    /**
-     * @since 5.3
-     */
-    public NewAction setDeprecatedSince(@Nullable String deprecatedSince) {
-      this.deprecatedSince = deprecatedSince;
-      return this;
-    }
-
-    public NewAction setPost(boolean b) {
-      this.post = b;
-      return this;
-    }
-
-    /**
-     * Internal actions are not displayed by default in the web api documentation. They are
-     * displayed only when the check-box "Show Internal API" is selected. By default
-     * an action is not internal.
-     */
-    public NewAction setInternal(boolean b) {
-      this.isInternal = b;
-      return this;
-    }
-
-    public NewAction setHandler(RequestHandler h) {
-      this.handler = h;
-      return this;
-    }
-
-    /**
-     * Link to the document containing an example of response. Content must be UTF-8 encoded.
-     * <br>
-     * Example:
-     * <pre>
-     *   newAction.setResponseExample(getClass().getResource("/org/sonar/my-ws-response-example.json"));
-     * </pre>
-     *
-     * @since 4.4
-     */
-    public NewAction setResponseExample(@Nullable URL url) {
-      this.responseExample = url;
-      return this;
-    }
-
-    /**
-     * List of changes made to the contract or valuable insight. Example: changes to the response format.
-     * Calling this method multiple times will not override previously set changes - all changes will be added.
-     *
-     * @since 6.4
-     */
-    public NewAction setChangelog(Change... changes) {
-      requireNonNull(changes);
-      Arrays.stream(changes)
-        .filter(Objects::nonNull)
-        .forEach(this.changelog::add);
-      return this;
-    }
-
-    public NewParam createParam(String paramKey) {
-      checkState(!newParams.containsKey(paramKey), "The parameter '%s' is defined multiple times in the action '%s'", paramKey, key);
-      NewParam newParam = new NewParam(paramKey);
-      newParams.put(paramKey, newParam);
-      return newParam;
-    }
-
-    /**
-     * Add predefined parameters related to pagination of results.
-     */
-    public NewAction addPagingParams(int defaultPageSize) {
-      createParam(Param.PAGE)
-        .setDescription(PAGE_PARAM_DESCRIPTION)
-        .setExampleValue("42")
-        .setDefaultValue("1");
-
-      createParam(Param.PAGE_SIZE)
-        .setDescription("Page size. Must be greater than 0.")
-        .setExampleValue("20")
-        .setDefaultValue(String.valueOf(defaultPageSize));
-      return this;
-    }
-
-    /**
-     * Add predefined parameters related to pagination of results with a maximum page size.
-     * Note the maximum is a documentation only feature. It does not check anything.
-     */
-    public NewAction addPagingParams(int defaultPageSize, int maxPageSize) {
-      createPageParam();
-      createPageSize(defaultPageSize, maxPageSize);
-      return this;
-    }
-
-    public NewParam createPageParam() {
-      return createParam(Param.PAGE)
-        .setDescription(PAGE_PARAM_DESCRIPTION)
-        .setExampleValue("42")
-        .setDefaultValue("1");
-    }
-
-    public NewParam createPageSize(int defaultPageSize, int maxPageSize) {
-      return createParam(Param.PAGE_SIZE)
-        .setDefaultValue(String.valueOf(defaultPageSize))
-        .setMaximumValue(maxPageSize)
-        .setDescription("Page size. Must be greater than 0 and less or equal than " + maxPageSize)
-        .setExampleValue("20");
-    }
-
-    /**
-     * Add predefined parameters related to pagination of results with a maximum page size.
-     *
-     * @since 7.1
-     */
-    public NewAction addPagingParamsSince(int defaultPageSize, int maxPageSize, String version) {
-      createParam(Param.PAGE)
-        .setDescription(PAGE_PARAM_DESCRIPTION)
-        .setExampleValue("42")
-        .setDefaultValue("1")
-        .setSince(version);
-      createParam(Param.PAGE_SIZE)
-        .setDescription("Page size. Must be greater than 0 and less than " + maxPageSize)
-        .setDefaultValue(String.valueOf(defaultPageSize))
-        .setMaximumValue(maxPageSize)
-        .setExampleValue("20")
-        .setSince(version);
-      return this;
-    }
-
-    /**
-     * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#FIELDS}, which is
-     * used to restrict the number of fields returned in JSON response.
-     */
-    public NewAction addFieldsParam(Collection<?> possibleValues) {
-      createFieldsParam(possibleValues);
-      return this;
-    }
-
-    public NewParam createFieldsParam(Collection<?> possibleValues) {
-      return createParam(Param.FIELDS)
-        .setDescription("Comma-separated list of the fields to be returned in response. All the fields are returned by default.")
-        .setPossibleValues(possibleValues);
-    }
-
-    /**
-     * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is
-     * used to search for a subset of fields containing the supplied string.
-     * <p>
-     * The fields must be in the <strong>plural</strong> form (ex: "names", "keys").
-     * </p>
-     */
-    public NewAction addSearchQuery(String exampleValue, String... pluralFields) {
-      createSearchQuery(exampleValue, pluralFields);
-      return this;
-    }
-
-    /**
-     * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is
-     * used to search for a subset of fields containing the supplied string.
-     * <p>
-     * The fields must be in the <strong>plural</strong> form (ex: "names", "keys").
-     * </p>
-     */
-    public NewParam createSearchQuery(String exampleValue, String... pluralFields) {
-      String actionDescription = format("Limit search to %s that contain the supplied string.", String.join(" or ", pluralFields));
-
-      return createParam(Param.TEXT_QUERY)
-        .setDescription(actionDescription)
-        .setExampleValue(exampleValue);
-    }
-
-    /**
-     * Add predefined parameters related to sorting of results.
-     */
-    public <V> NewAction addSortParams(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending) {
-      createSortParams(possibleValues, defaultValue, defaultAscending);
-      return this;
-    }
-
-    /**
-     * Add predefined parameters related to sorting of results.
-     */
-    public <V> NewParam createSortParams(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending) {
-      createParam(Param.ASCENDING)
-        .setDescription("Ascending sort")
-        .setBooleanPossibleValues()
-        .setDefaultValue(defaultAscending);
-
-      return createParam(Param.SORT)
-        .setDescription("Sort field")
-        .setDefaultValue(defaultValue)
-        .setPossibleValues(possibleValues);
-    }
-
-    /**
-     * Add 'selected=(selected|deselected|all)' for select-list oriented WS.
-     */
-    public NewAction addSelectionModeParam() {
-      createParam(Param.SELECTED)
-        .setDescription("Depending on the value, show only selected items (selected=selected), deselected items (selected=deselected), " +
-          "or all items with their selection status (selected=all).")
-        .setDefaultValue(SelectionMode.SELECTED.value())
-        .setPossibleValues(SelectionMode.possibleValues());
-      return this;
-    }
-  }
-
-  @Immutable
-  class Action {
-    private static final Logger LOGGER = Loggers.get(Action.class);
-
-    private final String key;
-    private final String deprecatedKey;
-    private final String path;
-    private final String description;
-    private final String since;
-    private final String deprecatedSince;
-    private final boolean post;
-    private final boolean isInternal;
-    private final RequestHandler handler;
-    private final Map<String, Param> params;
-    private final URL responseExample;
-    private final List<Change> changelog;
-
-    private Action(Controller controller, NewAction newAction) {
-      this.key = newAction.key;
-      this.deprecatedKey = newAction.deprecatedKey;
-      this.path = format("%s/%s", controller.path(), key);
-      this.description = newAction.description;
-      this.since = newAction.since;
-      this.deprecatedSince = newAction.deprecatedSince;
-      this.post = newAction.post;
-      this.isInternal = newAction.isInternal;
-      this.responseExample = newAction.responseExample;
-      this.handler = newAction.handler;
-      this.changelog = newAction.changelog;
-
-      checkState(this.handler != null, "RequestHandler is not set on action %s", path);
-      logWarningIf(this.description == null || this.description.isEmpty(), "Description is not set on action " + path);
-      logWarningIf(this.since == null || this.since.isEmpty(), "Since is not set on action " + path);
-      logWarningIf(!this.post && this.responseExample == null, "The response example is not set on action " + path);
-
-      Map<String, Param> paramsBuilder = new HashMap<>();
-      for (NewParam newParam : newAction.newParams.values()) {
-        paramsBuilder.put(newParam.key, new Param(this, newParam));
-      }
-      this.params = Collections.unmodifiableMap(paramsBuilder);
-    }
-
-    private static void logWarningIf(boolean condition, String message) {
-      if (condition) {
-        LOGGER.warn(message);
-      }
-    }
-
-    public String key() {
-      return key;
-    }
-
-    public String deprecatedKey() {
-      return deprecatedKey;
-    }
-
-    public String path() {
-      return path;
-    }
-
-    @CheckForNull
-    public String description() {
-      return description;
-    }
-
-    /**
-     * Set if different than controller.
-     */
-    @CheckForNull
-    public String since() {
-      return since;
-    }
-
-    @CheckForNull
-    public String deprecatedSince() {
-      return deprecatedSince;
-    }
-
-    public boolean isPost() {
-      return post;
-    }
-
-    /**
-     * @see NewAction#setChangelog(Change...)
-     * @since 6.4
-     */
-    public List<Change> changelog() {
-      return changelog;
-    }
-
-    /**
-     * @see NewAction#setInternal(boolean)
-     */
-    public boolean isInternal() {
-      return isInternal;
-    }
-
-    public RequestHandler handler() {
-      return handler;
-    }
-
-    /**
-     * @see org.sonar.api.server.ws.WebService.NewAction#setResponseExample(java.net.URL)
-     */
-    @CheckForNull
-    public URL responseExample() {
-      return responseExample;
-    }
-
-    /**
-     * @see org.sonar.api.server.ws.WebService.NewAction#setResponseExample(java.net.URL)
-     */
-    @CheckForNull
-    public String responseExampleAsString() {
-      try {
-        if (responseExample != null) {
-          return StringUtils.trim(IOUtils.toString(responseExample, StandardCharsets.UTF_8));
-        }
-        return null;
-      } catch (IOException e) {
-        throw new IllegalStateException("Fail to load " + responseExample, e);
-      }
-    }
-
-    /**
-     * @see org.sonar.api.server.ws.WebService.NewAction#setResponseExample(java.net.URL)
-     */
-    @CheckForNull
-    public String responseExampleFormat() {
-      if (responseExample != null) {
-        return StringUtils.lowerCase(FilenameUtils.getExtension(responseExample.getFile()));
-      }
-      return null;
-    }
-
-    @CheckForNull
-    public Param param(String key) {
-      return params.get(key);
-    }
-
-    public Collection<Param> params() {
-      return params.values();
-    }
-
-    @Override
-    public String toString() {
-      return path;
-    }
-  }
-
-  class NewParam {
-    private String key;
-    private String since;
-    private String deprecatedSince;
-    private String deprecatedKey;
-    private String deprecatedKeySince;
-    private String description;
-    private String exampleValue;
-    private String defaultValue;
-    private boolean required = false;
-    private boolean internal = false;
-    private Set<String> possibleValues = null;
-    private Integer maxValuesAllowed;
-    private Integer maximumLength;
-    private Integer minimumLength;
-    private Integer maximumValue;
-
-    private NewParam(String key) {
-      this.key = key;
-    }
-
-    /**
-     * @see Param#since()
-     * @since 5.3
-     */
-    public NewParam setSince(@Nullable String since) {
-      this.since = since;
-      return this;
-    }
-
-    /**
-     * @since 5.3
-     */
-    public NewParam setDeprecatedSince(@Nullable String deprecatedSince) {
-      this.deprecatedSince = deprecatedSince;
-      return this;
-    }
-
-    /**
-     * @param deprecatedSince Version when the old key was replaced/deprecated. Ex: 5.6
-     * @see Param#deprecatedKey()
-     * @since 6.4
-     */
-    public NewParam setDeprecatedKey(@Nullable String key, @Nullable String deprecatedSince) {
-      this.deprecatedKey = key;
-      this.deprecatedKeySince = deprecatedSince;
-      return this;
-    }
-
-    public NewParam setDescription(@Nullable String description) {
-      this.description = description;
-      return this;
-    }
-
-    /**
-     * @see Param#description()
-     * @since 5.6
-     */
-    public NewParam setDescription(@Nullable String description, Object... descriptionArgument) {
-      this.description = description == null ? null : String.format(description, descriptionArgument);
-      return this;
-    }
-
-    /**
-     * Is the parameter required or optional ? Default value is false (optional).
-     *
-     * @see Param#isRequired()
-     * @since 4.4
-     */
-    public NewParam setRequired(boolean b) {
-      this.required = b;
-      return this;
-    }
-
-    /**
-     * Internal parameters are not displayed by default in the web api documentation. They are
-     * displayed only when the check-box "Show Internal API" is selected. By default
-     * a parameter is not internal.
-     *
-     * @see Param#isInternal()
-     * @since 6.2
-     */
-    public NewParam setInternal(boolean b) {
-      this.internal = b;
-      return this;
-    }
-
-    /**
-     * @see Param#exampleValue()
-     * @since 4.4
-     */
-    public NewParam setExampleValue(@Nullable Object s) {
-      this.exampleValue = (s != null) ? s.toString() : null;
-      return this;
-    }
-
-    /**
-     * Exhaustive list of possible values when it makes sense, for example
-     * list of severities.
-     *
-     * @see Param#possibleValues()
-     * @since 4.4
-     */
-    public <T> NewParam setPossibleValues(@Nullable T... values) {
-      return setPossibleValues(values == null ? Collections.emptyList() : asList(values));
-    }
-
-    /**
-     * Shortcut for {@code setPossibleValues("true", "false", "yes", "no")}
-     *
-     * @since 4.4
-     */
-    public NewParam setBooleanPossibleValues() {
-      return setPossibleValues("true", "false", "yes", "no");
-    }
-
-    /**
-     * Exhaustive list of possible values when it makes sense, for example
-     * list of severities.
-     *
-     * @see Param#possibleValues()
-     * @since 4.4
-     */
-    public <T> NewParam setPossibleValues(@Nullable Collection<T> values) {
-      if (values == null || values.isEmpty()) {
-        this.possibleValues = null;
-      } else {
-        this.possibleValues = new LinkedHashSet<>();
-        for (Object value : values) {
-          this.possibleValues.add(value.toString());
-        }
-      }
-      return this;
-    }
-
-    /**
-     * @see Param#defaultValue()
-     * @since 4.4
-     */
-    public NewParam setDefaultValue(@Nullable Object o) {
-      this.defaultValue = (o != null) ? o.toString() : null;
-      return this;
-    }
-
-    /**
-     * @see Param#maxValuesAllowed()
-     * @since 6.4
-     */
-    public NewParam setMaxValuesAllowed(@Nullable Integer maxValuesAllowed) {
-      this.maxValuesAllowed = maxValuesAllowed;
-      return this;
-    }
-
-    /**
-     * @see Param#maximumLength()
-     * @since 7.0
-     */
-    public NewParam setMaximumLength(@Nullable Integer maximumLength) {
-      this.maximumLength = maximumLength;
-      return this;
-    }
-
-    /**
-     * @see Param#minimumLength()
-     * @since 7.0
-     */
-    public NewParam setMinimumLength(@Nullable Integer minimumLength) {
-      this.minimumLength = minimumLength;
-      return this;
-    }
-
-    /**
-     * @see Param#maximumValue()
-     * @since 7.0
-     */
-    public NewParam setMaximumValue(@Nullable Integer maximumValue) {
-      this.maximumValue = maximumValue;
-      return this;
-    }
-
-    @Override
-    public String toString() {
-      return key;
-    }
-  }
-
-  enum SelectionMode {
-    SELECTED("selected"), DESELECTED("deselected"), ALL("all");
-
-    private final String paramValue;
-
-    private static final Map<String, SelectionMode> BY_VALUE = stream(values())
-      .collect(Collectors.toMap(v -> v.paramValue, v -> v));
-
-    SelectionMode(String paramValue) {
-      this.paramValue = paramValue;
-    }
-
-    public String value() {
-      return paramValue;
-    }
-
-    public static SelectionMode fromParam(String paramValue) {
-      checkArgument(BY_VALUE.containsKey(paramValue));
-      return BY_VALUE.get(paramValue);
-    }
-
-    public static Collection<String> possibleValues() {
-      return BY_VALUE.keySet();
-    }
-  }
-
-  @Immutable
-  class Param {
-    public static final String TEXT_QUERY = "q";
-    public static final String PAGE = "p";
-    public static final String PAGE_SIZE = "ps";
-    public static final String FIELDS = "f";
-    public static final String SORT = "s";
-    public static final String ASCENDING = "asc";
-    public static final String FACETS = "facets";
-    public static final String SELECTED = "selected";
-
-    private final String key;
-    private final String since;
-    private final String deprecatedSince;
-    private final String deprecatedKey;
-    private final String deprecatedKeySince;
-    private final String description;
-    private final String exampleValue;
-    private final String defaultValue;
-    private final boolean required;
-    private final boolean internal;
-    private final Set<String> possibleValues;
-    private final Integer maximumLength;
-    private final Integer minimumLength;
-    private final Integer maximumValue;
-    private final Integer maxValuesAllowed;
-
-    protected Param(Action action, NewParam newParam) {
-      this.key = newParam.key;
-      this.since = newParam.since;
-      this.deprecatedSince = newParam.deprecatedSince;
-      this.deprecatedKey = newParam.deprecatedKey;
-      this.deprecatedKeySince = newParam.deprecatedKeySince;
-      this.description = newParam.description;
-      this.exampleValue = newParam.exampleValue;
-      this.defaultValue = newParam.defaultValue;
-      this.required = newParam.required;
-      this.internal = newParam.internal;
-      this.possibleValues = newParam.possibleValues;
-      this.maxValuesAllowed = newParam.maxValuesAllowed;
-      this.maximumLength = newParam.maximumLength;
-      this.minimumLength = newParam.minimumLength;
-      this.maximumValue = newParam.maximumValue;
-      checkArgument(!required || defaultValue == null, "Default value must not be set on parameter '%s?%s' as it's marked as required", action, key);
-    }
-
-    public String key() {
-      return key;
-    }
-
-    /**
-     * @since 5.3
-     */
-    @CheckForNull
-    public String since() {
-      return since;
-    }
-
-    /**
-     * @since 5.3
-     */
-    @CheckForNull
-    public String deprecatedSince() {
-      return deprecatedSince;
-    }
-
-    /**
-     * @since 5.0
-     */
-    @CheckForNull
-    public String deprecatedKey() {
-      return deprecatedKey;
-    }
-
-    /**
-     * @since 6.4
-     */
-    @CheckForNull
-    public String deprecatedKeySince() {
-      return deprecatedKeySince;
-    }
-
-    @CheckForNull
-    public String description() {
-      return description;
-    }
-
-    /**
-     * @since 4.4
-     */
-    @CheckForNull
-    public String exampleValue() {
-      return exampleValue;
-    }
-
-    /**
-     * Is the parameter required or optional ?
-     *
-     * @since 4.4
-     */
-    public boolean isRequired() {
-      return required;
-    }
-
-    /**
-     * Is the parameter internal ?
-     *
-     * @see NewParam#setInternal(boolean)
-     * @since 6.2
-     */
-    public boolean isInternal() {
-      return internal;
-    }
-
-    /**
-     * @since 4.4
-     */
-    @CheckForNull
-    public Set<String> possibleValues() {
-      return possibleValues;
-    }
-
-    /**
-     * @since 4.4
-     */
-    @CheckForNull
-    public String defaultValue() {
-      return defaultValue;
-    }
-
-    /**
-     * Specify the maximum number of values allowed when using {@link Request#multiParam(String)}
-     *
-     * @since 6.4
-     */
-    public Integer maxValuesAllowed() {
-      return maxValuesAllowed;
-    }
-
-    /**
-     * Specify the maximum length of the value used in this parameter
-     *
-     * @since 7.0
-     */
-    @CheckForNull
-    public Integer maximumLength() {
-      return maximumLength;
-    }
-
-    /**
-     * Specify the minimum length of the value used in this parameter
-     *
-     * @since 7.0
-     */
-    @CheckForNull
-    public Integer minimumLength() {
-      return minimumLength;
-    }
-
-    /**
-     * Specify the maximum value of the numeric variable used in this parameter
-     *
-     * @since 7.0
-     */
-    @CheckForNull
-    public Integer maximumValue() {
-      return maximumValue;
-    }
-
-    @Override
-    public String toString() {
-      return key;
-    }
-  }
-
-  /**
-   * Executed once at server startup.
-   */
-  @Override
-  void define(Context context);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/package-info.java
deleted file mode 100644 (file)
index 9ebf5ad..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/Task.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/Task.java
deleted file mode 100644 (file)
index b8e1a7d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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;
-
-/**
- * Implement this interface to provide the behavior of a task.
- * @since 3.6
- * @deprecated since 7.6
- */
-@ScannerSide
-@InstantiationStrategy(InstantiationStrategy.PER_TASK)
-@Deprecated
-public interface Task {
-
-  void execute();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskDefinition.java
deleted file mode 100644 (file)
index a2b4862..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.util.regex.Pattern;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.ScannerSide;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Register and describe a {@link TaskExtension}.
- *
- * @since 3.6
- * @deprecated since 7.6
- */
-@ExtensionPoint
-@ScannerSide
-@InstantiationStrategy(InstantiationStrategy.PER_TASK)
-@Deprecated
-public class TaskDefinition implements Comparable<TaskDefinition> {
-  static final String KEY_PATTERN = "[a-zA-Z0-9\\-\\_]+";
-
-  private final String key;
-  private final String description;
-  private final Class<? extends Task> taskClass;
-
-  private TaskDefinition(Builder builder) {
-    this.key = builder.key;
-    this.description = builder.description;
-    this.taskClass = builder.taskClass;
-  }
-
-  public String description() {
-    return description;
-  }
-
-  public String key() {
-    return key;
-  }
-
-  public Class<? extends Task> taskClass() {
-    return taskClass;
-  }
-
-  @Override
-  public String toString() {
-    return "Task " + key + "[class=" + taskClass.getName() + ", desc=" + description + "]";
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    TaskDefinition that = (TaskDefinition) o;
-    return key.equals(that.key);
-  }
-
-  @Override
-  public int hashCode() {
-    return key.hashCode();
-  }
-
-  @Override
-  public int compareTo(TaskDefinition o) {
-    return key.compareTo(o.key);
-  }
-
-  public static class Builder {
-    private String key;
-    private String description;
-    private Class<? extends Task> taskClass;
-
-    private Builder() {
-    }
-
-    public Builder key(String key) {
-      this.key = key;
-      return this;
-    }
-
-    public Builder description(String s) {
-      this.description = s;
-      return this;
-    }
-
-    public Builder taskClass(Class<? extends Task> taskClass) {
-      this.taskClass = taskClass;
-      return this;
-    }
-
-    public TaskDefinition build() {
-      checkArgument(!StringUtils.isEmpty(key), "Task key must be set");
-      checkArgument(Pattern.matches(KEY_PATTERN, key), "Task key '" + key + "' must match " + KEY_PATTERN);
-      checkArgument(!StringUtils.isEmpty(description), "Description must be set for task '" + key + "'");
-      checkArgument(taskClass != null, "Class must be set for task '" + key + "'");
-      return new TaskDefinition(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/package-info.java
deleted file mode 100644 (file)
index 3775852..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.task;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/User.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/User.java
deleted file mode 100644 (file)
index 83859ff..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import java.io.Serializable;
-
-/**
- * @since 3.6
- */
-public interface User extends Serializable {
-  String login();
-  String name();
-  String email();
-  boolean active();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java
deleted file mode 100644 (file)
index 9473719..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.security.DefaultGroups;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-public class UserGroupValidation {
-
-  public static final int GROUP_NAME_MAX_LENGTH = 255;
-
-  private UserGroupValidation() {
-    // Only static methods
-  }
-
-  public static void validateGroupName(String groupName) {
-    checkArgument(!StringUtils.isEmpty(groupName) && groupName.trim().length() > 0, "Group name cannot be empty");
-    checkArgument(groupName.length() <= GROUP_NAME_MAX_LENGTH, "Group name cannot be longer than %s characters", GROUP_NAME_MAX_LENGTH);
-    checkArgument(!DefaultGroups.isAnyone(groupName), "Anyone group cannot be used");
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserQuery.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserQuery.java
deleted file mode 100644 (file)
index bf4700e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import org.apache.commons.lang.StringUtils;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * @since 3.6
- */
-public class UserQuery {
-
-  public static final UserQuery ALL_ACTIVES = UserQuery.builder().build();
-
-  private final Collection<String> logins;
-  private final boolean includeDeactivated;
-  private final String searchText;
-  private final Boolean mustBeRoot;
-
-  // for internal use in MyBatis
-  final String searchTextSql;
-
-  private UserQuery(Builder builder) {
-    this.logins = builder.logins;
-    this.includeDeactivated = builder.includeDeactivated;
-    this.searchText = builder.searchText;
-    this.mustBeRoot = builder.mustBeRoot;
-
-    this.searchTextSql = searchTextToSql(searchText);
-  }
-
-  private static String searchTextToSql(@Nullable String s) {
-    String sql = null;
-    if (s != null) {
-      sql = StringUtils.replace(s, "%", "/%");
-      sql = StringUtils.replace(sql, "_", "/_");
-      sql = "%" + sql + "%";
-    }
-    return sql;
-  }
-
-  @CheckForNull
-  public Collection<String> logins() {
-    return logins;
-  }
-
-  public boolean includeDeactivated() {
-    return includeDeactivated;
-  }
-
-  /**
-   * Search for logins or names containing a given string
-   */
-  @CheckForNull
-  public String searchText() {
-    return searchText;
-  }
-
-  @CheckForNull
-  public Boolean mustBeRoot() {
-    return mustBeRoot;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static class Builder {
-    private boolean includeDeactivated = false;
-    private Collection<String> logins;
-    private String searchText;
-    private Boolean mustBeRoot;
-
-    private Builder() {
-    }
-
-    public Builder includeDeactivated() {
-      this.includeDeactivated = true;
-      return this;
-    }
-
-    public Builder logins(@Nullable Collection<String> logins) {
-      // TODO clone logins
-      this.logins = logins;
-      return this;
-    }
-
-    public Builder logins(String... logins) {
-      this.logins = Arrays.asList(logins);
-      return this;
-    }
-
-    public Builder searchText(@Nullable String s) {
-      this.searchText = StringUtils.defaultIfBlank(s, null);
-      return this;
-    }
-
-    public Builder mustBeRoot() {
-      this.mustBeRoot = true;
-      return this;
-    }
-
-    public Builder mustNotBeRoot() {
-      this.mustBeRoot = false;
-      return this;
-    }
-
-    public UserQuery build() {
-      if (logins != null && logins.size() >= 1000) {
-        throw new IllegalArgumentException("Max number of logins is 1000. Got " + logins.size());
-      }
-      return new UserQuery(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/package-info.java
deleted file mode 100644 (file)
index 94c227a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/AnnotationUtils.java
deleted file mode 100644 (file)
index d1959f1..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.apache.commons.lang.ClassUtils;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-/**
- * A utility class for annotations
- *
- * @since 1.11
- */
-public final class AnnotationUtils {
-
-  private AnnotationUtils() {
-  }
-
-  /**
-   * Searches for a class annotation. All inheritance tree is analysed.
-   * 
-   * @since 3.1
-   */
-  public static <A extends Annotation> A getAnnotation(Object objectOrClass, Class<A> annotationClass) {
-    Class<?> initialClass = objectOrClass instanceof Class<?> ? (Class<?>) objectOrClass : objectOrClass.getClass();
-    
-    for (Class<?> aClass = initialClass; aClass != null; aClass = aClass.getSuperclass()) {
-      A result = aClass.getAnnotation(annotationClass);
-      if (result != null) {
-        return result;
-      }
-    }
-
-    for (Class<?> anInterface : (List<Class<?>>) ClassUtils.getAllInterfaces(initialClass)) {
-      A result = anInterface.getAnnotation(annotationClass);
-      if (result != null) {
-        return result;
-      }
-    }
-
-    return null;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java
deleted file mode 100644 (file)
index 1607d01..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.time.temporal.ChronoUnit;
-import java.util.Date;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * Parses and formats <a href="https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html#rfc822timezone">RFC 822</a> dates.
- * This class is thread-safe.
- *
- * @since 2.7
- */
-public final class DateUtils {
-  public static final String DATE_FORMAT = "yyyy-MM-dd";
-  public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
-
-  private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern(DATETIME_FORMAT);
-
-  private DateUtils() {
-  }
-
-  /**
-   * Warning: relies on default timezone!
-   */
-  public static String formatDate(Date d) {
-    return d.toInstant().atZone(ZoneId.systemDefault()).toLocalDate().toString();
-  }
-
-  /**
-   * Warning: relies on default timezone!
-   *
-   * @since 7.6
-   */
-  public static String formatDate(Instant d) {
-    return d.atZone(ZoneId.systemDefault()).toLocalDate().toString();
-  }
-
-  /**
-   * Warning: relies on default timezone!
-   */
-  public static String formatDateTime(Date d) {
-    return formatDateTime(OffsetDateTime.ofInstant(d.toInstant(), ZoneId.systemDefault()));
-  }
-
-  /**
-   * Warning: relies on default timezone!
-   */
-  public static String formatDateTime(long ms) {
-    return formatDateTime(OffsetDateTime.ofInstant(Instant.ofEpochMilli(ms), ZoneId.systemDefault()));
-  }
-
-  /**
-   * @since 6.6
-   */
-  public static String formatDateTime(OffsetDateTime dt) {
-    return DATETIME_FORMATTER.format(dt);
-  }
-
-  /**
-   * Warning: relies on default timezone!
-   */
-  public static String formatDateTimeNullSafe(@Nullable Date date) {
-    return date == null ? "" : formatDateTime(date);
-  }
-
-  @CheckForNull
-  public static Date longToDate(@Nullable Long time) {
-    return time == null ? null : new Date(time);
-  }
-
-  @CheckForNull
-  public static Long dateToLong(@Nullable Date date) {
-    return date == null ? null : date.getTime();
-  }
-
-  /**
-   * Return a date at the start of day.
-   *
-   * @param s string in format {@link #DATE_FORMAT}
-   * @throws SonarException when string cannot be parsed
-   */
-  public static Date parseDate(String s) {
-    return Date.from(parseLocalDate(s).atStartOfDay(ZoneId.systemDefault()).toInstant());
-  }
-
-  /**
-   * Parse format {@link #DATE_FORMAT}. This method never throws exception.
-   *
-   * @param s any string
-   * @return the date, {@code null} if parsing error or if parameter is {@code null}
-   * @since 3.0
-   */
-  @CheckForNull
-  public static Date parseDateQuietly(@Nullable String s) {
-    Date date = null;
-    if (s != null) {
-      try {
-        date = parseDate(s);
-      } catch (RuntimeException e) {
-        // ignore
-      }
-
-    }
-    return date;
-  }
-
-  /**
-   * @since 6.6
-   */
-  public static LocalDate parseLocalDate(String s) {
-    try {
-      return LocalDate.parse(s);
-    } catch (DateTimeParseException e) {
-      throw MessageException.of("The date '" + s + "' does not respect format '" + DATE_FORMAT + "'", e);
-    }
-  }
-
-  /**
-   * Parse format {@link #DATE_FORMAT}. This method never throws exception.
-   *
-   * @param s any string
-   * @return the date, {@code null} if parsing error or if parameter is {@code null}
-   * @since 6.6
-   */
-  @CheckForNull
-  public static LocalDate parseLocalDateQuietly(@Nullable String s) {
-    LocalDate date = null;
-    if (s != null) {
-      try {
-        date = parseLocalDate(s);
-      } catch (RuntimeException e) {
-        // ignore
-      }
-
-    }
-    return date;
-  }
-
-  /**
-   * @param s string in format {@link #DATETIME_FORMAT}
-   * @throws SonarException when string cannot be parsed
-   */
-  public static Date parseDateTime(String s) {
-    return Date.from(parseOffsetDateTime(s).toInstant());
-  }
-
-  /**
-   * @param s string in format {@link #DATETIME_FORMAT}
-   * @throws SonarException when string cannot be parsed
-   * @since 6.6
-   */
-  public static OffsetDateTime parseOffsetDateTime(String s) {
-    try {
-      return OffsetDateTime.parse(s, DATETIME_FORMATTER);
-    } catch (DateTimeParseException e) {
-      throw MessageException.of("The date '" + s + "' does not respect format '" + DATETIME_FORMAT + "'", e);
-    }
-  }
-
-  /**
-   * Parse format {@link #DATETIME_FORMAT}. This method never throws exception.
-   *
-   * @param s any string
-   * @return the datetime, {@code null} if parsing error or if parameter is {@code null}
-   */
-  @CheckForNull
-  public static Date parseDateTimeQuietly(@Nullable String s) {
-    Date datetime = null;
-    if (s != null) {
-      try {
-        datetime = parseDateTime(s);
-      } catch (RuntimeException e) {
-        // ignore
-      }
-
-    }
-    return datetime;
-  }
-
-  /**
-   * Parse format {@link #DATETIME_FORMAT}. This method never throws exception.
-   *
-   * @param s any string
-   * @return the datetime, {@code null} if parsing error or if parameter is {@code null}
-   * @since 6.6
-   */
-  @CheckForNull
-  public static OffsetDateTime parseOffsetDateTimeQuietly(@Nullable String s) {
-    OffsetDateTime datetime = null;
-    if (s != null) {
-      try {
-        datetime = parseOffsetDateTime(s);
-      } catch (RuntimeException e) {
-        // ignore
-      }
-
-    }
-    return datetime;
-  }
-
-  /**
-   * Warning: rely on default timezone!
-   *
-   * @see #parseDateOrDateTime(String, ZoneId) 
-   * @since 6.1
-   */
-  @CheckForNull
-  public static Date parseDateOrDateTime(@Nullable String stringDate) {
-    return parseDateOrDateTime(stringDate, ZoneId.systemDefault());
-  }
-
-  /**
-   * Parse either a full date time (using RFC-822 TZ format), or a local date.
-   * For local dates, the returned {@link Date} will be set at the beginning of the day, in the provided timezone.
-   * @return the datetime, {@code null} if stringDate is null
-   * @throws IllegalArgumentException if stringDate is not a correctly formed date or datetime
-   * @since 8.6
-   */
-  @CheckForNull
-  public static Date parseDateOrDateTime(@Nullable String stringDate, ZoneId timeZone) {
-    if (stringDate == null) {
-      return null;
-    }
-
-    OffsetDateTime odt = parseOffsetDateTimeQuietly(stringDate);
-    if (odt != null) {
-      return Date.from(odt.toInstant());
-    }
-
-    LocalDate ld = parseLocalDateQuietly(stringDate);
-    checkArgument(ld != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);
-
-    return Date.from(ld.atStartOfDay(timeZone).toInstant());
-  }
-
-  /**
-   * Warning: rely on default timezone for local dates!
-   *
-   * @see #parseDateOrDateTime(String)
-   */
-  @CheckForNull
-  public static Date parseStartingDateOrDateTime(@Nullable String stringDate) {
-    return parseDateOrDateTime(stringDate);
-  }
-
-  /**
-   * @see #parseDateOrDateTime(String, ZoneId)
-   */
-  @CheckForNull
-  public static Date parseStartingDateOrDateTime(@Nullable String stringDate, ZoneId timeZone) {
-    return parseDateOrDateTime(stringDate, timeZone);
-  }
-
-  /**
-   * Warning: rely on default timezone for local dates!
-   *
-   * @see #parseEndingDateOrDateTime(String, ZoneId)
-   * @since 6.1
-   */
-  @CheckForNull
-  public static Date parseEndingDateOrDateTime(@Nullable String stringDate) {
-    return parseEndingDateOrDateTime(stringDate, ZoneId.systemDefault());
-  }
-  /**
-   * Return the datetime if @param stringDate is a datetime, local date + 1 day if stringDate is a local date.
-   * So '2016-09-01' would return a date equivalent to '2016-09-02T00:00:00' in the provided timezone
-   *
-   * @return the datetime, {@code null} if stringDate is null
-   * @throws IllegalArgumentException if stringDate is not a correctly formed date or datetime
-   * @since 8.6
-   */
-  @CheckForNull
-  public static Date parseEndingDateOrDateTime(@Nullable String stringDate, ZoneId timeZone) {
-    if (stringDate == null) {
-      return null;
-    }
-
-    OffsetDateTime odt = parseOffsetDateTimeQuietly(stringDate);
-    if (odt != null) {
-      return Date.from(odt.toInstant());
-    }
-
-    LocalDate ld = parseLocalDateQuietly(stringDate);
-    checkArgument(ld != null, "Date '%s' cannot be parsed as either a date or date+time", stringDate);
-
-    return Date.from(ld.atStartOfDay(timeZone).plusDays(1).toInstant());
-  }
-
-  /**
-   * Adds a number of days to a date returning a new object.
-   * The original date object is unchanged.
-   *
-   * @param date         the date, not null
-   * @param numberOfDays the amount to add, may be negative
-   * @return the new date object with the amount added
-   */
-  public static Date addDays(Date date, int numberOfDays) {
-    return Date.from(date.toInstant().plus(numberOfDays, ChronoUnit.DAYS));
-  }
-
-  /**
-   * @since 7.6
-   */
-  public static Instant addDays(Instant instant, int numberOfDays) {
-    return instant.plus(numberOfDays, ChronoUnit.DAYS);
-  }
-
-  @CheckForNull
-  public static Date truncateToSeconds(@Nullable Date d) {
-    if (d == null) {
-      return null;
-    }
-    return truncateToSecondsImpl(d);
-  }
-
-  public static long truncateToSeconds(long dateTime) {
-    return truncateToSecondsImpl(new Date(dateTime)).getTime();
-  }
-
-  private static Date truncateToSecondsImpl(Date d) {
-    Instant instant = d.toInstant();
-    instant = instant.truncatedTo(ChronoUnit.SECONDS);
-    return Date.from(instant);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
deleted file mode 100644 (file)
index 12d8e04..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.Serializable;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-
-/**
- * @since 4.3
- */
-public class Duration implements Serializable {
-
-  public static final String DAY = "d";
-  public static final String HOUR = "h";
-  public static final String MINUTE = "min";
-
-  private static final short MINUTES_IN_ONE_HOUR = 60;
-  private static final Pattern PATTERN = Pattern.compile("\\s*+(?:(\\d++)\\s*+" + DAY + ")?+\\s*+(?:(\\d++)\\s*+" + HOUR + ")?+\\s*+(?:(\\d++)\\s*+" + MINUTE + ")?+\\s*+");
-
-
-  private final long durationInMinutes;
-
-  private Duration(long durationInMinutes) {
-    this.durationInMinutes = durationInMinutes;
-  }
-
-  private Duration(int days, int hours, int minutes, int hoursInDay) {
-    this(((long) days * hoursInDay * MINUTES_IN_ONE_HOUR) + (hours * MINUTES_IN_ONE_HOUR) + minutes);
-  }
-
-  /**
-   * Create a Duration from a number of minutes.
-   */
-  public static Duration create(long durationInMinutes) {
-    return new Duration(durationInMinutes);
-  }
-
-  /**
-   * Create a Duration from a text duration and the number of hours in a day.
-   * <br>
-   * For instance, Duration.decode("1d 1h", 8) will have a number of minutes of 540 (1*8*60 + 60).
-   * */
-  public static Duration decode(String text, int hoursInDay) {
-    int days = 0;
-    int hours = 0;
-    int minutes = 0;
-    String sanitizedText = StringUtils.deleteWhitespace(text);
-    Matcher matcher = PATTERN.matcher(text);
-
-    try {
-      if (matcher.find()) {
-        String daysDuration = matcher.group(1);
-        if (daysDuration != null) {
-          days = Integer.parseInt(daysDuration);
-          sanitizedText = sanitizedText.replace(daysDuration + DAY, "");
-        }
-        String hoursText = matcher.group(2);
-        if (hoursText != null) {
-          hours = Integer.parseInt(hoursText);
-          sanitizedText = sanitizedText.replace(hoursText + HOUR, "");
-        }
-        String minutesText = matcher.group(3);
-        if (minutesText != null) {
-          minutes = Integer.parseInt(minutesText);
-          sanitizedText = sanitizedText.replace(minutesText + MINUTE, "");
-        }
-        if (sanitizedText.isEmpty()) {
-          return new Duration(days, hours, minutes, hoursInDay);
-        }
-      }
-      throw invalid(text, null);
-    } catch (NumberFormatException e) {
-      throw invalid(text, e);
-    }
-  }
-
-  /**
-   * Return the duration in text, by using the given hours in day parameter to process hours.
-   * <br>
-   * Duration.decode("1d 1h", 8).encode(8) will return "1d 1h"
-   * Duration.decode("2d", 8).encode(16) will return "1d"
-   */
-  public String encode(int hoursInDay) {
-    int days = ((Double) ((double) durationInMinutes / hoursInDay / MINUTES_IN_ONE_HOUR)).intValue();
-    long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR);
-    int hours = ((Double) ((double) remainingDuration / MINUTES_IN_ONE_HOUR)).intValue();
-    remainingDuration = remainingDuration - (hours * MINUTES_IN_ONE_HOUR);
-    int minutes = (int) remainingDuration;
-
-    StringBuilder stringBuilder = new StringBuilder();
-    if (days > 0) {
-      stringBuilder.append(days);
-      stringBuilder.append(DAY);
-    }
-    if (hours > 0) {
-      stringBuilder.append(hours);
-      stringBuilder.append(HOUR);
-    }
-    if (minutes > 0) {
-      stringBuilder.append(minutes);
-      stringBuilder.append(MINUTE);
-    }
-    return stringBuilder.length() == 0 ? ("0" + MINUTE) : stringBuilder.toString();
-  }
-
-  /**
-   * Return the duration in minutes.
-   * <br>
-   * For instance, Duration.decode(1h, 24).toMinutes() will return 60.
-   */
-  public long toMinutes() {
-    return durationInMinutes;
-  }
-
-  /**
-   * Return true if the given duration is greater than the current one.
-   */
-  public boolean isGreaterThan(Duration other) {
-    return toMinutes() > other.toMinutes();
-  }
-
-  /**
-   * Add the given duration to the current one.
-   */
-  public Duration add(Duration with) {
-    return Duration.create(durationInMinutes + with.durationInMinutes);
-  }
-
-  /**
-   * Subtract the given duration to the current one.
-   */
-  public Duration subtract(Duration with) {
-    return Duration.create(durationInMinutes - with.durationInMinutes);
-  }
-
-  /**
-   * Multiply the duration with the given factor.
-   */
-  public Duration multiply(int factor) {
-    return Duration.create(durationInMinutes * factor);
-  }
-
-  private static IllegalArgumentException invalid(String text, @Nullable Exception e) {
-    throw new IllegalArgumentException(String.format("Duration '%s' is invalid, it should use the following sample format : 2d 10h 15min", text), e);
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    Duration that = (Duration) o;
-    return durationInMinutes == that.durationInMinutes;
-
-  }
-
-  @Override
-  public int hashCode() {
-    return (int) (durationInMinutes ^ (durationInMinutes >>> 32));
-  }
-
-  @Override
-  public String toString() {
-    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
deleted file mode 100644 (file)
index 4d8a8bb..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * @since 4.3
- */
-@ServerSide
-@ComputeEngineSide
-public class Durations {
-
-  private static final String MINUTES_FORMAT = "%smin";
-  private static final String HOURS_FORMAT = "%sh";
-  private static final String DAYS_FORMAT = "%sd";
-
-  private static final int HOURS_IN_DAY = 8;
-
-  /**
-   * Create a Duration object from a number of minutes
-   */
-  public Duration create(long minutes) {
-    return Duration.create(minutes);
-  }
-
-  /**
-   * Convert the text to a Duration
-   * <br>
-   * Example : decode("9d 10 h") -&gt; Duration.encode("10d2h")
-   * <br>
-   * @throws IllegalArgumentException
-   */
-  public Duration decode(String duration) {
-    return Duration.decode(duration, HOURS_IN_DAY);
-  }
-
-  /**
-   * Return the string value of the Duration.
-   * <br>
-   * Example : encode(Duration.encode("9d 10h")) -&gt; "10d2h"
-   */
-  public String encode(Duration duration) {
-    return duration.encode(HOURS_IN_DAY);
-  }
-
-  /**
-   * Return the formatted work duration using the english bundles.
-   * <br>
-   * Example : format(Duration.encode("9d 10h")) -&gt; 10d 2h
-   *
-   */
-  public String format(Duration duration) {
-    long durationInMinutes = duration.toMinutes();
-    if (durationInMinutes == 0) {
-      return "0";
-    }
-    boolean isNegative = durationInMinutes < 0;
-    long absDuration = Math.abs(durationInMinutes);
-
-    int days = ((Double) ((double) absDuration / HOURS_IN_DAY / 60)).intValue();
-    long remainingDuration = absDuration - (days * HOURS_IN_DAY * 60);
-    int hours = ((Double) ((double) remainingDuration / 60)).intValue();
-    remainingDuration = remainingDuration - (hours * 60);
-    int minutes = (int) remainingDuration;
-
-    return format(days, hours, minutes, isNegative);
-  }
-
-  private static String format(int days, int hours, int minutes, boolean isNegative) {
-    StringBuilder message = new StringBuilder();
-    if (days > 0) {
-      message.append(String.format(DAYS_FORMAT, isNegative ? (-1 * days) : days));
-    }
-    if (displayHours(days, hours)) {
-      addSpaceIfNeeded(message);
-      message.append(String.format(HOURS_FORMAT, isNegative && message.length() == 0 ? (-1 * hours) : hours));
-    }
-    if (displayMinutes(days, hours, minutes)) {
-      addSpaceIfNeeded(message);
-      message.append(String.format(MINUTES_FORMAT, isNegative && message.length() == 0 ? (-1 * minutes) : minutes));
-    }
-    return message.toString();
-  }
-
-  private static boolean displayHours(int days, int hours) {
-    return hours > 0 && days < 10;
-  }
-
-  private static boolean displayMinutes(int days, int hours, int minutes) {
-    return minutes > 0 && hours < 10 && days == 0;
-  }
-
-  private static void addSpaceIfNeeded(StringBuilder message) {
-    if (message.length() > 0) {
-      message.append(" ");
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/FieldUtils2.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/FieldUtils2.java
deleted file mode 100644 (file)
index 391d02e..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.apache.commons.lang.ClassUtils;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Add features missing in {@code org.apache.commons.lang.reflect.FieldUtils}.
- *
- * @since 2.14
- */
-public final class FieldUtils2 {
-  private FieldUtils2() {
-    // only statics
-  }
-
-  /**
-   * Get accessible {@code Field} breaking scope if requested. Superclasses/interfaces are considered.
-   *
-   * @param clazz       the class to reflect, must not be null
-   * @param forceAccess whether to break scope restrictions using the {@code setAccessible} method.
-   *                    {@code False} only matches public fields.
-   */
-  public static List<Field> getFields(Class clazz, boolean forceAccess) {
-    List<Field> result = new ArrayList<>();
-    Class c = clazz;
-    while (c != null) {
-      for (Field declaredField : c.getDeclaredFields()) {
-        if (!Modifier.isPublic(declaredField.getModifiers())) {
-          if (forceAccess) {
-            declaredField.setAccessible(true);
-          } else {
-            continue;
-          }
-        }
-        result.add(declaredField);
-      }
-      c = c.getSuperclass();
-    }
-
-    for (Object anInterface : ClassUtils.getAllInterfaces(clazz)) {
-      Collections.addAll(result, ((Class) anInterface).getDeclaredFields());
-    }
-
-    return result;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
deleted file mode 100644 (file)
index 4cef067..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-
-/**
- * This component is available in IoC container, so it should be injected through
- * a constructor parameter. It is available in both scanner and server.
- */
-@ScannerSide
-@ServerSide
-public abstract class HttpDownloader extends UriReader.SchemeProcessor {
-
-  /**
-   * Catch-all default timeout, replaced by
-   *   {@link #DEFAULT_READ_TIMEOUT_IN_MILLISECONDS}
-   *   {@link #DEFAULT_CONNECT_TIMEOUT_IN_MILLISECONDS}
-   *
-   * @deprecated since 7.0
-   */
-  @Deprecated
-  public static final int TIMEOUT_MILLISECONDS = 20 * 1000;
-
-  /**
-   * @since 7.0
-   */
-  public static final int DEFAULT_READ_TIMEOUT_IN_MILLISECONDS = 60 * 1000;
-
-  /**
-   * @since 7.0
-   */
-  public static final int DEFAULT_CONNECT_TIMEOUT_IN_MILLISECONDS = 20 * 1000;
-
-  public abstract String downloadPlainText(URI uri, String encoding);
-
-  public abstract byte[] download(URI uri);
-
-  public abstract InputStream openStream(URI uri);
-
-  public abstract void download(URI uri, File toFile);
-
-  public static class HttpException extends RuntimeException {
-    private final URI uri;
-    private final int responseCode;
-    private final String responseContent;
-
-    public HttpException(URI uri, int responseContent) {
-      this(uri, responseContent, "");
-    }
-
-    public HttpException(URI uri, int responseCode, String responseContent) {
-      super("Fail to download [" + uri + "]. Response code: " + responseCode);
-      this.uri = uri;
-      this.responseCode = responseCode;
-      this.responseContent = responseContent;
-    }
-
-    public int getResponseCode() {
-      return responseCode;
-    }
-
-    public URI getUri() {
-      return uri;
-    }
-
-    public String getResponseContent() {
-      return responseContent;
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/KeyValueFormat.java
deleted file mode 100644 (file)
index 5f5d490..0000000
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-import org.sonar.api.rules.RulePriority;
-
-/**
- * <p>Formats and parses key/value pairs with the text representation : "key1=value1;key2=value2". Field typing
- * is supported, to make conversion from/to primitive types easier for example.
- * <br>
- * Since version 4.5.1, text keys and values are escaped if they contain the separator characters '=' or ';'.
- * <br>
- * <b>Parsing examples</b>
- * <pre>
- *   Map&lt;String,String&gt; mapOfStrings = KeyValueFormat.parse("hello=world;foo=bar");
- *   Map&lt;String,Integer&gt; mapOfStringInts = KeyValueFormat.parseStringInt("one=1;two=2");
- *   Map&lt;Integer,String&gt; mapOfIntStrings = KeyValueFormat.parseIntString("1=one;2=two");
- *   Map&lt;String,Date&gt; mapOfStringDates = KeyValueFormat.parseStringDate("d1=2014-01-14;d2=2015-07-28");
- *
- *   // custom conversion
- *   Map&lt;String,MyClass&gt; mapOfStringMyClass = KeyValueFormat.parse("foo=xxx;bar=yyy",
- *     KeyValueFormat.newStringConverter(), new MyClassConverter());
- * </pre>
- * <br>
- * <b>Formatting examples</b>
- * <pre>
- *   String output = KeyValueFormat.format(map);
- *
- *   Map&lt;Integer,String&gt; mapIntString;
- *   KeyValueFormat.formatIntString(mapIntString);
- * </pre>
- * @since 1.10
- */
-public final class KeyValueFormat {
-  public static final String PAIR_SEPARATOR = ";";
-  public static final String FIELD_SEPARATOR = "=";
-
-  private KeyValueFormat() {
-    // only static methods
-  }
-
-  private static class FieldParserContext {
-    private final StringBuilder result = new StringBuilder();
-    private boolean escaped = false;
-    private char firstChar;
-    private char previous = (char) -1;
-  }
-
-  static class FieldParser {
-    private static final char DOUBLE_QUOTE = '"';
-    private final String csv;
-    private int position = 0;
-
-    FieldParser(String csv) {
-      this.csv = csv;
-    }
-
-    @CheckForNull
-    String nextKey() {
-      return next('=');
-    }
-
-    @CheckForNull
-    String nextVal() {
-      return next(';');
-    }
-
-    @CheckForNull
-    private String next(char separator) {
-      if (position >= csv.length()) {
-        return null;
-      }
-      FieldParserContext context = new FieldParserContext();
-      context.firstChar = csv.charAt(position);
-      // check if value is escaped by analyzing first character
-      checkEscaped(context);
-
-      boolean isEnd = false;
-      while (position < csv.length() && !isEnd) {
-        isEnd = advance(separator, context);
-      }
-      return context.result.toString();
-    }
-
-    private boolean advance(char separator, FieldParserContext context) {
-      boolean end = false;
-      char c = csv.charAt(position);
-      if (c == separator && !context.escaped) {
-        end = true;
-        position++;
-      } else if (c == '\\' && context.escaped && position < csv.length() + 1 && csv.charAt(position + 1) == DOUBLE_QUOTE) {
-        // on a backslash that escapes double-quotes -> keep double-quotes and jump after
-        context.previous = DOUBLE_QUOTE;
-        context.result.append(context.previous);
-        position += 2;
-      } else if (c == '"' && context.escaped && context.previous != '\\') {
-        // on unescaped double-quotes -> end of escaping.
-        // assume that next character is a separator (= or ;). This could be
-        // improved to enforce check.
-        end = true;
-        position += 2;
-      } else {
-        context.result.append(c);
-        context.previous = c;
-        position++;
-      }
-      return end;
-    }
-
-    private void checkEscaped(FieldParserContext context) {
-      if (context.firstChar == DOUBLE_QUOTE) {
-        context.escaped = true;
-        position++;
-        context.previous = context.firstChar;
-      }
-    }
-  }
-
-  public abstract static class Converter<T> {
-    abstract String format(@Nullable T type);
-
-    @CheckForNull
-    abstract T parse(String s);
-
-
-    String escape(String s) {
-      if (s.contains(FIELD_SEPARATOR) || s.contains(PAIR_SEPARATOR)) {
-        return new StringBuilder()
-          .append(FieldParser.DOUBLE_QUOTE)
-          .append(s.replace("\"", "\\\""))
-          .append(FieldParser.DOUBLE_QUOTE).toString();
-      }
-      return s;
-    }
-  }
-
-  public static final class StringConverter extends Converter<String> {
-    private static final StringConverter INSTANCE = new StringConverter();
-
-    private StringConverter() {
-    }
-
-    @Override
-    String format(@Nullable String s) {
-      return s == null ? "" : escape(s);
-    }
-
-    @Override
-    String parse(String s) {
-      return s;
-    }
-  }
-
-  public static StringConverter newStringConverter() {
-    return StringConverter.INSTANCE;
-  }
-
-  public static final class ToStringConverter extends Converter<Object> {
-    private static final ToStringConverter INSTANCE = new ToStringConverter();
-
-    private ToStringConverter() {
-    }
-
-    @Override
-    String format(@Nullable Object o) {
-      return o == null ? "" : escape(o.toString());
-    }
-
-    @Override
-    String parse(String s) {
-      throw new UnsupportedOperationException("Can not parse with ToStringConverter: " + s);
-    }
-  }
-
-  public static ToStringConverter newToStringConverter() {
-    return ToStringConverter.INSTANCE;
-  }
-
-  public static final class IntegerConverter extends Converter<Integer> {
-    private static final IntegerConverter INSTANCE = new IntegerConverter();
-
-    private IntegerConverter() {
-    }
-
-    @Override
-    String format(@Nullable Integer s) {
-      return s == null ? "" : String.valueOf(s);
-    }
-
-    @Override
-    Integer parse(String s) {
-      return StringUtils.isBlank(s) ? null : NumberUtils.toInt(s);
-    }
-  }
-
-  public static IntegerConverter newIntegerConverter() {
-    return IntegerConverter.INSTANCE;
-  }
-
-  public static final class PriorityConverter extends Converter<RulePriority> {
-    private static final PriorityConverter INSTANCE = new PriorityConverter();
-
-    private PriorityConverter() {
-    }
-
-    @Override
-    String format(@Nullable RulePriority s) {
-      return s == null ? "" : s.toString();
-    }
-
-    @Override
-    RulePriority parse(String s) {
-      return StringUtils.isBlank(s) ? null : RulePriority.valueOf(s);
-    }
-  }
-
-  public static PriorityConverter newPriorityConverter() {
-    return PriorityConverter.INSTANCE;
-  }
-
-  public static final class DoubleConverter extends Converter<Double> {
-    private static final DoubleConverter INSTANCE = new DoubleConverter();
-
-    private DoubleConverter() {
-    }
-
-    @Override
-    String format(@Nullable Double d) {
-      return d == null ? "" : String.valueOf(d);
-    }
-
-    @Override
-    Double parse(String s) {
-      return StringUtils.isBlank(s) ? null : NumberUtils.toDouble(s);
-    }
-  }
-
-  public static DoubleConverter newDoubleConverter() {
-    return DoubleConverter.INSTANCE;
-  }
-
-  public static class DateConverter extends Converter<Date> {
-    private SimpleDateFormat dateFormat;
-
-    private DateConverter(String format) {
-      this.dateFormat = new SimpleDateFormat(format);
-    }
-
-    @Override
-    String format(@Nullable Date d) {
-      return d == null ? "" : dateFormat.format(d);
-    }
-
-    @Override
-    Date parse(String s) {
-      try {
-        return StringUtils.isBlank(s) ? null : dateFormat.parse(s);
-      } catch (ParseException e) {
-        throw new IllegalArgumentException("Not a date with format: " + dateFormat.toPattern(), e);
-      }
-    }
-  }
-
-  public static DateConverter newDateConverter() {
-    return newDateConverter(DateUtils.DATE_FORMAT);
-  }
-
-  public static DateConverter newDateTimeConverter() {
-    return newDateConverter(DateUtils.DATETIME_FORMAT);
-  }
-
-  public static DateConverter newDateConverter(String format) {
-    return new DateConverter(format);
-  }
-
-  /**
-   * If input is null, then an empty map is returned.
-   */
-  public static <K, V> Map<K, V> parse(@Nullable String input, Converter<K> keyConverter, Converter<V> valueConverter) {
-    Map<K, V> map = new LinkedHashMap<>();
-    if (input != null) {
-      FieldParser reader = new FieldParser(input);
-      boolean end = false;
-      while (!end) {
-        String key = reader.nextKey();
-        if (key == null) {
-          end = true;
-        } else {
-          String val = StringUtils.defaultString(reader.nextVal(), "");
-          map.put(keyConverter.parse(key), valueConverter.parse(val));
-        }
-      }
-    }
-    return map;
-  }
-
-  public static Map<String, String> parse(@Nullable String data) {
-    return parse(data, newStringConverter(), newStringConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<String, Integer> parseStringInt(@Nullable String data) {
-    return parse(data, newStringConverter(), newIntegerConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<String, Double> parseStringDouble(@Nullable String data) {
-    return parse(data, newStringConverter(), newDoubleConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<Integer, String> parseIntString(@Nullable String data) {
-    return parse(data, newIntegerConverter(), newStringConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<Integer, Double> parseIntDouble(@Nullable String data) {
-    return parse(data, newIntegerConverter(), newDoubleConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<Integer, Date> parseIntDate(@Nullable String data) {
-    return parse(data, newIntegerConverter(), newDateConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<Integer, Integer> parseIntInt(@Nullable String data) {
-    return parse(data, newIntegerConverter(), newIntegerConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static Map<Integer, Date> parseIntDateTime(@Nullable String data) {
-    return parse(data, newIntegerConverter(), newDateTimeConverter());
-  }
-
-  private static <K, V> String formatEntries(Collection<Map.Entry<K, V>> entries, Converter<K> keyConverter, Converter<V> valueConverter) {
-    StringBuilder sb = new StringBuilder();
-    boolean first = true;
-    for (Map.Entry<K, V> entry : entries) {
-      if (!first) {
-        sb.append(PAIR_SEPARATOR);
-      }
-      sb.append(keyConverter.format(entry.getKey()));
-      sb.append(FIELD_SEPARATOR);
-      if (entry.getValue() != null) {
-        sb.append(valueConverter.format(entry.getValue()));
-      }
-      first = false;
-    }
-    return sb.toString();
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static <K, V> String format(Map<K, V> map, Converter<K> keyConverter, Converter<V> valueConverter) {
-    return formatEntries(map.entrySet(), keyConverter, valueConverter);
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String format(Map map) {
-    return format(map, newToStringConverter(), newToStringConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String formatIntString(Map<Integer, String> map) {
-    return format(map, newIntegerConverter(), newStringConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String formatIntDouble(Map<Integer, Double> map) {
-    return format(map, newIntegerConverter(), newDoubleConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String formatIntDate(Map<Integer, Date> map) {
-    return format(map, newIntegerConverter(), newDateConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String formatIntDateTime(Map<Integer, Date> map) {
-    return format(map, newIntegerConverter(), newDateTimeConverter());
-  }
-
-  /**
-   * @since 2.7
-   */
-  public static String formatStringInt(Map<String, Integer> map) {
-    return format(map, newStringConverter(), newIntegerConverter());
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/LocalizedMessages.java
deleted file mode 100644 (file)
index 70f7e07..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.Set;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-public class LocalizedMessages extends ResourceBundle {
-
-  private static final Logger LOG = Loggers.get(LocalizedMessages.class);
-
-  private Locale locale;
-  private List<ResourceBundle> bundles;
-
-  /**
-   * Constructs a resource bundle from a list of other resource bundles. If
-   * there are duplicate keys, the key from the resource bundle with the
-   * smallest index takes precedence.
-   */
-  public LocalizedMessages(Locale locale, String... basenames) {
-    this.locale = locale;
-    bundles = new ArrayList<>(basenames.length);
-    for (String basename : basenames) {
-      bundles.add(getBundle("sonar.bundles." + basename, locale));
-    }
-  }
-
-  @Override
-  public Locale getLocale() {
-    return locale;
-  }
-
-  public String format(String key, Object... args) {
-    return format(true, key, args);
-  }
-
-  public String formatQuietly(String key, Object... args) {
-    return format(false, key, args);
-  }
-
-  private String format(boolean logIfMissing, String key, Object... args) {
-    try {
-      String message = getString(key);
-      return String.format(locale, message, args);
-
-    } catch (MissingResourceException e) {
-      if (logIfMissing) {
-        LOG.warn("Missing translation: key==" + key + ",locale=" + locale);
-      }
-      return key;
-    }
-  }
-
-  /*
-   * (non-Javadoc)
-   *
-   * @see java.util.ResourceBundle#getKeys()
-   */
-  @Override
-  public Enumeration<String> getKeys() {
-    return new KeyEnumeration();
-  }
-
-  /*
-   * (non-Javadoc)
-   *
-   * @see java.util.ResourceBundle#handleGetObject(java.lang.String)
-   */
-  @Override
-  protected Object handleGetObject(String key) {
-    for (ResourceBundle b : bundles) {
-      try {
-        return b.getObject(key);
-      } catch (MissingResourceException mre) {
-        // iterate
-      }
-    }
-    throw new MissingResourceException(null, null, key);
-  }
-
-  private class KeyEnumeration implements Enumeration<String> {
-    private Set<String> keys = new HashSet<>();
-
-    // Set iterator to simulate enumeration
-    private Iterator<String> i;
-
-    // Constructor
-    {
-      for (ResourceBundle b : bundles) {
-        Enumeration<String> bundleKeys = b.getKeys();
-        while (bundleKeys.hasMoreElements()) {
-          keys.add(bundleKeys.nextElement());
-        }
-      }
-      i = keys.iterator();
-    }
-
-    @Override
-    public boolean hasMoreElements() {
-      return i.hasNext();
-    }
-
-    @Override
-    public String nextElement() {
-      return i.next();
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ManifestUtils.java
deleted file mode 100644 (file)
index 2baf8de..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-/**
- * @since 2.2
- */
-public final class ManifestUtils {
-
-  private ManifestUtils() {
-  }
-
-  /**
-   * Search for a property in all the manifests found in the classloader
-   *
-   * @return the values, an empty list if the property is not found.
-   */
-  public static List<String> getPropertyValues(ClassLoader classloader, String key) {
-    List<String> values = new ArrayList<>();
-    try {
-      Enumeration<URL> resources = classloader.getResources("META-INF/MANIFEST.MF");
-      while (resources.hasMoreElements()) {
-        Manifest manifest = new Manifest(resources.nextElement().openStream());
-        Attributes attributes = manifest.getMainAttributes();
-        String value = attributes.getValue(key);
-        if (value != null) {
-          values.add(value);
-        }
-      }
-    } catch (IOException e) {
-      throw new SonarException("Fail to load manifests from classloader: " + classloader, e);
-    }
-    return values;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
deleted file mode 100644 (file)
index 7ede4bb..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.util.Collection;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.emptyList;
-
-/**
- * Runtime exception for "functional" error. It aims to be displayed to end-users, without any technical information
- * like stack traces. 
- * <br>
- * 
- * It's handling depends on the versions of the sonar-batch and sonar-runner. sonar-runner 2.4 will only show the 
- * message associated with this exception.
- * Starting from sonar-batch 5.3, this is handled in the batch side, and the main goal is to hide all wrappers of this
- * exception. If this exception is created without cause, then only the message associated with this exception is shown; 
- * otherwise, its causes are also shown.
- * Previous combinations of sonar-batch/sonar-runner log all stack trace.
- * <br>
- * Message should be clear and complete. Keep in mind that context might not be added to the exception.
- * Names of processed resource and decorator are for example not automatically added when throwing {@link MessageException}
- * from {@link org.sonar.api.batch.Decorator}.
- *
- * @since 3.7.1
- */
-public class MessageException extends RuntimeException {
-
-  private final String l10nKey;
-  private final Collection<Object> l10nParams;
-
-  protected MessageException(String s) {
-    this(s, null, null);
-  }
-
-  private MessageException(@Nullable String message, @Nullable String l10nKey, @Nullable Object[] l10nParams) {
-    super(message);
-    this.l10nKey = l10nKey;
-    this.l10nParams = l10nParams == null ? emptyList() : asList(l10nParams);
-  }
-
-  private MessageException(String message, Throwable cause) {
-    super(message, cause);
-    l10nKey = null;
-    l10nParams = emptyList();
-  }
-
-  public static MessageException of(String message, Throwable cause) {
-    return new MessageException(message, cause);
-  }
-
-  public static MessageException of(String message) {
-    return new MessageException(message);
-  }
-
-  public static MessageException ofL10n(String l10nKey, Object... l10nParams) {
-    return new MessageException(null, l10nKey, l10nParams);
-  }
-
-  /**
-   * Does not fill in the stack trace
-   *
-   * @see java.lang.Throwable#fillInStackTrace()
-   */
-  @Override
-  public synchronized Throwable fillInStackTrace() {
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return getMessage();
-  }
-
-  @CheckForNull
-  public String l10nKey() {
-    return l10nKey;
-  }
-
-  @CheckForNull
-  public Collection<Object> l10nParams() {
-    return l10nParams;
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java
deleted file mode 100644 (file)
index 9b33a95..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 3.6
- */
-public class Paging {
-
-  private final int pageSize;
-  private final int pageIndex;
-  private final int total;
-
-  private Paging(int pageSize, int pageIndex, int total) {
-    checkArgument(pageSize >= 1, "Page size must be strictly positive. Got %s", pageSize);
-    checkArgument(pageIndex >= 1, "Page index must be strictly positive. Got %s", pageIndex);
-    checkArgument(total >= 0, "Total items must be positive. Got %s", total);
-    this.pageSize = pageSize;
-    this.pageIndex = pageIndex;
-    this.total = total;
-  }
-
-  public static Builder forPageIndex(int pageIndex) {
-    return new Builder(pageIndex);
-  }
-
-  /**
-   * Page index, starting with 1.
-   */
-  public int pageIndex() {
-    return pageIndex;
-  }
-
-  /**
-   * Maximum number of items per page. It is greater than 0.
-   */
-  public int pageSize() {
-    return pageSize;
-  }
-
-  /**
-   * Total number of items. It is greater than or equal 0.
-   */
-  public int total() {
-    return total;
-  }
-
-  public int offset() {
-    return (pageIndex - 1) * pageSize;
-  }
-
-  public static int offset(int pageIndex, int pageSize) {
-    return (pageIndex - 1) * pageSize;
-  }
-
-  /**
-   * Number of pages. It is greater than or equal 0.
-   */
-  public int pages() {
-    int p = total / pageSize;
-    if (total % pageSize > 0) {
-      p++;
-    }
-    return p;
-  }
-
-  /**
-   *
-   * @since 4.1
-   */
-  public boolean hasNextPage() {
-    return pageIndex() < pages();
-  }
-
-  public static class Builder {
-    private int pageSize;
-    private int pageIndex;
-
-    private Builder(int pageIndex) {
-      this.pageIndex = pageIndex;
-    }
-
-    public Builder withPageSize(int pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public Paging andTotal(int total) {
-      return new Paging(pageSize, pageIndex, total);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java
deleted file mode 100644 (file)
index 93eb11b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-
-/**
- * Utility to parse various inputs
- *
- * @since 1.10
- */
-public final class ParsingUtils {
-
-  private ParsingUtils() {
-  }
-
-  /**
-   * Parses a string with a locale and returns the corresponding number
-   *
-   * @throws ParseException if number cannot be parsed
-   */
-  public static double parseNumber(String number, Locale locale) throws ParseException {
-    if ("".equals(number)) {
-      return Double.NaN;
-    }
-    return NumberFormat.getNumberInstance(locale).parse(number).doubleValue();
-  }
-
-  /**
-   * Parses a string with the default locale and returns the corresponding number
-   *
-   * @throws ParseException if number cannot be parsed
-   */
-  public static double parseNumber(String number) throws ParseException {
-    return parseNumber(number, Locale.ENGLISH);
-  }
-
-  /**
-   * Scales a double value, taking into account 2 decimals
-   */
-  public static double scaleValue(double value) {
-    return scaleValue(value, 2);
-  }
-
-  /**
-   * Scales a double value with decimals
-   */
-  public static double scaleValue(double value, int decimals) {
-    BigDecimal bd = BigDecimal.valueOf(value);
-    return bd.setScale(decimals, RoundingMode.HALF_UP).doubleValue();
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/PathUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/PathUtils.java
deleted file mode 100644 (file)
index 0d890db..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.File;
-import java.io.IOException;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.commons.io.FilenameUtils;
-
-/**
- * @since 4.0
- */
-public class PathUtils {
-
-  private PathUtils() {
-    // only static methods
-  }
-
-  /**
-   * Normalize path and replace file separators by forward slash
-   */
-  @CheckForNull
-  public static String sanitize(@Nullable String path) {
-    return FilenameUtils.normalize(path, true);
-  }
-
-  /**
-   * Get canonical path and replace file separators by forward slash. This
-   * method does not throw boring checked exception.
-   */
-  @CheckForNull
-  public static String canonicalPath(@Nullable File file) {
-    if (file == null) {
-      return null;
-    }
-    try {
-      return FilenameUtils.separatorsToUnix(file.getCanonicalPath());
-    } catch (IOException e) {
-      throw new IllegalStateException("Fail to get the canonical path of " + file.getAbsolutePath(), e);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Preconditions.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Preconditions.java
deleted file mode 100644 (file)
index 13b4eac..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import javax.annotation.Nullable;
-
-public class Preconditions {
-  private Preconditions() {
-    // static only
-  }
-
-  public static void checkArgument(boolean condition, String message) {
-    if (!condition) {
-      throw new IllegalArgumentException(message);
-    }
-  }
-
-  public static void checkArgument(boolean condition) {
-    if (!condition) {
-      throw new IllegalArgumentException();
-    }
-  }
-
-  public static void checkArgument(boolean condition, String format, Object... args) {
-    if (!condition) {
-      throw new IllegalArgumentException(String.format(format, args));
-    }
-  }
-
-  public static void checkState(boolean condition, String message) {
-    if (!condition) {
-      throw new IllegalStateException(message);
-    }
-  }
-
-  public static void checkNotNull(@Nullable Object obj) {
-    if (obj == null) {
-      throw new NullPointerException();
-    }
-  }
-
-  public static void checkState(boolean condition, String format, Object... args) {
-    if (!condition) {
-      throw new IllegalStateException(String.format(format, args));
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/SonarException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/SonarException.java
deleted file mode 100644 (file)
index 51849fa..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-/**
- * Because we don't like checked exceptions !
- *
- * @since 1.10
- * @deprecated in 4.4. Use standard exceptions like {@link java.lang.IllegalArgumentException}
- * or {@link java.lang.IllegalStateException}. Use {@link org.sonar.api.utils.MessageException}
- * for raising errors to end-users without displaying stackstrace.
- */
-@Deprecated
-public class SonarException extends RuntimeException {
-  public SonarException() {
-  }
-
-  public SonarException(String s) {
-    super(s);
-  }
-
-  public SonarException(String s, Throwable throwable) {
-    super(s, throwable);
-  }
-
-  public SonarException(Throwable throwable) {
-    super(throwable);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java
deleted file mode 100644 (file)
index 88919c8..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.net.URL;
-import java.time.Clock;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TimeZone;
-import javax.annotation.CheckForNull;
-import org.apache.commons.lang.SystemUtils;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Proxy over {@link java.lang.System}. It aims to improve testability of classes
- * that interact with low-level system methods, for example :
- * <br>
- * <pre>
- * public class MyClass {
- *   private final System2 system;
- *
- *   public MyClass(System2 s) {
- *     this.system = s;
- *   }
- *
- *   public long xxx() {
- *     return system.now();
- *   }
- * }
- *
- * {@literal @}Test
- * public void should_return_xxx() {
- *   // using Mockito
- *   System2 system = mock(System2.class);
- *   long now = 123456789L;
- *   doReturn(now).when(system).now();
- *   assertThat(new MyClass(system).xxx()).isEqualTo(now);
- * }
- * </pre>
- * <br>
- * Note that the name System2 was chosen to not conflict with {@link java.lang.System}.
- * <br>
- * An instance is available in IoC container since 4.3.
- * Since 6.4 you can also inject {@link Clock} instead of {@link System2} if you are only interested by date/time operations
- *
- * @since 4.2
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public class System2 {
-
-  public static final System2 INSTANCE = new System2();
-
-  /**
-   * Shortcut for {@link System#currentTimeMillis()}
-   * Since 6.4 you can also inject {@link Clock} instead of {@link System2}
-   */
-  public long now() {
-    return System.currentTimeMillis();
-  }
-
-  /**
-   * Shortcut for {@link System#getProperties()}
-   */
-  public Properties properties() {
-    return System.getProperties();
-  }
-
-  /**
-   * Shortcut for {@link System#getProperty(String)}
-   */
-  @CheckForNull
-  public String property(String key) {
-    return System.getProperty(key);
-  }
-
-  /**
-   * Shortcut for {@code System{@link #setProperty(String, String)}}
-   *
-   * @since 6.4
-   */
-  public System2 setProperty(String key, String value) {
-    System.setProperty(key, value);
-    return this;
-  }
-
-  /**
-   * Shortcut for {@link System#getenv()}
-   */
-  public Map<String, String> envVariables() {
-    return System.getenv();
-  }
-
-  /**
-   * Shortcut for {@link System#getenv(String)}
-   */
-  @CheckForNull
-  public String envVariable(String key) {
-    return System.getenv(key);
-  }
-
-  /**
-   * True if this is MS Windows.
-   */
-  public boolean isOsWindows() {
-    return SystemUtils.IS_OS_WINDOWS;
-  }
-
-  /**
-   * True if this is Mac system.
-   */
-  public boolean isOsMac() {
-    return SystemUtils.IS_OS_MAC;
-  }
-
-  public void println(String obj) {
-    System.out.print(obj);
-  }
-
-  /**
-   * @return the JVM's default time zone
-   * @since 5.1
-   */
-  public TimeZone getDefaultTimeZone() {
-    return TimeZone.getDefault();
-  }
-
-  /**
-   * @see Class#getResource(String)
-   * @since 5.5
-   */
-  public URL getResource(String name) {
-    return getClass().getResource(name);
-  }
-
-  /**
-   * Closes the object and throws an {@link java.lang.IllegalStateException} on error.
-   *
-   * @since 5.1
-   */
-  public void close(AutoCloseable closeable) {
-    try {
-      closeable.close();
-    } catch (Exception e) {
-      throw new IllegalStateException("Fail to close " + closeable, e);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java
deleted file mode 100644 (file)
index 5121411..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.File;
-import javax.annotation.Nullable;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Use this component to deal with temp files/folders. Root location of temp files/folders
- * depends on situation:
- * <ul>
- * <li>${SONAR_HOME}/temp on server side</li>
- * <li>${SONAR_HOME}/.sonartmp on scanner side</li>
- * </ul>
- * @since 4.0
- *
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public interface TempFolder {
-
-  /**
-   * Create a directory in temp folder with a random unique name.
-   */
-  File newDir();
-
-  /**
-   * Create a directory in temp folder using provided name.
-   */
-  File newDir(String name);
-
-  File newFile();
-
-  File newFile(@Nullable String prefix, @Nullable String suffix);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TimeUtils.java
deleted file mode 100644 (file)
index f82ec7f..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-/**
- * @since 3.6
- */
-public final class TimeUtils {
-
-  private TimeUtils() {
-  }
-
-  /**
-   * Label for a duration, expressed in numbers of ms, seconds or minutes.
-   * <br>
-   * Examples:
-   * <ul>
-   *   <li>10 -&gt; "10ms"</li>
-   *   <li>100 -&gt; "100ms"</li>
-   *   <li>10000 -&gt; "10s"</li>
-   *   <li>100000 -&gt; "1min 40s"</li>
-   * </ul>
-   */
-  public static String formatDuration(long durationInMs) {
-    if (durationInMs < 1000) {
-      return String.format("%sms", durationInMs);
-    } else {
-      long sec = durationInMs / 1000;
-      if (sec < 60) {
-        return String.format("%ss", sec);
-      } else {
-        long min = sec / 60;
-        long remainingSec = sec - (min * 60);
-        if (remainingSec > 0) {
-          return String.format("%smin %ss", min, remainingSec);
-        } else {
-          return String.format("%smin", min);
-        }
-      }
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
deleted file mode 100644 (file)
index 459f591..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.scanner.ScannerSide;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Reads different types of URI. Supported schemes are http and file.
- *
- * @since 3.2
- */
-@ScannerSide
-@ServerSide
-@ComputeEngineSide
-public class UriReader {
-
-  private final Map<String, SchemeProcessor> processorsByScheme = new HashMap<>();
-
-  public UriReader(SchemeProcessor[] processors) {
-    Stream.concat(Stream.of(new FileProcessor()), Arrays.stream(processors)).forEach(processor -> {
-      for (String scheme : processor.getSupportedSchemes()) {
-        processorsByScheme.put(scheme.toLowerCase(Locale.ENGLISH), processor);
-      }
-    });
-  }
-
-  /**
-   * Reads all bytes from uri. It throws an unchecked exception if an error occurs.
-   */
-  public byte[] readBytes(URI uri) {
-    return searchForSupportedProcessor(uri).readBytes(uri);
-  }
-
-  /**
-   * Reads all characters from uri, using the given character set.
-   * It throws an unchecked exception if an error occurs.
-   */
-  public String readString(URI uri, Charset charset) {
-    return searchForSupportedProcessor(uri).readString(uri, charset);
-  }
-
-  /**
-   * Returns a detailed description of the given uri. For example HTTP URIs are completed
-   * with the configured HTTP proxy.
-   */
-  public String description(URI uri) {
-    SchemeProcessor reader = searchForSupportedProcessor(uri);
-
-    return reader.description(uri);
-  }
-
-  SchemeProcessor searchForSupportedProcessor(URI uri) {
-    SchemeProcessor processor = processorsByScheme.get(uri.getScheme().toLowerCase(Locale.ENGLISH));
-    Preconditions.checkArgument(processor != null, "URI schema is not supported: " + uri.getScheme());
-    return processor;
-  }
-
-  public abstract static class SchemeProcessor {
-    protected abstract String[] getSupportedSchemes();
-
-    protected abstract byte[] readBytes(URI uri);
-
-    protected abstract String readString(URI uri, Charset charset);
-
-    protected abstract String description(URI uri);
-  }
-
-  /**
-   * This implementation is not exposed in API and is kept private.
-   */
-  private static class FileProcessor extends SchemeProcessor {
-
-    @Override
-    public String[] getSupportedSchemes() {
-      return new String[] {"file"};
-    }
-
-    @Override
-    protected byte[] readBytes(URI uri) {
-      try {
-        return Files.readAllBytes(Paths.get(uri));
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    @Override
-    protected String readString(URI uri, Charset charset) {
-      try {
-        return new String(Files.readAllBytes(Paths.get(uri)), charset);
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    @Override
-    protected String description(URI uri) {
-      return new File(uri).getAbsolutePath();
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ValidationMessages.java
deleted file mode 100644 (file)
index 5ee2706..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.slf4j.Logger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class ValidationMessages {
-
-  private List<String> errors = new ArrayList<>();
-  private List<String> warnings = new ArrayList<>();
-  private List<String> infos = new ArrayList<>();
-
-  /**
-   * Use the factory method <code>create()</code>
-   */
-  ValidationMessages() {
-  }
-
-  public static ValidationMessages create() {
-    return new ValidationMessages();
-  }
-
-  public boolean hasErrors() {
-    return !errors.isEmpty();
-  }
-
-  public List<String> getErrors() {
-    return errors;
-  }
-
-  public ValidationMessages addErrorText(String text) {
-    errors.add(text);
-    return this;
-  }
-
-  public List<String> getWarnings() {
-    return warnings;
-  }
-
-  public boolean hasWarnings() {
-    return !warnings.isEmpty();
-  }
-
-  public ValidationMessages addWarningText(String text) {
-    warnings.add(text);
-    return this;
-  }
-
-  public List<String> getInfos() {
-    return infos;
-  }
-
-  public boolean hasInfos() {
-    return !infos.isEmpty();
-  }
-
-  public ValidationMessages addInfoText(String text) {
-    infos.add(text);
-    return this;
-  }
-
-  /**
-   * @since 5.1
-   */
-  public void log(org.sonar.api.utils.log.Logger logger) {
-    for (String error : getErrors()) {
-      logger.error(error);
-    }
-    for (String warning : getWarnings()) {
-      logger.warn(warning);
-    }
-    for (String info : getInfos()) {
-      logger.info(info);
-    }
-  }
-
-  /**
-   * @deprecated replaced by {@link #log(org.sonar.api.utils.log.Logger)} since deprecation of slf4j in 5.1
-   */
-  @Deprecated
-  public void log(Logger logger) {
-    for (String error : getErrors()) {
-      logger.error(error);
-    }
-    for (String warning : getWarnings()) {
-      logger.warn(warning);
-    }
-    for (String info : getInfos()) {
-      logger.info(info);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
-        .append("errors", errors)
-        .append("warnings", warnings)
-        .append("infos", infos)
-        .toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Version.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Version.java
deleted file mode 100644 (file)
index 8eb99d7..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.util.regex.Pattern;
-import javax.annotation.concurrent.Immutable;
-
-import static java.lang.Integer.parseInt;
-import static java.lang.Long.parseLong;
-import static java.util.Objects.requireNonNull;
-import static org.apache.commons.lang.StringUtils.substringAfter;
-import static org.apache.commons.lang.StringUtils.substringBefore;
-import static org.apache.commons.lang.StringUtils.trimToEmpty;
-
-/**
- * Version composed of maximum four fields (major, minor, patch and build ID numbers) and optionally a qualifier.
- * <p>
- * Examples: 1.0, 1.0.0, 1.2.3, 1.2-beta1, 1.2.1-beta-1, 1.2.3.4567
- * <p>
- * <h3>IMPORTANT NOTE</h3>
- * Qualifier is ignored when comparing objects (methods {@link #equals(Object)}, {@link #hashCode()}
- * and {@link #compareTo(Version)}).
- * <p>
- * <pre>
- *   assertThat(Version.parse("1.2")).isEqualTo(Version.parse("1.2-beta1"));
- *   assertThat(Version.parse("1.2").compareTo(Version.parse("1.2-beta1"))).isZero();
- * </pre>
- *
- * @since 5.5
- */
-@Immutable
-public class Version implements Comparable<Version> {
-
-  private static final long DEFAULT_BUILD_NUMBER = 0L;
-  private static final int DEFAULT_PATCH = 0;
-  private static final String DEFAULT_QUALIFIER = "";
-  private static final String QUALIFIER_SEPARATOR = "-";
-  private static final String SEQUENCE_SEPARATOR = ".";
-
-  private final int major;
-  private final int minor;
-  private final int patch;
-  private final long buildNumber;
-  private final String qualifier;
-
-  private Version(int major, int minor, int patch, long buildNumber, String qualifier) {
-    this.major = major;
-    this.minor = minor;
-    this.patch = patch;
-    this.buildNumber = buildNumber;
-    this.qualifier = requireNonNull(qualifier, "Version qualifier must not be null");
-  }
-
-  public int major() {
-    return major;
-  }
-
-  public int minor() {
-    return minor;
-  }
-
-  public int patch() {
-    return patch;
-  }
-
-  /**
-   * Build number if the fourth field, for example {@code 12345} for "6.3.0.12345".
-   * If absent, then value is zero.
-   *
-   * @since 6.3
-   */
-  public long buildNumber() {
-    return buildNumber;
-  }
-
-  /**
-   * @return non-null suffix. Empty if absent, else the suffix without the first character "-"
-   */
-  public String qualifier() {
-    return qualifier;
-  }
-
-  /**
-   * Convert a {@link String} to a Version. Supported formats:
-   * <ul>
-   * <li>1</li>
-   * <li>1.2</li>
-   * <li>1.2.3</li>
-   * <li>1-beta-1</li>
-   * <li>1.2-beta-1</li>
-   * <li>1.2.3-beta-1</li>
-   * <li>1.2.3.4567</li>
-   * <li>1.2.3.4567-beta-1</li>
-   * </ul>
-   * Note that the optional qualifier is the part after the first "-".
-   *
-   * @throws IllegalArgumentException if parameter is badly formatted, for example
-   *                                  if it defines 5 integer-sequences.
-   */
-  public static Version parse(String text) {
-    String s = trimToEmpty(text);
-    String qualifier = substringAfter(s, QUALIFIER_SEPARATOR);
-    if (!qualifier.isEmpty()) {
-      s = substringBefore(s, QUALIFIER_SEPARATOR);
-    }
-    String[] fields = s.split(Pattern.quote(SEQUENCE_SEPARATOR));
-    int major = 0;
-    int minor = 0;
-    int patch = DEFAULT_PATCH;
-    long buildNumber = DEFAULT_BUILD_NUMBER;
-    int size = fields.length;
-    if (size > 0) {
-      major = parseFieldAsInt(fields[0]);
-      if (size > 1) {
-        minor = parseFieldAsInt(fields[1]);
-        if (size > 2) {
-          patch = parseFieldAsInt(fields[2]);
-          if (size > 3) {
-            buildNumber = parseFieldAsLong(fields[3]);
-            if (size > 4) {
-              throw new IllegalArgumentException("Maximum 4 fields are accepted: " + text);
-            }
-          }
-        }
-      }
-    }
-    return new Version(major, minor, patch, buildNumber, qualifier);
-  }
-
-  public static Version create(int major, int minor) {
-    return new Version(major, minor, DEFAULT_PATCH, DEFAULT_BUILD_NUMBER, DEFAULT_QUALIFIER);
-  }
-
-  public static Version create(int major, int minor, int patch) {
-    return new Version(major, minor, patch, DEFAULT_BUILD_NUMBER, DEFAULT_QUALIFIER);
-  }
-
-  private static int parseFieldAsInt(String field) {
-    if (field.isEmpty()) {
-      return 0;
-    }
-    return parseInt(field);
-  }
-
-  private static long parseFieldAsLong(String field) {
-    if (field.isEmpty()) {
-      return 0L;
-    }
-    return parseLong(field);
-  }
-
-  public boolean isGreaterThanOrEqual(Version than) {
-    return this.compareTo(than) >= 0;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    Version version = (Version) o;
-    if (major != version.major) {
-      return false;
-    }
-    if (minor != version.minor) {
-      return false;
-    }
-    if (patch != version.patch) {
-      return false;
-    }
-    return buildNumber == version.buildNumber;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = major;
-    result = 31 * result + minor;
-    result = 31 * result + patch;
-    result = 31 * result + (int) (buildNumber ^ (buildNumber >>> 32));
-    return result;
-  }
-
-  @Override
-  public int compareTo(Version other) {
-    int c = major - other.major;
-    if (c == 0) {
-      c = minor - other.minor;
-      if (c == 0) {
-        c = patch - other.patch;
-        if (c == 0) {
-          long diff = buildNumber - other.buildNumber;
-          c = (diff > 0) ? 1 : ((diff < 0) ? -1 : 0);
-        }
-      }
-    }
-    return c;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append(major).append(SEQUENCE_SEPARATOR).append(minor);
-    if (patch > 0 || buildNumber > 0) {
-      sb.append(SEQUENCE_SEPARATOR).append(patch);
-      if (buildNumber > 0) {
-        sb.append(SEQUENCE_SEPARATOR).append(buildNumber);
-      }
-    }
-    if (!qualifier.isEmpty()) {
-      sb.append(QUALIFIER_SEPARATOR).append(qualifier);
-    }
-    return sb.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java
deleted file mode 100644 (file)
index 9b86562..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Implementation of Ant-style matching patterns.
- * Contrary to other implementations (like AntPathMatcher from Spring Framework) it is based on {@link Pattern Java Regular Expressions}.
- * To increase performance it holds an internal cache of all processed patterns.
- * <p>
- * Following rules are applied:
- * <ul>
- * <li>? matches single character</li>
- * <li>* matches zero or more characters</li>
- * <li>** matches zero or more 'directories'</li>
- * </ul>
- * <p>
- * Some examples of patterns:
- * <ul>
- * <li><code>org/T?st.java</code> - matches <code>org/Test.java</code> and also <code>org/Tost.java</code></li>
- * <li><code>org/*.java</code> - matches all <code>.java</code> files in the <code>org</code> directory,
- * e.g. <code>org/Foo.java</code> or <code>org/Bar.java</code></li>
- * <li><code>org/**</code> - matches all files underneath the <code>org</code> directory,
- * e.g. <code>org/Foo.java</code> or <code>org/foo/bar.jsp</code></li>
- * <li><code>org/&#42;&#42;/Test.java</code> - matches all <code>Test.java</code> files underneath the <code>org</code> directory,
- * e.g. <code>org/Test.java</code> or <code>org/foo/Test.java</code> or <code>org/foo/bar/Test.java</code></li>
- * <li><code>org/&#42;&#42;/*.java</code> - matches all <code>.java</code> files underneath the <code>org</code> directory,
- * e.g. <code>org/Foo.java</code> or <code>org/foo/Bar.java</code> or <code>org/foo/bar/Baz.java</code></li>
- * </ul>
- * <p>
- * Another implementation, which is also based on Java Regular Expressions, can be found in
- * <a href="https://github.com/JetBrains/intellij-community/blob/idea/107.743/platform/util/src/com/intellij/openapi/util/io/FileUtil.java#L847">FileUtil</a>
- * from IntelliJ OpenAPI.
- * 
- * @since 1.10
- */
-@ThreadSafe
-public class WildcardPattern {
-
-  private static final Map<String, WildcardPattern> CACHE = Collections.synchronizedMap(new HashMap<>());
-  private static final String SPECIAL_CHARS = "()[]^$.{}+|";
-
-  private Pattern pattern;
-  private String stringRepresentation;
-
-  protected WildcardPattern(String pattern, String directorySeparator) {
-    this.stringRepresentation = pattern;
-    this.pattern = Pattern.compile(toRegexp(pattern, directorySeparator));
-  }
-
-  private static String toRegexp(String antPattern, String directorySeparator) {
-    final String escapedDirectorySeparator = '\\' + directorySeparator;
-
-    final StringBuilder sb = new StringBuilder(antPattern.length());
-
-    sb.append('^');
-
-    int i = antPattern.startsWith("/") || antPattern.startsWith("\\") ? 1 : 0;
-    while (i < antPattern.length()) {
-      final char ch = antPattern.charAt(i);
-
-      if (SPECIAL_CHARS.indexOf(ch) != -1) {
-        // Escape regexp-specific characters
-        sb.append('\\').append(ch);
-      } else if (ch == '*') {
-        if (i + 1 < antPattern.length() && antPattern.charAt(i + 1) == '*') {
-          // Double asterisk
-          // Zero or more directories
-          if (i + 2 < antPattern.length() && isSlash(antPattern.charAt(i + 2))) {
-            sb.append("(?:.*").append(escapedDirectorySeparator).append("|)");
-            i += 2;
-          } else {
-            sb.append(".*");
-            i += 1;
-          }
-        } else {
-          // Single asterisk
-          // Zero or more characters excluding directory separator
-          sb.append("[^").append(escapedDirectorySeparator).append("]*?");
-        }
-      } else if (ch == '?') {
-        // Any single character excluding directory separator
-        sb.append("[^").append(escapedDirectorySeparator).append("]");
-      } else if (isSlash(ch)) {
-        // Directory separator
-        sb.append(escapedDirectorySeparator);
-      } else {
-        // Single character
-        sb.append(ch);
-      }
-
-      i++;
-    }
-
-    sb.append('$');
-
-    return sb.toString();
-  }
-
-  private static boolean isSlash(char ch) {
-    return ch == '/' || ch == '\\';
-  }
-
-  /**
-   * Returns string representation of this pattern.
-   * 
-   * @since 2.5
-   */
-  @Override
-  public String toString() {
-    return stringRepresentation;
-  }
-
-  /**
-   * Returns true if specified value matches this pattern.
-   */
-  public boolean match(String value) {
-    value = StringUtils.removeStart(value, "/");
-    value = StringUtils.removeEnd(value, "/");
-    return pattern.matcher(value).matches();
-  }
-
-  /**
-   * Returns true if specified value matches one of specified patterns.
-   * 
-   * @since 2.4
-   */
-  public static boolean match(WildcardPattern[] patterns, String value) {
-    for (WildcardPattern pattern : patterns) {
-      if (pattern.match(value)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Creates pattern with "/" as a directory separator.
-   * 
-   * @see #create(String, String)
-   */
-  public static WildcardPattern create(String pattern) {
-    return create(pattern, "/");
-  }
-
-  /**
-   * Creates array of patterns with "/" as a directory separator.
-   * 
-   * @see #create(String, String)
-   */
-  public static WildcardPattern[] create(@Nullable String[] patterns) {
-    if (patterns == null) {
-      return new WildcardPattern[0];
-    }
-    WildcardPattern[] exclusionPAtterns = new WildcardPattern[patterns.length];
-    for (int i = 0; i < patterns.length; i++) {
-      exclusionPAtterns[i] = create(patterns[i]);
-    }
-    return exclusionPAtterns;
-  }
-
-  /**
-   * Creates pattern with specified separator for directories.
-   * <p>
-   * This is used to match Java-classes, i.e. <code>org.foo.Bar</code> against <code>org/**</code>.
-   * <b>However usage of character other than "/" as a directory separator is misleading and should be avoided,
-   * so method {@link #create(String)} is preferred over this one.</b>
-   * 
-   * <p>
-   * Also note that no matter whether forward or backward slashes were used in the <code>antPattern</code>
-   * the returned pattern will use <code>directorySeparator</code>.
-   * Thus to match Windows-style path "dir\file.ext" against pattern "dir/file.ext" normalization should be performed.
-   * 
-   */
-  public static WildcardPattern create(String pattern, String directorySeparator) {
-    String key = pattern + directorySeparator;
-    return CACHE.computeIfAbsent(key, k -> new WildcardPattern(pattern, directorySeparator));
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java
deleted file mode 100644 (file)
index 14ada70..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Enumeration;
-import java.util.function.Predicate;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-
-/**
- * Utility to zip directories and unzip files.
- *
- * @since 1.10
- */
-public final class ZipUtils {
-
-  private static final String ERROR_CREATING_DIRECTORY = "Error creating directory: ";
-
-  private ZipUtils() {
-    // only static methods
-  }
-
-  /**
-   * Unzip a file into a directory. The directory is created if it does not exist.
-   *
-   * @return the target directory
-   */
-  public static File unzip(File zip, File toDir) throws IOException {
-    return unzip(zip, toDir, ze -> true);
-  }
-
-  public static File unzip(InputStream zip, File toDir) throws IOException {
-    return unzip(zip, toDir, ze -> true);
-  }
-
-  /**
-   * Unzip a file to a directory.
-   *
-   * @param stream the zip input file
-   * @param toDir  the target directory. It is created if needed.
-   * @param filter filter zip entries so that only a subset of directories/files can be
-   *               extracted to target directory.
-   * @return the parameter {@code toDir}
-   * @since 6.2
-   */
-  public static File unzip(InputStream stream, File toDir, Predicate<ZipEntry> filter) throws IOException {
-    if (!toDir.exists()) {
-      FileUtils.forceMkdir(toDir);
-    }
-
-    Path targetDirNormalizedPath = toDir.toPath().normalize();
-    try (ZipInputStream zipStream = new ZipInputStream(stream)) {
-      ZipEntry entry;
-      while ((entry = zipStream.getNextEntry()) != null) {
-        if (filter.test(entry)) {
-          unzipEntry(entry, zipStream, targetDirNormalizedPath);
-        }
-      }
-      return toDir;
-    }
-  }
-
-  private static void unzipEntry(ZipEntry entry, ZipInputStream zipStream, Path targetDirNormalized) throws IOException {
-    File to = targetDirNormalized.resolve(entry.getName()).toFile();
-    verifyInsideTargetDirectory(entry, to.toPath(), targetDirNormalized);
-
-    if (entry.isDirectory()) {
-      throwExceptionIfDirectoryIsNotCreatable(to);
-    } else {
-      File parent = to.getParentFile();
-      throwExceptionIfDirectoryIsNotCreatable(parent);
-      copy(zipStream, to);
-    }
-  }
-
-  private static void throwExceptionIfDirectoryIsNotCreatable(File to) throws IOException {
-    if (!to.exists() && !to.mkdirs()) {
-      throw new IOException(ERROR_CREATING_DIRECTORY + to);
-    }
-  }
-
-  /**
-   * Unzip a file to a directory.
-   *
-   * @param zip    the zip file. It must exist.
-   * @param toDir  the target directory. It is created if needed.
-   * @param filter filter zip entries so that only a subset of directories/files can be
-   *               extracted to target directory.
-   * @return the parameter {@code toDir}
-   * @since 6.2
-   */
-  public static File unzip(File zip, File toDir, Predicate<ZipEntry> filter) throws IOException {
-    if (!toDir.exists()) {
-      FileUtils.forceMkdir(toDir);
-    }
-
-    Path targetDirNormalizedPath = toDir.toPath().normalize();
-    try (ZipFile zipFile = new ZipFile(zip)) {
-      Enumeration<? extends ZipEntry> entries = zipFile.entries();
-      while (entries.hasMoreElements()) {
-        ZipEntry entry = entries.nextElement();
-        if (filter.test(entry)) {
-          File target = new File(toDir, entry.getName());
-
-          verifyInsideTargetDirectory(entry, target.toPath(), targetDirNormalizedPath);
-
-          if (entry.isDirectory()) {
-            throwExceptionIfDirectoryIsNotCreatable(target);
-          } else {
-            File parent = target.getParentFile();
-            throwExceptionIfDirectoryIsNotCreatable(parent);
-            copy(zipFile, entry, target);
-          }
-        }
-      }
-      return toDir;
-    }
-  }
-
-  private static void copy(ZipInputStream zipStream, File to) throws IOException {
-    try (OutputStream fos = new FileOutputStream(to)) {
-      IOUtils.copy(zipStream, fos);
-    }
-  }
-
-  private static void copy(ZipFile zipFile, ZipEntry entry, File to) throws IOException {
-    try (InputStream input = zipFile.getInputStream(entry); OutputStream fos = new FileOutputStream(to)) {
-      IOUtils.copy(input, fos);
-    }
-  }
-
-  public static void zipDir(File dir, File zip) throws IOException {
-    try (OutputStream out = Files.newOutputStream(zip.toPath());
-         ZipOutputStream zout = new ZipOutputStream(out)) {
-      doZipDir(dir, zout);
-    }
-  }
-
-  private static void doZip(String entryName, InputStream in, ZipOutputStream out) throws IOException {
-    ZipEntry entry = new ZipEntry(entryName);
-    out.putNextEntry(entry);
-    IOUtils.copy(in, out);
-    out.closeEntry();
-  }
-
-  private static void doZip(String entryName, File file, ZipOutputStream out) throws IOException {
-    if (file.isDirectory()) {
-      entryName += "/";
-      ZipEntry entry = new ZipEntry(entryName);
-      out.putNextEntry(entry);
-      out.closeEntry();
-      File[] files = file.listFiles();
-      // java.io.File#listFiles() returns null if object is a directory (not possible here) or if
-      // an I/O error occurs (weird!)
-      if (files == null) {
-        throw new IllegalStateException("Fail to list files of directory " + file.getAbsolutePath());
-      }
-      for (File f : files) {
-        doZip(entryName + f.getName(), f, out);
-      }
-
-    } else {
-      try (InputStream in = new BufferedInputStream(new FileInputStream(file))) {
-        doZip(entryName, in, out);
-      }
-    }
-  }
-
-  private static void doZipDir(File dir, ZipOutputStream out) throws IOException {
-    File[] children = dir.listFiles();
-    if (children == null) {
-      throw new IllegalStateException("Fail to list files of directory " + dir.getAbsolutePath());
-    }
-    for (File child : children) {
-      doZip(child.getName(), child, out);
-    }
-  }
-
-  private static void verifyInsideTargetDirectory(ZipEntry entry, Path entryPath, Path targetDirNormalizedPath) {
-    if (!entryPath.normalize().startsWith(targetDirNormalizedPath)) {
-      // vulnerability - trying to create a file outside the target directory
-      throw new IllegalStateException("Unzipping an entry outside the target directory is not allowed: " + entry.getName());
-    }
-  }
-
-  /**
-   * @see #unzip(File, File, Predicate)
-   * @deprecated replaced by {@link Predicate<ZipEntry>} in 6.2.
-   */
-  @Deprecated
-  @FunctionalInterface
-  public interface ZipEntryFilter {
-    boolean accept(ZipEntry entry);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/Command.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/Command.java
deleted file mode 100644 (file)
index 5145ef4..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.utils.System2;
-
-import static java.util.Collections.unmodifiableList;
-import static java.util.Collections.unmodifiableMap;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 2.7
- */
-public class Command {
-  private final String executable;
-  private final List<String> arguments = new ArrayList<>();
-  private final List<String> argumentsForLogs = new ArrayList<>();
-  private final Map<String, String> env;
-  private File directory;
-  private boolean newShell = false;
-  private final System2 system;
-
-  Command(String executable, System2 system) {
-    checkArgument(!StringUtils.isBlank(executable), "Command executable can not be blank");
-    this.executable = executable;
-    this.env = new HashMap<>(system.envVariables());
-    this.system = system;
-  }
-
-  /**
-   * Create a command line without any arguments
-   *
-   * @param executable
-   */
-  public static Command create(String executable) {
-    return new Command(executable, System2.INSTANCE);
-  }
-
-  public String getExecutable() {
-    return executable;
-  }
-
-  public List<String> getArguments() {
-    return unmodifiableList(arguments);
-  }
-
-  public Command addArgument(String arg) {
-    arguments.add(arg);
-    argumentsForLogs.add(arg);
-    return this;
-  }
-
-  public Command addMaskedArgument(String arg) {
-    arguments.add(arg);
-    argumentsForLogs.add("********");
-    return this;
-  }
-
-  public Command addArguments(List<String> args) {
-    arguments.addAll(args);
-    argumentsForLogs.addAll(args);
-    return this;
-  }
-
-  public Command addArguments(String[] args) {
-    Collections.addAll(arguments, args);
-    Collections.addAll(argumentsForLogs, args);
-    return this;
-  }
-
-  public File getDirectory() {
-    return directory;
-  }
-
-  /**
-   * Sets working directory.
-   */
-  public Command setDirectory(File d) {
-    this.directory = d;
-    return this;
-  }
-
-  /**
-   * @see org.sonar.api.utils.command.Command#getEnvironmentVariables()
-   * @since 3.2
-   */
-  public Command setEnvironmentVariable(String name, String value) {
-    this.env.put(name, value);
-    return this;
-  }
-
-  /**
-   * Environment variables that are propagated during command execution.
-   * The initial value is a copy of the environment of the current process.
-   *
-   * @return a non-null and immutable map of variables
-   * @since 3.2
-   */
-  public Map<String, String> getEnvironmentVariables() {
-    return unmodifiableMap(env);
-  }
-
-  /**
-   * <code>true</code> if a new shell should be used to execute the command.
-   * The default behavior is to not use a new shell.
-   *
-   * @since 3.3
-   */
-  public boolean isNewShell() {
-    return newShell;
-  }
-
-  /**
-   * Set to <code>true</code> if a new shell should be used to execute the command.
-   * This is useful when the executed command is a script with no execution rights (+x on unix).
-   * On windows, the command will be executed with <code>cmd /C executable</code>.
-   * On other platforms, the command will be executed with <code>sh executable</code>.
-   *
-   * @since 3.3
-   */
-  public Command setNewShell(boolean b) {
-    this.newShell = b;
-    return this;
-  }
-
-  List<String> toStrings(boolean forLogs) {
-    List<String> command = new ArrayList<>();
-    if (newShell) {
-      if (system.isOsWindows()) {
-        command.add("cmd");
-        command.add("/C");
-        command.add("call");
-      } else {
-        command.add("sh");
-      }
-    }
-    command.add(executable);
-    command.addAll(forLogs ? argumentsForLogs : arguments);
-    return unmodifiableList(command);
-  }
-
-  public String toCommandLine() {
-    return String.join(" ", toStrings(false));
-  }
-
-  @Override
-  public String toString() {
-    return String.join(" ", toStrings(true));
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java
deleted file mode 100644 (file)
index e971e20..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-public class CommandException extends RuntimeException {
-
-  private final transient Command command;
-
-  public CommandException(Command command, String message, Throwable throwable) {
-    super(message + " [command: " + command + "]", throwable);
-    this.command = command;
-  }
-
-  public CommandException(Command command, Throwable throwable) {
-    super(throwable);
-    this.command = command;
-  }
-
-  public Command getCommand() {
-    return command;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/CommandExecutor.java
deleted file mode 100644 (file)
index 0c625bb..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
-import org.apache.commons.io.IOUtils;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-/**
- * Synchronously execute a native command line. It's much more limited than the Apache Commons Exec library.
- * For example it does not allow to run asynchronously or to automatically quote command-line arguments.
- *
- * @since 2.7
- */
-public class CommandExecutor {
-
-  private static final Logger LOG = Loggers.get(CommandExecutor.class);
-
-  private static final CommandExecutor INSTANCE = new CommandExecutor();
-
-  private CommandExecutor() {
-  }
-
-  public static CommandExecutor create() {
-    // stateless object, so a single singleton can be shared
-    return INSTANCE;
-  }
-
-  /**
-   * @throws org.sonar.api.utils.command.TimeoutException on timeout, since 4.4
-   * @throws CommandException on any other error
-   * @param timeoutMilliseconds any negative value means no timeout.
-   * @since 3.0
-   */
-  public int execute(Command command, StreamConsumer stdOut, StreamConsumer stdErr, long timeoutMilliseconds) {
-    ExecutorService executorService = null;
-    Process process = null;
-    StreamGobbler outputGobbler = null;
-    StreamGobbler errorGobbler = null;
-    try {
-      ProcessBuilder builder = new ProcessBuilder(command.toStrings(false));
-      if (command.getDirectory() != null) {
-        builder.directory(command.getDirectory());
-      }
-      builder.environment().putAll(command.getEnvironmentVariables());
-      process = builder.start();
-
-      outputGobbler = new StreamGobbler(process.getInputStream(), stdOut);
-      errorGobbler = new StreamGobbler(process.getErrorStream(), stdErr);
-      outputGobbler.start();
-      errorGobbler.start();
-
-      executorService = Executors.newSingleThreadExecutor();
-      Future<Integer> ft = executorService.submit((Callable<Integer>) process::waitFor);
-      int exitCode;
-      if (timeoutMilliseconds < 0) {
-        exitCode = ft.get();
-      } else {
-        exitCode = ft.get(timeoutMilliseconds, TimeUnit.MILLISECONDS);
-      }
-      waitUntilFinish(outputGobbler);
-      waitUntilFinish(errorGobbler);
-      verifyGobbler(command, outputGobbler, "stdOut");
-      verifyGobbler(command, errorGobbler, "stdErr");
-      return exitCode;
-
-    } catch (java.util.concurrent.TimeoutException te) {
-      throw new TimeoutException(command, "Timeout exceeded: " + timeoutMilliseconds + " ms", te);
-
-    } catch (CommandException e) {
-      throw e;
-
-    } catch (Exception e) {
-      throw new CommandException(command, e);
-
-    } finally {
-      if (process != null) {
-        process.destroy();
-      }
-      waitUntilFinish(outputGobbler);
-      waitUntilFinish(errorGobbler);
-      closeStreams(process);
-
-      if (executorService != null) {
-        executorService.shutdown();
-      }
-    }
-  }
-
-  private static void verifyGobbler(Command command, StreamGobbler gobbler, String type) {
-    if (gobbler.getException() != null) {
-      throw new CommandException(command, "Error inside " + type + " stream", gobbler.getException());
-    }
-  }
-
-  /**
-   * Execute command and display error and output streams in log.
-   * Method {@link #execute(Command, StreamConsumer, StreamConsumer, long)} is preferable,
-   * when fine-grained control of output of command required.
-   * @param timeoutMilliseconds any negative value means no timeout.
-   *
-   * @throws CommandException
-   */
-  public int execute(Command command, long timeoutMilliseconds) {
-    LOG.info("Executing command: " + command);
-    return execute(command, new DefaultConsumer(), new DefaultConsumer(), timeoutMilliseconds);
-  }
-
-  private static void closeStreams(@Nullable Process process) {
-    if (process != null) {
-      IOUtils.closeQuietly(process.getInputStream());
-      IOUtils.closeQuietly(process.getOutputStream());
-      IOUtils.closeQuietly(process.getErrorStream());
-    }
-  }
-
-  private static void waitUntilFinish(@Nullable StreamGobbler thread) {
-    if (thread != null) {
-      try {
-        thread.join();
-      } catch (InterruptedException e) {
-        // considered as finished, restore the interrupted flag
-        Thread.currentThread().interrupt();
-      }
-    }
-  }
-
-  private static class StreamGobbler extends Thread {
-    private final InputStream is;
-    private final StreamConsumer consumer;
-    private volatile Exception exception;
-
-    StreamGobbler(InputStream is, StreamConsumer consumer) {
-      super("ProcessStreamGobbler");
-      this.is = is;
-      this.consumer = consumer;
-    }
-
-    @Override
-    public void run() {
-      try (BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
-        String line;
-        while ((line = br.readLine()) != null) {
-          consumeLine(line);
-        }
-      } catch (IOException ioe) {
-        exception = ioe;
-      }
-    }
-
-    private void consumeLine(String line) {
-      if (exception == null) {
-        try {
-          consumer.consumeLine(line);
-        } catch (Exception e) {
-          exception = e;
-        }
-      }
-    }
-
-    public Exception getException() {
-      return exception;
-    }
-  }
-
-  private static class DefaultConsumer implements StreamConsumer {
-    @Override
-    public void consumeLine(String line) {
-      LOG.info(line);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StreamConsumer.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StreamConsumer.java
deleted file mode 100644 (file)
index 358730b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-@FunctionalInterface
-public interface StreamConsumer {
-
-  void consumeLine(String line);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StringStreamConsumer.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/StringStreamConsumer.java
deleted file mode 100644 (file)
index 959c914..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-/**
- * @since 5.0
- */
-public class StringStreamConsumer implements StreamConsumer {
-  private StringBuilder string = new StringBuilder();
-
-  private String ls = System.getProperty("line.separator");
-
-  @Override
-  public void consumeLine(String line) {
-    string.append(line + ls);
-  }
-
-  public String getOutput() {
-    return string.toString();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/TimeoutException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/TimeoutException.java
deleted file mode 100644 (file)
index 9a0875c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-/**
- * Unchecked version of {@link java.util.concurrent.TimeoutException}
- *
- * @since 4.4
- */
-public class TimeoutException extends CommandException {
-
-  public TimeoutException(Command command, String message, Throwable throwable) {
-    super(command, message, throwable);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/command/package-info.java
deleted file mode 100644 (file)
index 8b65899..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java
deleted file mode 100644 (file)
index 6d0f824..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.dag;
-
-import org.sonar.api.utils.SonarException;
-
-/**
- * @since 1.10
- */
-public class CyclicDependenciesException extends SonarException {
-  public CyclicDependenciesException(String s) {
-    super(s);
-  }
-}
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/DirectAcyclicGraph.java
deleted file mode 100644 (file)
index 07e1776..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.dag;
-
-import org.sonar.api.utils.SonarException;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph">http://en.wikipedia.org/wiki/Directed_acyclic_graph</a>
- *
- * @since 1.10
- */
-public class DirectAcyclicGraph {
-
-  private Map<Object, Node> registeredObjects = new HashMap<>();
-  private List<Node> nodes = new ArrayList<>();
-
-  public DirectAcyclicGraph(Object... objects) {
-    for (Object object : objects) {
-      add(object);
-    }
-  }
-
-  public Node add(Object object, Object... dependencies) {
-    Node node = registeredObjects.get(object);
-    if (node == null) {
-      node = new Node(object);
-      nodes.add(node);
-      registeredObjects.put(object, node);
-    }
-
-    for (Object dependency : dependencies) {
-      Node depNode = add(dependency);
-      node.addDependency(depNode);
-    }
-    return node;
-  }
-
-  public List sort() {
-    sortNodes();
-
-    List<Object> result = new ArrayList<>();
-    for (Node node : nodes) {
-      result.add(node.getObject());
-    }
-    return result;
-  }
-
-  private List<Node> sortNodes() {
-    verify();
-    Collections.sort(nodes);
-    return nodes;
-  }
-
-  private void verify() {
-    for (Node node : nodes) {
-      node.reset();
-    }
-
-    for (Node node : nodes) {
-      for (Node dep : node.getDependencies()) {
-        if (!nodes.contains(dep)) {
-          throw new SonarException("A dependent node (" + dep + ") of "
-              + " (" + node + ") was not included in the nodes list.");
-        }
-      }
-
-      node.resolveOrder();
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/Node.java
deleted file mode 100644 (file)
index 9410661..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.dag;
-
-import org.sonar.api.utils.SonarException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @since 1.10
- */
-public class Node implements Comparable<Node> {
-
-  private final Object object;
-  private int order = 0;
-  private boolean seen = false;
-  private final List<Node> dependencies = new ArrayList<>();
-
-  public Node(final Object object) {
-    if (object == null) {
-      throw new SonarException("object can not be null");
-    }
-    this.object = object;
-  }
-
-  public void reset() {
-    order = 0;
-    seen = false;
-  }
-
-  public Object getObject() {
-    return object;
-  }
-
-  public void addDependency(Node v) {
-    if (!equals(v) && !dependencies.contains(v)) {
-      dependencies.add(v);
-    }
-  }
-
-  public void resolveOrder() {
-    resolveOrder(toString());
-  }
-
-  private int resolveOrder(String path) {
-    seen = true;
-    try {
-      int highOrder = -1;
-      for (Node dep : dependencies) {
-        if (dep.seen) {
-          throw new CyclicDependenciesException(path + " -> " + dep.toString());
-        }
-        highOrder = Math.max(highOrder, dep.resolveOrder(path + " -> " + dep.toString()));
-
-      }
-
-      order = highOrder + 1;
-      return order;
-
-    } finally {
-      seen = false;
-    }
-  }
-
-  public List<Node> getDependencies() {
-    return dependencies;
-  }
-
-  @Override
-  public int compareTo(final Node other) {
-    int orderInd = 0;
-
-    if (order < other.order) {
-      orderInd = -1;
-    } else if (order > other.order) {
-      orderInd = 1;
-    }
-
-    return orderInd;
-  }
-
-  @Override
-  public String toString() {
-    return object.toString();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (!(o instanceof Node)) {
-      return false;
-    }
-    return object.equals(((Node) o).getObject());
-  }
-
-  @Override
-  public int hashCode() {
-    return object.hashCode();
-  }
-}
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/dag/package-info.java
deleted file mode 100644 (file)
index 30ee5b4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.dag;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/AbstractLogTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/AbstractLogTester.java
deleted file mode 100644 (file)
index 0dfd803..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.List;
-
-class AbstractLogTester<G extends AbstractLogTester> {
-
-  protected void before() {
-    // this shared instance breaks compatibility with parallel execution of tests
-    LogInterceptors.set(new ListInterceptor());
-    setLevel(LoggerLevel.INFO);
-  }
-
-  protected void after() {
-    LogInterceptors.set(NullInterceptor.NULL_INSTANCE);
-    setLevel(LoggerLevel.INFO);
-  }
-
-  LoggerLevel getLevel() {
-    return Loggers.getFactory().getLevel();
-  }
-
-  /**
-   * Enable/disable debug logs. Info, warn and error logs are always enabled.
-   * By default INFO logs are enabled when LogTester is started.
-   */
-  public G setLevel(LoggerLevel level) {
-    Loggers.getFactory().setLevel(level);
-    return (G) this;
-  }
-
-  /**
-   * Logs in chronological order (item at index 0 is the oldest one)
-   */
-  public List<String> logs() {
-    return ((ListInterceptor) LogInterceptors.get()).logs();
-  }
-
-  /**
-   * Logs in chronological order (item at index 0 is the oldest one) for
-   * a given level
-   */
-  public List<String> logs(LoggerLevel level) {
-    return ((ListInterceptor) LogInterceptors.get()).logs(level);
-  }
-
-  /**
-   * Logs with arguments in chronological order (item at index 0 is the oldest one)
-   */
-  public List<LogAndArguments> getLogs() {
-    return ((ListInterceptor) LogInterceptors.get()).getLogs();
-  }
-
-  /**
-   * Logs with arguments in chronological order (item at index 0 is the oldest one) for
-   * a given level
-   */
-  public List<LogAndArguments> getLogs(LoggerLevel level) {
-    return ((ListInterceptor) LogInterceptors.get()).getLogs(level);
-  }
-
-  public G clear() {
-    ((ListInterceptor) LogInterceptors.get()).clear();
-    return (G) this;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/BaseLogger.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/BaseLogger.java
deleted file mode 100644 (file)
index fb00d2a..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import javax.annotation.Nullable;
-
-abstract class BaseLogger implements Logger {
-  @Override
-  public void trace(String msg) {
-    LogInterceptors.get().log(LoggerLevel.TRACE, msg);
-    doTrace(msg);
-  }
-
-  @Override
-  public void trace(String pattern, @Nullable Object arg) {
-    LogInterceptors.get().log(LoggerLevel.TRACE, pattern, arg);
-    doTrace(pattern, arg);
-  }
-
-  @Override
-  public void trace(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    LogInterceptors.get().log(LoggerLevel.TRACE, msg, arg1, arg2);
-    doTrace(msg, arg1, arg2);
-  }
-
-  @Override
-  public void trace(String msg, Object... args) {
-    LogInterceptors.get().log(LoggerLevel.TRACE, msg, args);
-    doTrace(msg, args);
-  }
-
-  @Override
-  public void debug(String msg) {
-    LogInterceptors.get().log(LoggerLevel.DEBUG, msg);
-    doDebug(msg);
-  }
-
-  @Override
-  public void debug(String pattern, @Nullable Object arg) {
-    LogInterceptors.get().log(LoggerLevel.DEBUG, pattern, arg);
-    doDebug(pattern, arg);
-  }
-
-  @Override
-  public void debug(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    LogInterceptors.get().log(LoggerLevel.DEBUG, msg, arg1, arg2);
-    doDebug(msg, arg1, arg2);
-  }
-
-  @Override
-  public void debug(String msg, Object... args) {
-    LogInterceptors.get().log(LoggerLevel.DEBUG, msg, args);
-    doDebug(msg, args);
-  }
-
-  @Override
-  public void info(String msg) {
-    LogInterceptors.get().log(LoggerLevel.INFO, msg);
-    doInfo(msg);
-  }
-
-  @Override
-  public void info(String msg, @Nullable Object arg) {
-    LogInterceptors.get().log(LoggerLevel.INFO, msg, arg);
-    doInfo(msg, arg);
-  }
-
-  @Override
-  public void info(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    LogInterceptors.get().log(LoggerLevel.INFO, msg, arg1, arg2);
-    doInfo(msg, arg1, arg2);
-  }
-
-  @Override
-  public void info(String msg, Object... args) {
-    LogInterceptors.get().log(LoggerLevel.INFO, msg, args);
-    doInfo(msg, args);
-  }
-
-  @Override
-  public void warn(String msg) {
-    LogInterceptors.get().log(LoggerLevel.WARN, msg);
-    doWarn(msg);
-  }
-
-  @Override
-  public void warn(String msg, Throwable throwable) {
-    LogInterceptors.get().log(LoggerLevel.WARN, msg, throwable);
-    doWarn(msg, throwable);
-  }
-
-  @Override
-  public void warn(String msg, @Nullable Object arg) {
-    LogInterceptors.get().log(LoggerLevel.WARN, msg, arg);
-    doWarn(msg, arg);
-  }
-
-  @Override
-  public void warn(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    LogInterceptors.get().log(LoggerLevel.WARN, msg, arg1, arg2);
-    doWarn(msg, arg1, arg2);
-  }
-
-  @Override
-  public void warn(String msg, Object... args) {
-    LogInterceptors.get().log(LoggerLevel.WARN, msg, args);
-    doWarn(msg, args);
-  }
-
-  @Override
-  public void error(String msg) {
-    LogInterceptors.get().log(LoggerLevel.ERROR, msg);
-    doError(msg);
-  }
-
-  @Override
-  public void error(String msg, @Nullable Object arg) {
-    LogInterceptors.get().log(LoggerLevel.ERROR, msg, arg);
-    doError(msg, arg);
-  }
-
-  @Override
-  public void error(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    LogInterceptors.get().log(LoggerLevel.ERROR, msg, arg1, arg2);
-    doError(msg, arg1, arg2);
-  }
-
-  @Override
-  public void error(String msg, Object... args) {
-    LogInterceptors.get().log(LoggerLevel.ERROR, msg, args);
-    doError(msg, args);
-  }
-
-  @Override
-  public void error(String msg, Throwable thrown) {
-    LogInterceptors.get().log(LoggerLevel.ERROR, msg, thrown);
-    doError(msg, thrown);
-  }
-
-  abstract void doTrace(String msg);
-
-  abstract void doTrace(String msg, @Nullable Object arg);
-
-  abstract void doTrace(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  abstract void doTrace(String msg, Object... args);
-
-  abstract void doDebug(String msg);
-
-  abstract void doDebug(String msg, @Nullable Object arg);
-
-  abstract void doDebug(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  abstract void doDebug(String msg, Object... args);
-
-  abstract void doInfo(String msg);
-
-  abstract void doInfo(String msg, @Nullable Object arg);
-
-  abstract void doInfo(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  abstract void doInfo(String msg, Object... args);
-
-  abstract void doWarn(String msg);
-
-  abstract void doWarn(String msg, Throwable thrown);
-
-  abstract void doWarn(String msg, @Nullable Object arg);
-
-  abstract void doWarn(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  abstract void doWarn(String msg, Object... args);
-
-  abstract void doError(String msg);
-
-  abstract void doError(String msg, @Nullable Object arg);
-
-  abstract void doError(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  abstract void doError(String msg, Object... args);
-
-  abstract void doError(String msg, Throwable thrown);
-
-  void log(LoggerLevel level, String msg) {
-    switch (level) {
-      case TRACE:
-        trace(msg);
-        break;
-      case DEBUG:
-        debug(msg);
-        break;
-      case INFO:
-        info(msg);
-        break;
-      case WARN:
-        warn(msg);
-        break;
-      case ERROR:
-        error(msg);
-        break;
-      default:
-        throw new IllegalArgumentException("Unsupported LoggerLevel value: " + level);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleFormatter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleFormatter.java
deleted file mode 100644 (file)
index 1af506d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.Objects;
-
-class ConsoleFormatter {
-
-  private ConsoleFormatter() {
-    // only static methods
-  }
-
-  static String format(String pattern, Object... args) {
-    String result = pattern;
-    for (Object arg : args) {
-      result = StringUtils.replaceOnce(result, "{}", Objects.toString(arg));
-    }
-    return result;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLogger.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLogger.java
deleted file mode 100644 (file)
index 84a5a40..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.io.PrintStream;
-import javax.annotation.Nullable;
-
-import static org.sonar.api.utils.log.ConsoleFormatter.format;
-
-/**
- * Slow implementation based on {@link java.lang.System#out}. It is not production-ready and it must be used
- * only for the tests that do not have logback dependency.
- * <br>Implementation of message patterns is naive. It does not support escaped '{' and '}'
- * arguments.
- */
-class ConsoleLogger extends BaseLogger {
-
-  private final PrintStream stream;
-
-  ConsoleLogger() {
-    this.stream = System.out;
-  }
-
-  ConsoleLogger(PrintStream stream) {
-    this.stream = stream;
-  }
-
-  @Override
-  public boolean isTraceEnabled() {
-    return Loggers.getFactory().getLevel() == LoggerLevel.TRACE;
-  }
-
-  @Override
-  protected void doTrace(String msg) {
-    if (isTraceEnabled()) {
-      log("TRACE", msg);
-    }
-  }
-
-  @Override
-  protected void doTrace(String pattern, @Nullable Object arg) {
-    if (isTraceEnabled()) {
-      doTrace(format(pattern, arg));
-    }
-  }
-
-  @Override
-  protected void doTrace(String pattern, @Nullable Object arg1, @Nullable Object arg2) {
-    if (isTraceEnabled()) {
-      doTrace(format(pattern, arg1, arg2));
-    }
-  }
-
-  @Override
-  protected void doTrace(String pattern, Object... args) {
-    if (isTraceEnabled()) {
-      doTrace(format(pattern, args));
-    }
-  }
-
-  @Override
-  public boolean isDebugEnabled() {
-    LoggerLevel level = Loggers.getFactory().getLevel();
-    return level == LoggerLevel.TRACE || level == LoggerLevel.DEBUG;
-  }
-
-  @Override
-  protected void doDebug(String msg) {
-    if (isDebugEnabled()) {
-      log("DEBUG", msg);
-    }
-  }
-
-  @Override
-  protected void doDebug(String pattern, @Nullable Object arg) {
-    if (isDebugEnabled()) {
-      doDebug(format(pattern, arg));
-    }
-  }
-
-  @Override
-  protected void doDebug(String pattern, @Nullable Object arg1, @Nullable Object arg2) {
-    if (isDebugEnabled()) {
-      doDebug(format(pattern, arg1, arg2));
-    }
-  }
-
-  @Override
-  protected void doDebug(String pattern, Object... args) {
-    if (isDebugEnabled()) {
-      doDebug(format(pattern, args));
-    }
-  }
-
-  @Override
-  protected void doInfo(String msg) {
-    log("INFO ", msg);
-  }
-
-  @Override
-  protected void doInfo(String pattern, @Nullable Object arg) {
-    doInfo(format(pattern, arg));
-  }
-
-  @Override
-  protected void doInfo(String pattern, @Nullable Object arg1, @Nullable Object arg2) {
-    doInfo(format(pattern, arg1, arg2));
-  }
-
-  @Override
-  protected void doInfo(String pattern, Object... args) {
-    doInfo(format(pattern, args));
-  }
-
-  @Override
-  protected void doWarn(String msg) {
-    log("WARN ", msg);
-  }
-
-  @Override
-  void doWarn(String msg, Throwable thrown) {
-    doWarn(msg);
-    thrown.printStackTrace();
-  }
-
-  @Override
-  protected void doWarn(String pattern, @Nullable Object arg) {
-    doWarn(format(pattern, arg));
-  }
-
-  @Override
-  protected void doWarn(String pattern, @Nullable Object arg1, @Nullable Object arg2) {
-    doWarn(format(pattern, arg1, arg2));
-  }
-
-  @Override
-  protected void doWarn(String pattern, Object... args) {
-    doWarn(format(pattern, args));
-  }
-
-  @Override
-  protected void doError(String msg) {
-    log("ERROR", msg);
-  }
-
-  @Override
-  protected void doError(String pattern, @Nullable Object arg) {
-    doError(format(pattern, arg));
-  }
-
-  @Override
-  protected void doError(String pattern, @Nullable Object arg1, @Nullable Object arg2) {
-    doError(format(pattern, arg1, arg2));
-  }
-
-  @Override
-  protected void doError(String pattern, Object... args) {
-    doError(format(pattern, args));
-  }
-
-  @Override
-  public void doError(String msg, Throwable thrown) {
-    doError(msg);
-    thrown.printStackTrace();
-  }
-
-  @Override
-  public boolean setLevel(LoggerLevel level) {
-    return false;
-  }
-
-  @Override
-  public LoggerLevel getLevel() {
-    return Loggers.getFactory().getLevel();
-  }
-
-  private void log(String level, String msg) {
-    this.stream.println(String.format("%s %s", level, msg));
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLoggers.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ConsoleLoggers.java
deleted file mode 100644 (file)
index b7b92db..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-class ConsoleLoggers extends Loggers {
-
-  private LoggerLevel level = LoggerLevel.INFO;
-
-  @Override
-  protected Logger newInstance(String name) {
-    return new ConsoleLogger();
-  }
-
-  @Override
-  protected LoggerLevel getLevel() {
-    return level;
-  }
-
-  @Override
-  protected void setLevel(LoggerLevel level) {
-    this.level = level;
-  }
-
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java
deleted file mode 100644 (file)
index 8b234ae..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.utils.System2;
-
-import javax.annotation.Nullable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-class DefaultProfiler extends Profiler {
-
-  private static final String CONTEXT_SEPARATOR = " | ";
-  private static final String DONE_SUFFIX = " (done)";
-
-  private final LinkedHashMap<String, Object> context = new LinkedHashMap<>();
-  private final BaseLogger logger;
-
-  private long startTime = 0L;
-  private String startMessage = null;
-
-  public DefaultProfiler(BaseLogger logger) {
-    this.logger = logger;
-  }
-
-  @Override
-  public boolean isDebugEnabled() {
-    return logger.isDebugEnabled();
-  }
-
-  @Override
-  public boolean isTraceEnabled() {
-    return logger.isTraceEnabled();
-  }
-
-  @Override
-  public Profiler start() {
-    this.startTime = System2.INSTANCE.now();
-    this.startMessage = null;
-    return this;
-  }
-
-  @Override
-  public Profiler startTrace(String message) {
-    this.startTime = System2.INSTANCE.now();
-    this.startMessage = message;
-    StringBuilder sb = new StringBuilder();
-    sb.append(message);
-    appendContext(sb);
-    logger.trace(sb.toString());
-    return this;
-  }
-
-  @Override
-  public Profiler startDebug(String message) {
-    this.startTime = System2.INSTANCE.now();
-    this.startMessage = message;
-    StringBuilder sb = new StringBuilder();
-    sb.append(message);
-    appendContext(sb);
-    logger.debug(sb.toString());
-    return this;
-  }
-
-  @Override
-  public Profiler startInfo(String message) {
-    this.startTime = System2.INSTANCE.now();
-    this.startMessage = message;
-    StringBuilder sb = new StringBuilder();
-    sb.append(message);
-    appendContext(sb);
-    logger.info(sb.toString());
-    return this;
-  }
-
-
-  @Override
-  public Profiler stopTrace() {
-    return doStopWithoutMessage(LoggerLevel.TRACE, DONE_SUFFIX);
-  }
-
-  @Override
-  public Profiler stopDebug() {
-    return doStopWithoutMessage(LoggerLevel.DEBUG, DONE_SUFFIX);
-  }
-
-  @Override
-  public Profiler stopInfo() {
-    return stopInfo(false);
-  }
-  
-
-  @Override
-  public Profiler stopInfo(boolean cacheUsed) {
-    String suffix = cacheUsed ? " (done from cache)" : DONE_SUFFIX;
-    return doStopWithoutMessage(LoggerLevel.INFO, suffix);
-  }
-
-  private Profiler doStopWithoutMessage(LoggerLevel level, String suffix) {
-    if (startMessage == null) {
-      throw new IllegalStateException("Profiler#stopXXX() can't be called without any message defined in start methods");
-    }
-    doStop(level, startMessage, suffix);
-    return this;
-  }
-
-  @Override
-  public Profiler stopTrace(String message) {
-    doStop(LoggerLevel.TRACE, message, "");
-    return this;
-  }
-
-  @Override
-  public Profiler stopDebug(String message) {
-    doStop(LoggerLevel.DEBUG, message, "");
-    return this;
-  }
-
-  @Override
-  public Profiler stopInfo(String message) {
-    doStop(LoggerLevel.INFO, message, "");
-    return this;
-  }
-
-  private void doStop(LoggerLevel level, @Nullable String message, String messageSuffix) {
-    if (startTime == 0L) {
-      throw new IllegalStateException("Profiler must be started before being stopped");
-    }
-    long duration = System2.INSTANCE.now() - startTime;
-    StringBuilder sb = new StringBuilder();
-    if (!StringUtils.isEmpty(message)) {
-      sb.append(message);
-      sb.append(messageSuffix);
-      sb.append(CONTEXT_SEPARATOR);
-    }
-    sb.append("time=").append(duration).append("ms");
-    appendContext(sb);
-    logger.log(level, sb.toString());
-    startTime = 0L;
-    startMessage = null;
-    context.clear();
-  }
-
-  private void appendContext(StringBuilder sb) {
-    for (Map.Entry<String, Object> entry : context.entrySet()) {
-      if (sb.length() > 0) {
-        sb.append(CONTEXT_SEPARATOR);
-      }
-      sb.append(entry.getKey()).append("=").append(entry.getValue());
-    }
-  }
-
-  @Override
-  public Profiler addContext(String key, @Nullable Object value) {
-    if (value == null) {
-      context.remove(key);
-    } else {
-      context.put(key, value);
-    }
-    return this;
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ListInterceptor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/ListInterceptor.java
deleted file mode 100644 (file)
index 150d1fc..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.stream.Collectors;
-import javax.annotation.Nullable;
-
-public class ListInterceptor implements LogInterceptor {
-
-  private final List<LogAndArguments> logs = new CopyOnWriteArrayList<>();
-  private final Map<LoggerLevel, List<LogAndArguments>> logsByLevel = new ConcurrentHashMap<>();
-
-  @Override
-  public void log(LoggerLevel level, String msg) {
-    LogAndArguments l = new LogAndArguments(msg, msg);
-    add(level, l);
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, @Nullable Object arg) {
-    String s = ConsoleFormatter.format(msg, arg);
-    LogAndArguments l = new LogAndArguments(s, msg, arg);
-    add(level, l);
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    String s = ConsoleFormatter.format(msg, arg1, arg2);
-    LogAndArguments l = new LogAndArguments(s, msg, arg1, arg2);
-    add(level, l);
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Object... args) {
-    String s = ConsoleFormatter.format(msg, args);
-    LogAndArguments l = new LogAndArguments(s, msg, args);
-    add(level, l);
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Throwable thrown) {
-    LogAndArguments l = new LogAndArguments(msg, msg, thrown);
-    add(level, l);
-  }
-
-  private void add(LoggerLevel level, LogAndArguments l) {
-    logs.add(l);
-    logsByLevel.compute(level, (key, existingList) -> {
-      if (existingList == null) {
-        return new CopyOnWriteArrayList<>(new LogAndArguments[] {l});
-      }
-      existingList.add(l);
-      return existingList;
-    });
-  }
-
-  public List<String> logs() {
-    return logs.stream().map(LogAndArguments::getFormattedMsg).collect(Collectors.toList());
-  }
-
-  public List<String> logs(LoggerLevel level) {
-    List<LogAndArguments> res = logsByLevel.get(level);
-    if (res == null) {
-      return Collections.emptyList();
-    }
-    return res.stream().map(LogAndArguments::getFormattedMsg).collect(Collectors.toList());
-  }
-
-  public List<LogAndArguments> getLogs() {
-    return logs;
-  }
-
-  public List<LogAndArguments> getLogs(LoggerLevel level) {
-    return logsByLevel.get(level);
-  }
-
-  public void clear() {
-    logs.clear();
-    logsByLevel.clear();
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogAndArguments.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogAndArguments.java
deleted file mode 100644 (file)
index f9a1b11..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.Arrays;
-import java.util.Optional;
-import javax.annotation.Nullable;
-
-public final class LogAndArguments {
-  private final String rawMsg;
-  private final Object[] args;
-  private final String msg;
-
-  LogAndArguments(String msg, String rawMsg) {
-    this.rawMsg = rawMsg;
-    this.msg = msg;
-    this.args = null;
-  }
-
-  LogAndArguments(String msg, String rawMsg, @Nullable Object arg1) {
-    this.rawMsg = rawMsg;
-    this.args = new Object[] {arg1};
-    this.msg = msg;
-  }
-
-  LogAndArguments(String msg, String rawMsg, @Nullable Object arg1, @Nullable Object arg2) {
-    this.rawMsg = rawMsg;
-    this.msg = msg;
-    this.args = new Object[] {arg1, arg2};
-  }
-
-  LogAndArguments(String msg, String rawMsg, Object... args) {
-    this.rawMsg = rawMsg;
-    this.msg = msg;
-    this.args = args;
-  }
-
-  public String getRawMsg() {
-    return rawMsg;
-  }
-
-  public Optional<Object[]> getArgs() {
-    return Optional.ofNullable(args);
-  }
-
-  public String getFormattedMsg() {
-    return msg;
-  }
-
-  @Override
-  public String toString() {
-    return "LogAndArguments{" +
-      "rawMsg='" + rawMsg + '\'' +
-      ", args=" + Arrays.toString(args) +
-      ", msg='" + msg + '\'' +
-      '}';
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptor.java
deleted file mode 100644 (file)
index cc05645..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import javax.annotation.Nullable;
-
-interface LogInterceptor {
-
-  void log(LoggerLevel level, String msg);
-
-  void log(LoggerLevel level, String msg, @Nullable Object arg);
-
-  void log(LoggerLevel level, String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  void log(LoggerLevel level, String msg, Object... args);
-
-  void log(LoggerLevel level, String msg, Throwable thrown);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptors.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogInterceptors.java
deleted file mode 100644 (file)
index dc0397c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-class LogInterceptors {
-
-  private static volatile LogInterceptor instance = NullInterceptor.NULL_INSTANCE;
-
-  private LogInterceptors() {
-  }
-
-  static LogInterceptor get() {
-    return instance;
-  }
-
-  static void set(LogInterceptor li) {
-    checkArgument(li != null);
-    instance = li;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java
deleted file mode 100644 (file)
index 1481a8f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/**
- * <b>For tests only</b>
- * <br>
- * This JUnit rule allows to configure and access logs in tests. By default
- * trace level is enabled.
- * <br>
- * Warning - not compatible with parallel execution of tests in the same JVM fork.
- * <br>
- * Example:
- * <pre>
- * public class MyClass {
- *   private final Logger logger = Loggers.get("logger_name");
- *
- *   public void doSomething() {
- *     logger.info("foo");
- *   }
- * }
- *
- * public class MyTest {
- *   &#064;org.junit.Rule
- *   public LogTester logTester = new LogTester();
- *
- *   &#064;org.junit.Test
- *   public void test_log() {
- *     new MyClass().doSomething();
- *
- *     assertThat(logTester.logs()).containsOnly("foo");
- *   }
- * }
- * </pre>
- *
- * @since 5.1
- */
-public class LogTester extends AbstractLogTester<LogTester> implements TestRule {
-  public Statement apply(Statement base, Description description) {
-    return statement(base);
-  }
-
-  private Statement statement(final Statement base) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        before();
-        try {
-          base.evaluate();
-        } finally {
-          after();
-        }
-      }
-    };
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTesterJUnit5.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTesterJUnit5.java
deleted file mode 100644 (file)
index 8e31f69..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
-import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
-/**
- * <b>For tests only</b>
- * <br>
- * This JUnit 5 extension allows to configure and access logs in tests. By default
- * trace level is enabled.
- * <br>
- * Warning - not compatible with parallel execution of tests in the same JVM fork.
- * <br>
- * Example:
- * <pre>
- * public class MyClass {
- *   private final Logger logger = Loggers.get("logger_name");
- *
- *   public void doSomething() {
- *     logger.info("foo");
- *   }
- * }
- *
- * class MyClassTests {
- *   &#064;org.junit.jupiter.api.extension.RegisterExtension
- *   LogTesterJUnit5 logTester = new LogTesterJUnit5();
- *
- *   &#064;org.junit.jupiter.api.Test
- *   public void test_log() {
- *     new MyClass().doSomething();
- *
- *     assertThat(logTester.logs()).containsOnly("foo");
- *   }
- * }
- * </pre>
- *
- * @since 8.1
- */
-public class LogTesterJUnit5 extends AbstractLogTester<LogTesterJUnit5> implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
-
-  @Override
-  public void beforeTestExecution(ExtensionContext context) throws Exception {
-    before();
-  }
-
-  @Override
-  public void afterTestExecution(ExtensionContext context) throws Exception {
-    after();
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLogger.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLogger.java
deleted file mode 100644 (file)
index 6782a8e..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import javax.annotation.Nullable;
-
-/**
- * Logback is used in production.
- */
-class LogbackLogger extends BaseLogger {
-
-  private final Logger logback;
-
-  LogbackLogger(Logger logback) {
-    this.logback = logback;
-  }
-
-  @Override
-  public boolean isTraceEnabled() {
-    return logback.isTraceEnabled();
-  }
-
-  @Override
-  void doTrace(String msg) {
-    logback.trace(msg);
-  }
-
-  @Override
-  void doTrace(String msg, @Nullable Object arg) {
-    logback.trace(msg, arg);
-  }
-
-  @Override
-  void doTrace(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    logback.trace(msg, arg1, arg2);
-  }
-
-  @Override
-  void doTrace(String msg, Object... args) {
-    logback.trace(msg, args);
-  }
-
-  @Override
-  public boolean isDebugEnabled() {
-    return logback.isDebugEnabled();
-  }
-
-
-  @Override
-  protected void doDebug(String msg) {
-    logback.debug(msg);
-  }
-
-  @Override
-  protected void doDebug(String msg, @Nullable Object arg) {
-    logback.debug(msg, arg);
-  }
-
-  @Override
-  protected void doDebug(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    logback.debug(msg, arg1, arg2);
-  }
-
-  @Override
-  protected void doDebug(String msg, Object... args) {
-    logback.debug(msg, args);
-  }
-
-  @Override
-  protected void doInfo(String msg) {
-    logback.info(msg);
-  }
-
-  @Override
-  protected void doInfo(String msg, @Nullable Object arg) {
-    logback.info(msg, arg);
-  }
-
-  @Override
-  protected void doInfo(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    logback.info(msg, arg1, arg2);
-  }
-
-  @Override
-  protected void doInfo(String msg, Object... args) {
-    logback.info(msg, args);
-  }
-
-  @Override
-  protected void doWarn(String msg) {
-    logback.warn(msg);
-  }
-
-  @Override
-  void doWarn(String msg, Throwable thrown) {
-    logback.warn(msg, thrown);
-  }
-
-  @Override
-  protected void doWarn(String msg, @Nullable Object arg) {
-    logback.warn(msg, arg);
-  }
-
-  @Override
-  protected void doWarn(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    logback.warn(msg, arg1, arg2);
-  }
-
-  @Override
-  protected void doWarn(String msg, Object... args) {
-    logback.warn(msg, args);
-  }
-
-  @Override
-  protected void doError(String msg) {
-    logback.error(msg);
-  }
-
-  @Override
-  protected void doError(String msg, @Nullable Object arg) {
-    logback.error(msg, arg);
-  }
-
-  @Override
-  protected void doError(String msg, @Nullable Object arg1, @Nullable Object arg2) {
-    logback.error(msg, arg1, arg2);
-  }
-
-  @Override
-  protected void doError(String msg, Object... args) {
-    logback.error(msg, args);
-  }
-
-  @Override
-  protected void doError(String msg, Throwable thrown) {
-    logback.error(msg, thrown);
-  }
-
-  @Override
-  public boolean setLevel(LoggerLevel level) {
-    switch (level) {
-      case TRACE:
-        logback.setLevel(Level.TRACE);
-        break;
-      case DEBUG:
-        logback.setLevel(Level.DEBUG);
-        break;
-      case INFO:
-        logback.setLevel(Level.INFO);
-        break;
-      case WARN:
-        logback.setLevel(Level.WARN);
-        break;
-      case ERROR:
-        logback.setLevel(Level.ERROR);
-        break;
-      default:
-        throw new IllegalArgumentException("Only TRACE, DEBUG, INFO , WARN, ERROR logging levels are supported. Got: " + level);
-    }
-    return true;
-  }
-
-  @Override
-  public LoggerLevel getLevel() {
-    return LoggerLevel.valueOf(logback.getEffectiveLevel().levelStr);
-  }
-
-  Logger logbackLogger() {
-    return logback;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLoggers.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogbackLoggers.java
deleted file mode 100644 (file)
index a2918ba..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import ch.qos.logback.classic.Level;
-import org.slf4j.LoggerFactory;
-
-/**
- * Note that this is not "Slf4jLoggers" as there's a coupling on Logback
- * in order to change level of root logger.
- */
-class LogbackLoggers extends Loggers {
-
-  @Override
-  protected Logger newInstance(String name) {
-    // logback is accessed through SLF4J
-    return new LogbackLogger((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(name));
-  }
-
-  @Override
-  protected LoggerLevel getLevel() {
-    ch.qos.logback.classic.Logger logback = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
-    switch (logback.getLevel().levelInt) {
-      case Level.TRACE_INT:
-        return LoggerLevel.TRACE;
-      case Level.DEBUG_INT:
-        return LoggerLevel.DEBUG;
-      default:
-        return LoggerLevel.INFO;
-    }
-  }
-
-  @Override
-  protected void setLevel(LoggerLevel level) {
-    ch.qos.logback.classic.Logger logback = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
-    new LogbackLogger(logback).setLevel(level);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Logger.java
deleted file mode 100644 (file)
index 467921d..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.function.Supplier;
-import javax.annotation.Nullable;
-
-/**
- * SonarQube plugins are not coupled with external logging libraries like SLF4J or Logback.
- * <p>
- * Example:
- * <pre>
- * public class MyClass {
- *   private static final Logger LOGGER = Loggers.get("logger_name");
- *
- *   public void doSomething() {
- *     LOGGER.info("something valuable for production environment");
- *     LOGGER.warn("message with arguments {} and {}", "foo", 42);
- *   }
- * }
- * </pre>
- * <p>
- * Message arguments are defined with <code>{}</code>, but not with {@link java.util.Formatter} syntax.
- *
- * <p>
- * INFO, WARN and ERROR levels are always enabled. They can't be disabled by users.
- * DEBUG and TRACE levels are enabled on demand with the property <code>sonar.log.level</code>.
- * <p>
- * See {@link org.sonar.api.utils.log.LogTester} for testing facilities.
- * @since 5.1
- */
-public interface Logger {
-
-  boolean isTraceEnabled();
-
-  /**
-   * Logs a TRACE message.
-   * <p>
-   * TRACE messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * They can significantly slow down performances. The standard use-case is logging of
-   * SQL and Elasticsearch requests.
-   */
-  void trace(String msg);
-
-  /**
-   * Logs a TRACE message, which is only to be constructed if the logging level
-   * is such that the message will actually be logged.
-   * <p>
-   * TRACE messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * They can significantly slow down performances. The standard use-case is logging of
-   * SQL and Elasticsearch requests.
-   * @param msgSupplier A function, which when called, produces the desired log message
-   * @since 6.3
-   */
-  default void trace(Supplier<String> msgSupplier) {
-    if (isTraceEnabled()) {
-      trace(msgSupplier.get());
-    }
-  }
-
-  /**
-   * Logs an TRACE parameterized message according to the specified format and argument. Example:
-   * <code>trace("Value is {}", value)</code>
-   * <p>
-   * TRACE messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * They can significantly slow down performances. The standard use-case is logging of
-   * SQL and Elasticsearch requests.
-   */
-  void trace(String pattern, @Nullable Object arg);
-
-  /**
-   * Logs an TRACE parameterized message according to the specified format and arguments. Example:
-   * <code>trace("Values are {} and {}", value1, value2)</code>
-   * <p>
-   * TRACE messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * They can significantly slow down performances. The standard use-case is logging of
-   * SQL and Elasticsearch requests.
-   */
-  void trace(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  /**
-   * Logs an TRACE parameterized message according to the specified format and arguments. Example:
-   * <code>trace("Values are {} and {}", value1, value2)</code>
-   * <p>
-   * TRACE messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * They can significantly slow down performances. The standard use-case is logging of
-   * SQL and Elasticsearch requests.
-   * <p>
-   * This variant incurs the hidden cost of creating an Object[] before invoking the method.
-   * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See
-   * {@link #trace(String, Object)} and {@link #trace(String, Object, Object)}
-   */
-  void trace(String msg, Object... args);
-
-  boolean isDebugEnabled();
-
-  /**
-   * Logs a DEBUG message. 
-   * <p>
-   * DEBUG messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   */
-  void debug(String msg);
-
-  /**
-   * Logs a DEBUG message which is only to be constructed if the logging level
-   * is such that the message will actually be logged.
-   * <p>
-   * DEBUG messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * @param msgSupplier A function, which when called, produces the desired log message
-   * @since 6.3
-   */
-  default void debug(Supplier<String> msgSupplier) {
-    if (isDebugEnabled()) {
-      debug(msgSupplier.get());
-    }
-  }
-
-  /**
-   * Logs an DEBUG parameterized message according to the specified format and argument. Example:
-   * <code>debug("Value is {}", value)</code>
-   * <p>
-   * Debug messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   */
-  void debug(String pattern, @Nullable Object arg);
-
-  /**
-   * Logs an DEBUG parameterized message according to the specified format and arguments. Example:
-   * <code>debug("Values are {} and {}", value1, value2)</code>
-   * <p>
-   * Debug messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   */
-  void debug(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  /**
-   * Logs an DEBUG parameterized message according to the specified format and arguments. Example:
-   * <code>debug("Values are {}, {} and {}", value1, value2, value3)</code>
-   * <p>
-   * Debug messages must
-   * be valuable for diagnosing production problems. They must not be used for development debugging.
-   * * <p>
-   * This variant incurs the hidden cost of creating an Object[] before invoking the method.
-   * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See
-   * {@link #debug(String, Object)} and {@link #debug(String, Object, Object)}
-   */
-  void debug(String msg, Object... args);
-
-  /**
-   * Logs an INFO level message.
-   */
-  void info(String msg);
-
-  /**
-   * Logs an INFO parameterized message according to the specified format and argument. Example:
-   * <code>info("Value is {}", value)</code>
-   */
-  void info(String msg, @Nullable Object arg);
-
-  /**
-   * Logs an INFO parameterized message according to the specified format and arguments. Example:
-   * <code>info("Values are {} and {}", value1, value2)</code>
-   */
-  void info(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  /**
-   * Logs an INFO parameterized message according to the specified format and arguments. Example:
-   * <code>info("Values are {}, {} and {}", value1, value2, value3)</code>
-   * <p>
-   * This variant incurs the hidden cost of creating an Object[] before invoking the method.
-   * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See
-   * {@link #info(String, Object)} and {@link #info(String, Object, Object)}
-   */
-  void info(String msg, Object... args);
-
-  /**
-   * Logs a WARN level message.
-   */
-  void warn(String msg);
-
-  /**
-   * Logs an exception at the WARN level with an accompanying message.
-   */
-  void warn(String msg, Throwable throwable);
-
-  /**
-   * Logs a WARN parameterized message according to the specified format and argument. Example:
-   * <code>warn("Value is {}", value)</code>
-   */
-  void warn(String msg, @Nullable Object arg);
-
-  /**
-   * Logs a WARN parameterized message according to the specified format and arguments. Example:
-   * <code>warn("Values are {} and {}", value1, value2)</code>
-   */
-  void warn(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  /**
-   * Logs a WARN parameterized message according to the specified format and arguments. Example:
-   * <code>warn("Values are {}, {} and {}", value1, value2, value3)</code>
-   * <p>
-   * This variant incurs the hidden cost of creating an Object[] before invoking the method.
-   * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See
-   * {@link #warn(String, Object)} and {@link #warn(String, Object, Object)}
-   */
-  void warn(String msg, Object... args);
-
-  /**
-   * Logs an ERROR level message.
-   */
-  void error(String msg);
-
-  /**
-   * Logs an ERROR parameterized message according to the specified format and argument. Example:
-   * <code>error("Value is {}", value)</code>
-   */
-  void error(String msg, @Nullable Object arg);
-
-  /**
-   * Logs a ERROR parameterized message according to the specified format and arguments. Example:
-   * <code>error("Values are {} and {}", value1, value2)</code>
-   */
-  void error(String msg, @Nullable Object arg1, @Nullable Object arg2);
-
-  /**
-   * Logs a ERROR parameterized message according to the specified format and arguments. Example:
-   * <code>error("Values are {}, {} and {}", value1, value2, value3)</code>
-   * <p>
-   * This variant incurs the hidden cost of creating an Object[] before invoking the method.
-   * The variants taking one and two arguments exist solely in order to avoid this hidden cost. See
-   * {@link #error(String, Object)} and {@link #error(String, Object, Object)}
-   */
-  void error(String msg, Object... args);
-
-  /**
-   * Logs an exception at the ERROR level with an accompanying message.
-   */
-  void error(String msg, Throwable thrown);
-
-  /**
-   * Attempt to change logger level. Return true if it succeeded, false if
-   * the underlying logging facility does not allow to change level at
-   * runtime.
-   * <p>
-   * This method must not be used to enable DEBUG or TRACE logs in tests. Use
-   * {@link org.sonar.api.utils.log.LogTester#setLevel(LoggerLevel)} instead.
-   * <p>
-   * The standard use-case is to customize logging of embedded 3rd-party
-   * libraries.
-   */
-  boolean setLevel(LoggerLevel level);
-
-  LoggerLevel getLevel();
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerFactory.java
deleted file mode 100644 (file)
index 221fdc2..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-/**
- * @since 8.7
- */
-public abstract class LoggerFactory {
-
-  private static Loggers factory;
-
-  private LoggerFactory() {
-    // no new instance
-  }
-
-  static {
-    try {
-      Class.forName("ch.qos.logback.classic.Logger");
-      factory = new LogbackLoggers();
-    } catch (Exception e) {
-      // no slf4j -> testing environment
-      factory = new ConsoleLoggers();
-    }
-  }
-
-  static Loggers getFactory(){
-    return factory;
-  }
-
-  static Logger get(Class<?> name) {
-    return factory.newInstance(name.getName());
-  }
-
-  static Logger get(String name) {
-    return factory.newInstance(name);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerLevel.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LoggerLevel.java
deleted file mode 100644 (file)
index ac1a345..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-public enum  LoggerLevel {
-  TRACE,
-
-  DEBUG,
-
-  INFO,
-
-  WARN,
-
-  ERROR
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Loggers.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Loggers.java
deleted file mode 100644 (file)
index 59b3e3b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-public abstract class Loggers {
-
-  static Loggers getFactory() {
-    return LoggerFactory.getFactory();
-  }
-
-  protected abstract Logger newInstance(String name);
-
-  protected abstract LoggerLevel getLevel();
-
-  protected abstract void setLevel(LoggerLevel level);
-
-  public static Logger get(Class<?> name) {
-    return LoggerFactory.get(name);
-  }
-
-  public static Logger get(String name) {
-    return LoggerFactory.get(name);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullInterceptor.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullInterceptor.java
deleted file mode 100644 (file)
index 7aa1765..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-/**
- * Log interceptor that does nothing, so production-ready!
- */
-class NullInterceptor implements LogInterceptor {
-
-  static final NullInterceptor NULL_INSTANCE = new NullInterceptor();
-
-  private NullInterceptor() {
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg) {
-    // nothing
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Object arg) {
-    // nothing
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Object arg1, Object arg2) {
-    // nothing
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Object... args) {
-    // nothing
-  }
-
-  @Override
-  public void log(LoggerLevel level, String msg, Throwable thrown) {
-    // nothing
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullProfiler.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/NullProfiler.java
deleted file mode 100644 (file)
index 4038e7e..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import javax.annotation.Nullable;
-
-class NullProfiler extends Profiler {
-
-  static final NullProfiler NULL_INSTANCE = new NullProfiler();
-
-  private NullProfiler() {
-  }
-
-  @Override
-  public boolean isDebugEnabled() {
-    return false;
-  }
-
-  @Override
-  public boolean isTraceEnabled() {
-    return false;
-  }
-
-  @Override
-  public Profiler start() {
-    return this;
-  }
-
-  @Override
-  public Profiler startTrace(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler startDebug(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler startInfo(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler stopTrace() {
-    return this;
-  }
-
-  @Override
-  public Profiler stopDebug() {
-    return this;
-  }
-
-  @Override
-  public Profiler stopInfo() {
-    return this;
-  }
-
-  @Override
-  public Profiler stopTrace(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler stopDebug(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler stopInfo(String message) {
-    return this;
-  }
-
-  @Override
-  public Profiler addContext(String key, @Nullable Object value) {
-    // nothing to do
-    return this;
-  }
-
-  @Override
-  public Profiler stopInfo(boolean cacheUsed) {
-    return this;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Profiler.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/Profiler.java
deleted file mode 100644 (file)
index 08740d5..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import javax.annotation.Nullable;
-
-/**
- *
- * @since 5.1
- */
-public abstract class Profiler {
-
-  public static Profiler create(Logger logger) {
-    return new DefaultProfiler((BaseLogger) logger);
-  }
-
-  public static Profiler createIfTrace(Logger logger) {
-    if (logger.isTraceEnabled()) {
-      return create(logger);
-    }
-    return NullProfiler.NULL_INSTANCE;
-  }
-
-  public static Profiler createIfDebug(Logger logger) {
-    if (logger.isDebugEnabled()) {
-      return create(logger);
-    }
-    return NullProfiler.NULL_INSTANCE;
-  }
-
-  public abstract boolean isDebugEnabled();
-
-  public abstract boolean isTraceEnabled();
-
-  public abstract Profiler start();
-
-  public abstract Profiler startTrace(String message);
-
-  public abstract Profiler startDebug(String message);
-
-  public abstract Profiler startInfo(String message);
-
-  /**
-   * Works only if a message have been set in startXXX() methods.
-   */
-  public abstract Profiler stopTrace();
-
-  public abstract Profiler stopDebug();
-
-  public abstract Profiler stopInfo();
-  
-  public abstract Profiler stopInfo(boolean cacheUsed);
-
-  public abstract Profiler stopTrace(String message);
-
-  public abstract Profiler stopDebug(String message);
-
-  public abstract Profiler stopInfo(String message);
-
-  /**
-   * Context information is removed if value is <code>null</code>.
-   */
-  public abstract Profiler addContext(String key, @Nullable Object value);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/package-info.java
deleted file mode 100644 (file)
index f8b4a04..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/package-info.java
deleted file mode 100644 (file)
index 81864c4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/CsvWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/CsvWriter.java
deleted file mode 100644 (file)
index 8894882..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-import java.io.IOException;
-import java.io.Writer;
-
-/**
- * @since 4.2
- */
-public class CsvWriter {
-  private static final String VALUE_SEPARATOR = ",";
-  private static final String LINE_SEPARATOR = "\r\n";
-  private final Writer writer;
-
-  private CsvWriter(Writer writer) {
-    this.writer = writer;
-  }
-
-  public static CsvWriter of(Writer writer) {
-    return new CsvWriter(writer);
-  }
-
-  public CsvWriter values(String... values) {
-    for (int index = 0; index < values.length; index++) {
-      if (index > 0) {
-        write(VALUE_SEPARATOR);
-      }
-      String value = values[index];
-      if (value != null) {
-        write(StringEscapeUtils.escapeCsv(value));
-      }
-      if (index == values.length - 1) {
-        write(LINE_SEPARATOR);
-      }
-    }
-    return this;
-  }
-
-  public void close() {
-    try {
-      writer.close();
-    } catch (IOException e) {
-      throw new WriterException("Fail to close CSV output", e);
-    }
-  }
-
-  private void write(String s) {
-    try {
-      writer.append(s);
-    } catch (IOException e) {
-      throw new WriterException("Fail to generate CSV with value: " + s, e);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java
deleted file mode 100644 (file)
index 58d4877..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Date;
-import java.util.Map;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.DateUtils;
-
-/**
- * Writes JSON as a stream. This class allows plugins to not directly depend
- * on the underlying JSON library.
- * <p>
- * <h3>How to use</h3>
- * <pre>
- *   try (JsonWriter jsonWriter = JsonWriter.of(writer)) {
- *     jsonWriter
- *       .beginObject()
- *       .prop("aBoolean", true)
- *       .prop("aInt", 123)
- *       .prop("aString", "foo")
- *       .beginObject().name("aList")
- *         .beginArray()
- *           .beginObject().prop("key", "ABC").endObject()
- *           .beginObject().prop("key", "DEF").endObject()
- *         .endArray()
- *       .endObject()
- *   }
- * </pre>
- *
- * <p>
- * By default, null objects are not serialized. To enable {@code null} serialization,
- * use {@link #setSerializeNulls(boolean)}.
- * </p>
- * <p>
- * By default, empty strings are serialized. To disable empty string serialization,
- * use {@link #setSerializeEmptys(boolean)}.
- * </p>
- * <p>
- * {@link JsonWriter} implements {@link AutoCloseable} since version 6.3. The
- * method {@link #close()} closes the underlying writer.
- * </p>
- *
- * @since 4.2
- * @deprecated since 8.3 this utility class will be moved out of the API. Use your own JSON dependency
- * if you need to write JSON from your plugin
- */
-@Deprecated
-public class JsonWriter implements AutoCloseable {
-
-  private final com.google.gson.stream.JsonWriter stream;
-  private boolean serializeEmptyStrings;
-
-  private JsonWriter(Writer writer) {
-    this.stream = new com.google.gson.stream.JsonWriter(writer);
-    this.stream.setSerializeNulls(false);
-    this.stream.setLenient(false);
-    this.stream.setHtmlSafe(true);
-    this.serializeEmptyStrings = true;
-  }
-
-  // for unit testing
-  JsonWriter(com.google.gson.stream.JsonWriter stream) {
-    this.stream = stream;
-  }
-
-  public static JsonWriter of(Writer writer) {
-    return new JsonWriter(writer);
-  }
-
-  public JsonWriter setSerializeNulls(boolean b) {
-    this.stream.setSerializeNulls(b);
-    return this;
-  }
-
-  /**
-   * Enable/disable serialization of properties which value is an empty String.
-   */
-  public JsonWriter setSerializeEmptys(boolean serializeEmptyStrings) {
-    this.serializeEmptyStrings = serializeEmptyStrings;
-    return this;
-  }
-
-  /**
-   * Begins encoding a new array. Each call to this method must be paired with
-   * a call to {@link #endArray}. Output is <code>[</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter beginArray() {
-    try {
-      stream.beginArray();
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Ends encoding the current array. Output is <code>]</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter endArray() {
-    try {
-      stream.endArray();
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Begins encoding a new object. Each call to this method must be paired
-   * with a call to {@link #endObject}. Output is <code>{</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter beginObject() {
-    try {
-      stream.beginObject();
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Ends encoding the current object. Output is <code>}</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter endObject() {
-    try {
-      stream.endObject();
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Encodes the property name. Output is <code>"theName":</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter name(String name) {
-    try {
-      stream.name(name);
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Encodes {@code value}. Output is <code>true</code> or <code>false</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter value(boolean value) {
-    try {
-      stream.value(value);
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter value(double value) {
-    try {
-      stream.value(value);
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter value(@Nullable String value) {
-    try {
-      stream.value(serializeEmptyStrings ? value : emptyToNull(value));
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Encodes an object that can be a :
-   * <ul>
-   * <li>primitive types: String, Number, Boolean</li>
-   * <li>java.util.Date: encoded as datetime (see {@link #valueDateTime(java.util.Date)}</li>
-   * <li>{@code Map<Object, Object>}. Method toString is called for the key.</li>
-   * <li>Iterable</li>
-   * </ul>
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter valueObject(@Nullable Object value) {
-
-    try {
-      if (value == null) {
-        stream.nullValue();
-        return this;
-      }
-      valueNonNullObject(value);
-      return this;
-    } catch (IllegalArgumentException e) {
-      throw e;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  private void valueNonNullObject(Object value) throws IOException {
-    if (value instanceof String) {
-      stream.value(serializeEmptyStrings ? (String) value : emptyToNull((String) value));
-    } else if (value instanceof Number) {
-      stream.value((Number) value);
-    } else if (value instanceof Boolean) {
-      stream.value((Boolean) value);
-    } else if (value instanceof Date) {
-      valueDateTime((Date) value);
-    } else if (value instanceof Enum) {
-      stream.value(((Enum) value).name());
-    } else if (value instanceof Map) {
-      stream.beginObject();
-      for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) value).entrySet()) {
-        stream.name(entry.getKey().toString());
-        valueObject(entry.getValue());
-      }
-      stream.endObject();
-    } else if (value instanceof Iterable) {
-      stream.beginArray();
-      for (Object o : (Iterable<Object>) value) {
-        valueObject(o);
-      }
-      stream.endArray();
-    } else {
-      throw new IllegalArgumentException(getClass() + " does not support encoding of type: " + value.getClass());
-    }
-  }
-
-  /**
-   * Write a list of values in an array, for example:
-   * <pre>
-   *   writer.beginArray().values(myValues).endArray();
-   * </pre>
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter values(Iterable<String> values) {
-    for (String value : values) {
-      value(value);
-    }
-    return this;
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter valueDate(@Nullable Date value) {
-    try {
-      stream.value(value == null ? null : DateUtils.formatDate(value));
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  public JsonWriter valueDateTime(@Nullable Date value) {
-    try {
-      stream.value(value == null ? null : DateUtils.formatDateTime(value));
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter value(long value) {
-    try {
-      stream.value(value);
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter value(@Nullable Number value) {
-    try {
-      stream.value(value);
-      return this;
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Encodes the property name and value. Output is for example <code>"theName":123</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter prop(String name, @Nullable Number value) {
-    return name(name).value(value);
-  }
-
-  /**
-   * Encodes the property name and date value (ISO format).
-   * Output is for example <code>"theDate":"2013-01-24"</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter propDate(String name, @Nullable Date value) {
-    return name(name).valueDate(value);
-  }
-
-  /**
-   * Encodes the property name and datetime value (ISO format).
-   * Output is for example <code>"theDate":"2013-01-24T13:12:45+01"</code>.
-   *
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter propDateTime(String name, @Nullable Date value) {
-    return name(name).valueDateTime(value);
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter prop(String name, @Nullable String value) {
-    return name(name).value(value);
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter prop(String name, boolean value) {
-    return name(name).value(value);
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter prop(String name, long value) {
-    return name(name).value(value);
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  public JsonWriter prop(String name, double value) {
-    return name(name).value(value);
-  }
-
-  /**
-   * @throws org.sonar.api.utils.text.WriterException on any failure
-   */
-  @Override
-  public void close() {
-    try {
-      stream.close();
-    } catch (Exception e) {
-      throw rethrow(e);
-    }
-  }
-
-  private static IllegalStateException rethrow(Exception e) {
-    throw new WriterException("Fail to write JSON", e);
-  }
-
-  @Nullable
-  private static String emptyToNull(@Nullable String value) {
-    if (value == null || value.isEmpty()) {
-      return null;
-    }
-    return value;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/WriterException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/WriterException.java
deleted file mode 100644 (file)
index 9d2f5ce..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-/**
- * @since 4.2
- */
-public class WriterException extends RuntimeException {
-
-  public WriterException(String message) {
-    super(message);
-  }
-
-  public WriterException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/XmlWriter.java
deleted file mode 100644 (file)
index 4056b5f..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import javax.annotation.Nullable;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.Writer;
-
-/**
- * TODO document that output is UTF-8
- */
-public class XmlWriter {
-
-  private final XMLStreamWriter stream;
-
-  private XmlWriter(Writer writer) {
-    try {
-      XMLOutputFactory xmlFactory = XMLOutputFactory.newInstance();
-      stream = xmlFactory.createXMLStreamWriter(writer);
-    } catch (Exception e) {
-      throw new WriterException("Fail to initialize XML Stream writer", e);
-    }
-  }
-
-  public static XmlWriter of(Writer writer) {
-    return new XmlWriter(writer);
-  }
-
-  public XmlWriter declaration() {
-    try {
-      stream.writeStartDocument("UTF-8", "1.0");
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  public XmlWriter begin(String nodeName) {
-    try {
-      stream.writeStartElement(nodeName);
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-
-  public XmlWriter end() {
-    try {
-      stream.writeEndElement();
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  /**
-   * Same as {@link #end()}. The parameter is unused. It's declared only to improve
-   * readability :
-   * <pre>
-   *   xml.write("rules");
-   *   xml.write("rule");
-   *   // many other writes
-   *   xml.end("rule");
-   *   xml.end("rules");
-   * </pre>
-   */
-  public XmlWriter end(String unused) {
-    return end();
-  }
-
-  public XmlWriter prop(String nodeName, @Nullable String value) {
-    if (value != null) {
-      begin(nodeName).value(value).end();
-    }
-    return this;
-  }
-
-  public XmlWriter prop(String nodeName, @Nullable Number value) {
-    if (value != null) {
-      begin(nodeName).value(value).end();
-    }
-    return this;
-  }
-
-  public XmlWriter prop(String nodeName, boolean value) {
-    return begin(nodeName).value(value).end();
-  }
-
-  public XmlWriter prop(String nodeName, long value) {
-    return begin(nodeName).value(value).end();
-  }
-
-  public XmlWriter prop(String nodeName, double value) {
-    return begin(nodeName).value(value).end();
-  }
-
-  private XmlWriter value(boolean value) {
-    try {
-      stream.writeCharacters(String.valueOf(value));
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  private XmlWriter value(double value) {
-    try {
-      if (Double.isNaN(value) || Double.isInfinite(value)) {
-        throw new WriterException("Fail to write XML. Double value is not valid: " + value);
-      }
-      stream.writeCharacters(String.valueOf(value));
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  private XmlWriter value(@Nullable String value) {
-    try {
-      if (value != null) {
-        stream.writeCharacters(value);
-      }
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  private XmlWriter value(long value) {
-    try {
-      stream.writeCharacters(String.valueOf(value));
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  private XmlWriter value(@Nullable Number value) {
-    try {
-      if (value != null) {
-        stream.writeCharacters(String.valueOf(value));
-      }
-      return this;
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  public void close() {
-    try {
-      stream.writeEndDocument();
-      stream.flush();
-      stream.close();
-    } catch (XMLStreamException e) {
-      throw rethrow(e);
-    }
-  }
-
-  private static IllegalStateException rethrow(XMLStreamException e) {
-    // stacktrace is not helpful
-    throw new IllegalStateException("Fail to write XML: " + e.getMessage());
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/package-info.java
deleted file mode 100644 (file)
index 4bd66ca..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java
deleted file mode 100644 (file)
index a524ea7..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import javax.servlet.Filter;
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableList;
-import static org.apache.commons.lang.StringUtils.substringBeforeLast;
-import static org.sonar.api.utils.Preconditions.checkArgument;
-
-/**
- * @since 3.1
- */
-@ServerSide
-@ExtensionPoint
-public abstract class ServletFilter implements Filter {
-
-  /**
-   * Override to change URL. Default is /*
-   */
-  public UrlPattern doGetPattern() {
-    return UrlPattern.builder().build();
-  }
-
-  public static final class UrlPattern {
-
-    private static final String MATCH_ALL = "/*";
-
-    private final List<String> inclusions;
-    private final List<String> exclusions;
-    private final Predicate<String>[] inclusionPredicates;
-    private final Predicate<String>[] exclusionPredicates;
-
-    private UrlPattern(Builder builder) {
-      this.inclusions = unmodifiableList(new ArrayList<>(builder.inclusions));
-      this.exclusions = unmodifiableList(new ArrayList<>(builder.exclusions));
-      if (builder.inclusionPredicates.isEmpty()) {
-        // because Stream#anyMatch() returns false if stream is empty
-        this.inclusionPredicates = new Predicate[] {s -> true};
-      } else {
-        this.inclusionPredicates = builder.inclusionPredicates.stream().toArray(Predicate[]::new);
-      }
-      this.exclusionPredicates = builder.exclusionPredicates.stream().toArray(Predicate[]::new);
-    }
-
-    public boolean matches(String path) {
-      return !Arrays.stream(exclusionPredicates).anyMatch(pattern -> pattern.test(path)) &&
-        Arrays.stream(inclusionPredicates).anyMatch(pattern -> pattern.test(path));
-    }
-
-    /**
-     * @since 6.0
-     */
-    public Collection<String> getInclusions() {
-      return inclusions;
-    }
-
-    /**
-     * @since 6.0
-     */
-    public Collection<String> getExclusions() {
-      return exclusions;
-    }
-
-    public String label() {
-      return "UrlPattern{" +
-        "inclusions=[" + convertPatternsToString(inclusions) + "]" +
-        ", exclusions=[" + convertPatternsToString(exclusions) + "]" +
-        '}';
-    }
-
-    private static String convertPatternsToString(List<String> input) {
-      StringBuilder output = new StringBuilder();
-      if (input.isEmpty()) {
-        return "";
-      }
-      if (input.size() == 1) {
-        return output.append(input.get(0)).toString();
-      }
-      return output.append(input.get(0)).append(", ...").toString();
-    }
-
-    /**
-     * Defines only a single inclusion pattern. This is a shortcut for {@code builder().includes(inclusionPattern).build()}.
-     */
-    public static UrlPattern create(String inclusionPattern) {
-      return builder().includes(inclusionPattern).build();
-    }
-
-    /**
-     * @since 6.0
-     */
-    public static Builder builder() {
-      return new Builder();
-    }
-
-    /**
-     * @since 6.0
-     */
-    public static class Builder {
-      private static final String WILDCARD_CHAR = "*";
-      private static final Collection<String> STATIC_RESOURCES = unmodifiableList(asList(
-        "*.css", "*.css.map", "*.ico", "*.png", "*.jpg", "*.jpeg", "*.gif", "*.svg", "*.js", "*.js.map", "*.pdf", "/json/*",
-        "/static/*", "/robots.txt", "/favicon.ico", "/apple-touch-icon*", "/mstile*"));
-
-      private final Set<String> inclusions = new LinkedHashSet<>();
-      private final Set<String> exclusions = new LinkedHashSet<>();
-      private final Set<Predicate<String>> inclusionPredicates = new HashSet<>();
-      private final Set<Predicate<String>> exclusionPredicates = new HashSet<>();
-
-      private Builder() {
-      }
-
-      public static Collection<String> staticResourcePatterns() {
-        return STATIC_RESOURCES;
-      }
-
-      /**
-       * Add inclusion patterns. Supported formats are:
-       * <ul>
-       *   <li>path prefixed by / and ended by * or /*, for example "/api/foo/*", to match all paths "/api/foo" and "api/api/foo/something/else"</li>
-       *   <li>path prefixed by / and ended by .*, for example "/api/foo.*", to match exact path "/api/foo" with any suffix like "/api/foo.protobuf"</li>
-       *   <li>path prefixed by *, for example "*\/foo", to match all paths "/api/foo" and "something/else/foo"</li>
-       *   <li>path with leading slash and no wildcard, for example "/api/foo", to match exact path "/api/foo"</li>
-       * </ul>
-       */
-      public Builder includes(String... includePatterns) {
-        return includes(asList(includePatterns));
-      }
-
-      /**
-       * Add exclusion patterns. See format described in {@link #includes(String...)}
-       */
-      public Builder includes(Collection<String> includePatterns) {
-        this.inclusions.addAll(includePatterns);
-        this.inclusionPredicates.addAll(includePatterns.stream()
-          .filter(pattern -> !MATCH_ALL.equals(pattern))
-          .map(Builder::compile)
-          .collect(Collectors.toList()));
-        return this;
-      }
-
-      public Builder excludes(String... excludePatterns) {
-        return excludes(asList(excludePatterns));
-      }
-
-      public Builder excludes(Collection<String> excludePatterns) {
-        this.exclusions.addAll(excludePatterns);
-        this.exclusionPredicates.addAll(excludePatterns.stream()
-          .map(Builder::compile)
-          .collect(Collectors.toList()));
-        return this;
-      }
-
-      public UrlPattern build() {
-        return new UrlPattern(this);
-      }
-
-      private static Predicate<String> compile(String pattern) {
-        int countStars = pattern.length() - pattern.replace(WILDCARD_CHAR, "").length();
-        if (countStars == 0) {
-          checkArgument(pattern.startsWith("/"), "URL pattern must start with slash '/': %s", pattern);
-          return url -> url.equals(pattern);
-        }
-        checkArgument(countStars == 1, "URL pattern accepts only zero or one wildcard character '*': %s", pattern);
-        if (pattern.charAt(0) == '/') {
-          checkArgument(pattern.endsWith(WILDCARD_CHAR), "URL pattern must end with wildcard character '*': %s", pattern);
-          if (pattern.endsWith("/*")) {
-            String path = pattern.substring(0, pattern.length() - "/*".length());
-            return url -> url.startsWith(path);
-          }
-          if (pattern.endsWith(".*")) {
-            String path = pattern.substring(0, pattern.length() - ".*".length());
-            return url -> substringBeforeLast(url, ".").equals(path);
-          }
-          String path = pattern.substring(0, pattern.length() - "*".length());
-          return url -> url.startsWith(path);
-        }
-        checkArgument(pattern.startsWith(WILDCARD_CHAR), "URL pattern must start with wildcard character '*': %s", pattern);
-        // remove the leading *
-        String path = pattern.substring(1);
-        return url -> url.endsWith(path);
-      }
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/UserRole.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/UserRole.java
deleted file mode 100644 (file)
index dcdf538..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @since 1.11
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface UserRole {
-  /**
-   * Permissions which are implicitly available for any user, any group and to group "AnyOne" on public components.
-   * @since 7.5
-   */
-  Set<String> PUBLIC_PERMISSIONS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(UserRole.USER, UserRole.CODEVIEWER)));
-
-  /**
-   * @deprecated use the constant USER since 1.12.
-   */
-  @Deprecated
-  String VIEWER = "user";
-
-  String USER = "user";
-  String ADMIN = "admin";
-  String CODEVIEWER = "codeviewer";
-  String ISSUE_ADMIN = "issueadmin";
-
-  /**
-   * @since 7.3
-   */
-  String SECURITYHOTSPOT_ADMIN = "securityhotspotadmin";
-
-  /**
-   * @since 7.5
-   */
-  String SCAN = "scan";
-
-  String[] value() default {};
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WebAnalytics.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WebAnalytics.java
deleted file mode 100644 (file)
index b773f64..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Extension point to support a web analytics tool like Matomo or
- * Google Analytics in the webapp.
- *
- * <p>See the method {@link #getUrlPathToJs()} for the details about specification.</p>
- *
- * <p>
- * Example of implementation with a {@link org.sonar.api.server.ws.WebService}:
- * </p>
- * <pre>
- * import java.io.IOException;
- * import java.io.OutputStream;
- * import java.nio.charset.StandardCharsets;
- * import org.apache.commons.io.IOUtils;
- * import org.sonar.api.server.ws.Request;
- * import org.sonar.api.server.ws.RequestHandler;
- * import org.sonar.api.server.ws.Response;
- * import org.sonar.api.server.ws.WebService;
- * import org.sonar.api.web.WebAnalytics;
- *
- * public class MyWebAnalytics implements WebAnalytics, WebService, RequestHandler {
- *
- *   {@literal @}Override
- *   public String getUrlPathToJs() {
- *     return "api/myplugin/analytics";
- *   }
- *
- *   {@literal @}Override
- *   public void define(Context context) {
- *     NewController controller = context.createController("api/myplugin");
- *     controller.createAction("analytics")
- *       .setInternal(false)
- *       .setHandler(this);
- *     controller.done();
- *   }
- *
- *   {@literal @}Override
- *   public void handle(Request request, Response response) throws IOException {
- *     try (OutputStream output = response.stream()
- *       .setMediaType("application/javascript")
- *       .output()) {
- *       IOUtils.write("{replace with the javascript content}", output, StandardCharsets.UTF_8);
- *     }
- *   }
- * }
- * </pre>
- *
- * @since 7.8
- */
-@ServerSide
-@ExtensionPoint
-public interface WebAnalytics {
-
-  /**
-   * Returns the URL path to the Javascript file that will be loaded by the webapp. File must be
-   * provided by SonarQube server and can't be located outside.
-   *
-   * <p>
-   * The returned path must not start with a slash '/' and must not contain ".." or "://".
-   * </p>
-   *
-   * <p>
-   * Examples:
-   * <ul>
-   *  <li>"api/google/analytics" if file is generated by a {@link org.sonar.api.server.ws.WebService}.</li>
-   *  <li>"static/myplugin/analytics.js" if file is bundled with the plugin with key "myplugin"
-   *   (note that in this case the file in the plugin JAR is "static/analytics.js").</li>
-   * </ul>
-   * </p>
-   *
-   * <p>
-   * Webapp does not load the Javascript file if the URL does not return HTTP code 200.
-   * </p>
-   *
-   * <p>
-   * The Javascript file is composed of two parts:
-   * <ul>
-   *   <li>the global code that is executed when the browser loads the webapp</li>
-   *   <li>the handler that is executed by the webapp when page is changed. See function "window.setWebAnalyticsPageChangeHandler()".</li>
-   * </ul>
-   * </p>
-   * Example for Matomo:
-   *
-   * <pre>
-   * var _paq = window._paq || [];
-   * // tracker methods like "setCustomDimension" should be called before "trackPageView"
-   * _paq.push(["trackPageView"]);
-   * _paq.push(["enableLinkTracking"]);
-   * (function() {
-   *   var u = "https://me.matomo.cloud/";
-   *   _paq.push(["setTrackerUrl", u + "matomo.php"]);
-   *   _paq.push(["setSiteId", "12345"]);
-   *   var d = document,
-   *     g = d.createElement("script"),
-   *     s = d.getElementsByTagName("script")[0];
-   *   g.type = "text/javascript";
-   *   g.async = true;
-   *   g.defer = true;
-   *   g.src = "//cdn.matomo.cloud/me.matomo.cloud/matomo.js";
-   *   s.parentNode.insertBefore(g, s);
-   * })();
-   *
-   * window.setWebAnalyticsPageChangeHandler(function(pathname) {
-   *   _paq.push(["setCustomUrl", pathname]);
-   *   _paq.push(["setDocumentTitle", document.title]);
-   *   _paq.push(["trackPageView"]);
-   * });
-   * </pre>
-   */
-  String getUrlPathToJs();
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/package-info.java
deleted file mode 100644 (file)
index 4a4069f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/page/Context.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/page/Context.java
deleted file mode 100644 (file)
index 52dd7fe..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import static java.lang.String.format;
-import static java.util.Collections.unmodifiableCollection;
-
-/**
- * @see PageDefinition
- * @since 6.3
- */
-public final class Context {
-  private final Map<String, Page> pagesByPath = new HashMap<>();
-
-  public Context addPage(Page page) {
-    Page existingPageWithSameKey = pagesByPath.putIfAbsent(page.getKey(), page);
-    if (existingPageWithSameKey != null) {
-      throw new IllegalArgumentException(format("Page '%s' cannot be loaded. Another page with key '%s' already exists.", page.getName(), page.getKey()));
-    }
-
-    return this;
-  }
-
-  public Collection<Page> getPages() {
-    return unmodifiableCollection(pagesByPath.values());
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/page/Page.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/page/Page.java
deleted file mode 100644 (file)
index 4b0ae6d..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.annotation.CheckForNull;
-
-import static java.lang.String.format;
-import static java.util.Objects.requireNonNull;
-import static org.sonar.api.web.page.Page.Scope.COMPONENT;
-import static org.sonar.api.web.page.Page.Scope.GLOBAL;
-
-/**
- * @see PageDefinition
- * @since 6.3
- */
-public final class Page {
-  private final String key;
-  private final String name;
-  private final boolean isAdmin;
-  private final Scope scope;
-  private final Set<Qualifier> qualifiers;
-
-  private Page(Builder builder) {
-    this.key = builder.key;
-    this.name = builder.name;
-    this.qualifiers = Stream.of(builder.qualifiers).sorted().collect(Collectors.toCollection(LinkedHashSet::new));
-    this.isAdmin = builder.isAdmin;
-    this.scope = builder.scope;
-  }
-
-  public static Builder builder(String key) {
-    return new Builder(key);
-  }
-
-  public String getKey() {
-    return key;
-  }
-
-  public String getPluginKey() {
-    return key.substring(0, key.indexOf('/'));
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public Set<Qualifier> getComponentQualifiers() {
-    return qualifiers;
-  }
-
-  public boolean isAdmin() {
-    return isAdmin;
-  }
-
-  public Scope getScope() {
-    return scope;
-  }
-
-  public enum Scope {
-    GLOBAL, ORGANIZATION, COMPONENT
-  }
-
-  public enum Qualifier {
-    PROJECT(org.sonar.api.resources.Qualifiers.PROJECT),
-    MODULE(org.sonar.api.resources.Qualifiers.MODULE),
-    APP(org.sonar.api.resources.Qualifiers.APP),
-    VIEW(org.sonar.api.resources.Qualifiers.VIEW),
-    SUB_VIEW(org.sonar.api.resources.Qualifiers.SUBVIEW);
-
-    private final String key;
-
-    Qualifier(String key) {
-      this.key = key;
-    }
-
-    @CheckForNull
-    public static Qualifier fromKey(String key) {
-      return Arrays.stream(values())
-        .filter(qualifier -> qualifier.key.equals(key))
-        .findAny()
-        .orElse(null);
-    }
-
-    public String getKey() {
-      return key;
-    }
-  }
-
-  public static class Builder {
-    private final String key;
-    private String name;
-    private boolean isAdmin = false;
-    private Scope scope = GLOBAL;
-    private Qualifier[] qualifiers = new Qualifier[] {};
-
-    /**
-     * @param key It must respect the format plugin_key/page_identifier. Example: <code>my_plugin/my_page</code>
-     */
-    private Builder(String key) {
-      requireNonNull(key, "Key must not be null");
-      if (key.split("/").length != 2) {
-        throw new IllegalArgumentException("Page key [" + key + "] is not valid. It must contain a single slash, for example my_plugin/my_page.");
-      }
-      this.key = requireNonNull(key, "Key must not be null");
-    }
-
-    /**
-     * Page name displayed in the UI. Mandatory.
-     */
-    public Builder setName(String name) {
-      this.name = name;
-      return this;
-    }
-
-    /**
-     * if set to true, display the page in the administration section, depending on the scope
-     */
-    public Builder setAdmin(boolean admin) {
-      this.isAdmin = admin;
-      return this;
-    }
-
-    /**
-     * Define where the page is displayed, either in the global menu or in a component page
-     * @param scope - default is GLOBAL
-     */
-    public Builder setScope(Scope scope) {
-      this.scope = requireNonNull(scope, "Scope must not be null");
-      return this;
-    }
-
-    /**
-     * Define the components where the page is displayed. If set, {@link #setScope(Scope)} must be set to COMPONENT
-     * @see Qualifier
-     */
-    public Builder setComponentQualifiers(Qualifier... qualifiers) {
-      this.qualifiers = requireNonNull(qualifiers);
-      return this;
-    }
-
-    public Page build() {
-      if (key == null || key.isEmpty()) {
-        throw new IllegalArgumentException("Key must not be empty");
-      }
-      if (name == null || name.isEmpty()) {
-        throw new IllegalArgumentException("Name must be defined and not empty");
-      }
-      if (qualifiers.length > 0 && !COMPONENT.equals(scope)) {
-        throw new IllegalArgumentException(format("The scope must be '%s' when component qualifiers are provided", COMPONENT));
-      }
-      if (qualifiers.length == 0 && COMPONENT.equals(scope)) {
-        qualifiers = Qualifier.values();
-      }
-
-      return new Page(this);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/page/PageDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/page/PageDefinition.java
deleted file mode 100644 (file)
index c929cba..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-
-/**
- * Defines the Javascript pages added to SonarQube.
- * <br>
- * This interface replaces the deprecated class {@link org.sonar.api.web.Page}. Moreover, the technology changed from Ruby to Javascript
- * <br>
- * <h3>How to define pages</h3>
- * <pre>
- * import org.sonar.api.web.page.Page.Qualifier;
- *
- * public class MyPluginPagesDefinition implements PagesDefinition {
- *  {@literal @Override}
- *  public void define(Context context) {
- *    context
- *      // Global page by default
- *      .addPage(Page.builder("my_plugin/global_page").setName("Global Page").build())
- *      // Global admin page
- *      .addPage(Page.builder("my_plugin/global_admin_page").setName("Admin Global Page").setAdmin(true).build())
- *      // Project page
- *      .addPage(Page.builder("my_plugin/project_page").setName("Project Page").setScope(Scope.COMPONENT).setQualifiers(Qualifier.PROJECT).build())
- *      // Admin project or module page
- *      .addPage(Page.builder("my_plugin/project_admin_page").setName("Admin Page for Project or Module").setAdmin(true)
- *        .setScope(Scope.COMPONENT).setQualifiers(Qualifier.PROJECT, Qualifier.MODULE).build())
- *      // Page on all components (see Qualifier class) supported
- *      .addPage(Page.builder("my_plugin/component_page").setName("Component Page").setScope(Scope.COMPONENT).build());
- *      // Organization page (when organizations are enabled)
- *      .addPage(Page.builder("my_plugin/org_page").setName("Organization Page").setScope(Scope.ORGANIZATION).build());
- *  }
- * }
- * </pre>
- * <h3>How to test a page definition</h3>
- * <pre>
- *   public class PageDefinitionTest {
- *     {@literal @Test}
- *     public void test_page_definition() {
- *       PageDefinition underTest = context -> context.addPage(Page.builder("my_plugin/my_page").setName("My Page").build());
- *       Context context = new Context();
- *
- *       underTest.define(context);
- *
- *       assertThat(context.getPages()).extracting(Page::getKey).contains("my_plugin/my_page");
- *     }
- * </pre>
- *
- * @since 6.3
- */
-
-@ServerSide
-@ExtensionPoint
-public interface PageDefinition {
-  /**
-   * This method is executed when server is started
-   */
-  void define(Context context);
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/page/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/page/package-info.java
deleted file mode 100644 (file)
index 5a91ee2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/SonarLintSide.java b/sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/SonarLintSide.java
deleted file mode 100644 (file)
index 879bb26..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.sonarsource.api.sonarlint;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation for all the components available in container of sonarlint. Note that
- * injection of dependencies by constructor is used :
- * <pre>
- *   {@literal @}SonarLintSide
- *   public class Foo {
- *
- *   }
- *   {@literal @}SonarLintSide
- *   public class Bar {
- *     private final Foo foo;
- *     public Bar(Foo f) {
- *       this.foo = f;
- *     }
- *   }
- *
- * </pre>
- *
- * @since 6.0
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface SonarLintSide {
-
-  /**
-   * The component will be instantiated for each analysis (could be single or multiple files analysis).
-   */
-  String SINGLE_ANALYSIS = "SINGLE_ANALYSIS";
-
-  /**
-   * The component will be instantiated once and reused by all analyses, as long as the SonarLint engine is not restarted.
-   * @deprecated since 9.0 use {@link #INSTANCE} as a direct replacement
-   */
-  @Deprecated
-  String MULTIPLE_ANALYSES = "MULTIPLE_ANALYSES";
-
-  /**
-   * The component will be instantiated when a module is opened and kept alive until the module is closed.
-   * A module is a project in Eclipse, a folder in VSCode and a module in IntelliJ.
-   */
-  String MODULE = "MODULE";
-
-  /**
-   * The component will be instantiated once and reused by all analyses, as long as SonarLint is active in the IDE.
-   * @since 9.0
-   */
-  String INSTANCE = "INSTANCE";
-
-  /**
-   * Control the lifecycle of the component in the IoC container.
-   * @since 7.0
-   */
-  String lifespan() default SINGLE_ANALYSIS;
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/package-info.java b/sonar-plugin-api/src/main/java/org/sonarsource/api/sonarlint/package-info.java
deleted file mode 100644 (file)
index c6a6b25..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.sonarsource.api.sonarlint;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/resources/sonar-api-version.txt b/sonar-plugin-api/src/main/resources/sonar-api-version.txt
deleted file mode 100644 (file)
index d2193c1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@project.buildVersion@
\ No newline at end of file
diff --git a/sonar-plugin-api/src/main/resources/sq-version.txt b/sonar-plugin-api/src/main/resources/sq-version.txt
deleted file mode 100644 (file)
index b3f131d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@project.version.3digits@
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/PluginTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/PluginTest.java
deleted file mode 100644 (file)
index 997d582..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 java.util.Arrays;
-import org.junit.Test;
-import org.sonar.api.config.internal.MapSettings;
-import org.sonar.api.internal.PluginContextImpl;
-import org.sonar.api.internal.SonarRuntimeImpl;
-import org.sonar.api.utils.Version;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class PluginTest {
-
-  private static final Version VERSION_5_6 = Version.create(5, 6);
-
-  @Test
-  public void test_context() {
-    SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(VERSION_5_6, SonarQubeSide.SERVER, SonarEdition.COMMUNITY);
-    MapSettings settings = new MapSettings().setProperty("foo", "bar");
-    Plugin.Context context = new PluginContextImpl.Builder()
-      .setSonarRuntime(runtime)
-      .setBootConfiguration(settings.asConfig())
-      .build();
-
-    assertThat(context.getSonarQubeVersion()).isEqualTo(VERSION_5_6);
-    assertThat(context.getExtensions()).isEmpty();
-
-    context.addExtension("foo");
-    assertThat(context.getExtensions()).containsOnly("foo");
-
-    context.addExtensions(Arrays.asList("bar", "baz"));
-    assertThat(context.getExtensions()).containsOnly("foo", "bar", "baz");
-
-    context.addExtensions("one", "two", "three", "four");
-    assertThat(context.getExtensions()).containsOnly("foo", "bar", "baz", "one", "two", "three", "four");
-
-    assertThat(context.getBootConfiguration().get("foo")).hasValue("bar");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/SonarQubeVersionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/SonarQubeVersionTest.java
deleted file mode 100644 (file)
index 9b34489..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-import org.sonar.api.utils.Version;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SonarQubeVersionTest {
-
-  @Test
-  public void isGte() {
-    Version version = Version.parse("1.2.3");
-    SonarQubeVersion qubeVersion = new SonarQubeVersion(version);
-    assertThat(qubeVersion.get()).isEqualTo(version);
-    assertThat(qubeVersion.isGreaterThanOrEqual(version)).isTrue();
-    assertThat(qubeVersion.isGreaterThanOrEqual(Version.parse("1.1"))).isTrue();
-    assertThat(qubeVersion.isGreaterThanOrEqual(Version.parse("1.3"))).isFalse();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java
deleted file mode 100644 (file)
index 1809597..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import java.io.File;
-import org.junit.Test;
-import org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.config.internal.MapSettings;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class ProjectBuilderTest {
-
-  @Test
-  public void shouldChangeProject() {
-    // this reactor is created and provided by Sonar
-    final ProjectReactor projectReactor = new ProjectReactor(ProjectDefinition.create());
-
-    ProjectBuilder builder = new ProjectBuilderSample();
-    final MapSettings settings = new MapSettings();
-    settings.setProperty("foo", "bar");
-    final Configuration configuration = settings.asConfig();
-    builder.build(new ProjectBuilderContext(projectReactor, configuration));
-
-    assertThat(projectReactor.getProjects().size(), is(2));
-    ProjectDefinition root = projectReactor.getRoot();
-    assertThat(root.getName(), is("Name changed by plugin"));
-    assertThat(root.getSubProjects().size(), is(1));
-    assertThat(root.getSubProjects().get(0).sources()).contains("src");
-  }
-
-  final static class ProjectBuilderSample extends ProjectBuilder {
-
-    @Override
-    public void build(Context context) {
-      assertThat(context.config().get("foo")).contains("bar");
-      // change name of root project
-      ProjectDefinition root = context.projectReactor().getRoot();
-      root.setName("Name changed by plugin");
-
-      // add sub-project
-      File baseDir = new File(root.getBaseDir(), "path/to/subproject");
-      ProjectDefinition subProject = ProjectDefinition.create();
-      subProject.setBaseDir(baseDir);
-      subProject.setWorkDir(new File(baseDir, "target/.sonar"));
-      subProject.setKey("groupId:parentProjectId");
-      subProject.setProjectVersion(root.getOriginalVersion());
-      subProject.setName("Sub Project");
-      subProject.setSources("src");
-      root.addSubProject(subProject);
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java
deleted file mode 100644 (file)
index 5570546..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import org.sonar.api.CoreProperties;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectDefinitionTest {
-
-  @Test
-  public void shouldSetKey() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setKey("mykey");
-    assertThat(def.getKey()).isEqualTo("mykey");
-  }
-
-  @Test
-  public void shouldSetVersion() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setProjectVersion("2.0-SNAPSHOT");
-    assertThat(def.getVersion()).isEqualTo("2.0-SNAPSHOT");
-  }
-
-  @Test
-  public void shouldSupportNoVersion() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setProjectVersion(null);
-    assertThat(def.getVersion()).isEqualTo("not provided");
-    assertThat(def.getOriginalVersion()).isEmpty();
-  }
-
-  @Test
-  public void shouldSetOptionalFields() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setName("myname");
-    def.setDescription("desc");
-    assertThat(def.getName()).isEqualTo("myname");
-    assertThat(def.getDescription()).isEqualTo("desc");
-  }
-
-  @Test
-  public void shouldSupportDefaultName() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setKey("myKey");
-    assertThat(def.getName()).isEqualTo("myKey");
-  }
-
-  @Test
-  public void shouldGetKeyFromProperties() {
-    Map<String, String> props = new HashMap<>();
-    props.put(CoreProperties.PROJECT_KEY_PROPERTY, "foo");
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setProperties(props);
-    assertThat(def.getKey()).isEqualTo("foo");
-  }
-
-  @Test
-  public void testDefaultValues() {
-    ProjectDefinition def = ProjectDefinition.create();
-    assertThat(def.sources()).isEmpty();
-    assertThat(def.tests()).isEmpty();
-  }
-
-  /**
-   * See SONAR-2879
-   */
-  @Test
-  public void shouldTrimPaths() {
-    ProjectDefinition def = ProjectDefinition.create();
-    def.setSources("src1", " src2 ", " with whitespace");
-    def.setTests("test1", " test2 ", " with whitespace");
-
-    assertThat(def.sources()).containsOnly("src1", "src2", "with whitespace");
-    assertThat(def.tests()).containsOnly("test1", "test2", "with whitespace");
-  }
-
-  @Test
-  public void shouldManageRelationships() {
-    ProjectDefinition root = ProjectDefinition.create();
-    ProjectDefinition child = ProjectDefinition.create();
-    root.addSubProject(child);
-
-    assertThat(root.getSubProjects()).hasSize(1);
-    assertThat(child.getSubProjects()).isEmpty();
-
-    assertThat(root.getParent()).isNull();
-    assertThat(child.getParent()).isEqualTo(root);
-  }
-
-  @Test
-  public void shouldResetSourceDirs() {
-    ProjectDefinition root = ProjectDefinition.create();
-    root.addSources("src", "src2/main");
-    assertThat(root.sources()).hasSize(2);
-
-    root.resetSources();
-    assertThat(root.sources()).isEmpty();
-  }
-
-  @Test
-  public void shouldResetTestDirs() {
-    ProjectDefinition root = ProjectDefinition.create();
-    root.addTests("src", "src2/test");
-    assertThat(root.tests()).hasSize(2);
-
-    root.resetTests();
-    assertThat(root.tests()).isEmpty();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectReactorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectReactorTest.java
deleted file mode 100644 (file)
index ccf36a5..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.bootstrap;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProjectReactorTest {
-
-  @Test
-  public void shouldSupportMultipleProjects() {
-    ProjectDefinition root = ProjectDefinition.create();
-    ProjectDefinition child = ProjectDefinition.create();
-    root.addSubProject(child);
-
-    ProjectReactor reactor = new ProjectReactor(root);
-    assertThat(reactor.getProjects()).hasSize(2);
-    assertThat(reactor.getRoot()).isSameAs(root);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void shouldFailIfNotRoot() {
-    ProjectDefinition root = ProjectDefinition.create();
-    ProjectDefinition child = ProjectDefinition.create();
-    root.addSubProject(child);
-
-    new ProjectReactor(child);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/AbstractCheck.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/AbstractCheck.java
deleted file mode 100644 (file)
index b31ca35..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.RuleProperty;
-
-public abstract class AbstractCheck {
-
-  @RuleProperty
-  private Integer max;
-
-  public Integer getMax() {
-    return max;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckFactoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckFactoryTest.java
deleted file mode 100644 (file)
index cf2259a..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.junit.Test;
-import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
-import org.sonar.api.batch.rule.internal.NewActiveRule;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.SonarException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class CheckFactoryTest {
-
-  ActiveRulesBuilder builder = new ActiveRulesBuilder();
-
-  @Test
-  public void no_checks_are_enabled() {
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithoutProperties.class);
-
-    assertThat(checks.all()).isEmpty();
-  }
-
-  @Test
-  public void class_name_as_check_key() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithoutProperties");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .build();
-    builder.addRule(rule);
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithoutProperties.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithoutProperties.class);
-    assertThat(checks.all()).containsOnly(check);
-    assertThat(checks.ruleKey(check)).isEqualTo(ruleKey);
-  }
-
-  @Test
-  public void param_as_string_field() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithStringProperty");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("pattern", "foo")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithStringProperty.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithStringProperty.class);
-
-    assertThat(((CheckWithStringProperty) check).getPattern()).isEqualTo("foo");
-  }
-
-  @Test
-  public void fail_if_missing_field() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithStringProperty");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("unknown", "foo")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-
-    assertThatThrownBy(() -> checkFactory.create("squid").addAnnotatedChecks(CheckWithStringProperty.class))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("The field 'unknown' does not exist or is not annotated with @RuleProperty in the class org.sonar.api.batch.rule.CheckWithStringProperty");
-  }
-
-  @Test
-  public void param_as_primitive_fields() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithPrimitiveProperties");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("max", "300")
-      .setParam("ignore", "true")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithPrimitiveProperties.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithPrimitiveProperties.class);
-    assertThat(((CheckWithPrimitiveProperties) check).getMax()).isEqualTo(300);
-    assertThat(((CheckWithPrimitiveProperties) check).isIgnore()).isTrue();
-  }
-
-  /**
-   * SONAR-3164
-   */
-  @Test
-  public void param_as_inherited_field() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithPrimitiveProperties");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("max", "300")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithPrimitiveProperties.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithPrimitiveProperties.class);
-    assertThat(((CheckWithPrimitiveProperties) check).getMax()).isEqualTo(300);
-  }
-
-  @Test
-  public void use_template_rule_key() {
-    RuleKey ruleKey = RuleKey.of("squid", "S0001_123");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setTemplateRuleKey("S0001")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithKey.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithKey.class);
-    assertThat(checks.of(ruleKey)).isSameAs(check);
-    assertThat(checks.ruleKey(check)).isEqualTo(ruleKey);
-    assertThat(checks.all()).containsOnly(check);
-  }
-
-  @Test
-  public void fail_if_field_type_is_not_supported() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithUnsupportedPropertyType");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("max", "300")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-
-    assertThatThrownBy(() -> checkFactory.create("squid").addAnnotatedChecks(CheckWithUnsupportedPropertyType.class))
-      .isInstanceOf(SonarException.class);
-  }
-
-  @Test
-  public void override_field_key() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithOverriddenPropertyKey");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("maximum", "300")
-      .build();
-    builder.addRule(rule);
-
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(CheckWithOverriddenPropertyKey.class);
-
-    Object check = checks.of(ruleKey);
-    assertThat(check).isInstanceOf(CheckWithOverriddenPropertyKey.class);
-    assertThat(((CheckWithOverriddenPropertyKey) check).getMax()).isEqualTo(300);
-  }
-
-  /**
-   * SONAR-2900
-   */
-  @Test
-  public void checks_as_objects() {
-    RuleKey ruleKey = RuleKey.of("squid", "org.sonar.api.batch.rule.CheckWithStringProperty");
-    NewActiveRule rule = new NewActiveRule.Builder()
-      .setRuleKey(ruleKey)
-      .setParam("pattern", "foo")
-      .build();
-    builder.addRule(rule);
-    CheckFactory checkFactory = new CheckFactory(builder.build());
-
-    CheckWithStringProperty check = new CheckWithStringProperty();
-    Checks checks = checkFactory.create("squid").addAnnotatedChecks(check);
-
-    Object createdCheck = checks.of(ruleKey);
-    assertThat(createdCheck).isSameAs(check);
-    assertThat(((CheckWithStringProperty) createdCheck).getPattern()).isEqualTo("foo");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithKey.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithKey.java
deleted file mode 100644 (file)
index a9a62ae..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-
-@Rule(key = "S0001", priority = Priority.CRITICAL)
-public class CheckWithKey {
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithOverriddenPropertyKey.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithOverriddenPropertyKey.java
deleted file mode 100644 (file)
index a582a6a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-import org.sonar.check.RuleProperty;
-
-@Rule(priority = Priority.CRITICAL)
-public class CheckWithOverriddenPropertyKey{
-
-  @RuleProperty(key = "maximum")
-  private int max = 50;
-
-  public int getMax() {
-    return max;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithPrimitiveProperties.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithPrimitiveProperties.java
deleted file mode 100644 (file)
index fdc3f76..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-import org.sonar.check.RuleProperty;
-
-@Rule(priority = Priority.CRITICAL)
-public class CheckWithPrimitiveProperties {
-
-  @RuleProperty(description = "Maximum threshold")
-  private int max = 50;
-
-  @RuleProperty
-  private boolean ignore;
-
-  public int getMax() {
-    return max;
-  }
-
-  public boolean isIgnore() {
-    return ignore;
-  }
-}
-
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithStringProperty.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithStringProperty.java
deleted file mode 100644 (file)
index 292e343..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-import org.sonar.check.RuleProperty;
-
-@Rule(priority = Priority.CRITICAL)
-public class CheckWithStringProperty {
-
-  @RuleProperty
-  private String pattern;
-
-  public String getPattern() {
-    return pattern;
-  }
-}
-
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithUnsupportedPropertyType.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithUnsupportedPropertyType.java
deleted file mode 100644 (file)
index a674262..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-import org.sonar.check.RuleProperty;
-
-@Rule(priority = Priority.CRITICAL)
-class CheckWithUnsupportedPropertyType {
-
-  @RuleProperty
-  private StringBuilder max = null;
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithoutProperties.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithoutProperties.java
deleted file mode 100644 (file)
index 7abf41b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-
-@Rule(priority = Priority.CRITICAL)
-public class CheckWithoutProperties {
-
-}
-
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/ImplementedCheck.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/ImplementedCheck.java
deleted file mode 100644 (file)
index cdc7e37..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.sonar.check.Priority;
-import org.sonar.check.Rule;
-
-@Rule(priority = Priority.CRITICAL)
-public class ImplementedCheck extends AbstractCheck {
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/BlameLineTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/BlameLineTest.java
deleted file mode 100644 (file)
index e79104f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import org.junit.Test;
-
-import java.util.Date;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class BlameLineTest {
-
-  @Test
-  public void testBlameLine() {
-    Date date = new Date();
-    BlameLine line1 = new BlameLine().date(date).revision("1").author("foo");
-
-    assertThat(line1.author()).isEqualTo("foo");
-    assertThat(line1.date()).isEqualTo(date);
-    assertThat(line1.revision()).isEqualTo("1");
-    assertThat(line1.toString()).isNotEqualTo("foo");
-    assertThat(line1.toString()).contains("revision=1,author=foo");
-  }
-
-  @Test
-  public void test_equals_and_hashCode() {
-    Date date = new Date();
-    BlameLine line1 = new BlameLine().date(date).revision("1").author("foo");
-    BlameLine line2 = new BlameLine().date(date).revision("1").author("foo");
-    BlameLine line3 = new BlameLine().date(null).revision("1").author("bar");
-    BlameLine line4 = new BlameLine().date(date).revision("2").author("foo");
-    BlameLine line5 = new BlameLine().date(date).revision("1").author("bar");
-
-    assertThat(line1)
-      .isEqualTo(line1)
-      .isNotNull()
-      .isEqualTo(line2)
-      .isNotEqualTo(line3)
-      .hasSameHashCodeAs(line2);
-    assertThat(line1.hashCode()).isNotEqualTo(line3.hashCode());
-    assertThat(line1.hashCode()).isNotEqualTo(line4.hashCode());
-    assertThat(line1.hashCode()).isNotEqualTo(line5.hashCode());
-  }
-
-  @Test
-  public void testTrimAuthor() {
-    BlameLine line1 = new BlameLine().date(null).revision("2").author("foo1");
-    BlameLine line2 = new BlameLine().date(null).revision("2").author("  ");
-    BlameLine line3 = new BlameLine().date(null).revision("2").author(" foo3  ");
-
-    assertThat(line1.author()).isEqualTo("foo1");
-    assertThat(line2.author()).isNull();
-    assertThat(line3.author()).isEqualTo("foo3");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/ScmProviderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/scm/ScmProviderTest.java
deleted file mode 100644 (file)
index cf904fe..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scm;
-
-import java.nio.file.Paths;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class ScmProviderTest {
-
-  private final ScmProvider provider = new ScmProvider() {
-
-    @Override
-    public String key() {
-      return "foo";
-    }
-  };
-
-  @Test
-  public void default_implementation_does_not_support_blame() {
-    assertThat(provider.supports(null)).isFalse();
-
-    assertThatThrownBy(() -> provider.blameCommand())
-      .isInstanceOf(UnsupportedOperationException.class);
-  }
-
-  @Test
-  public void default_implementation_does_not_support_relativePathFromScmRoot() {
-    assertThatThrownBy(() -> provider.relativePathFromScmRoot(Paths.get("foo")))
-      .isInstanceOf(UnsupportedOperationException.class);
-  }
-
-  @Test
-  public void default_implementation_does_not_support_revisionId() {
-    assertThatThrownBy(() -> provider.revisionId(Paths.get("foo")))
-      .isInstanceOf(UnsupportedOperationException.class);
-  }
-
-  @Test
-  public void default_implementation_does_not_support_ignore() {
-    assertThatThrownBy(() -> provider.ignoreCommand())
-      .isInstanceOf(UnsupportedOperationException.class);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/TypeOfTextTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/TypeOfTextTest.java
deleted file mode 100644 (file)
index 214d5a1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.highlighting;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TypeOfTextTest {
-
-  @Test
-  public void testForCss() {
-    assertThat(TypeOfText.forCssClass("k")).isEqualTo(TypeOfText.KEYWORD);
-    assertThat(TypeOfText.KEYWORD_LIGHT.cssClass()).isEqualTo("h");
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void throwIfUnknowCss() {
-    TypeOfText.forCssClass("w");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/RangeDistributionBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/RangeDistributionBuilderTest.java
deleted file mode 100644 (file)
index de392dc..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RangeDistributionBuilderTest {
-
-  @Test
-  public void work_on_an_limits_array_copy() {
-    Integer[] limits = new Integer[] {4, 2, 0};
-    RangeDistributionBuilder builder = new RangeDistributionBuilder(limits);
-    builder.add(3.2).add(2.0).add(6.2).build();
-
-    assertThat(limits[0]).isEqualTo(4);
-    assertThat(limits[1]).isEqualTo(2);
-    assertThat(limits[2]).isZero();
-  }
-
-  @Test
-  public void build_integer_distribution() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder(new Integer[] {0, 2, 4});
-    String data = builder
-      .add(3.2)
-      .add(2.0)
-      .add(6.2)
-      .build();
-
-    assertThat(data).isEqualTo("0=0;2=2;4=1");
-  }
-
-  @Test
-  public void build_double_distribution() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder(new Double[] {0.0, 2.0, 4.0});
-    String data = builder
-      .add(3.2)
-      .add(2.0)
-      .add(6.2)
-      .build();
-
-    assertThat(data).isEqualTo("0=0;2=2;4=1");
-  }
-
-  @Test
-  public void value_lesser_than_minimum_is_ignored() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder(new Integer[] {0, 2, 4});
-    String data = builder
-      .add(3.2)
-      .add(2.0)
-      .add(-3.0)
-      .build();
-
-    assertThat(data).isEqualTo("0=0;2=2;4=0");
-  }
-
-  @Test
-  public void add_existing_integer_distribution() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String data = builder
-      .add("0=0;2=2;4=1")
-      .add("0=1;2=2;4=2")
-      .build();
-
-    assertThat(data).isEqualTo("0=1;2=4;4=3");
-  }
-
-  @Test
-  public void add_existing_double_distribution() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String data = builder
-      .add("0.5=0;1.9=2;4.5=1")
-      .add("0.5=1;1.9=3;4.5=1")
-      .build();
-
-    assertThat(data).isEqualTo("0.5=1;1.9=5;4.5=2");
-  }
-
-  @Test
-  public void add_distribution_with_identical_limits() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String data = builder
-      .add("0=1;2=0")
-      .add("0=3;2=5")
-      .build();
-
-    assertThat(data).isEqualTo("0=4;2=5");
-  }
-
-  @Test
-  public void add_distribution_with_different_int_limits() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-
-    assertThat(builder
-      .add("0=1")
-      .add("0=3;2=5")
-      .build()).isNull();
-  }
-
-  @Test
-  public void add_distribution_with_different_double_limits() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-
-    assertThat(builder
-      .add("0.0=3;3.0=5")
-      .add("0.0=3;3.0=5;6.0=9")
-      .build()).isNull();
-  }
-
-  @Test
-  public void init_limits_at_the_first_add() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String data = builder
-      .add("0.5=3;3.5=5;6.5=9")
-      .add("0.5=0;3.5=2;6.5=1")
-      .build();
-
-    assertThat(data).isEqualTo("0.5=3;3.5=7;6.5=10");
-  }
-
-  @Test
-  public void keep_int_ranges_when_merging_distributions() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String data = builder
-      .add("0=3;3=5;6=9")
-      .add("0=0;3=2;6=1")
-      .build();
-
-    assertThat(data).isEqualTo("0=3;3=7;6=10");
-  }
-
-
-  @Test
-  public void is_empty_is_true_when_no_data() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-
-    assertThat(builder.isEmpty()).isTrue();
-  }
-
-  @Test
-  public void is_empty_is_true_when_no_data_on_distribution_with_limits() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder(new Integer[] {4, 2, 0});
-
-    assertThat(builder.isEmpty()).isTrue();
-  }
-
-  @Test
-  public void aggregate_empty_distribution() {
-    RangeDistributionBuilder builder = new RangeDistributionBuilder();
-    String distribution = builder.build();
-    assertThat(distribution).isEmpty();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java
deleted file mode 100644 (file)
index db4e86d..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.junit.Test;
-import org.sonar.api.ce.measure.Component;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class TestComponentTest {
-
-  @Test
-  public void create_project() {
-    TestComponent component = new TestComponent("Project", Component.Type.PROJECT, null);
-
-    assertThat(component.getKey()).isEqualTo("Project");
-    assertThat(component.getType()).isEqualTo(Component.Type.PROJECT);
-  }
-
-  @Test
-  public void create_source_file() {
-    TestComponent component = new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl("xoo", false));
-
-    assertThat(component.getType()).isEqualTo(Component.Type.FILE);
-    assertThat(component.getFileAttributes().getLanguageKey()).isEqualTo("xoo");
-    assertThat(component.getFileAttributes().isUnitTest()).isFalse();
-  }
-
-  @Test
-  public void create_test_file() {
-    TestComponent component = new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl(null, true));
-
-    assertThat(component.getType()).isEqualTo(Component.Type.FILE);
-    assertThat(component.getFileAttributes().isUnitTest()).isTrue();
-    assertThat(component.getFileAttributes().getLanguageKey()).isNull();
-  }
-
-  @Test
-  public void fail_with_ISE_when_calling_get_file_attributes_on_not_file() {
-    TestComponent component = new TestComponent("Project", Component.Type.PROJECT, null);
-
-    assertThatThrownBy(() -> component.getFileAttributes())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Only component of type FILE have a FileAttributes object");
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_create_a_file_without_file_attributes() {
-    assertThatThrownBy(() -> new TestComponent("File", Component.Type.FILE, null))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Component of type FILE must have a FileAttributes object");
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_create_not_a_file_with_file_attributes() {
-    assertThatThrownBy(() -> new TestComponent("Project", Component.Type.PROJECT, new TestComponent.FileAttributesImpl(null, true)))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Only component of type FILE have a FileAttributes object");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_component_without_key() {
-    assertThatThrownBy(() -> new TestComponent(null, Component.Type.PROJECT, null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Key cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_component_without_type() {
-    assertThatThrownBy(() -> new TestComponent("Project", null, null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Type cannot be null");
-  }
-
-  @Test
-  public void test_equals_and_hashcode() {
-    TestComponent component = new TestComponent("Project1", Component.Type.PROJECT, null);
-    TestComponent sameComponent = new TestComponent("Project1", Component.Type.PROJECT, null);
-    TestComponent anotherComponent = new TestComponent("Project2", Component.Type.PROJECT, null);
-
-    assertThat(component)
-      .isEqualTo(component)
-      .isEqualTo(sameComponent)
-      .isNotEqualTo(anotherComponent)
-      .isNotNull()
-      .hasSameHashCodeAs(component)
-      .hasSameHashCodeAs(sameComponent);
-    assertThat(component.hashCode()).isNotEqualTo(anotherComponent.hashCode());
-  }
-
-  @Test
-  public void test_to_string() {
-    assertThat(new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl("xoo", true)).toString())
-      .isEqualTo("ComponentImpl{key=File, type='FILE', fileAttributes=FileAttributesImpl{languageKey='xoo', unitTest=true}}");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java
deleted file mode 100644 (file)
index 4ceb693..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.junit.Test;
-import org.sonar.api.ce.measure.Issue;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.utils.Duration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class TestIssueTest {
-
-  @Test
-  public void create_issue() {
-    Issue issue = new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setEffort(Duration.create(10L))
-      .setType(RuleType.BUG)
-      .build();
-
-    assertThat(issue.key()).isEqualTo("ABCD");
-    assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("xoo", "S01"));
-    assertThat(issue.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(issue.status()).isEqualTo(org.sonar.api.issue.Issue.STATUS_RESOLVED);
-    assertThat(issue.resolution()).isEqualTo(org.sonar.api.issue.Issue.RESOLUTION_FIXED);
-    assertThat(issue.effort()).isEqualTo(Duration.create(10L));
-  }
-
-  @Test
-  public void create_issue_with_minimal_fields() {
-    Issue issue = new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setType(RuleType.BUG)
-      .build();
-
-    assertThat(issue.resolution()).isNull();
-    assertThat(issue.effort()).isNull();
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_issue_without_key() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_issue_with_null_key() {
-    assertThatThrownBy(() -> new TestIssue.Builder().setKey(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_issue_without_rule_key() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("ruleKey cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_issue_with_null_rule_key() {
-    assertThatThrownBy(() -> new TestIssue.Builder().setRuleKey(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("ruleKey cannot be null");
-  }
-
-  @Test
-  public void fail_with_IAE_when_building_issue_with_invalid_resolution() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution("unknown")
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("resolution 'unknown' is invalid");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_issue_without_severity() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("severity cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_issue_with_null_severity() {
-    assertThatThrownBy(() -> new TestIssue.Builder().setSeverity(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("severity cannot be null");
-  }
-
-  @Test
-  public void fail_with_IAE_when_building_issue_with_invalid_severity() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity("unknown")
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("severity 'unknown' is invalid");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_issue_without_status() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_creating_issue_with_null_status() {
-    assertThatThrownBy(() -> new TestIssue.Builder().setStatus(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void fail_with_IAE_when_building_issue_with_invalid_status() {
-    assertThatThrownBy(() -> new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus("unknown")
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setType(RuleType.BUG)
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("status 'unknown' is invalid");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java
deleted file mode 100644 (file)
index 91c5061..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import java.util.Arrays;
-import org.junit.Test;
-import org.sonar.api.ce.measure.Component;
-import org.sonar.api.ce.measure.Issue;
-import org.sonar.api.ce.measure.Settings;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.utils.Duration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition;
-
-public class TestMeasureComputerContextTest {
-
-  static final String INPUT_METRIC = "INPUT_METRIC";
-  static final String OUTPUT_METRIC = "OUTPUT_METRIC";
-
-  final static Component PROJECT = new TestComponent("Project", Component.Type.PROJECT, null);
-
-  final static MeasureComputerDefinition DEFINITION = new TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl()
-    .setInputMetrics(INPUT_METRIC)
-    .setOutputMetrics(OUTPUT_METRIC)
-    .build();
-
-  Settings settings = new TestSettings();
-
-  TestMeasureComputerContext underTest = new TestMeasureComputerContext(PROJECT, settings, DEFINITION);
-
-  @Test
-  public void get_component() {
-    assertThat(underTest.getComponent()).isEqualTo(PROJECT);
-  }
-
-  @Test
-  public void get_settings() {
-    assertThat(underTest.getSettings()).isEqualTo(settings);
-  }
-
-  @Test
-  public void get_int_measure() {
-    underTest.addInputMeasure(INPUT_METRIC, 10);
-
-    assertThat(underTest.getMeasure(INPUT_METRIC).getIntValue()).isEqualTo(10);
-  }
-
-  @Test
-  public void get_double_measure() {
-    underTest.addInputMeasure(INPUT_METRIC, 10d);
-
-    assertThat(underTest.getMeasure(INPUT_METRIC).getDoubleValue()).isEqualTo(10d);
-  }
-
-  @Test
-  public void get_long_measure() {
-    underTest.addInputMeasure(INPUT_METRIC, 10L);
-
-    assertThat(underTest.getMeasure(INPUT_METRIC).getLongValue()).isEqualTo(10L);
-  }
-
-  @Test
-  public void get_string_measure() {
-    underTest.addInputMeasure(INPUT_METRIC, "text");
-
-    assertThat(underTest.getMeasure(INPUT_METRIC).getStringValue()).isEqualTo("text");
-  }
-
-  @Test
-  public void get_boolean_measure() {
-    underTest.addInputMeasure(INPUT_METRIC, true);
-
-    assertThat(underTest.getMeasure(INPUT_METRIC).getBooleanValue()).isTrue();
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_get_measure_on_unknown_metric() {
-    assertThatThrownBy(() -> underTest.getMeasure("unknown"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Only metrics in [INPUT_METRIC] can be used to load measures");
-  }
-
-  @Test
-  public void get_int_children_measures() {
-    underTest.addChildrenMeasures(INPUT_METRIC, 10, 20);
-
-    assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
-  }
-
-  @Test
-  public void get_doublet_children_measures() {
-    underTest.addChildrenMeasures(INPUT_METRIC, 10d, 20d);
-
-    assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
-  }
-
-  @Test
-  public void get_long_children_measures() {
-    underTest.addChildrenMeasures(INPUT_METRIC, 10L, 20L);
-
-    assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
-  }
-
-  @Test
-  public void get_string_children_measures() {
-    underTest.addChildrenMeasures(INPUT_METRIC, "value1", "value2");
-
-    assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_get_children_measures_on_unknown_metric() {
-    assertThatThrownBy(() -> underTest.getChildrenMeasures("unknown"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Only metrics in [INPUT_METRIC] can be used to load measures");
-  }
-
-  @Test
-  public void add_int_measure() {
-    underTest.addMeasure(OUTPUT_METRIC, 10);
-
-    assertThat(underTest.getMeasure(OUTPUT_METRIC).getIntValue()).isEqualTo(10);
-  }
-
-  @Test
-  public void add_double_measure() {
-    underTest.addMeasure(OUTPUT_METRIC, 10d);
-
-    assertThat(underTest.getMeasure(OUTPUT_METRIC).getDoubleValue()).isEqualTo(10d);
-  }
-
-  @Test
-  public void add_long_measure() {
-    underTest.addMeasure(OUTPUT_METRIC, 10L);
-
-    assertThat(underTest.getMeasure(OUTPUT_METRIC).getLongValue()).isEqualTo(10L);
-  }
-
-  @Test
-  public void add_string_measure() {
-    underTest.addMeasure(OUTPUT_METRIC, "text");
-
-    assertThat(underTest.getMeasure(OUTPUT_METRIC).getStringValue()).isEqualTo("text");
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_add_measure_on_unknown_metric() {
-    assertThatThrownBy(() -> underTest.addMeasure("unknown", 10))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Only metrics in [OUTPUT_METRIC] can be used to add measures. Metric 'unknown' is not allowed.");
-  }
-
-  @Test
-  public void fail_with_IAE_when_trying_to_add_measure_on_input_metric() {
-    assertThatThrownBy(() -> underTest.addMeasure(INPUT_METRIC, 10))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Only metrics in [OUTPUT_METRIC] can be used to add measures. Metric 'INPUT_METRIC' is not allowed.");
-  }
-
-  @Test
-  public void fail_with_UOE_when_trying_to_add_same_measures_twice() {
-    underTest.addMeasure(OUTPUT_METRIC, 10);
-
-    assertThatThrownBy(() -> underTest.addMeasure(OUTPUT_METRIC, 20))
-      .isInstanceOf(UnsupportedOperationException.class)
-      .hasMessage("A measure on metric 'OUTPUT_METRIC' already exists");
-  }
-
-  @Test
-  public void get_issues() {
-    Issue issue = new TestIssue.Builder()
-      .setKey("ABCD")
-      .setRuleKey(RuleKey.of("xoo", "S01"))
-      .setSeverity(Severity.BLOCKER)
-      .setStatus(org.sonar.api.issue.Issue.STATUS_RESOLVED)
-      .setResolution(org.sonar.api.issue.Issue.RESOLUTION_FIXED)
-      .setEffort(Duration.create(10L))
-      .setType(RuleType.BUG)
-      .build();
-    underTest.setIssues(Arrays.asList(issue));
-
-    assertThat(underTest.getIssues()).hasSize(1);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerDefinitionTest.java
deleted file mode 100644 (file)
index 3df4924..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.junit.Test;
-import org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition;
-import org.sonar.api.ce.measure.test.TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl;
-import org.sonar.api.measures.CoreMetrics;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class TestMeasureComputerDefinitionTest {
-
-  @Test
-  public void build_definition() {
-    MeasureComputerDefinition definition = new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .setOutputMetrics("OUTPUT_1", "OUTPUT_2")
-      .build();
-
-    assertThat(definition.getInputMetrics()).containsOnly("INPUT_1", "INPUT_2");
-    assertThat(definition.getOutputMetrics()).containsOnly("OUTPUT_1", "OUTPUT_2");
-  }
-
-  @Test
-  public void build_definition_without_input_metric() {
-    MeasureComputerDefinition definition = new MeasureComputerDefinitionBuilderImpl()
-      .setOutputMetrics("OUTPUT_1", "OUTPUT_2")
-      .build();
-
-    assertThat(definition.getInputMetrics()).isEmpty();
-    assertThat(definition.getOutputMetrics()).containsOnly("OUTPUT_1", "OUTPUT_2");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_definition_with_null_input_metrics() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics((String[]) null)
-      .setOutputMetrics("OUTPUT_1", "OUTPUT_2")
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Input metrics cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_definition_with_on_null_input_metric() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", null)
-      .setOutputMetrics("OUTPUT_1", "OUTPUT_2")
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Null metric is not allowed");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_definition_with_null_output_metrics() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .setOutputMetrics((String[]) null)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Output metrics cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_definition_without_output_metrics() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Output metrics cannot be null");
-  }
-
-  @Test
-  public void fail_with_NPE_when_building_definition_with_on_null_ouput_metric() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .setOutputMetrics("OUTPUT_1", null)
-      .build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Null metric is not allowed");
-  }
-
-  @Test
-  public void fail_with_IAE_when_building_definition_with_empty_output_metrics() {
-    assertThatThrownBy(() ->  new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .setOutputMetrics()
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("At least one output metric must be defined");
-  }
-
-  @Test
-  public void fail_with_IAE_when_building_definition_with_core_metrics_in_output_metrics() {
-    assertThatThrownBy(() -> new MeasureComputerDefinitionBuilderImpl()
-      .setInputMetrics("INPUT_1", "INPUT_2")
-      .setOutputMetrics(CoreMetrics.NCLOC_KEY)
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Core metrics are not allowed");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java
deleted file mode 100644 (file)
index eecb98d..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class TestMeasureTest {
-
-  @Test
-  public void create_double_measure() {
-    assertThat(TestMeasure.createMeasure(10d).getDoubleValue()).isEqualTo(10d);
-  }
-
-  @Test
-  public void create_int_measure() {
-    assertThat(TestMeasure.createMeasure(10).getIntValue()).isEqualTo(10);
-  }
-
-  @Test
-  public void create_long_measure() {
-    assertThat(TestMeasure.createMeasure(10L).getLongValue()).isEqualTo(10L);
-  }
-
-  @Test
-  public void create_string_measure() {
-    assertThat(TestMeasure.createMeasure("value").getStringValue()).isEqualTo("value");
-  }
-
-  @Test
-  public void create_boolean_measure() {
-    assertThat(TestMeasure.createMeasure(true).getBooleanValue()).isTrue();
-  }
-
-  @Test
-  public void getDoubleValue_fails_with_ISE_when_not_a_double() {
-    assertThatThrownBy(() -> TestMeasure.createMeasure(10).getDoubleValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Not a double measure");
-  }
-
-  @Test
-  public void getIntValue_fails_with_ISE_when_not_an_int() {
-    assertThatThrownBy(() -> TestMeasure.createMeasure(10L).getIntValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Not an integer measure");
-  }
-
-  @Test
-  public void getLongValue_fails_with_ISE_when_not_a_long() {
-    assertThatThrownBy(() -> TestMeasure.createMeasure(10).getLongValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Not a long measure");
-  }
-
-  @Test
-  public void getStringValue_fails_with_ISE_when_not_a_string() {
-    assertThatThrownBy(() -> TestMeasure.createMeasure(10).getStringValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Not a string measure");
-  }
-
-  @Test
-  public void getBooleanValue_fails_with_ISE_when_not_a_boolean() {
-    assertThatThrownBy(() -> TestMeasure.createMeasure(10).getBooleanValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Not a boolean measure");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java
deleted file mode 100644 (file)
index 8e3c67d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.measure.test;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TestSettingsTest {
-
-  TestSettings underTest = new TestSettings();
-
-  @Test
-  public void get_string_value() {
-    underTest.setValue("key", "value");
-
-    assertThat(underTest.getString("key")).isEqualTo("value");
-    assertThat(underTest.getString("unknown")).isNull();
-  }
-
-  @Test
-  public void get_string_array_value() {
-    underTest.setValue("key", "value1,value2");
-
-    assertThat(underTest.getStringArray("key")).containsOnly("value1", "value2");
-    assertThat(underTest.getStringArray("unknown")).isEmpty();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java
deleted file mode 100644 (file)
index ef6f70c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class CeTaskBuilder_PostProjectAnalysisTaskTesterTest {
-  private static final CeTask.Status SOME_STATUS = CeTask.Status.SUCCESS;
-  private static final String SOME_ID = "some id";
-
-  private PostProjectAnalysisTaskTester.CeTaskBuilder underTest = PostProjectAnalysisTaskTester.newCeTaskBuilder();
-
-  @Test
-  public void setId_throws_NPE_if_id_is_null() {
-    assertThatThrownBy(() -> underTest.setId(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("id cannot be null");
-  }
-
-  @Test
-  public void setStatus_throws_NPE_if_status_is_null() {
-    assertThatThrownBy(() -> underTest.setStatus(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_id_is_null() {
-    underTest.setStatus(SOME_STATUS);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("id cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_status_is_null() {
-    underTest.setId(SOME_ID);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void build_returns_new_instance_at_each_call() {
-    underTest.setId(SOME_ID).setStatus(SOME_STATUS);
-
-    assertThat(underTest.build()).isNotSameAs(underTest.build());
-  }
-
-  @Test
-  public void verify_getters() {
-    CeTask ceTask = underTest.setId(SOME_ID).setStatus(SOME_STATUS).build();
-
-    assertThat(ceTask.getId()).isEqualTo(SOME_ID);
-    assertThat(ceTask.getStatus()).isEqualTo(SOME_STATUS);
-  }
-
-  @Test
-  public void verify_toString() {
-    assertThat(underTest.setId(SOME_ID).setStatus(SOME_STATUS).build().toString()).isEqualTo("CeTask{id='some id', status=SUCCESS}");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ConditionBuilder_PostProjectAnalysisTaskTesterTest.java
deleted file mode 100644 (file)
index c2fae1b..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class ConditionBuilder_PostProjectAnalysisTaskTesterTest {
-  private static final String SOME_METRIC_KEY = "some metric key";
-  private static final QualityGate.Operator SOME_OPERATOR = QualityGate.Operator.GREATER_THAN;
-  private static final String SOME_ERROR_THRESHOLD = "some error threshold";
-  private static final QualityGate.EvaluationStatus SOME_STATUS_BUT_NO_VALUE = QualityGate.EvaluationStatus.OK;
-  private static final String SOME_VALUE = "some value";
-
-  private PostProjectAnalysisTaskTester.ConditionBuilder underTest = PostProjectAnalysisTaskTester.newConditionBuilder();
-
-  @Test
-  public void setMetricKey_throws_NPE_if_operator_is_null() {
-    assertThatThrownBy(() -> underTest.setMetricKey(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("metricKey cannot be null");
-  }
-
-  @Test
-  public void setOperator_throws_NPE_if_operator_is_null() {
-    assertThatThrownBy(() -> underTest.setOperator(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("operator cannot be null");
-  }
-
-  @Test
-  public void buildNoValue_throws_NPE_if_metricKey_is_null() {
-    underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD);
-
-    assertThatThrownBy(() -> underTest.buildNoValue())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("metricKey cannot be null");
-  }
-
-  @Test
-  public void buildNoValue_throws_NPE_if_operator_is_null() {
-    underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD);
-
-    assertThatThrownBy(() -> underTest.buildNoValue())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("operator cannot be null");
-  }
-
-  @Test
-  public void buildNoValue_throws_NPE_if_errorThreshold_is_null() {
-    underTest.setMetricKey(SOME_METRIC_KEY).setOperator(SOME_OPERATOR);
-
-    assertThatThrownBy(() -> underTest.buildNoValue())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("errorThreshold cannot be null");
-  }
-
-  @Test
-  public void buildNoValue_returns_Condition_which_getStatus_method_returns_NO_VALUE() {
-    initValidBuilder();
-
-    assertThat(underTest.buildNoValue().getStatus()).isEqualTo(QualityGate.EvaluationStatus.NO_VALUE);
-  }
-
-  @Test
-  public void buildNoValue_returns_Condition_which_getValue_method_throws_ISE() {
-    initValidBuilder();
-    QualityGate.Condition condition = underTest.buildNoValue();
-
-    assertThatThrownBy(() -> condition.getValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("There is no value when status is NO_VALUE");
-  }
-
-  @Test
-  public void buildNoValue_returns_new_instance_at_each_call() {
-    initValidBuilder();
-
-    assertThat(underTest.buildNoValue()).isNotSameAs(underTest.buildNoValue());
-  }
-
-  @Test
-  public void buildNoValue_has_no_value_in_toString_and_status_is_NO_VALUE() {
-    initValidBuilder();
-
-    assertThat(underTest.buildNoValue().toString())
-      .isEqualTo(
-        "Condition{status=NO_VALUE, metricKey='some metric key', operator=GREATER_THAN, " +
-          "errorThreshold='some error threshold'}");
-  }
-
-  @Test
-  public void verify_getters_of_object_returned_by_buildNoValue() {
-    initValidBuilder().setOnLeakPeriod(true);
-
-    QualityGate.Condition condition = underTest.buildNoValue();
-
-    assertThat(condition.getMetricKey()).isEqualTo(SOME_METRIC_KEY);
-    assertThat(condition.getOperator()).isEqualTo(SOME_OPERATOR);
-    assertThat(condition.getErrorThreshold()).isEqualTo(SOME_ERROR_THRESHOLD);
-  }
-
-  @Test
-  public void build_throws_NPE_if_status_is_null() {
-    initValidBuilder();
-
-    assertThatThrownBy(() -> underTest.build(null, SOME_VALUE))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void build_throws_IAE_if_status_is_NO_VALUE() {
-    initValidBuilder();
-
-    assertThatThrownBy(() -> underTest.build(QualityGate.EvaluationStatus.NO_VALUE, SOME_VALUE))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("status cannot be NO_VALUE, use method buildNoValue() instead");
-  }
-
-  @Test
-  public void build_throws_NPE_if_value_is_null() {
-    initValidBuilder();
-
-    assertThatThrownBy(() -> underTest.build(SOME_STATUS_BUT_NO_VALUE, null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("value cannot be null, use method buildNoValue() instead");
-  }
-
-  @Test
-  public void build_throws_NPE_if_metricKey_is_null() {
-    underTest.setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD);
-
-    assertThatThrownBy(() -> underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("metricKey cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_operator_is_null() {
-    underTest.setMetricKey(SOME_METRIC_KEY).setErrorThreshold(SOME_ERROR_THRESHOLD);
-
-    assertThatThrownBy(() -> underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("operator cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_errorThreshold_is_null() {
-    underTest.setMetricKey(SOME_METRIC_KEY).setOperator(SOME_OPERATOR);
-
-    assertThatThrownBy(() -> underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("errorThreshold cannot be null");
-  }
-
-  @Test
-  public void build_returns_new_instance_at_each_call() {
-    initValidBuilder();
-
-    assertThat(underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE)).isNotSameAs(underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE));
-  }
-
-  @Test
-  public void build_has_value_in_toString_and_specified_status() {
-    initValidBuilder();
-
-    assertThat(underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE).toString())
-      .isEqualTo(
-        "Condition{status=OK, metricKey='some metric key', operator=GREATER_THAN, "
-          + "errorThreshold='some error threshold', value='some value'}");
-  }
-
-  @Test
-  public void build_returns_Condition_which_getStatus_method_returns_NO_VALUE() {
-    initValidBuilder();
-
-    assertThat(underTest.buildNoValue().getStatus()).isEqualTo(QualityGate.EvaluationStatus.NO_VALUE);
-  }
-
-  @Test
-  public void build_returns_Condition_which_getValue_method_throws_ISE() {
-    initValidBuilder();
-    QualityGate.Condition condition = underTest.buildNoValue();
-
-    assertThatThrownBy(() -> condition.getValue())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("There is no value when status is NO_VALUE");
-  }
-
-  @Test
-  public void verify_getters_of_object_returned_by_build() {
-    initValidBuilder().setOnLeakPeriod(true);
-
-    QualityGate.Condition condition = underTest.build(SOME_STATUS_BUT_NO_VALUE, SOME_VALUE);
-
-    assertThat(condition.getStatus()).isEqualTo(SOME_STATUS_BUT_NO_VALUE);
-    assertThat(condition.getMetricKey()).isEqualTo(SOME_METRIC_KEY);
-    assertThat(condition.getOperator()).isEqualTo(SOME_OPERATOR);
-    assertThat(condition.getErrorThreshold()).isEqualTo(SOME_ERROR_THRESHOLD);
-    assertThat(condition.getValue()).isEqualTo(SOME_VALUE);
-  }
-
-  private PostProjectAnalysisTaskTester.ConditionBuilder initValidBuilder() {
-    underTest.setMetricKey(SOME_METRIC_KEY).setOperator(SOME_OPERATOR).setErrorThreshold(SOME_ERROR_THRESHOLD);
-    return underTest;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java
deleted file mode 100644 (file)
index 1d5ad4a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.sonar.api.ce.posttask.PostProjectAnalysisTask.Context;
-import org.sonar.api.ce.posttask.PostProjectAnalysisTask.ProjectAnalysis;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class PostProjectAnalysisTaskTest {
-  private final Context context = mock(Context.class);
-  private final ProjectAnalysis projectAnalysis = Mockito.mock(ProjectAnalysis.class);
-
-  @Test
-  public void default_implementation_of_finished_ProjectAnalysis_returns_class_name() {
-    PostProjectAnalysisTask underTest = new PostTask();
-
-    assertThat(underTest.getDescription()).isEqualTo("PostTask");
-  }
-
-  private static class PostTask implements PostProjectAnalysisTask {
-
-  }
-
-  @Test
-  public void default_implementation_of_finished_Context_calls_finished_ProjectAnalysis() {
-    when(context.getProjectAnalysis()).thenReturn(projectAnalysis);
-    boolean[] called = {false};
-    PostProjectAnalysisTask underTest = new PostProjectAnalysisTask() {
-
-      // override default implementation which throws an exception
-      @Override
-      public void finished(ProjectAnalysis analysis) {
-        called[0] = true;
-        assertThat(analysis).isSameAs(projectAnalysis);
-      }
-
-      @Override
-      public String getDescription() {
-        throw new UnsupportedOperationException("getDescription not implemented");
-      }
-    };
-
-    underTest.finished(context);
-
-    assertThat(called[0]).isTrue();
-    verify(context).getProjectAnalysis();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTesterTest.java
deleted file mode 100644 (file)
index b797189..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import org.apache.commons.lang.RandomStringUtils;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.sonar.api.ce.posttask.Branch.Type.BRANCH;
-
-public class PostProjectAnalysisTaskTesterTest {
-
-  private CeTask ceTask = mock(CeTask.class);
-  private Project project = mock(Project.class);
-  private long someDateAsLong = 846351351684351L;
-  private Date someDate = new Date(someDateAsLong);
-  private String analysisUuid = RandomStringUtils.randomAlphanumeric(40);
-  private QualityGate qualityGate = mock(QualityGate.class);
-  private CaptorPostProjectAnalysisTask captorPostProjectAnalysisTask = new CaptorPostProjectAnalysisTask();
-  private PostProjectAnalysisTaskTester underTest = PostProjectAnalysisTaskTester.of(captorPostProjectAnalysisTask);
-
-  @Test
-  public void of_throws_NPE_if_PostProjectAnalysisTask_is_null() {
-    assertThatThrownBy(() -> PostProjectAnalysisTaskTester.of(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("PostProjectAnalysisTask instance cannot be null");
-  }
-
-  @Test
-  public void withCeTask_throws_NPE_if_ceTask_is_null() {
-    assertThatThrownBy(() -> underTest.withCeTask(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("ceTask cannot be null");
-  }
-
-  @Test
-  public void withProject_throws_NPE_if_project_is_null() {
-    assertThatThrownBy(() -> underTest.withProject(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("project cannot be null");
-  }
-
-  @Test
-  public void at_throws_NPE_if_date_is_null() {
-    assertThatThrownBy(() -> underTest.at(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("date cannot be null");
-  }
-
-  @Test
-  public void withQualityGate_does_not_throw_NPE_if_project_is_null() {
-    underTest.withQualityGate(null);
-  }
-
-  @Test
-  public void execute_throws_NPE_if_ceTask_is_null() {
-    underTest.withProject(project).at(someDate);
-
-    assertThatThrownBy(() -> underTest.execute())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("ceTask cannot be null");
-  }
-
-  @Test
-  public void execute_throws_NPE_if_project_is_null() {
-    underTest.withCeTask(ceTask).at(someDate);
-
-    assertThatThrownBy(() -> underTest.execute())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("project cannot be null");
-  }
-
-  @Test
-  public void verify_getters_of_ProjectAnalysis_object_passed_to_PostProjectAnalysisTask() {
-    underTest.withCeTask(ceTask).withProject(project).withQualityGate(qualityGate).withAnalysisUuid(analysisUuid).at(someDate);
-
-    underTest.execute();
-
-    PostProjectAnalysisTask.ProjectAnalysis projectAnalysis = captorPostProjectAnalysisTask.projectAnalysis;
-    assertThat(projectAnalysis).isNotNull();
-    assertThat(projectAnalysis.getCeTask()).isSameAs(ceTask);
-    assertThat(projectAnalysis.getProject()).isSameAs(project);
-    assertThat(projectAnalysis.getQualityGate()).isSameAs(qualityGate);
-    assertThat(projectAnalysis.getAnalysis().get().getAnalysisUuid()).isSameAs(analysisUuid);
-  }
-
-  @Test
-  public void verify_toString_of_ProjectAnalysis_object_passed_to_PostProjectAnalysisTask() {
-    when(ceTask.toString()).thenReturn("CeTask");
-    when(project.toString()).thenReturn("Project");
-    when(qualityGate.toString()).thenReturn("QualityGate");
-    underTest.withCeTask(ceTask).withProject(project).withQualityGate(qualityGate).at(someDate);
-
-    underTest.execute();
-
-    assertThat(captorPostProjectAnalysisTask.projectAnalysis)
-      .hasToString("ProjectAnalysis{ceTask=CeTask, project=Project, date=846351351684351, analysisDate=846351351684351, qualityGate=QualityGate}");
-
-  }
-
-  @Test
-  public void execute_throws_NPE_if_date_is_null() {
-    underTest.withCeTask(ceTask).withProject(project);
-
-    assertThatThrownBy(() -> underTest.execute())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("date cannot be null");
-  }
-
-  @Test
-  public void getLogStatistics_throws_ISE_if_called_before_execute() {
-    assertThatThrownBy(() -> underTest.getLogStatistics())
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("execute must be called first");
-  }
-
-  @Test
-  public void getLogStatistics_returns_empty_if_no_log_statistic_added_by_tested_Task() {
-    underTest.withCeTask(ceTask).withProject(project).withQualityGate(qualityGate).withAnalysisUuid(analysisUuid).at(someDate);
-
-    underTest.execute();
-
-    assertThat(underTest.getLogStatistics()).isEmpty();
-  }
-
-  @Test
-  public void getLogStatistics_returns_log_statistics_added_by_tested_Task() {
-    Random random = new Random();
-    Map<String, Object> expected = new HashMap<>();
-    for (int i = 0; i < 1 + random.nextInt(10); i++) {
-      expected.put(String.valueOf(i), random.nextInt(100));
-    }
-    PostProjectAnalysisTask projectAnalysisTask = mock(PostProjectAnalysisTask.class);
-    doAnswer(i -> {
-      PostProjectAnalysisTask.Context context = i.getArgument(0);
-      expected.forEach((k, v) -> context.getLogStatistics().add(k, v));
-      return null;
-    }).when(projectAnalysisTask).finished(any(PostProjectAnalysisTask.Context.class));
-    PostProjectAnalysisTaskTester underTest = PostProjectAnalysisTaskTester.of(projectAnalysisTask);
-    underTest.withCeTask(ceTask).withProject(project).withQualityGate(qualityGate).withAnalysisUuid(analysisUuid).at(someDate);
-
-    underTest.execute();
-
-    assertThat(underTest.getLogStatistics()).isEqualTo(expected);
-  }
-
-  @Test
-  public void branch_builder_builds_branch_of_type_branch_by_default() {
-    Branch branch = PostProjectAnalysisTaskTester.newBranchBuilder().build();
-
-    assertThat(branch.getType()).isEqualTo(BRANCH);
-  }
-
-  private static class CaptorPostProjectAnalysisTask implements PostProjectAnalysisTask {
-    private ProjectAnalysis projectAnalysis;
-
-    @Override
-    public String getDescription() {
-      return "captor";
-    }
-
-    @Override
-    public void finished(Context context) {
-      this.projectAnalysis = context.getProjectAnalysis();
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/ProjectBuilder_PostProjectAnalysisTaskTesterTest.java
deleted file mode 100644 (file)
index 9db590f..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class ProjectBuilder_PostProjectAnalysisTaskTesterTest {
-  private static final String SOME_NAME = "some name";
-  private static final String SOME_KEY = "some key";
-  private static final String SOME_UUID = "some uuid";
-
-  private PostProjectAnalysisTaskTester.ProjectBuilder underTest = PostProjectAnalysisTaskTester.newProjectBuilder();
-
-  @Test
-  public void setKey_throws_NPE_if_key_is_null() {
-    assertThatThrownBy(() -> underTest.setKey(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key cannot be null");
-  }
-
-  @Test
-  public void setName_throws_NPE_if_name_is_null() {
-    assertThatThrownBy(() -> underTest.setName(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("name cannot be null");
-  }
-
-  @Test
-  public void setUuid_throws_NPE_if_uuid_is_null() {
-    assertThatThrownBy(() -> underTest.setUuid(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("uuid cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_key_is_null() {
-    underTest.setUuid(SOME_UUID).setName(SOME_NAME);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_name_is_null() {
-    underTest.setUuid(SOME_UUID).setKey(SOME_KEY);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("name cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_uuid_is_null() {
-    underTest.setKey(SOME_KEY).setName(SOME_NAME);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("uuid cannot be null");
-  }
-
-  @Test
-  public void build_returns_new_instance_at_each_call() {
-    underTest.setUuid(SOME_UUID).setKey(SOME_KEY).setName(SOME_NAME);
-
-    assertThat(underTest.build()).isNotSameAs(underTest.build());
-  }
-
-  @Test
-  public void verify_getters() {
-    Project project = underTest.setUuid(SOME_UUID).setKey(SOME_KEY).setName(SOME_NAME).build();
-
-    assertThat(project.getUuid()).isEqualTo(SOME_UUID);
-    assertThat(project.getKey()).isEqualTo(SOME_KEY);
-    assertThat(project.getName()).isEqualTo(SOME_NAME);
-  }
-
-  @Test
-  public void verify_toString() {
-    assertThat(underTest.setUuid(SOME_UUID).setKey(SOME_KEY).setName(SOME_NAME).build().toString())
-      .isEqualTo("Project{uuid='some uuid', key='some key', name='some name'}");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java
deleted file mode 100644 (file)
index d901b58..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.ce.posttask;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class QualityGateBuilder_PostProjectAnalysisTaskTesterTest {
-  private static final String SOME_NAME = "some name";
-  private static final QualityGate.Status SOME_STATUS = QualityGate.Status.ERROR;
-  private static final String SOME_ID = "some id";
-
-  private QualityGate.Condition condition1 = mock(QualityGate.Condition.class);
-  private QualityGate.Condition condition2 = mock(QualityGate.Condition.class);
-  private PostProjectAnalysisTaskTester.QualityGateBuilder underTest = PostProjectAnalysisTaskTester.newQualityGateBuilder();
-
-  @Test
-  public void setId_throws_NPE_if_id_is_null() {
-    assertThatThrownBy(() -> underTest.setId(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("id cannot be null");
-  }
-
-  @Test
-  public void setStatus_throws_NPE_if_status_is_null() {
-    assertThatThrownBy(() -> underTest.setStatus(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void setName_throws_NPE_if_name_is_null() {
-    assertThatThrownBy(() -> underTest.setName(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("name cannot be null");
-  }
-
-  @Test
-  public void addCondition_throws_NPE_if_condition_is_null() {
-    assertThatThrownBy(() -> underTest.add(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("condition cannot be null");
-  }
-
-  @Test
-  public void clearConditions_does_not_raise_any_error_if_there_is_no_condition_in_builder() {
-    underTest.clearConditions();
-  }
-
-  @Test
-  public void clearConditions_removes_all_conditions_from_builder() {
-    underTest.setId(SOME_ID).setStatus(SOME_STATUS).setName(SOME_NAME).add(condition1).add(condition2);
-
-    assertThat(underTest.build().getConditions()).containsOnly(condition1, condition2);
-
-    underTest.clearConditions();
-
-    assertThat(underTest.build().getConditions()).isEmpty();
-  }
-
-  @Test
-  public void build_throws_NPE_if_id_is_null() {
-    underTest.setStatus(SOME_STATUS).setName(SOME_NAME);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("id cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_status_is_null() {
-    underTest.setId(SOME_ID).setName(SOME_NAME);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("status cannot be null");
-  }
-
-  @Test
-  public void build_throws_NPE_if_name_is_null() {
-    underTest.setId(SOME_ID).setStatus(SOME_STATUS);
-
-    assertThatThrownBy(() -> underTest.build())
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("name cannot be null");
-  }
-
-  @Test
-  public void build_returns_new_instance_at_each_call() {
-    underTest.setId(SOME_ID).setStatus(SOME_STATUS).setName(SOME_NAME);
-
-    assertThat(underTest.build()).isNotSameAs(underTest.build());
-  }
-
-  @Test
-  public void verify_getters() {
-    QualityGate qualityGate = underTest.setId(SOME_ID).setStatus(SOME_STATUS).setName(SOME_NAME).add(condition1).add(condition2).build();
-
-    assertThat(qualityGate.getId()).isEqualTo(SOME_ID);
-    assertThat(qualityGate.getStatus()).isEqualTo(SOME_STATUS);
-    assertThat(qualityGate.getName()).isEqualTo(SOME_NAME);
-    assertThat(qualityGate.getConditions()).containsOnly(condition1, condition2);
-  }
-
-  @Test
-  public void verify_toString() {
-    when(condition1.toString()).thenReturn("condition1");
-    when(condition2.toString()).thenReturn("condition2");
-
-    assertThat(underTest.setId(SOME_ID).setStatus(SOME_STATUS).setName(SOME_NAME).add(condition1).add(condition2).build().toString())
-      .isEqualTo("QualityGate{id='some id', name='some name', status=ERROR, conditions=[condition1, condition2]}");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/CategoryTest.java
deleted file mode 100644 (file)
index 5af98ca..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class CategoryTest {
-
-  @Test
-  public void category_key_is_case_insentive() {
-    assertThat(new Category("Licenses")).isEqualTo(new Category("licenses"));
-
-    // Just to raise coverage
-    assertThat(new Category("Licenses").key()).isNotEqualTo("Licenses");
-  }
-
-  @Test
-  public void should_preserve_original_key() {
-    assertThat(new Category("Licenses").originalKey()).isEqualTo("Licenses");
-  }
-
-  @Test
-  public void should_normalize_key() {
-    assertThat(new Category("Licenses").key()).isEqualTo("licenses");
-  }
-
-  @Test
-  public void should_use_original_key() {
-    assertThat(new Category("Licenses").toString()).isEqualTo("Licenses");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java
deleted file mode 100644 (file)
index 1ce65e5..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Random;
-import java.util.function.BiFunction;
-import org.apache.commons.lang.RandomStringUtils;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ConfigurationTest {
-
-  private DumpMapConfiguration underTest = new DumpMapConfiguration();
-
-  @Test
-  public void getBoolean_supports_heading_and_or_trailing_whitespaces() {
-    boolean value = new Random().nextBoolean();
-
-    verifySupportHeadAndOrTrailingWhitespaces(value, Configuration::getBoolean);
-  }
-
-  @Test
-  public void getBoolean_returns_false_if_value_is_not_true() {
-    verifyBooleanFalse("false");
-    verifyBooleanFalse("False");
-    verifyBooleanFalse("FALSE");
-    verifyBooleanFalse("  false  ");
-    verifyBooleanFalse("foo");
-    verifyBooleanFalse("xxx");
-    verifyBooleanFalse("___");
-    verifyBooleanFalse("yes");
-    verifyBooleanFalse("no");
-  }
-
-  @Test
-  public void getBoolean_returns_true_if_value_is_true_ignore_case() {
-    verifyBooleanTrue("true");
-    verifyBooleanTrue("TRUE");
-    verifyBooleanTrue("True");
-    verifyBooleanTrue(" True ");
-  }
-
-  private void verifyBooleanFalse(String value) {
-    underTest.put("foo", value);
-    assertThat(underTest.getBoolean("foo")).hasValue(false);
-  }
-
-  private void verifyBooleanTrue(String value) {
-    underTest.put("foo", value);
-    assertThat(underTest.getBoolean("foo")).hasValue(true);
-  }
-
-  @Test
-  public void getInt() {
-    int value = new Random().nextInt();
-
-    verifySupportHeadAndOrTrailingWhitespaces(value, Configuration::getInt);
-  }
-
-  @Test
-  public void getLong() {
-    long value = new Random().nextLong();
-
-    verifySupportHeadAndOrTrailingWhitespaces(value, Configuration::getLong);
-  }
-
-  @Test
-  public void getFloat() {
-    float value = new Random().nextFloat();
-
-    verifySupportHeadAndOrTrailingWhitespaces(value, Configuration::getFloat);
-  }
-
-  @Test
-  public void getDouble() {
-    double value = new Random().nextDouble();
-
-    verifySupportHeadAndOrTrailingWhitespaces(value, Configuration::getDouble);
-  }
-
-  private <T> void verifySupportHeadAndOrTrailingWhitespaces(T value, BiFunction<Configuration, String, Optional<T>> t) {
-    String randomKey = RandomStringUtils.randomAlphabetic(3);
-    String randomNumberOfWhitespaces = StringUtils.repeat(" ", 1 + new Random().nextInt(10));
-
-    assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + value), randomKey)).isEqualTo(Optional.of(value));
-    assertThat(t.apply(underTest.put(randomKey, value + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
-    assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + value + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
-  }
-
-  private static class DumpMapConfiguration implements Configuration {
-    private final Map<String, String> keyValues = new HashMap<>();
-
-    public Configuration put(String key, String value) {
-      keyValues.put(key, value.trim());
-      return this;
-    }
-
-    @Override
-    public Optional<String> get(String key) {
-      return Optional.ofNullable(keyValues.get(key));
-    }
-
-    @Override
-    public boolean hasKey(String key) {
-      throw new UnsupportedOperationException("hasKey not implemented");
-    }
-
-    @Override
-    public String[] getStringArray(String key) {
-      throw new UnsupportedOperationException("getStringArray not implemented");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/EmailSettingsTest.java
deleted file mode 100644 (file)
index 371f69b..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import org.apache.commons.lang.RandomStringUtils;
-import org.junit.Test;
-import org.sonar.api.config.internal.MapSettings;
-import org.sonar.api.platform.Server;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EmailSettingsTest {
-
-  private MapSettings settings = new MapSettings();
-  private Server server = mock(Server.class);
-  private EmailSettings underTest = new EmailSettings(settings.asConfig(), server);
-
-  @Test
-  public void should_return_default_values() {
-    assertThat(underTest.getSmtpHost()).isEmpty();
-    assertThat(underTest.getSmtpPort()).isEqualTo(25);
-    assertThat(underTest.getSmtpUsername()).isEmpty();
-    assertThat(underTest.getSmtpPassword()).isEmpty();
-    assertThat(underTest.getSecureConnection()).isEmpty();
-    assertThat(underTest.getFrom()).isEqualTo("noreply@nowhere");
-    assertThat(underTest.getFromName()).isEqualTo("SonarQube");
-    assertThat(underTest.getPrefix()).isEqualTo("[SONARQUBE]");
-  }
-
-  @Test
-  public void getServerBaseUrl_returns_server_getPublicRootUrl() {
-    String expected = RandomStringUtils.randomAlphabetic(15);
-    when(server.getPublicRootUrl()).thenReturn(expected);
-
-    assertThat(underTest.getServerBaseURL()).isEqualTo(expected);
-  }
-
-  @Test
-  public void return_definitions() {
-    assertThat(EmailSettings.definitions()).hasSize(8);
-  }
-
-  @Test
-  public void definitions_should_have_index() {
-    assertThat(EmailSettings.definitions())
-      .extracting(PropertyDefinition::index)
-    .isNotEqualTo(999);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/GlobalPropertyChangeHandlerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/GlobalPropertyChangeHandlerTest.java
deleted file mode 100644 (file)
index 95fed74..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class GlobalPropertyChangeHandlerTest {
-  @Test
-  public void propertyChangeToString() {
-    GlobalPropertyChangeHandler.PropertyChange change = GlobalPropertyChangeHandler.PropertyChange.create("favourite.java.version", "1.5");
-    assertThat(change.toString(), is("[key=favourite.java.version, newValue=1.5]"));
-  }
-
-  @Test
-  public void propertyChangeGetters() {
-    GlobalPropertyChangeHandler.PropertyChange change = GlobalPropertyChangeHandler.PropertyChange.create("favourite.java.version", "1.5");
-    assertThat(change.getKey(), is("favourite.java.version"));
-    assertThat(change.getNewValue(), is("1.5"));
-  }
-
-  @Test
-  public void nullNewValue() {
-    GlobalPropertyChangeHandler.PropertyChange change = GlobalPropertyChangeHandler.PropertyChange.create("favourite.java.version", null);
-    assertThat(change.getNewValue(), nullValue());
-    assertThat(change.toString(), is("[key=favourite.java.version, newValue=null]"));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
deleted file mode 100644 (file)
index d7003bd..0000000
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import com.google.common.collect.ImmutableSet;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Set;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import org.junit.Test;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.PropertyField;
-import org.sonar.api.PropertyType;
-import org.sonar.api.config.PropertyDefinition.Builder;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.utils.AnnotationUtils;
-
-import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.assertj.core.api.Assertions.fail;
-
-public class PropertyDefinitionTest {
-
-  @Test
-  public void should_override_toString() {
-    PropertyDefinition def = PropertyDefinition.builder("hello").build();
-    assertThat(def.toString()).isEqualTo("hello");
-  }
-
-  @Test
-  public void should_create_property() {
-    PropertyDefinition def = PropertyDefinition.builder("hello")
-      .name("Hello")
-      .defaultValue("world")
-      .category("categ")
-      .options("de", "en")
-      .description("desc")
-      .type(PropertyType.FLOAT)
-      .onlyOnQualifiers(Qualifiers.MODULE)
-      .multiValues(true)
-      .build();
-
-    assertThat(def.key()).isEqualTo("hello");
-    assertThat(def.name()).isEqualTo("Hello");
-    assertThat(def.defaultValue()).isEqualTo("world");
-    assertThat(def.category()).isEqualTo("categ");
-    assertThat(def.options()).containsOnly("de", "en");
-    assertThat(def.description()).isEqualTo("desc");
-    assertThat(def.type()).isEqualTo(PropertyType.FLOAT);
-    assertThat(def.global()).isFalse();
-    assertThat(def.qualifiers()).containsOnly(Qualifiers.MODULE);
-    assertThat(def.multiValues()).isTrue();
-    assertThat(def.fields()).isEmpty();
-  }
-
-  @Test
-  public void should_create_from_annotation() {
-    Properties props = AnnotationUtils.getAnnotation(Init.class, Properties.class);
-    Property prop = props.value()[0];
-
-    PropertyDefinition def = PropertyDefinition.create(prop);
-
-    assertThat(def.key()).isEqualTo("hello");
-    assertThat(def.name()).isEqualTo("Hello");
-    assertThat(def.defaultValue()).isEqualTo("world");
-    assertThat(def.category()).isEqualTo("categ");
-    assertThat(def.options()).containsOnly("de", "en");
-    assertThat(def.description()).isEqualTo("desc");
-    assertThat(def.type()).isEqualTo(PropertyType.FLOAT);
-    assertThat(def.global()).isFalse();
-    assertThat(def.qualifiers()).containsOnly(Qualifiers.PROJECT, Qualifiers.MODULE);
-    assertThat(def.multiValues()).isTrue();
-    assertThat(def.fields()).isEmpty();
-  }
-
-  @Test
-  public void should_create_hidden_property() {
-    PropertyDefinition def = PropertyDefinition.builder("hello")
-      .name("Hello")
-      .hidden()
-      .build();
-
-    assertThat(def.key()).isEqualTo("hello");
-    assertThat(def.qualifiers()).isEmpty();
-    assertThat(def.global()).isFalse();
-  }
-
-  @Test
-  public void should_create_property_with_default_values() {
-    PropertyDefinition def = PropertyDefinition.builder("hello")
-      .name("Hello")
-      .build();
-
-    assertThat(def.key()).isEqualTo("hello");
-    assertThat(def.name()).isEqualTo("Hello");
-    assertThat(def.defaultValue()).isEmpty();
-    assertThat(def.category()).isEmpty();
-    assertThat(def.options()).isEmpty();
-    assertThat(def.description()).isEmpty();
-    assertThat(def.type()).isEqualTo(PropertyType.STRING);
-    assertThat(def.global()).isTrue();
-    assertThat(def.qualifiers()).isEmpty();
-    assertThat(def.multiValues()).isFalse();
-    assertThat(def.fields()).isEmpty();
-  }
-
-  @Test
-  public void should_create_from_annotation_default_values() {
-    Properties props = AnnotationUtils.getAnnotation(DefaultValues.class, Properties.class);
-    Property prop = props.value()[0];
-
-    PropertyDefinition def = PropertyDefinition.create(prop);
-
-    assertThat(def.key()).isEqualTo("hello");
-    assertThat(def.name()).isEqualTo("Hello");
-    assertThat(def.defaultValue()).isEmpty();
-    assertThat(def.category()).isEmpty();
-    assertThat(def.options()).isEmpty();
-    assertThat(def.description()).isEmpty();
-    assertThat(def.type()).isEqualTo(PropertyType.STRING);
-    assertThat(def.global()).isTrue();
-    assertThat(def.qualifiers()).isEmpty();
-    assertThat(def.multiValues()).isFalse();
-    assertThat(def.fields()).isEmpty();
-  }
-
-  @Test
-  public void should_support_property_sets() {
-    PropertyDefinition def = PropertyDefinition.builder("hello")
-      .name("Hello")
-      .fields(
-        PropertyFieldDefinition.build("first").name("First").description("Description").options("A", "B").build(),
-        PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).build())
-      .build();
-
-    assertThat(def.type()).isEqualTo(PropertyType.PROPERTY_SET);
-    assertThat(def.fields()).hasSize(2);
-    assertThat(def.fields().get(0).key()).isEqualTo("first");
-    assertThat(def.fields().get(0).name()).isEqualTo("First");
-    assertThat(def.fields().get(0).description()).isEqualTo("Description");
-    assertThat(def.fields().get(0).type()).isEqualTo(PropertyType.STRING);
-    assertThat(def.fields().get(0).options()).containsOnly("A", "B");
-    assertThat(def.fields().get(1).key()).isEqualTo("second");
-    assertThat(def.fields().get(1).name()).isEqualTo("Second");
-    assertThat(def.fields().get(1).type()).isEqualTo(PropertyType.INTEGER);
-    assertThat(def.fields().get(1).options()).isEmpty();
-  }
-
-  @Test
-  public void should_support_property_sets_from_annotation() {
-    Properties props = AnnotationUtils.getAnnotation(WithPropertySet.class, Properties.class);
-    Property prop = props.value()[0];
-
-    PropertyDefinition def = PropertyDefinition.create(prop);
-
-    assertThat(def.type()).isEqualTo(PropertyType.PROPERTY_SET);
-    assertThat(def.fields()).hasSize(2);
-    assertThat(def.fields().get(0).key()).isEqualTo("first");
-    assertThat(def.fields().get(0).name()).isEqualTo("First");
-    assertThat(def.fields().get(0).description()).isEqualTo("Description");
-    assertThat(def.fields().get(0).type()).isEqualTo(PropertyType.STRING);
-    assertThat(def.fields().get(0).options()).containsOnly("A", "B");
-    assertThat(def.fields().get(1).key()).isEqualTo("second");
-    assertThat(def.fields().get(1).name()).isEqualTo("Second");
-    assertThat(def.fields().get(1).type()).isEqualTo(PropertyType.INTEGER);
-    assertThat(def.fields().get(1).options()).isEmpty();
-  }
-
-  @Test
-  public void should_validate_string() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.STRING).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("foo").isValid()).isTrue();
-  }
-
-  @Test
-  public void should_validate_boolean() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.BOOLEAN).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("true").isValid()).isTrue();
-    assertThat(def.validate("false").isValid()).isTrue();
-
-    assertThat(def.validate("foo").isValid()).isFalse();
-    assertThat(def.validate("foo").getErrorKey()).isEqualTo("notBoolean");
-  }
-
-  @Test
-  public void should_validate_integer() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.INTEGER).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("123456").isValid()).isTrue();
-
-    assertThat(def.validate("foo").isValid()).isFalse();
-    assertThat(def.validate("foo").getErrorKey()).isEqualTo("notInteger");
-  }
-
-  @Test
-  public void validate_long() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.LONG).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("123456").isValid()).isTrue();
-
-    assertThat(def.validate("foo").isValid()).isFalse();
-    assertThat(def.validate("foo").getErrorKey()).isEqualTo("notInteger");
-  }
-
-  @Test
-  public void should_validate_float() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.FLOAT).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("123456").isValid()).isTrue();
-    assertThat(def.validate("3.14").isValid()).isTrue();
-
-    assertThat(def.validate("foo").isValid()).isFalse();
-    assertThat(def.validate("foo").getErrorKey()).isEqualTo("notFloat");
-  }
-
-  @Test
-  public void validate_regular_expression() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.REGULAR_EXPRESSION).build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("[a-zA-Z]").isValid()).isTrue();
-
-    assertThat(def.validate("[a-zA-Z").isValid()).isFalse();
-    assertThat(def.validate("[a-zA-Z").getErrorKey()).isEqualTo("notRegexp");
-  }
-
-  @Test
-  public void should_validate_single_select_list() {
-    PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.SINGLE_SELECT_LIST).options("de", "en").build();
-
-    assertThat(def.validate(null).isValid()).isTrue();
-    assertThat(def.validate("").isValid()).isTrue();
-    assertThat(def.validate("   ").isValid()).isTrue();
-    assertThat(def.validate("de").isValid()).isTrue();
-    assertThat(def.validate("en").isValid()).isTrue();
-
-    assertThat(def.validate("fr").isValid()).isFalse();
-    assertThat(def.validate("fr").getErrorKey()).isEqualTo("notInOptions");
-  }
-
-  @Test
-  public void should_auto_detect_password_type() {
-    PropertyDefinition def = PropertyDefinition.builder("scm.password.secured").name("SCM password").build();
-
-    assertThat(def.key()).isEqualTo("scm.password.secured");
-    assertThat(def.type()).isEqualTo(PropertyType.PASSWORD);
-  }
-
-  @Test
-  public void PropertyDef() {
-    PropertyDefinition def = PropertyDefinition.builder("views.license.secured").name("Views license").build();
-
-    assertThat(def.key()).isEqualTo("views.license.secured");
-    assertThat(def.type()).isEqualTo(PropertyType.LICENSE);
-  }
-
-  @Test
-  public void should_create_json_property_type() {
-    Builder builder = PropertyDefinition.builder("json-prop").type(PropertyType.JSON).multiValues(false);
-    assertThatCode(builder::build)
-      .doesNotThrowAnyException();
-  }
-
-  @Test
-  public void should_not_authorise_empty_key() {
-    Builder builder = PropertyDefinition.builder(null);
-    assertThatThrownBy(builder::build)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Key must be set");
-  }
-
-  @Test
-  public void should_not_create_json_multivalue() {
-    Builder builder = PropertyDefinition.builder("json-prop").type(PropertyType.JSON).multiValues(true);
-    assertThatThrownBy(builder::build)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Multivalues are not allowed to be defined for JSON-type property.");
-  }
-
-  @Test
-  public void should_not_authorize_defining_on_qualifiers_and_hidden() {
-    Builder builder = PropertyDefinition.builder("foo").name("foo").onQualifiers(Qualifiers.PROJECT).hidden();
-    assertThatThrownBy(builder::build)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Cannot be hidden and defining qualifiers on which to display");
-  }
-
-  @Test
-  public void should_not_authorize_defining_ony_on_qualifiers_and_hidden() {
-    Builder builder = PropertyDefinition.builder("foo").name("foo").onlyOnQualifiers(Qualifiers.PROJECT).hidden();
-    assertThatThrownBy(builder::build)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Cannot be hidden and defining qualifiers on which to display");
-  }
-
-  @Test
-  public void should_not_authorize_defining_on_qualifiers_and_only_on_qualifiers() {
-    Builder builder = PropertyDefinition.builder("foo").name("foo").onQualifiers(Qualifiers.MODULE)
-      .onlyOnQualifiers(Qualifiers.PROJECT);
-    assertThatThrownBy(builder::build)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Cannot define both onQualifiers and onlyOnQualifiers");
-  }
-
-  private static final Set<String> ALLOWED_QUALIFIERS = ImmutableSet.of("TRK", "VW", "BRC", "SVW");
-  private static final Set<String> NOT_ALLOWED_QUALIFIERS = ImmutableSet.of("FIL", "DIR", "UTS", "", randomAlphabetic(3));
-
-  @Test
-  public void onQualifiers_with_varargs_parameter_fails_with_IAE_when_qualifier_is_not_supported() {
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onQualifiers(qualifier));
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onQualifiers("TRK", qualifier, "BRC"));
-  }
-
-  @Test
-  public void onQualifiers_with_list_parameter_fails_with_IAE_when_qualifier_is_not_supported() {
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onQualifiers(Collections.singletonList(qualifier)));
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onQualifiers(Arrays.asList("TRK", qualifier, "BRC")));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_varargs_parameter_fails_with_IAE_when_qualifier_is_not_supported() {
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers(qualifier));
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers("TRK", qualifier, "BRC"));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_list_parameter_fails_with_IAE_when_qualifier_is_not_supported() {
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers(Collections.singletonList(qualifier)));
-    failsWithIAEForUnsupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers(Arrays.asList("TRK", qualifier, "BRC")));
-  }
-
-  @Test
-  public void onQualifiers_with_varargs_parameter_fails_with_NPE_when_qualifier_is_null() {
-    failsWithNPEForNullQualifiers(builder -> builder.onQualifiers((String) null));
-    failsWithNPEForNullQualifiers(builder -> builder.onQualifiers("TRK", null, "BRC"));
-  }
-
-  @Test
-  public void onQualifiers_with_list_parameter_fails_with_NPE_when_qualifier_is_null() {
-    failsWithNPEForNullQualifiers(builder -> builder.onQualifiers(Collections.singletonList(null)));
-    failsWithNPEForNullQualifiers(builder -> builder.onlyOnQualifiers("TRK", null, "BRC"));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_varargs_parameter_fails_with_NPE_when_qualifier_is_null() {
-    failsWithNPEForNullQualifiers(builder -> builder.onlyOnQualifiers((String) null));
-    failsWithNPEForNullQualifiers(builder -> builder.onlyOnQualifiers("TRK", null, "BRC"));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_list_parameter_fails_with_NPE_when_qualifier_is_null() {
-    failsWithNPEForNullQualifiers(builder -> builder.onlyOnQualifiers(Collections.singletonList(null)));
-    failsWithNPEForNullQualifiers(builder -> builder.onlyOnQualifiers(Arrays.asList("TRK", null, "BRC")));
-  }
-
-  @Test
-  public void onQualifiers_with_varargs_parameter_accepts_supported_qualifiers() {
-    acceptsSupportedQualifiers((builder, qualifier) -> builder.onQualifiers(qualifier));
-  }
-
-  @Test
-  public void onQualifiers_with_list_parameter_accepts_supported_qualifiers() {
-    acceptsSupportedQualifiers((builder, qualifier) -> builder.onQualifiers(Collections.singletonList(qualifier)));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_varargs_parameter_accepts_supported_qualifiers() {
-    acceptsSupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers(qualifier));
-  }
-
-  @Test
-  public void onlyOnQualifiers_with_list_parameter_accepts_supported_qualifiers() {
-    acceptsSupportedQualifiers((builder, qualifier) -> builder.onlyOnQualifiers(Collections.singletonList(qualifier)));
-  }
-
-  private static void failsWithIAEForUnsupportedQualifiers(BiConsumer<PropertyDefinition.Builder, String> biConsumer) {
-    PropertyDefinition.Builder builder = PropertyDefinition.builder(randomAlphabetic(3));
-    NOT_ALLOWED_QUALIFIERS.forEach(qualifier -> {
-      try {
-        biConsumer.accept(builder, qualifier);
-        fail("A IllegalArgumentException should have been thrown for qualifier " + qualifier);
-      } catch (IllegalArgumentException e) {
-        assertThat(e).hasMessage("Qualifier must be one of [TRK, VW, BRC, SVW, APP]");
-      }
-    });
-  }
-
-  private static void acceptsSupportedQualifiers(BiConsumer<PropertyDefinition.Builder, String> biConsumer) {
-    PropertyDefinition.Builder builder = PropertyDefinition.builder(randomAlphabetic(3));
-    ALLOWED_QUALIFIERS.forEach(qualifier -> biConsumer.accept(builder, qualifier));
-  }
-
-  private static void failsWithNPEForNullQualifiers(Consumer<PropertyDefinition.Builder> consumer) {
-    PropertyDefinition.Builder builder = PropertyDefinition.builder(randomAlphabetic(3));
-    NOT_ALLOWED_QUALIFIERS.forEach(qualifier -> {
-      try {
-        consumer.accept(builder);
-        fail("A NullPointerException should have been thrown for null qualifier");
-      } catch (NullPointerException e) {
-        assertThat(e).hasMessage("Qualifier cannot be null");
-      }
-    });
-  }
-
-  @Properties(@Property(key = "hello", name = "Hello", defaultValue = "world", description = "desc",
-    options = {"de", "en"}, category = "categ", type = PropertyType.FLOAT, global = false, project = true, module = true, multiValues = true, propertySetKey = "set"))
-  static class Init {
-  }
-
-  @Properties(@Property(key = "hello", name = "Hello", fields = {
-    @PropertyField(key = "first", name = "First", description = "Description", options = {"A", "B"}),
-    @PropertyField(key = "second", name = "Second", type = PropertyType.INTEGER)}))
-  static class WithPropertySet {
-  }
-
-  @Properties(@Property(key = "hello", name = "Hello"))
-  static class DefaultValues {
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java
deleted file mode 100644 (file)
index f73fadd..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import com.google.common.collect.ImmutableMap;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-import java.util.stream.IntStream;
-import org.apache.commons.lang.RandomStringUtils;
-import org.junit.Test;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.utils.System2;
-
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class PropertyDefinitionsTest {
-
-  @Test
-  public void should_build_with_predefined_list_of_definitions() {
-    List<PropertyDefinition> list = Arrays.asList(
-      PropertyDefinition.builder("foo").name("Foo").build(),
-      PropertyDefinition.builder("one").name("One").build(),
-      PropertyDefinition.builder("two").name("Two").defaultValue("2").build());
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE, list);
-
-    assertProperties(def);
-  }
-
-  @Test
-  public void should_inspect_plugin_objects() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE,
-      PropertyDefinition.builder("foo").name("Foo").build(),
-      PropertyDefinition.builder("one").name("One").build(),
-      PropertyDefinition.builder("two").name("Two").defaultValue("2").build());
-
-    assertProperties(def);
-  }
-
-  @Test
-  public void should_inspect_annotation_plugin_objects() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE, new PluginWithProperty(), new PluginWithProperties());
-
-    assertProperties(def);
-  }
-
-  @Test
-  public void should_inspect_plugin_classes() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE, PluginWithProperty.class, PluginWithProperties.class);
-
-    assertProperties(def);
-  }
-
-  @Test
-  public void test_categories() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE,
-      PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(),
-      PropertyDefinition.builder("noCateg").name("No categ").build());
-
-    assertThat(def.getCategory("inCateg")).isEqualTo("categ");
-    assertThat(def.getCategory("noCateg")).isEmpty();
-  }
-
-  @Test
-  public void test_categories_on_annotation_plugin() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE, Categories.class);
-
-    assertThat(def.getCategory("inCateg")).isEqualTo("categ");
-    assertThat(def.getCategory("noCateg")).isEmpty();
-  }
-
-  @Test
-  public void test_default_category() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE);
-    def.addComponent(PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(), "default");
-    def.addComponent(PropertyDefinition.builder("noCateg").name("No categ").build(), "default");
-
-    assertThat(def.getCategory("inCateg")).isEqualTo("categ");
-    assertThat(def.getCategory("noCateg")).isEqualTo("default");
-  }
-
-  @Test
-  public void test_default_category_on_annotation_plugin() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE);
-    def.addComponent(Categories.class, "default");
-    assertThat(def.getCategory("inCateg")).isEqualTo("categ");
-    assertThat(def.getCategory("noCateg")).isEqualTo("default");
-  }
-
-  @Test
-  public void should_return_special_categories() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE);
-
-    assertThat(def.propertiesByCategory(null).get(new Category("general"))).containsOnlyKeys(new SubCategory("email"));
-    assertThat(def.propertiesByCategory(null).get(new Category("general")).keySet().iterator().next().isSpecial()).isTrue();
-    assertThat(def.propertiesByCategory(null).get(new Category("security"))).containsOnlyKeys(new SubCategory("encryption"));
-    assertThat(def.propertiesByCategory(null).get(new Category("security")).keySet().iterator().next().isSpecial()).isTrue();
-    assertThat(def.propertiesByCategory(null).get(new Category("licenses"))).containsOnlyKeys(new SubCategory("server_id"));
-    assertThat(def.propertiesByCategory(null).get(new Category("licenses")).keySet().iterator().next().isSpecial()).isTrue();
-  }
-
-  @Test
-  public void should_group_by_category() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE,
-      PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").build(),
-      PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").build(),
-      PropertyDefinition.builder("global3").name("Global3").category("catGlobal2").build(),
-      PropertyDefinition.builder("project").name("Project").category("catProject").onlyOnQualifiers(Qualifiers.PROJECT).build(),
-      PropertyDefinition.builder("module").name("Module").category("catModule").onlyOnQualifiers(Qualifiers.MODULE).build(),
-      PropertyDefinition.builder("view").name("View").category("catView").onlyOnQualifiers(Qualifiers.VIEW).build(),
-      PropertyDefinition.builder("app").name("Application").category("catApp").onlyOnQualifiers(Qualifiers.APP).build());
-
-    assertThat(def.propertiesByCategory(null).keySet()).contains(new Category("catGlobal1"), new Category("catGlobal2"));
-    assertThat(def.propertiesByCategory(Qualifiers.PROJECT)).containsOnlyKeys(new Category("catProject"));
-    assertThat(def.propertiesByCategory(Qualifiers.MODULE)).containsOnlyKeys(new Category("catModule"));
-    assertThat(def.propertiesByCategory(Qualifiers.VIEW)).containsOnlyKeys(new Category("catView"));
-    assertThat(def.propertiesByCategory(Qualifiers.APP)).containsOnlyKeys(new Category("catApp"));
-    assertThat(def.propertiesByCategory("Unkown").keySet()).isEmpty();
-  }
-
-  @Test
-  public void should_group_by_subcategory() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE,
-      PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").subCategory("sub1").build(),
-      PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").subCategory("sub2").build(),
-      PropertyDefinition.builder("global3").name("Global3").category("catGlobal1").build(),
-      PropertyDefinition.builder("global4").name("Global4").category("catGlobal2").build());
-
-    assertThat(def.propertiesByCategory(null).get(new Category("catGlobal1"))).containsOnlyKeys(new SubCategory("catGlobal1"), new SubCategory("sub1"),
-      new SubCategory("sub2"));
-    assertThat(def.propertiesByCategory(null).get(new Category("catGlobal2"))).containsOnlyKeys(new SubCategory("catGlobal2"));
-  }
-
-  @Test
-  public void should_group_by_category_on_annotation_plugin() {
-    PropertyDefinitions def = new PropertyDefinitions(System2.INSTANCE, ByCategory.class);
-
-    assertThat(def.propertiesByCategory(null).keySet()).contains(new Category("catglobal1"), new Category("catglobal2"));
-    assertThat(def.propertiesByCategory(Qualifiers.PROJECT)).containsOnlyKeys(new Category("catproject"));
-    assertThat(def.propertiesByCategory(Qualifiers.MODULE)).containsOnlyKeys(new Category("catmodule"));
-  }
-
-  private void assertProperties(PropertyDefinitions definitions) {
-    assertThat(definitions.get("foo").name()).isEqualTo("Foo");
-    assertThat(definitions.get("one").name()).isEqualTo("One");
-    assertThat(definitions.get("two").name()).isEqualTo("Two");
-    assertThat(definitions.get("unknown")).isNull();
-
-    assertThat(definitions.getDefaultValue("foo")).isNull();
-    assertThat(definitions.getDefaultValue("two")).isEqualTo("2");
-
-    assertThat(definitions.getAll()).hasSize(3);
-  }
-
-  @Test
-  public void validKey_throws_NPE_if_key_is_null() {
-    PropertyDefinitions underTest = new PropertyDefinitions(System2.INSTANCE);
-
-    assertThatThrownBy(() -> underTest.validKey(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key can't be null");
-  }
-
-  @Test
-  public void get_throws_NPE_if_key_is_null() {
-    PropertyDefinitions underTest = new PropertyDefinitions(System2.INSTANCE);
-
-    assertThatThrownBy(() -> underTest.get(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("key can't be null");
-  }
-
-  @Test
-  public void get_trims_key_before_looking_for_replacement() {
-    Random random = new Random();
-    String key = RandomStringUtils.randomAlphanumeric(4);
-    String deprecatedKey = RandomStringUtils.randomAlphanumeric(4);
-    PropertyDefinitions underTest = new PropertyDefinitions(System2.INSTANCE, singletonList(
-      PropertyDefinition.builder(key)
-        .deprecatedKey(deprecatedKey)
-        .build()));
-
-    String untrimmedKey = blank(random) + deprecatedKey + blank(random);
-    assertThat(underTest.get(untrimmedKey).key())
-      .describedAs("expecting key %s being returned for get(%s)", key, untrimmedKey)
-      .isEqualTo(key);
-  }
-
-  private static String blank(Random random) {
-    StringBuilder b = new StringBuilder();
-    IntStream.range(0, random.nextInt(3)).mapToObj(s -> " ").forEach(b::append);
-    return b.toString();
-  }
-
-  @Test
-  public void get_value_from_env() {
-    System2 system = mock(System2.class);
-    when(system.envVariable("FOO")).thenReturn("777");
-    when(system.envVariable("ONE")).thenReturn("888");
-    when(system.envVariable("SOME_COMPLETELY_RANDOM_ENV_VAR")).thenReturn("999");
-
-    PropertyDefinitions underTest = new PropertyDefinitions(system, new PluginWithProperty(), new PluginWithProperties());
-
-    assertThat(underTest.getValueFromEnv("foo")).hasValue("777");
-    assertThat(underTest.getValueFromEnv("one")).hasValue("888");
-    assertThat(underTest.getValueFromEnv("two")).isEmpty();
-    assertThat(underTest.getValueFromEnv("some.unrecognizable.prop")).isEmpty();
-  }
-
-  @Test
-  public void get_all_properties_set_in_env() {
-    System2 system = mock(System2.class);
-    when(system.envVariable("FOO")).thenReturn("777");
-    when(system.envVariable("ONE")).thenReturn("888");
-    when(system.envVariable("SOME_COMPLETELY_RANDOM_ENV_VAR")).thenReturn("999");
-
-    PropertyDefinitions underTest = new PropertyDefinitions(system, new PluginWithProperty(), new PluginWithProperties());
-
-    assertThat(underTest.getAllPropertiesSetInEnv()).containsExactlyInAnyOrderEntriesOf(ImmutableMap.of("foo", "777", "one", "888"));
-  }
-
-  @Property(key = "foo", name = "Foo")
-  static final class PluginWithProperty {
-  }
-
-  @Properties({
-    @Property(key = "one", name = "One"),
-    @Property(key = "two", name = "Two", defaultValue = "2")
-  })
-  static final class PluginWithProperties {
-  }
-
-  @Properties({
-    @Property(key = "inCateg", name = "In Categ", category = "categ"),
-    @Property(key = "noCateg", name = "No categ")
-  })
-  static final class Categories {
-  }
-
-  @Properties({
-    @Property(key = "global1", name = "Global1", category = "catGlobal1", global = true, project = false, module = false),
-    @Property(key = "global2", name = "Global2", category = "catGlobal1", global = true, project = false, module = false),
-    @Property(key = "global3", name = "Global3", category = "catGlobal2", global = true, project = false, module = false),
-    @Property(key = "project", name = "Project", category = "catProject", global = false, project = true, module = false),
-    @Property(key = "module", name = "Module", category = "catModule", global = false, project = false, module = true)
-  })
-  static final class ByCategory {
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/SubCategoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/SubCategoryTest.java
deleted file mode 100644 (file)
index 28598f6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.config;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SubCategoryTest {
-
-  // see processProperties in application_controller.rb
-  @Test
-  public void defaultSubCategoryShouldEqualParentCategory() {
-    assertThat(new Category("general")).isEqualTo(new SubCategory("general"));
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/database/model/UserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/database/model/UserTest.java
deleted file mode 100644 (file)
index 9476093..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.database.model;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class UserTest {
-
-  @Test
-  public void testToString() {
-    User user = new User()
-      .setEmail("super@m.an")
-      .setLogin("superman")
-      .setName("Superman");
-    assertThat(user.toString()).contains("super@m.an");
-    assertThat(user.toString()).contains("superman");
-    assertThat(user.toString()).contains("Superman");
-  }
-
-  @Test
-  public void testEquals() {
-    User one = new User()
-      .setLogin("one")
-      .setName("One");
-
-    User two = new User()
-      .setLogin("two")
-      .setName("Two");
-
-    assertThat(one.equals(one)).isTrue();
-    assertThat(one.equals(new User().setLogin("one"))).isTrue();
-    assertThat(one.equals(two)).isFalse();
-
-    assertThat(one).hasSameHashCodeAs(new User().setLogin("one"));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/NoSonarFilterTest.java
deleted file mode 100644 (file)
index f70aced..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.issue;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import org.junit.Test;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.batch.sensor.issue.internal.DefaultNoSonarFilter;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class NoSonarFilterTest {
-
-  @Test
-  public void should_store_nosonar_lines_on_inputfile() {
-    DefaultInputFile f = TestInputFileBuilder.create("module1", "myfile.java").setLines(8).build();
-    new DefaultNoSonarFilter().noSonarInFile(f, new HashSet<>(Arrays.asList(1, 4)));
-
-    assertThat(f.hasNoSonarAt(1)).isTrue();
-    assertThat(f.hasNoSonarAt(2)).isFalse();
-    assertThat(f.hasNoSonarAt(4)).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MetricTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MetricTest.java
deleted file mode 100644 (file)
index 2f9f06e..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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 org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class MetricTest {
-
-  @Test
-  public void shouldCreateMetric() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.INT)
-      .setDomain("my domain")
-      .create();
-
-    assertThat(metric.getKey()).isEqualTo("foo");
-    assertThat(metric.getName()).isEqualTo("Foo");
-    assertThat(metric.getDomain()).isEqualTo("my domain");
-  }
-
-  @Test
-  public void shouldCreateMetricWithDefaultValues() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.INT)
-      .create();
-
-    assertThat(metric.getBestValue()).isNull();
-    assertThat(metric.getDescription()).isNull();
-    assertThat(metric.getWorstValue()).isNull();
-    assertThat(metric.getDirection()).isEqualTo(Metric.DIRECTION_NONE);
-    assertThat(metric.getEnabled()).isTrue();
-    assertThat(metric.getUuid()).isNull();
-    assertThat(metric.getUserManaged()).isFalse();
-    assertThat(metric.isHidden()).isFalse();
-    assertThat(metric.isOptimizedBestValue()).isFalse();
-  }
-
-  @Test
-  public void shouldCreatePercentMetricWithDefaultValues() {
-    Metric better = new Metric.Builder("foo", "Foo", Metric.ValueType.PERCENT)
-      .setDirection(Metric.DIRECTION_BETTER)
-      .create();
-    Metric worst = new Metric.Builder("foo", "Foo", Metric.ValueType.PERCENT)
-      .setDirection(Metric.DIRECTION_WORST)
-      .create();
-
-    assertThat(better.getBestValue()).isEqualTo(100.0);
-    assertThat(better.getWorstValue()).isEqualTo(0.0);
-    assertThat(worst.getBestValue()).isEqualTo(0.0);
-    assertThat(worst.getWorstValue()).isEqualTo(100.0);
-  }
-
-  @Test
-  public void override_decimal_scale_of_float_metric() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.FLOAT)
-      .setDecimalScale(3)
-      .create();
-    assertThat(metric.getDecimalScale()).isEqualTo(3);
-  }
-
-  @Test
-  public void fail_if_decimal_scale_is_greater_than_max_supported_value() {
-    assertThatThrownBy(() -> new Metric.Builder("foo", "Foo", Metric.ValueType.FLOAT)
-      .setDecimalScale(6)
-      .create())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Scale of decimal metric [foo] must be less than or equal 5: 6");
-  }
-
-  @Test
-  public void override_decimal_scale_of_percent_metric() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.PERCENT)
-      .setDecimalScale(3)
-      .create();
-    assertThat(metric.getDecimalScale()).isEqualTo(3);
-  }
-
-  @Test
-  public void default_decimal_scale_is_1() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.FLOAT)
-      .create();
-    assertThat(metric.getDecimalScale()).isOne();
-  }
-
-  @Test
-  public void non_decimal_metric_has_no_scale() {
-    Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.INT)
-      .create();
-    assertThat(metric.getDecimalScale()).isNull();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/platform/NewUserHandlerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/platform/NewUserHandlerTest.java
deleted file mode 100644 (file)
index 1bde5dc..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.platform;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class NewUserHandlerTest {
-
-  @Test
-  public void build_context() {
-    NewUserHandler.Context context = NewUserHandler.Context.builder().setLogin("marius").setName("Marius").setEmail("marius@lesbronzes.fr").build();
-
-    assertThat(context.getLogin()).isEqualTo("marius");
-    assertThat(context.getName()).isEqualTo("Marius");
-    assertThat(context.getEmail()).isEqualTo("marius@lesbronzes.fr");
-  }
-
-  @Test
-  public void login_is_mandatory() {
-    assertThatThrownBy(() -> NewUserHandler.Context.builder().setName("Marius").build())
-      .isInstanceOf(NullPointerException.class);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileExporterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileExporterTest.java
deleted file mode 100644 (file)
index 9fafd1d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-
-import java.io.Writer;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class ProfileExporterTest {
-
-  @Test
-  public void testSupportedRepositories() {
-    ProfileExporter exporter = new ProfileExporter("all", "All") {
-      @Override
-      public void exportProfile(RulesProfile profile, Writer writer) {
-      }
-    };
-    exporter.setSupportedLanguages("java", "php");
-
-    assertThat(exporter.getSupportedLanguages().length, is(2));
-    assertThat(exporter.getSupportedLanguages()[0], is("java"));
-    assertThat(exporter.getSupportedLanguages()[1], is("php"));
-  }
-
-  @Test
-  public void supportAllRepositories() {
-    ProfileExporter exporter = new ProfileExporter("all", "All") {
-      @Override
-      public void exportProfile(RulesProfile profile, Writer writer) {
-      }
-    };
-
-    assertThat(exporter.getSupportedLanguages().length, is(0));
-
-    exporter.setSupportedLanguages();
-    assertThat(exporter.getSupportedLanguages().length, is(0));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileImporterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/ProfileImporterTest.java
deleted file mode 100644 (file)
index 1a02bfd..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-import org.sonar.api.utils.ValidationMessages;
-
-import java.io.Reader;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class ProfileImporterTest {
-
-  @Test
-  public void testSupportedLanguages() {
-    ProfileImporter inmporter = new ProfileImporter("all", "All") {
-      @Override
-      public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
-        return null;
-      }
-    };
-    inmporter.setSupportedLanguages("java", "php");
-
-    assertThat(inmporter.getSupportedLanguages().length, is(2));
-    assertThat(inmporter.getSupportedLanguages()[0], is("java"));
-    assertThat(inmporter.getSupportedLanguages()[1], is("php"));
-  }
-
-  @Test
-  public void supportAllLanguages() {
-    ProfileImporter importer = new ProfileImporter("all", "All") {
-      @Override
-      public RulesProfile importProfile(Reader reader, ValidationMessages messages) {
-        return null;
-      }
-    };
-
-    assertThat(importer.getSupportedLanguages().length, is(0));
-
-    importer.setSupportedLanguages();
-    assertThat(importer.getSupportedLanguages().length, is(0));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/RulesProfileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/RulesProfileTest.java
deleted file mode 100644 (file)
index 33331cd..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RulePriority;
-import org.sonar.api.utils.MessageException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-
-public class RulesProfileTest {
-
-  @Test
-  public void searchRulesByConfigKey() {
-    RulesProfile profile = RulesProfile.create();
-    profile.activateRule(Rule.create("repo", "key1", "name1"), null);
-    profile.activateRule(Rule.create("repo", "key2", "name2").setConfigKey("config2"), null);
-
-    assertThat(profile.getActiveRuleByConfigKey("repo", "unknown")).isNull();
-    assertThat(profile.getActiveRuleByConfigKey("repo", "config2").getRuleKey()).isEqualTo("key2");
-  }
-
-  @Test
-  public void activateRuleWithDefaultPriority() {
-    RulesProfile profile = RulesProfile.create();
-    Rule rule = Rule.create("repo", "key1", "name1").setSeverity(RulePriority.CRITICAL);
-    profile.activateRule(rule, null);
-    assertThat(profile.getActiveRule("repo", "key1").getSeverity()).isEqualTo(RulePriority.CRITICAL);
-  }
-
-  @Test
-  public void activateRuleWithSpecificPriority() {
-    RulesProfile profile = RulesProfile.create();
-    Rule rule = Rule.create("repo", "key1", "name1").setSeverity(RulePriority.CRITICAL);
-    profile.activateRule(rule, RulePriority.MINOR);
-    assertThat(profile.getActiveRule("repo", "key1").getSeverity()).isEqualTo(RulePriority.MINOR);
-  }
-
-  @Test
-  public void fail_to_activate_already_activated_rule() {
-    RulesProfile profile = RulesProfile.create("Default", "java");
-    Rule rule = Rule.create("repo", "key1", "name1").setSeverity(RulePriority.CRITICAL);
-    profile.activateRule(rule, null);
-
-    try {
-      profile.activateRule(rule, null);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(MessageException.class)
-        .hasMessage("The definition of the profile 'Default' (language 'java') contains multiple occurrences of the 'repo:key1' rule. The plugin which declares this profile should fix this.");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java
deleted file mode 100644 (file)
index b9d4b57..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.sonar.api.rules.ActiveRule;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RuleFinder;
-import org.sonar.api.rules.RulePriority;
-import org.sonar.api.utils.ValidationMessages;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class XMLProfileParserTest {
-
-  @Test
-  public void importProfile() {
-    ValidationMessages validation = ValidationMessages.create();
-    RulesProfile profile = parse("importProfile.xml", validation);
-
-    assertThat(profile.getLanguage()).isEqualTo("java");
-    assertThat(profile.getName()).isEqualTo("sonar way");
-    assertThat(validation.hasErrors()).isFalse();
-    assertThat(profile).isNotNull();
-
-    assertThat(profile.getActiveRule("checkstyle", "IllegalRegexp").getSeverity()).isEqualTo(RulePriority.CRITICAL);
-  }
-
-  @Test
-  public void nameAndLanguageShouldBeMandatory() {
-    ValidationMessages validation = ValidationMessages.create();
-    parse("nameAndLanguageShouldBeMandatory.xml", validation);
-
-    assertThat(validation.getErrors()).hasSize(2);
-    assertThat(validation.getErrors().get(0)).contains("");
-  }
-
-  @Test
-  public void importProfileWithRuleParameters() {
-    ValidationMessages validation = ValidationMessages.create();
-    RulesProfile profile = parse("importProfileWithRuleParameters.xml", validation);
-
-    assertThat(validation.hasErrors()).isFalse();
-    assertThat(validation.hasWarnings()).isFalse();
-
-    ActiveRule rule = profile.getActiveRule("checkstyle", "IllegalRegexp");
-    assertThat(rule.getParameter("format")).isEqualTo("foo");
-    assertThat(rule.getParameter("message")).isEqualTo("with special characters < > &");
-  }
-
-  @Test
-  public void importProfileWithUnknownRuleParameter() {
-    ValidationMessages validation = ValidationMessages.create();
-    RulesProfile profile = parse("importProfileWithUnknownRuleParameter.xml", validation);
-
-    assertThat(validation.getWarnings()).hasSize(1);
-    ActiveRule rule = profile.getActiveRule("checkstyle", "IllegalRegexp");
-    assertThat(rule.getParameter("unknown")).isNull();
-  }
-
-  private RulesProfile parse(String resource, ValidationMessages validation) {
-    return new XMLProfileParser(newRuleFinder())
-      .parseResource(getClass().getClassLoader(), getResourcePath(resource), validation);
-  }
-
-  private String getResourcePath(String resource) {
-    return "org/sonar/api/profiles/XMLProfileParserTest/" + resource;
-  }
-
-  private RuleFinder newRuleFinder() {
-    RuleFinder ruleFinder = mock(RuleFinder.class);
-    when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() {
-      public Rule answer(InvocationOnMock iom) {
-        Rule rule = Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]);
-        rule.createParameter("format");
-        rule.createParameter("message");
-        return rule;
-      }
-    });
-    return ruleFinder;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
deleted file mode 100644 (file)
index c397940..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import org.sonar.api.rules.ActiveRule;
-import org.sonar.api.rules.Rule;
-import org.sonar.api.rules.RulePriority;
-import org.xml.sax.SAXException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class XMLProfileSerializerTest {
-
-  @Test
-  public void exportEmptyProfile() throws IOException, SAXException {
-    Writer writer = new StringWriter();
-    RulesProfile profile = RulesProfile.create("sonar way", "java");
-    new XMLProfileSerializer().write(profile, writer);
-
-    assertSimilarXml("exportEmptyProfile.xml", writer.toString());
-  }
-
-  @Test
-  public void exportProfile() throws IOException, SAXException {
-    Writer writer = new StringWriter();
-    RulesProfile profile = RulesProfile.create("sonar way", "java");
-    profile.activateRule(Rule.create("checkstyle", "IllegalRegexp", "illegal regexp"), RulePriority.BLOCKER);
-    new XMLProfileSerializer().write(profile, writer);
-
-    assertSimilarXml("exportProfile.xml", writer.toString());
-  }
-
-  @Test
-  public void exportRuleParameters() throws IOException, SAXException {
-    Writer writer = new StringWriter();
-    RulesProfile profile = RulesProfile.create("sonar way", "java");
-    Rule rule = Rule.create("checkstyle", "IllegalRegexp", "illegal regexp");
-    rule.createParameter("format");
-    rule.createParameter("message");
-    rule.createParameter("tokens");
-
-    ActiveRule activeRule = profile.activateRule(rule, RulePriority.BLOCKER);
-    activeRule.setParameter("format", "foo");
-    activeRule.setParameter("message", "with special characters < > &");
-    // the tokens parameter is not set
-    new XMLProfileSerializer().write(profile, writer);
-
-    assertSimilarXml("exportRuleParameters.xml", writer.toString());
-  }
-
-  private void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException {
-    String pathToExpectedXml = "XMLProfileSerializerTest/" + fileWithExpectedXml;
-    assertThat(xml).isXmlEqualTo(IOUtils.toString(getClass().getResource(pathToExpectedXml)));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
deleted file mode 100644 (file)
index 7da6cd7..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class AbstractLanguageTest {
-
-
-  @Test
-  public void test_equals_and_hashcode() {
-    final Language1 lang1 = new Language1();
-    assertThat(lang1.equals(lang1)).isTrue();
-    assertThat(lang1.equals(new Language2())).isFalse();
-    assertThat(lang1.equals(new Language1Too())).isTrue();
-    assertThat(lang1.equals("not a language")).isFalse();
-    assertThat(lang1.equals(null)).isFalse();
-
-    // not an AbstractLanguage but a Language
-    assertThat(lang1.equals(new Language() {
-      @Override
-      public String getKey() {
-        return lang1.getKey();
-      }
-
-      @Override
-      public String getName() {
-        return lang1.getName();
-      }
-
-      @Override
-      public String[] getFileSuffixes() {
-        return lang1.getFileSuffixes();
-      }
-
-      @Override
-      public boolean publishAllFiles() {
-        return true;
-      }
-    })).isTrue();
-
-    assertThat(lang1)
-      .hasSameHashCodeAs(lang1)
-      .hasSameHashCodeAs(new Language1Too());
-  }
-
-  @Test
-  public void should_not_define_language_with_too_long_key() {
-    assertThatThrownBy(TooLongKeyLanguage::new)
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The following language key exceeds 20 characters: 'aKeyWhichIsVeryVeryVeryVeryVeryLong'");
-  }
-
-  static class TooLongKeyLanguage extends AbstractLanguage {
-    public TooLongKeyLanguage() {
-      super("aKeyWhichIsVeryVeryVeryVeryVeryLong");
-    }
-
-    public String[] getFileSuffixes() {
-      // TODO Auto-generated method stub
-      return null;
-    }
-  }
-
-  static class Language1 extends AbstractLanguage {
-    public Language1() {
-      super("lang1");
-    }
-
-    public String[] getFileSuffixes() {
-      return new String[0];
-    }
-  }
-
-  static class Language1Too extends AbstractLanguage {
-    public Language1Too() {
-      super("lang1");
-    }
-
-    public String[] getFileSuffixes() {
-      return new String[0];
-    }
-  }
-
-  static class Language2 extends AbstractLanguage {
-    public Language2() {
-      super("lang2");
-    }
-
-    public String[] getFileSuffixes() {
-      return new String[0];
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/CoreMetricsTest.java
deleted file mode 100644 (file)
index 647cd3a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import java.util.List;
-import java.util.NoSuchElementException;
-import org.junit.Test;
-import org.sonar.api.measures.Metric;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.measures.CoreMetrics.DIRECTORIES;
-import static org.sonar.api.measures.CoreMetrics.NCLOC;
-import static org.sonar.api.measures.CoreMetrics.getMetric;
-import static org.sonar.api.measures.CoreMetrics.getMetrics;
-
-public class CoreMetricsTest {
-
-  @Test
-  public void read_metrics_from_class_reflection() {
-    List<Metric> metrics = getMetrics();
-    assertThat(metrics.size()).isGreaterThan(100);
-    assertThat(metrics).contains(NCLOC, DIRECTORIES);
-  }
-
-  @Test
-  public void get_metric_by_key() {
-    Metric metric = getMetric("ncloc");
-    assertThat(metric.getKey()).isEqualTo("ncloc");
-  }
-
-  @Test
-  public void fail_get_unknown_metric_by_key() {
-    assertThatThrownBy(() -> getMetric("unknown"))
-      .isInstanceOf(NoSuchElementException.class);
-  }
-
-  @Test
-  public void someMetricsAreMeantToBeHidden() {
-    Metric metric = getMetric("analysis_from_sonarqube_9_4");
-    assertThat(metric.isHidden()).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/LanguagesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/LanguagesTest.java
deleted file mode 100644 (file)
index 5b8fb2a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class LanguagesTest {
-  @Test
-  public void should_add_several_times_the_same_language() {
-    Languages languages = new Languages(
-      language("fake"),
-      language("fake"));
-
-    assertThat(languages.get("fake").getKey()).isEqualTo("fake");
-  }
-
-  @Test
-  public void should_get_suffixes() {
-    Languages languages = new Languages(
-      language("java", "java"),
-      language("php", "php4", "php5"));
-
-    assertThat(languages.getSuffixes()).containsOnly("java", "php4", "php5");
-    assertThat(languages.getSuffixes("java")).containsOnly("java");
-    assertThat(languages.getSuffixes("php")).containsOnly("php4", "php5");
-    assertThat(languages.getSuffixes("xxx")).isEmpty();
-  }
-
-  @Test
-  public void test_no_languages() {
-    Languages languages = new Languages();
-    assertThat(languages.get("foo")).isNull();
-    assertThat(languages.getSuffixes("foo")).isEmpty();
-  }
-
-  static Language language(String key, String... suffixes) {
-    Language lang = mock(Language.class);
-    when(lang.getKey()).thenReturn(key);
-    when(lang.getFileSuffixes()).thenReturn(suffixes);
-    return lang;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTest.java
deleted file mode 100644 (file)
index e43d90f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-
-public class ResourceTypeTest {
-
-  @Test
-  public void shouldCreateWithDefaults() {
-    ResourceType def = ResourceType.builder("qualifier")
-      .build();
-    assertThat(def.getQualifier()).isEqualTo("qualifier");
-    assertThat(def.getIconPath()).isEqualTo("/images/q/qualifier.png");
-    assertThat(def.hasSourceCode()).isFalse();
-  }
-
-  @Test
-  public void shouldCreate() {
-    ResourceType def = ResourceType.builder("qualifier")
-      .setIconPath("/custom-icon.png")
-      .hasSourceCode()
-      .setProperty("supportsMeasureFilters", "true")
-      .setProperty("anotherProperty", "foo")
-      .build();
-    assertThat(def.getQualifier()).isEqualTo("qualifier");
-    assertThat(def.getIconPath()).isEqualTo("/custom-icon.png");
-    assertThat(def.hasSourceCode()).isTrue();
-    assertThat(def.getStringProperty("anotherProperty")).isEqualTo("foo");
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void shouldCheckQualifierLength() {
-    ResourceType.builder("qualifier bigger than 10 characters");
-  }
-
-  @Test
-  public void testEqualsAndHashCode() {
-    ResourceType foo1 = ResourceType.builder("FOO").build();
-    ResourceType foo2 = ResourceType.builder("FOO").build();
-    ResourceType bar = ResourceType.builder("BAR").build();
-
-    assertThat(foo1.equals(foo1)).isTrue();
-    assertThat(foo1.equals(foo2)).isTrue();
-    assertThat(foo1.equals(bar)).isFalse();
-
-    assertThat(foo1).hasSameHashCodeAs(foo1);
-  }
-
-  @Test
-  public void getBooleanProperty_is_set() {
-    // set with boolean parameter
-    ResourceType def = ResourceType.builder("qualifier").setProperty("test", true).build();
-    assertThat(def.getBooleanProperty("test")).isTrue();
-
-    def = ResourceType.builder("qualifier").setProperty("test", false).build();
-    assertThat(def.getBooleanProperty("test")).isFalse();
-
-    def = ResourceType.builder("qualifier").setProperty("test", "true").build();
-    assertThat(def.getBooleanProperty("test")).isTrue();
-
-    def = ResourceType.builder("qualifier").setProperty("test", "false").build();
-    assertThat(def.getBooleanProperty("test")).isFalse();
-  }
-
-  @Test
-  public void getBooleanProperty_is_not_set() {
-    ResourceType def = ResourceType.builder("qualifier").build();
-    assertThat(def.getBooleanProperty("test")).isFalse();
-  }
-
-  @Test
-  public void hasProperty() {
-    ResourceType def = ResourceType.builder("qualifier").build();
-    assertThat(def.hasProperty("foo")).isFalse();
-
-    def = ResourceType.builder("qualifier").setProperty("foo", "bar").build();
-    assertThat(def.hasProperty("foo")).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTreeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypeTreeTest.java
deleted file mode 100644 (file)
index 494ef50..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.api.resources.ResourceTypesTest.qualifiers;
-
-public class ResourceTypeTreeTest {
-  private final ResourceTypeTree tree = ResourceTypeTree.builder()
-    .addType(ResourceType.builder("TRK").build())
-    .addType(ResourceType.builder("DIR").build())
-    .addType(ResourceType.builder("FIL").build())
-    .addType(ResourceType.builder("UTS").build())
-    .addRelations("TRK", "DIR")
-    .addRelations("DIR", "FIL")
-    .addRelations("DIR", "UTS")
-    .build();
-
-  @Test
-  public void getTypes() {
-    assertThat(tree.getTypes()).hasSize(4);
-    assertThat(qualifiers(tree.getTypes())).containsOnly("TRK", "DIR", "FIL", "UTS");
-  }
-
-  @Test
-  public void getChildren() {
-    assertThat(tree.getChildren("TRK")).containsOnly("DIR");
-
-    assertThat(tree.getChildren("DIR")).containsOnly("FIL", "UTS");
-
-    assertThat(tree.getChildren("FIL")).isEmpty();
-  }
-
-  @Test
-  public void getRoot() {
-    assertThat(tree.getRootType()).isEqualTo(ResourceType.builder("TRK").build());
-  }
-
-  @Test
-  public void getLeaves() {
-    assertThat(tree.getLeaves()).containsOnly("FIL", "UTS");
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void forbidNullRelation() {
-    ResourceTypeTree.builder()
-      .addType(ResourceType.builder("TRK").build())
-      .addType(ResourceType.builder("DIR").build())
-      .addRelations("DIR" /* missing child */)
-      .build();
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void forbidDuplicatedType() {
-    ResourceTypeTree.builder()
-      .addType(ResourceType.builder("TRK").build())
-      .addType(ResourceType.builder("TRK").build())
-      .build();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceTypesTest.java
deleted file mode 100644 (file)
index 7e690e7..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.resources;
-
-import com.google.common.collect.Collections2;
-import java.util.Collection;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ResourceTypesTest {
-
-  private ResourceTypeTree viewsTree = ResourceTypeTree.builder()
-      .addType(ResourceType.builder(Qualifiers.VIEW).setProperty("supportsMeasureFilters", "true").build())
-      .addType(ResourceType.builder(Qualifiers.SUBVIEW).build())
-      .addRelations(Qualifiers.VIEW, Qualifiers.SUBVIEW)
-      .addRelations(Qualifiers.SUBVIEW, Qualifiers.PROJECT)
-      .build();
-
-  private ResourceTypeTree applicationTree = ResourceTypeTree.builder()
-    .addType(ResourceType.builder(Qualifiers.APP).setProperty("supportsMeasureFilters", "true").build())
-    .addRelations(Qualifiers.APP, Qualifiers.PROJECT)
-    .build();
-
-  private ResourceTypeTree defaultTree = ResourceTypeTree.builder()
-      .addType(ResourceType.builder(Qualifiers.PROJECT).setProperty("supportsMeasureFilters", "true").build())
-      .addType(ResourceType.builder(Qualifiers.DIRECTORY).build())
-      .addType(ResourceType.builder(Qualifiers.FILE).build())
-      .addRelations(Qualifiers.PROJECT, Qualifiers.DIRECTORY)
-      .addRelations(Qualifiers.DIRECTORY, Qualifiers.FILE)
-      .build();
-
-  private ResourceTypes types = new ResourceTypes(new ResourceTypeTree[] {defaultTree, viewsTree, applicationTree});
-
-  @Test
-  public void get() {
-    assertThat(types.get(Qualifiers.PROJECT).getQualifier()).isEqualTo(Qualifiers.PROJECT);
-
-    // does not return null
-    assertThat(types.get("xxx").getQualifier()).isEqualTo("xxx");
-  }
-
-  @Test
-  public void get_all() {
-    assertThat(qualifiers(types.getAll())).containsExactly(Qualifiers.PROJECT, Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.VIEW, Qualifiers.SUBVIEW, Qualifiers.APP);
-  }
-
-  @Test
-  public void get_roots() {
-    assertThat(qualifiers(types.getRoots())).containsOnly(Qualifiers.PROJECT, Qualifiers.VIEW, Qualifiers.APP);
-  }
-
-  @Test
-  public void get_leaves_qualifiers() {
-    assertThat(types.getLeavesQualifiers(Qualifiers.PROJECT)).containsExactly(Qualifiers.FILE);
-    assertThat(types.getLeavesQualifiers(Qualifiers.DIRECTORY)).containsExactly(Qualifiers.FILE);
-    assertThat(types.getLeavesQualifiers(Qualifiers.VIEW)).containsExactly(Qualifiers.PROJECT);
-    assertThat(types.getLeavesQualifiers(Qualifiers.APP)).containsExactly(Qualifiers.PROJECT);
-    assertThat(types.getLeavesQualifiers("xxx")).isEmpty();
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void fail_on_duplicated_qualifier() {
-    ResourceTypeTree tree1 = ResourceTypeTree.builder()
-        .addType(ResourceType.builder("foo").build())
-        .build();
-    ResourceTypeTree tree2 = ResourceTypeTree.builder()
-        .addType(ResourceType.builder("foo").build())
-        .build();
-
-    new ResourceTypes(new ResourceTypeTree[] {tree1, tree2});
-  }
-
-  @Test
-  public void isQualifierPresent() {
-    assertThat(types.isQualifierPresent(Qualifiers.APP)).isTrue();
-    assertThat(types.isQualifierPresent(Qualifiers.VIEW)).isTrue();
-    assertThat(types.isQualifierPresent("XXXX")).isFalse();
-  }
-
-  static Collection<String> qualifiers(Collection<ResourceType> types) {
-    return Collections2.transform(types, ResourceType::getQualifier);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleKeyTest.java
deleted file mode 100644 (file)
index c0c20d6..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class RuleKeyTest {
-
-  @Test
-  public void testOf() throws Exception {
-    RuleKey key = RuleKey.of("squid", "NullDeref");
-    assertThat(key.repository()).isEqualTo("squid");
-    assertThat(key.rule()).isEqualTo("NullDeref");
-  }
-
-  @Test
-  public void key_can_contain_colons() {
-    RuleKey key = RuleKey.of("squid", "Key:With:Some::Colons");
-    assertThat(key.repository()).isEqualTo("squid");
-    assertThat(key.rule()).isEqualTo("Key:With:Some::Colons");
-  }
-
-  @Test
-  public void repository_must_not_be_null() {
-    try {
-      RuleKey.of(null, "NullDeref");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Repository must be set");
-    }
-  }
-
-  @Test
-  public void repository_must_not_be_empty() {
-    try {
-      RuleKey.of("", "NullDeref");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Repository must be set");
-    }
-  }
-
-  @Test
-  public void rule_must_not_be_null() {
-    try {
-      RuleKey.of("squid", null);
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Rule must be set");
-    }
-  }
-
-  @Test
-  public void rule_must_not_be_empty() {
-    try {
-      RuleKey.of("squid", "");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Rule must be set");
-    }
-  }
-
-  @Test
-  public void encode_and_decode_string() {
-    RuleKey key = RuleKey.of("squid", "NullDeref");
-    String serialized = key.toString();
-    assertThat(serialized).isEqualTo("squid:NullDeref");
-    RuleKey parsed = RuleKey.parse(serialized);
-    assertThat(parsed.repository()).isEqualTo("squid");
-    assertThat(parsed.rule()).isEqualTo("NullDeref");
-    assertThat(parsed.toString()).isEqualTo("squid:NullDeref");
-  }
-
-  @Test
-  public void parse_key_with_colons() {
-    RuleKey key = RuleKey.parse("squid:Key:With:Some::Colons");
-    assertThat(key.repository()).isEqualTo("squid");
-    assertThat(key.rule()).isEqualTo("Key:With:Some::Colons");
-  }
-
-  @Test
-  public void not_accept_bad_format() {
-    try {
-      RuleKey.parse("foo");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Invalid rule key: foo");
-    }
-  }
-
-  @Test
-  public void test_equals_and_hashcode() throws Exception {
-    RuleKey key1 = RuleKey.of("squid", "NullDeref");
-    RuleKey key2 = RuleKey.of("squid", "NullDeref");
-    RuleKey key3 = RuleKey.of("squid", "Other");
-
-    assertThat(key1)
-      .isEqualTo(key1)
-      .isEqualTo(key2)
-      .isNotEqualTo(key3)
-      .isNotNull()
-      .hasSameHashCodeAs(key1)
-      .hasSameHashCodeAs(key2);
-  }
-
-  @Test
-  public void test_compareTo() {
-    RuleKey aa = RuleKey.of("A", "A");
-    RuleKey ab = RuleKey.of("A", "B");
-
-    assertThat(ab).isGreaterThan(aa);
-    assertThat(aa).isLessThan(ab);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java
deleted file mode 100644 (file)
index a03cbfe..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RuleStatusTest {
-  @Test
-  public void default_is_ready() {
-    assertThat(RuleStatus.defaultStatus()).isEqualTo(RuleStatus.READY);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java
deleted file mode 100644 (file)
index 387ad27..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rule;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SeverityTest {
-
-  @Test
-  public void test_ALL() {
-    assertThat(Severity.ALL).hasSize(5).containsSubsequence("INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER");
-  }
-
-  @Test
-  public void default_is_major() {
-    assertThat(Severity.defaultSeverity()).isEqualTo(Severity.MAJOR);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java
deleted file mode 100644 (file)
index ca33ea5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-@org.sonar.check.Rule(name ="Annotated Check", description = "Description")
-public class AnnotatedCheck {
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java
deleted file mode 100644 (file)
index d84145a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.sonar.check.RuleProperty;
-
-@org.sonar.check.Rule(key = "overridden_key", name = "Check with parameters", description = "Has parameters")
-public class AnnotatedCheckWithParameters {
-
-  @RuleProperty(description = "Maximum value")
-  private String max;
-
-  @RuleProperty(key = "overridden_min", description = "Minimum value")
-  protected String min;
-
-  private int nonConfigurableProperty;
-
-  public String getMax() {
-    return max;
-  }
-
-  public void setMax(String max) {
-    this.max = max;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/AnnotationRuleParserTest.java
deleted file mode 100644 (file)
index be73d6c..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.Collections;
-import java.util.List;
-import org.junit.Test;
-import org.sonar.api.PropertyType;
-import org.sonar.api.utils.SonarException;
-import org.sonar.check.Priority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class AnnotationRuleParserTest {
-
-  @Test
-  public void rule_with_property() {
-    List<Rule> rules = parseAnnotatedClass(RuleWithProperty.class);
-    assertThat(rules).hasSize(1);
-    Rule rule = rules.get(0);
-    assertThat(rule.getKey()).isEqualTo("foo");
-    assertThat(rule.getName()).isEqualTo("bar");
-    assertThat(rule.getDescription()).isEqualTo("Foo Bar");
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.BLOCKER);
-    assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_READY);
-    assertThat(rule.getParams()).hasSize(1);
-
-    RuleParam prop = rule.getParam("property");
-    assertThat(prop.getKey()).isEqualTo("property");
-    assertThat(prop.getDescription()).isEqualTo("Ignore ?");
-    assertThat(prop.getDefaultValue()).isEqualTo("false");
-    assertThat(prop.getType()).isEqualTo(PropertyType.STRING.name());
-  }
-
-  @Test
-  public void rule_with_integer_property() {
-    List<Rule> rules = parseAnnotatedClass(RuleWithIntegerProperty.class);
-
-    RuleParam prop = rules.get(0).getParam("property");
-    assertThat(prop.getDescription()).isEqualTo("Max");
-    assertThat(prop.getDefaultValue()).isEqualTo("12");
-    assertThat(prop.getType()).isEqualTo(PropertyType.INTEGER.name());
-  }
-
-  @Test
-  public void rule_with_text_property() {
-    List<Rule> rules = parseAnnotatedClass(RuleWithTextProperty.class);
-
-    RuleParam prop = rules.get(0).getParam("property");
-    assertThat(prop.getDescription()).isEqualTo("text");
-    assertThat(prop.getDefaultValue()).isEqualTo("Long text");
-    assertThat(prop.getType()).isEqualTo(PropertyType.TEXT.name());
-  }
-
-  @Test
-  public void should_reject_invalid_property_types() {
-    assertThatThrownBy(() -> parseAnnotatedClass(RuleWithInvalidPropertyType.class))
-      .isInstanceOf(SonarException.class)
-      .hasMessage("Invalid property type [INVALID]");
-  }
-
-  @Test
-  public void should_recognize_type() {
-    assertThat(AnnotationRuleParser.guessType(Integer.class)).isEqualTo(PropertyType.INTEGER);
-    assertThat(AnnotationRuleParser.guessType(int.class)).isEqualTo(PropertyType.INTEGER);
-    assertThat(AnnotationRuleParser.guessType(Float.class)).isEqualTo(PropertyType.FLOAT);
-    assertThat(AnnotationRuleParser.guessType(float.class)).isEqualTo(PropertyType.FLOAT);
-    assertThat(AnnotationRuleParser.guessType(Boolean.class)).isEqualTo(PropertyType.BOOLEAN);
-    assertThat(AnnotationRuleParser.guessType(boolean.class)).isEqualTo(PropertyType.BOOLEAN);
-    assertThat(AnnotationRuleParser.guessType(String.class)).isEqualTo(PropertyType.STRING);
-    assertThat(AnnotationRuleParser.guessType(Object.class)).isEqualTo(PropertyType.STRING);
-  }
-
-  @Test
-  public void rule_without_name_nor_description() {
-    List<Rule> rules = parseAnnotatedClass(RuleWithoutNameNorDescription.class);
-    assertThat(rules).hasSize(1);
-    Rule rule = rules.get(0);
-    assertThat(rule.getKey()).isEqualTo("foo");
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-    assertThat(rule.getName()).isNull();
-    assertThat(rule.getDescription()).isNull();
-  }
-
-  @Test
-  public void rule_without_key() {
-    List<Rule> rules = parseAnnotatedClass(RuleWithoutKey.class);
-    assertThat(rules).hasSize(1);
-    Rule rule = rules.get(0);
-    assertThat(rule.getKey()).isEqualTo(RuleWithoutKey.class.getCanonicalName());
-    assertThat(rule.getName()).isEqualTo("foo");
-    assertThat(rule.getDescription()).isNull();
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-  }
-
-  @Test
-  public void overridden_rule() {
-    List<Rule> rules = parseAnnotatedClass(OverridingRule.class);
-    assertThat(rules).hasSize(1);
-    Rule rule = rules.get(0);
-    assertThat(rule.getKey()).isEqualTo("overriding_foo");
-    assertThat(rule.getName()).isEqualTo("Overriding Foo");
-    assertThat(rule.getDescription()).isNull();
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-    assertThat(rule.getParams()).hasSize(2);
-  }
-
-  private List<Rule> parseAnnotatedClass(Class annotatedClass) {
-    return new AnnotationRuleParser().parse("repo", Collections.singleton(annotatedClass));
-  }
-
-  @org.sonar.check.Rule(name = "foo")
-  static class RuleWithoutKey {
-  }
-
-  @org.sonar.check.Rule(key = "foo")
-  static class RuleWithoutNameNorDescription {
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = Rule.STATUS_READY, priority = Priority.BLOCKER)
-  static class RuleWithProperty {
-    @org.sonar.check.RuleProperty(description = "Ignore ?", defaultValue = "false")
-    private String property;
-  }
-
-  @org.sonar.check.Rule(key = "overriding_foo", name = "Overriding Foo")
-  static class OverridingRule extends RuleWithProperty {
-    @org.sonar.check.RuleProperty
-    private String additionalProperty;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = Rule.STATUS_READY, priority = Priority.BLOCKER)
-  static class RuleWithIntegerProperty {
-    @org.sonar.check.RuleProperty(description = "Max", defaultValue = "12")
-    private Integer property;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = Rule.STATUS_READY, priority = Priority.BLOCKER)
-  static class RuleWithTextProperty {
-    @org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "TEXT")
-    protected String property;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = Rule.STATUS_READY, priority = Priority.BLOCKER)
-  static class RuleWithInvalidPropertyType {
-    @org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "INVALID")
-    public String property;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java
deleted file mode 100644 (file)
index 2aa3bc1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class RuleAnnotationUtilsTest {
-
-  @Test
-  public void defaultKeyShouldBeTheClassName() {
-    String key = RuleAnnotationUtils.getRuleKey(AnnotatedCheck.class);
-    assertThat(key, is(AnnotatedCheck.class.getName()));
-  }
-
-  @Test
-  public void shouldGetKey() {
-    String key = RuleAnnotationUtils.getRuleKey(AnnotatedCheckWithParameters.class);
-    assertThat(key, is("overridden_key"));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RulePriorityTest.java
deleted file mode 100644 (file)
index 0653284..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.junit.Test;
-import org.sonar.check.Priority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RulePriorityTest {
-
-  @Test
-  public void testValueOfString() {
-    assertThat(RulePriority.valueOfString("info")).isEqualTo(RulePriority.INFO);
-    assertThat(RulePriority.valueOfString("MAJOR")).isEqualTo(RulePriority.MAJOR);
-    assertThat(RulePriority.valueOfString("ERROR")).isEqualTo(RulePriority.MAJOR);
-    assertThat(RulePriority.valueOfString("WARNING")).isEqualTo(RulePriority.INFO);
-    assertThat(RulePriority.valueOfString("ErRor")).isEqualTo(RulePriority.MAJOR);
-    assertThat(RulePriority.valueOfString("WaRnInG")).isEqualTo(RulePriority.INFO);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testUnknownValueOfString() {
-    RulePriority.valueOfString("make me crash");
-  }
-
-  @Test
-  public void test_toCheckPriority() {
-    assertThat(RulePriority.fromCheckPriority(Priority.BLOCKER)).isEqualTo(RulePriority.BLOCKER);
-    assertThat(RulePriority.fromCheckPriority(Priority.CRITICAL)).isEqualTo(RulePriority.CRITICAL);
-    assertThat(RulePriority.fromCheckPriority(Priority.MAJOR)).isEqualTo(RulePriority.MAJOR);
-    assertThat(RulePriority.fromCheckPriority(Priority.MINOR)).isEqualTo(RulePriority.MINOR);
-    assertThat(RulePriority.fromCheckPriority(Priority.INFO)).isEqualTo(RulePriority.INFO);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java
deleted file mode 100644 (file)
index 59a86a2..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RuleTest {
-
-  @Test
-  public void description_should_be_cleaned() {
-    Rule rule = Rule.create().setDescription("    my description         ");
-    Assert.assertEquals("my description", rule.getDescription());
-
-    rule.setDescription(null);
-    assertThat(rule.getDescription()).isNull();
-  }
-
-  @Test
-  public void should_remove_new_line_characters_in_name_with_setter() {
-    Rule rule = Rule.create();
-    for (String example : getExamplesContainingNewLineCharacter()) {
-      rule.setName(example);
-      assertThat(rule.getName()).isEqualTo("test");
-    }
-  }
-
-  @Test
-  public void should_remove_new_line_characters_in_name_with_first_constructor() {
-    Rule rule;
-    for (String example : getExamplesContainingNewLineCharacter()) {
-      rule = new Rule(null, null).setName(example);
-      assertThat(rule.getName()).isEqualTo("test");
-    }
-  }
-
-  @Test
-  public void should_remove_new_line_characters_in_name_with_second_constructor() {
-    Rule rule;
-    for (String example : getExamplesContainingNewLineCharacter()) {
-      rule = new Rule(null, null).setName(example);
-      assertThat(rule.getName()).isEqualTo("test");
-    }
-  }
-
-  @Test
-  public void default_priority_is_major() {
-    Rule rule = Rule.create();
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-
-    rule = new Rule("name", "key");
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-
-    rule.setSeverity(RulePriority.BLOCKER);
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.BLOCKER);
-
-    rule.setSeverity(null);
-    assertThat(rule.getSeverity()).isEqualTo(RulePriority.MAJOR);
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void should_not_authorize_unkown_status() {
-    Rule.create().setStatus("Unknown");
-  }
-
-  @Test
-  public void should_set_valid_status() {
-    Rule rule = Rule.create().setStatus(Rule.STATUS_DEPRECATED);
-    assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_DEPRECATED);
-
-    rule = Rule.create().setStatus(Rule.STATUS_REMOVED);
-    assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_REMOVED);
-
-    rule = Rule.create().setStatus(Rule.STATUS_BETA);
-    assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_BETA);
-
-    rule = Rule.create().setStatus(Rule.STATUS_READY);
-    assertThat(rule.getStatus()).isEqualTo(Rule.STATUS_READY);
-  }
-
-  @Test
-  public void testTags() {
-    Rule rule = Rule.create();
-    assertThat(rule.getTags()).isEmpty();
-    assertThat(rule.getSystemTags()).isEmpty();
-
-    rule.setTags(new String[] {"tag1", "tag2"});
-    assertThat(rule.getTags()).containsOnly("tag1", "tag2");
-    assertThat(rule.getSystemTags()).isEmpty();
-  }
-
-  private List<String> getExamplesContainingNewLineCharacter() {
-    return Arrays.asList("te\nst", "te\ns\nt", "te\rst", "te\n\rst", "te\r\nst");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTypeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTypeTest.java
deleted file mode 100644 (file)
index 19de1e8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.rules;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class RuleTypeTest {
-
-
-  @Test
-  public void test_valueOf_db_constant() {
-    assertThat(RuleType.valueOf(1)).isEqualTo(RuleType.CODE_SMELL);
-    assertThat(RuleType.valueOf(2)).isEqualTo(RuleType.BUG);
-  }
-
-  @Test
-  public void valueOf_throws_ISE_if_unsupported_db_constant() {
-    assertThatThrownBy(() -> RuleType.valueOf(5))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Unsupported type value : 5");
-  }
-
-  @Test
-  public void test_ALL_NAMES() {
-    assertThat(RuleType.names()).containsOnly("BUG", "VULNERABILITY", "CODE_SMELL", "SECURITY_HOTSPOT");
-  }
-
-  @Test
-  public void ALL_NAMES_is_immutable() {
-    assertThatThrownBy(() -> RuleType.names().add("foo"))
-      .isInstanceOf(UnsupportedOperationException.class);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/FileExclusionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/FileExclusionsTest.java
deleted file mode 100644 (file)
index 8f3c3d1..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.filesystem;
-
-import org.junit.Test;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.config.internal.MapSettings;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class FileExclusionsTest {
-  @Test
-  public void ignore_inclusion_of_world() {
-    MapSettings settings = new MapSettings();
-    settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*");
-    settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "**/*");
-    assertThat(new FileExclusions(settings.asConfig()).sourceInclusions()).isEmpty();
-    assertThat(new FileExclusions(settings.asConfig()).testInclusions()).isEmpty();
-  }
-
-  @Test
-  public void load_inclusions() {
-    MapSettings settings = new MapSettings();
-    settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*Foo.java");
-    settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "**/*FooTest.java");
-    FileExclusions moduleExclusions = new FileExclusions(settings.asConfig());
-
-    assertThat(moduleExclusions.sourceInclusions()).containsOnly("**/*Foo.java");
-    assertThat(moduleExclusions.testInclusions()).containsOnly("**/*FooTest.java");
-  }
-
-  @Test
-  public void load_exclusions() {
-    MapSettings settings = new MapSettings();
-    settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*Foo.java");
-    settings.setProperty(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, "**/*FooTest.java");
-    FileExclusions moduleExclusions = new FileExclusions(settings.asConfig());
-
-    assertThat(moduleExclusions.sourceInclusions()).isEmpty();
-    assertThat(moduleExclusions.sourceExclusions()).containsOnly("**/*Foo.java");
-    assertThat(moduleExclusions.testInclusions()).isEmpty();
-    assertThat(moduleExclusions.testExclusions()).containsOnly("**/*FooTest.java");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/PathResolverTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/scan/filesystem/PathResolverTest.java
deleted file mode 100644 (file)
index c50a79e..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.scan.filesystem;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class PathResolverTest {
-  @Rule
-  public TemporaryFolder temp = new TemporaryFolder();
-
-  @Test
-  public void get_file_by_relative_path() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    File file = resolver.relativeFile(rootDir, "org/foo/Bar.java");
-    assertThat(file.getName()).isEqualTo("Bar.java");
-    assertThat(FilenameUtils.separatorsToUnix(file.getCanonicalPath())).endsWith("org/foo/Bar.java");
-    assertThat(file.getParentFile().getParentFile().getParentFile().getCanonicalPath()).isEqualTo(rootDir.getCanonicalPath());
-  }
-
-  @Test
-  public void get_file_by_absolute_path() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    File file = resolver.relativeFile(rootDir, new File(rootDir, "org/foo/Bar.java").getAbsolutePath());
-    assertThat(file.getName()).isEqualTo("Bar.java");
-    assertThat(FilenameUtils.separatorsToUnix(file.getCanonicalPath())).endsWith("org/foo/Bar.java");
-    assertThat(file.getParentFile().getParentFile().getParentFile().getCanonicalPath()).isEqualTo(rootDir.getCanonicalPath());
-  }
-
-  @Test
-  public void get_files_by_relative_paths() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    List<File> files = resolver.relativeFiles(rootDir, Arrays.asList("org/foo/Bar.java", "org/hello/World.java"));
-    assertThat(files).hasSize(2);
-    for (File file : files) {
-      assertThat(file.getName()).endsWith(".java");
-      assertThat(file.getParentFile().getParentFile().getParentFile().getCanonicalPath()).isEqualTo(rootDir.getCanonicalPath());
-    }
-  }
-
-  @Test
-  public void relative_path_from_dir() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    File org = new File(rootDir, "org");
-    File hello = new File(org, "hello");
-    File world = new File(hello, "World.java");
-
-    assertThat(resolver.relativePath(rootDir, world)).isEqualTo("org/hello/World.java");
-    assertThat(resolver.relativePath(new File(rootDir, "."), world)).isEqualTo("org/hello/World.java");
-  }
-
-  @Test
-  public void relative_path_from_not_normalized_dir() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = new File(temp.newFolder(), "foo/..");
-    File org = new File(rootDir, "org");
-    File hello = new File(org, "hello");
-    File world = new File(hello, "World.java");
-
-    assertThat(resolver.relativePath(rootDir, world)).isEqualTo("org/hello/World.java");
-  }
-
-  @Test
-  public void relative_path_for_not_normalized_dir() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    File file = new File(rootDir, "level1/../dir/file.c");
-
-    assertThat(resolver.relativePath(rootDir, file)).isEqualTo("dir/file.c");
-  }
-
-  @Test
-  public void relative_path_for_not_normalized_dir_sub_level() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-    File file = new File(rootDir, "level1/level2/../dir/file.c");
-
-    assertThat(resolver.relativePath(rootDir, file)).isEqualTo("level1/dir/file.c");
-  }
-
-  @Test
-  public void relative_path_for_case_insensitive_fs() throws IOException {
-    // To please the quality gate, don't use assumeTrue, or the test will be reported as skipped
-    if (SystemUtils.IS_OS_WINDOWS) {
-      PathResolver resolver = new PathResolver();
-      File rootDir = temp.newFolder();
-      File baseDir = new File(rootDir, "level1");
-      File file = new File(baseDir, "../Level1/dir/file.c");
-
-      assertThat(resolver.relativePath(baseDir, file)).isEqualTo("dir/file.c");
-    }
-  }
-
-  @Test
-  public void relative_path_from_multiple_dirs() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File dir1 = temp.newFolder("D1");
-    File dir2 = temp.newFolder("D2");
-
-    File org = new File(dir2, "org");
-    File hello = new File(org, "hello");
-    File world = new File(hello, "World.java");
-
-    PathResolver.RelativePath relativePath = resolver.relativePath(Arrays.asList(dir1, dir2), world);
-    assertThat(relativePath.dir().getCanonicalPath()).isEqualTo(dir2.getCanonicalPath());
-    assertThat(relativePath.path()).isEqualTo("org/hello/World.java");
-  }
-
-  @Test
-  public void relative_path_from_not_normalized_dirs() throws IOException {
-    PathResolver resolver = new PathResolver();
-
-    File rootDir = new File(temp.newFolder(), "foo/..");
-    File org = new File(rootDir, "org");
-    File hello = new File(org, "hello");
-    File world = new File(hello, "World.java");
-
-    PathResolver.RelativePath relativePath = resolver.relativePath(Arrays.asList(rootDir), world);
-    assertThat(relativePath).isNotNull();
-    assertThat(relativePath.dir()).isEqualTo(rootDir);
-    assertThat(relativePath.path()).isEqualTo("org/hello/World.java");
-  }
-
-  @Test
-  public void cant_find_relative_path_from_multiple_dirs() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File dir1 = temp.newFolder("D1");
-    File dir2 = temp.newFolder("D2");
-
-    File org = new File(dir2, "org");
-    File hello = new File(org, "hello");
-    File world = new File(hello, "World.java");
-
-    PathResolver.RelativePath relativePath = resolver.relativePath(Arrays.asList(dir1), world);
-    assertThat(relativePath).isNull();
-  }
-
-  @Test
-  public void null_relative_path_when_file_is_not_in_dir() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-
-    assertThat(resolver.relativePath(rootDir, new File("Elsewhere.java"))).isNull();
-  }
-
-  @Test
-  public void null_relative_path_when_file_is_not_in_dir2() throws IOException {
-    PathResolver resolver = new PathResolver();
-    File rootDir = temp.newFolder();
-
-    assertThat(resolver.relativePath(rootDir, new File(rootDir, "../Elsewhere.java"))).isNull();
-  }
-
-  @Test
-  public void supportSymlink() {
-    PathResolver resolver = new PathResolver();
-    File rootDir = new File("test-resources/org/sonar/api/scan/filesystem/sample-with-symlink");
-
-    assertThat(resolver.relativePath(rootDir, new File("test-resources/org/sonar/api/scan/filesystem/sample-with-symlink/testx/ClassOneTest.java"))).isEqualTo(
-      "testx/ClassOneTest.java");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java
deleted file mode 100644 (file)
index a84ca8c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DefaultGroupsTest {
-  @Test
-  public void isAnyone_is_not_case_sensitive() {
-    assertThat(DefaultGroups.isAnyone("ANYONE")).isTrue();
-    assertThat(DefaultGroups.isAnyone("anyone")).isTrue();
-    assertThat(DefaultGroups.isAnyone(DefaultGroups.ANYONE)).isTrue();
-
-    assertThat(DefaultGroups.isAnyone(DefaultGroups.ADMINISTRATORS)).isFalse();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalGroupsProviderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalGroupsProviderTest.java
deleted file mode 100644 (file)
index 6b1d4e3..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import com.google.common.base.Preconditions;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Nullable;
-import javax.servlet.http.HttpServletRequest;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class ExternalGroupsProviderTest {
-  @Test
-  public void doGetGroupsNoOverride() {
-    ExternalGroupsProvider groupsProvider = new ExternalGroupsProvider() {
-    };
-
-    String userName = "foo";
-    assertThat(groupsProvider.doGetGroups(new ExternalGroupsProvider.Context(userName,
-      mock(HttpServletRequest.class)))).isNull();
-  }
-
-  @Test
-  public void doGetGroupsTests() {
-    final Map<String, Collection<String>> userGroupsMap = getTestUserGroupMapping();
-
-    ExternalGroupsProvider groupsProvider = new ExternalGroupsProvider() {
-      @Override
-      public Collection<String> doGetGroups(Context context) {
-        Preconditions.checkNotNull(context.getUsername());
-        Preconditions.checkNotNull(context.getRequest());
-
-        return userGroupsMap.get(context.getUsername());
-      }
-    };
-
-    runDoGetGroupsTests(groupsProvider, userGroupsMap);
-  }
-
-  private static void runDoGetGroupsTests(ExternalGroupsProvider groupsProvider, Map<String, Collection<String>> userGroupsMap) {
-    for (Map.Entry<String, Collection<String>> userGroupMapEntry : userGroupsMap.entrySet()) {
-      Collection<String> groups = groupsProvider.doGetGroups(new ExternalGroupsProvider.Context(
-        userGroupMapEntry.getKey(), mock(HttpServletRequest.class)));
-      assertThat(groups).isEqualTo(userGroupMapEntry.getValue());
-    }
-  }
-
-  private static Map<String, Collection<String>> getTestUserGroupMapping() {
-    Map<String, Collection<String>> userGroupsMap = new HashMap<>();
-    addUserGroupMapping(userGroupsMap, "userWithOneGroups", new String[] {"group1"});
-    addUserGroupMapping(userGroupsMap, "userWithTwoGroups", new String[] {"group1", "group2"});
-    addUserGroupMapping(userGroupsMap, "userWithNoGroup", new String[] {});
-    addUserGroupMapping(userGroupsMap, "userWithNullGroup", null);
-
-    return userGroupsMap;
-  }
-
-  private static void addUserGroupMapping(Map<String, Collection<String>> userGroupsMap, String user, @Nullable String[] groups) {
-    Collection<String> groupsCollection = null;
-    if (groups != null) {
-      groupsCollection = Arrays.asList(groups);
-    }
-
-    userGroupsMap.put(user, groupsCollection);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalUsersProviderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/ExternalUsersProviderTest.java
deleted file mode 100644 (file)
index 3b3e310..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import com.google.common.base.Preconditions;
-import org.junit.Test;
-
-import javax.servlet.http.HttpServletRequest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class ExternalUsersProviderTest {
-
-  @Test
-  public void doGetUserDetails() {
-    ExternalUsersProvider provider = new ExternalUsersProvider() {
-      @Override
-      public UserDetails doGetUserDetails(Context context) {
-        Preconditions.checkNotNull(context.getUsername());
-        Preconditions.checkNotNull(context.getRequest());
-        UserDetails user = new UserDetails();
-        user.setName(context.getUsername());
-        user.setEmail("foo@bar.com");
-        return user;
-      }
-    };
-    UserDetails user = provider.doGetUserDetails(new ExternalUsersProvider.Context("foo", mock(HttpServletRequest.class)));
-
-    assertThat(user.getName()).isEqualTo("foo");
-    assertThat(user.getEmail()).isEqualTo("foo@bar.com");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/SecurityRealmTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/SecurityRealmTest.java
deleted file mode 100644 (file)
index 4fd5086..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import org.junit.Test;
-
-import javax.servlet.http.HttpServletRequest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public class SecurityRealmTest {
-
-  @Test
-  public void doGetAuthenticator() {
-    final Authenticator authenticator = mock(Authenticator.class);
-    SecurityRealm realm = new SecurityRealm() {
-      @Override
-      public Authenticator doGetAuthenticator() {
-        return authenticator;
-      }
-    };
-    assertThat(realm.doGetAuthenticator()).isSameAs(authenticator);
-    assertThat(realm.getLoginPasswordAuthenticator()).isNull();
-  }
-
-  @Test
-  public void getLoginPasswordAuthenticator_deprecated_method_replaced_by_getAuthenticator() {
-    final LoginPasswordAuthenticator deprecatedAuthenticator = mock(LoginPasswordAuthenticator.class);
-    SecurityRealm realm = new SecurityRealm() {
-      @Override
-      public LoginPasswordAuthenticator getLoginPasswordAuthenticator() {
-        return deprecatedAuthenticator;
-      }
-    };
-    Authenticator proxy = realm.doGetAuthenticator();
-    Authenticator.Context context = new Authenticator.Context("foo", "bar", mock(HttpServletRequest.class));
-    proxy.doAuthenticate(context);
-
-    verify(deprecatedAuthenticator).authenticate("foo", "bar");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/security/UserDetailsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/security/UserDetailsTest.java
deleted file mode 100644 (file)
index c8c414d..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.security;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class UserDetailsTest {
-  private UserDetails userDetails;
-
-  @Before
-  public void init() {
-    userDetails = new UserDetails();
-  }
-
-  @Test
-  public void getNameTest() {
-    userDetails.setName(null);
-    assertThat(userDetails.getName()).isNull();
-
-    userDetails.setName("");
-    assertThat(userDetails.getName()).isEmpty();
-
-    userDetails.setName("foo");
-    assertThat(userDetails.getName()).isEqualTo("foo");
-  }
-
-  @Test
-  public void getEmailTest() {
-    userDetails.setEmail(null);
-    assertThat(userDetails.getEmail()).isNull();
-
-    userDetails.setEmail("");
-    assertThat(userDetails.getEmail()).isEmpty();
-
-    userDetails.setEmail("foo@example.com");
-    assertThat(userDetails.getEmail()).isEqualTo("foo@example.com");
-  }
-
-  @Test
-  public void getUserIdTest() {
-    userDetails.setUserId(null);
-    assertThat(userDetails.getUserId()).isNull();
-
-    userDetails.setUserId("");
-    assertThat(userDetails.getUserId()).isEmpty();
-
-    userDetails.setUserId("foo@example");
-    assertThat(userDetails.getUserId()).isEqualTo("foo@example");
-  }
-
-  @Test
-  public void toStringTest() {
-    userDetails.setName("foo");
-    userDetails.setEmail("foo@example.com");
-    userDetails.setUserId("foo@example");
-
-    assertThat(userDetails.toString()).isEqualTo("UserDetails{name='foo', email='foo@example.com', userId='foo@example'}");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/DisplayTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/DisplayTest.java
deleted file mode 100644 (file)
index 9b77233..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class DisplayTest {
-
-  @Test
-  public void create_display() {
-    Display display = Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setBackgroundColor("#123456")
-      .build();
-
-    assertThat(display.getIconPath()).isEqualTo("/static/authgithub/github.svg");
-    assertThat(display.getBackgroundColor()).isEqualTo("#123456");
-    assertThat(display.getHelpMessage()).isNull();
-  }
-
-  @Test
-  public void create_display_with_default_background_color() {
-    Display display = Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .build();
-
-    assertThat(display.getBackgroundColor()).isEqualTo("#236a97");
-  }
-
-
-  @Test
-  public void create_display_with_help_message() {
-    Display display = Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setHelpMessage("Help message")
-      .build();
-
-    assertThat(display.getHelpMessage()).isEqualTo("Help message");
-  }
-
-  @Test
-  public void fail_when_icon_path_is_null() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath(null)
-      .setBackgroundColor("#123456")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Icon path must not be blank");
-  }
-
-  @Test
-  public void fail_when_icon_path_is_blank() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath("")
-      .setBackgroundColor("#123456")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Icon path must not be blank");
-  }
-
-  @Test
-  public void fail_when_background_color_is_null() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setBackgroundColor(null)
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Background color must not be blank");
-  }
-
-  @Test
-  public void fail_when_background_color_is_blank() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setBackgroundColor("")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Background color must not be blank");
-  }
-
-  @Test
-  public void fail_when_background_color_has_wrong_size() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setBackgroundColor("1234")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Background color must begin with a sharp followed by 6 characters");
-  }
-
-  @Test
-  public void fail_when_background_color_doesnt_begin_with_sharp() {
-    assertThatThrownBy(() -> Display.builder()
-      .setIconPath("/static/authgithub/github.svg")
-      .setBackgroundColor("*123456")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Background color must begin with a sharp followed by 6 characters");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/authentication/UserIdentityTest.java
deleted file mode 100644 (file)
index 266959f..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.authentication;
-
-import com.google.common.base.Strings;
-import org.junit.Test;
-
-import static com.google.common.collect.Sets.newHashSet;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class UserIdentityTest {
-
-  @Test
-  public void create_user() {
-    UserIdentity underTest = UserIdentity.builder()
-      .setProviderId("4321")
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .build();
-
-    assertThat(underTest.getProviderId()).isEqualTo("4321");
-    assertThat(underTest.getProviderLogin()).isEqualTo("john");
-    assertThat(underTest.getName()).isEqualTo("John");
-    assertThat(underTest.getEmail()).isEqualTo("john@email.com");
-    assertThat(underTest.shouldSyncGroups()).isFalse();
-    assertThat(underTest.getGroups()).isEmpty();
-  }
-
-  @Test
-  public void create_user_with_minimum_fields() {
-    UserIdentity underTest = UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .build();
-
-    assertThat(underTest.getProviderLogin()).isEqualTo("john");
-    assertThat(underTest.getName()).isEqualTo("John");
-    assertThat(underTest.getProviderId()).isNull();
-    assertThat(underTest.getEmail()).isNull();
-    assertThat(underTest.shouldSyncGroups()).isFalse();
-    assertThat(underTest.getGroups()).isEmpty();
-  }
-
-  @Test
-  public void fail_when_id_is_too_long() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderId(Strings.repeat("1", 256))
-      .setProviderLogin("john")
-      .setName("John")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("ID is too big (255 characters max)");
-  }
-
-  @Test
-  public void fail_when_provider_login_is_null() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setName("John")
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Provider login must not be blank");
-  }
-
-  @Test
-  public void fail_when_provider_login_is_empty() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("")
-      .setName("John")
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Provider login must not be blank");
-  }
-
-  @Test
-  public void fail_when_provider_login_is_too_long() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin(Strings.repeat("1", 256))
-      .setName("John")
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Provider login size is incorrect (maximum 255 characters)");
-  }
-
-  @Test
-  public void fail_when_name_is_null() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("User name must not be blank");
-  }
-
-  @Test
-  public void fail_when_name_is_empty() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("")
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("User name must not be blank");
-  }
-
-  @Test
-  public void fail_when_name_is_loo_long() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName(Strings.repeat("1", 201))
-      .setEmail("john@email.com")
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("User name size is too big (200 characters max)");
-  }
-
-  @Test
-  public void fail_when_email_is_loo_long() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail(Strings.repeat("1", 101))
-      .build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("User email size is too big (100 characters max)");
-  }
-
-  @Test
-  public void create_user_with_groups() {
-    UserIdentity underTest = UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet("admin", "user"))
-      .build();
-
-    assertThat(underTest.shouldSyncGroups()).isTrue();
-    assertThat(underTest.getGroups()).containsOnly("admin", "user");
-  }
-
-  @Test
-  public void fail_when_groups_are_null() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setEmail("john@email.com")
-      .setGroups(null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Groups cannot be null, please don't use this method if groups should not be synchronized.");
-  }
-
-  @Test
-  public void fail_when_groups_contain_empty_group_name() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet("")))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-
-  @Test
-  public void fail_when_groups_contain_only_blank_space() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet("      ")))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-
-  @Test
-  public void fail_when_groups_contain_null_group_name() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet((String)null)))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-
-  @Test
-  public void fail_when_groups_contain_anyone() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet("Anyone")))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Anyone group cannot be used");
-  }
-
-  @Test
-  public void fail_when_groups_contain_too_long_group_name() {
-    assertThatThrownBy(() -> UserIdentity.builder()
-      .setProviderLogin("john")
-      .setName("John")
-      .setEmail("john@email.com")
-      .setGroups(newHashSet(Strings.repeat("group", 300))))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be longer than 255 characters");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java
deleted file mode 100644 (file)
index c9f15ea..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.debt;
-
-import org.junit.Test;
-import org.sonar.api.server.debt.internal.DefaultDebtRemediationFunction;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class DefaultDebtRemediationFunctionTest {
-
-  @Test
-  public void create_linear() {
-    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "10h", null);
-    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR);
-    assertThat(function.gapMultiplier()).isEqualTo("10h");
-    assertThat(function.baseEffort()).isNull();
-  }
-
-  @Test
-  public void create_linear_with_offset() {
-    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min");
-    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET);
-    assertThat(function.gapMultiplier()).isEqualTo("10h");
-    assertThat(function.baseEffort()).isEqualTo("5min");
-  }
-
-  @Test
-  public void create_constant_per_issue() {
-    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "10h");
-    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE);
-    assertThat(function.gapMultiplier()).isNull();
-    assertThat(function.baseEffort()).isEqualTo("10h");
-  }
-
-  @Test
-  public void sanitize_remediation_coefficient_and_offset() {
-    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "  1  h   ", "  10   min");
-
-    assertThat(function.gapMultiplier()).isEqualTo("1h");
-    assertThat(function.baseEffort()).isEqualTo("10min");
-  }
-
-  @Test
-  public void fail_to_when_no_type() {
-    try {
-      new DefaultDebtRemediationFunction(null, "5min", "10h");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Remediation function type cannot be null");
-    }
-  }
-
-  @Test
-  public void fail_to_create_linear_when_no_coefficient() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, null, "10h");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Linear functions must only have a non empty gap multiplier");
-    }
-  }
-
-  @Test
-  public void fail_to_create_linear_when_offset() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "5min", "10h");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Linear functions must only have a non empty gap multiplier");
-    }
-  }
-
-  @Test
-  public void fail_to_create_constant_per_issue_when_no_offset() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, "10h", null);
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Constant/issue functions must only have a non empty base effort");
-    }
-  }
-
-  @Test
-  public void fail_to_create_constant_per_issue_when_coefficient() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, "5min", "10h");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Constant/issue functions must only have a non empty base effort");
-    }
-  }
-
-  @Test
-  public void fail_to_create_linear_with_offset_when_no_coefficient() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "", "10h");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Linear with offset functions must have both non null gap multiplier and base effort");
-    }
-  }
-
-  @Test
-  public void fail_to_create_linear_with_offset_when_no_offset() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "5min", "");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Linear with offset functions must have both non null gap multiplier and base effort");
-    }
-  }
-
-  @Test
-  public void test_equals_and_hashcode() {
-    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min");
-    DebtRemediationFunction functionWithSameValue = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min");
-    DebtRemediationFunction functionWithDifferentType = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "5min");
-
-    assertThat(function).isEqualTo(function)
-      .isEqualTo(functionWithSameValue)
-      .isNotEqualTo(functionWithDifferentType)
-      .isNotEqualTo(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "11h", "5min"))
-      .isNotEqualTo(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "6min"))
-      .isNotEqualTo(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "10h", null))
-      .isNotEqualTo(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "6min"))
-      .hasSameHashCodeAs(function)
-      .hasSameHashCodeAs(functionWithSameValue);
-    assertThat(function.hashCode()).isNotEqualTo(functionWithDifferentType.hashCode());
-  }
-
-  @Test
-  public void test_to_string() {
-    assertThat(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min").toString())
-      .isEqualTo("DebtRemediationFunction{type=LINEAR_OFFSET, gap multiplier=10h, base effort=5min}");
-  }
-
-  @Test
-  public void fail_if_bad_coefficient_format() {
-    try {
-      new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "foo", null);
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Invalid gap multiplier: foo (Duration 'foo' is invalid, it should use the following sample format : 2d 10h 15min)");
-    }
-
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfileAnnotationLoaderTest.java
deleted file mode 100644 (file)
index dac9968..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.profile;
-
-import org.junit.Test;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInQualityProfile;
-import org.sonar.check.BelongsToProfile;
-import org.sonar.check.Priority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class BuiltInQualityProfileAnnotationLoaderTest {
-
-  @Test
-  public void shouldParseAnnotatedClasses() {
-    BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
-    NewBuiltInQualityProfile newProfile = context.createBuiltInQualityProfile("Foo way", "java");
-
-    new BuiltInQualityProfileAnnotationLoader().load(newProfile, "squid", FakeRule.class, RuleNoProfile.class);
-    newProfile.done();
-
-    assertThat(context.profile("java", "Foo way").rule(RuleKey.of("squid", "fake")).overriddenSeverity()).isEqualTo(Severity.BLOCKER);
-  }
-
-  @Test
-  public void shouldParseOnlyWantedProfile() {
-    BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
-    NewBuiltInQualityProfile newProfile = context.createBuiltInQualityProfile("Foo way", "java");
-
-    new BuiltInQualityProfileAnnotationLoader().load(newProfile, "squid", FakeRule.class, RuleOnOtherProfile.class, RuleNoProfile.class);
-    newProfile.done();
-
-    assertThat(context.profile("java", "Foo way").rule(RuleKey.of("squid", "fake"))).isNotNull();
-    assertThat(context.profile("java", "Foo way").rule(RuleKey.of("squid", "other"))).isNull();
-  }
-}
-
-@BelongsToProfile(title = "Other profile", priority = Priority.BLOCKER)
-@org.sonar.check.Rule(key = "other", priority = Priority.CRITICAL)
-class RuleOnOtherProfile {
-}
-
-@org.sonar.check.Rule(key = "no", priority = Priority.CRITICAL)
-class RuleNoProfile {
-}
-
-@BelongsToProfile(title = "Foo way", priority = Priority.BLOCKER)
-@org.sonar.check.Rule(key = "fake", priority = Priority.CRITICAL)
-class FakeRule {
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java
deleted file mode 100644 (file)
index 8714992..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.profile;
-
-import java.util.Map;
-import java.util.function.Consumer;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile;
-import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInActiveRule;
-import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.NewBuiltInQualityProfile;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.assertj.core.groups.Tuple.tuple;
-
-public class BuiltInQualityProfilesDefinitionTest {
-
-
-  @Test
-  public void coverage() {
-    assertThat(new BuiltInQualityProfilesDefinition.Context().profile("Foo", "xoo")).isNull();
-  }
-
-  @Test
-  public void createEmptyProfile() {
-    Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> c.createBuiltInQualityProfile("Foo", "xoo").done());
-    assertThat(profiles).containsOnlyKeys("xoo");
-    assertThat(profiles.get("xoo")).containsOnlyKeys("Foo");
-    BuiltInQualityProfile profile = profiles.get("xoo").get("Foo");
-    assertThat(profile.name()).isEqualTo("Foo");
-    assertThat(profile.language()).isEqualTo("xoo");
-    assertThat(profile.isDefault()).isFalse();
-  }
-
-  @Test
-  public void sanityEqualCheck() {
-    Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> {
-      NewBuiltInQualityProfile profile1 = c.createBuiltInQualityProfile("Foo1", "xoo");
-      NewBuiltInActiveRule rule = profile1.activateRule("repo", "rule");
-      profile1.done();
-      NewBuiltInQualityProfile profile2 = c.createBuiltInQualityProfile("Foo2", "xoo");
-      profile2.done();
-      NewBuiltInQualityProfile profile3 = c.createBuiltInQualityProfile("Foo1", "xoo2");
-      profile3.done();
-
-      assertThat(profile1).isNotNull();
-      assertThat(profile1).isNotEqualTo(profile2);
-      assertThat(profile1).isNotEqualTo(profile3);
-
-      assertThat(profile1.hashCode()).isNotEqualTo(profile2.hashCode());
-
-      assertThat(profile1.name()).isNotEqualTo("Foo");
-      assertThat(profile1.toString()).hasToString("NewBuiltInQualityProfile{name='Foo1', language='xoo', default='false'}");
-      assertThat(rule.toString()).hasToString("[repository=repo, key=rule]");
-    });
-
-    BuiltInQualityProfile profile1 = profiles.get("xoo").get("Foo1");
-    BuiltInQualityProfile profile2 = profiles.get("xoo").get("Foo2");
-    BuiltInQualityProfile profile3 = profiles.get("xoo2").get("Foo1");
-
-    assertThat(profile1)
-      .isNotNull()
-      .isNotEqualTo(profile2)
-      .isNotEqualTo(profile3);
-    assertThat(profile1.hashCode()).isNotEqualTo(profile2.hashCode());
-
-    assertThat(profile1.name()).isNotEqualTo("Foo");
-    assertThat(profile1.toString()).hasToString("BuiltInQualityProfile{name='Foo1', language='xoo', default='false'}");
-    assertThat(profile1.rule(RuleKey.of("repo", "rule")).toString()).hasToString("[repository=repo, key=rule]");
-  }
-
-  @Test
-  public void createDefaultProfile() {
-    Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> {
-      c.createBuiltInQualityProfile("Foo", "xoo")
-        .setDefault(true)
-        .done();
-    });
-    assertThat(profiles).containsOnlyKeys("xoo");
-    assertThat(profiles.get("xoo")).containsOnlyKeys("Foo");
-    BuiltInQualityProfile profile = profiles.get("xoo").get("Foo");
-    assertThat(profile.name()).isEqualTo("Foo");
-    assertThat(profile.language()).isEqualTo("xoo");
-    assertThat(profile.isDefault()).isTrue();
-  }
-
-  @Test
-  public void duplicateProfile() {
-    assertThatThrownBy(() -> define(c -> {
-      c.createBuiltInQualityProfile("Foo", "xoo").done();
-      c.createBuiltInQualityProfile("Foo", "xoo").done();
-    }))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("There is already a quality profile with name 'Foo' for language 'xoo'");
-  }
-
-  @Test
-  public void createProfileWithRules() {
-    Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> {
-      NewBuiltInQualityProfile profile = c.createBuiltInQualityProfile("Foo", "xoo");
-      profile.activateRule("repo", "ruleWithoutParam");
-      profile.activateRule("repo", "ruleWithSeverity").overrideSeverity("CRITICAL");
-      profile.activateRule("repo", "ruleWithParam").overrideParam("param", "value");
-      profile.done();
-    });
-    assertThat(profiles).containsOnlyKeys("xoo");
-    assertThat(profiles.get("xoo")).containsOnlyKeys("Foo");
-    BuiltInQualityProfile profile = profiles.get("xoo").get("Foo");
-    assertThat(profile.name()).isEqualTo("Foo");
-    assertThat(profile.language()).isEqualTo("xoo");
-    assertThat(profile.isDefault()).isFalse();
-    assertThat(profile.rules())
-      .extracting(BuiltInQualityProfilesDefinition.BuiltInActiveRule::repoKey, BuiltInQualityProfilesDefinition.BuiltInActiveRule::ruleKey,
-        BuiltInQualityProfilesDefinition.BuiltInActiveRule::overriddenSeverity, r -> r.overriddenParams().size())
-      .containsOnly(
-        tuple("repo", "ruleWithoutParam", null, 0),
-        tuple("repo", "ruleWithSeverity", "CRITICAL", 0),
-        tuple("repo", "ruleWithParam", null, 1));
-    assertThat(profile.rule(RuleKey.of("repo", "ruleWithParam")).overriddenParam("param").key()).isEqualTo("param");
-    assertThat(profile.rule(RuleKey.of("repo", "ruleWithParam")).overriddenParam("param").overriddenValue()).isEqualTo("value");
-  }
-
-  @Test
-  public void createProfileWithDuplicateRules() {
-
-    define(c -> {
-      NewBuiltInQualityProfile profile = c.createBuiltInQualityProfile("Foo", "xoo");
-      profile.activateRule("repo", "rule");
-
-      assertThatThrownBy(() -> profile.activateRule("repo", "rule"))
-        .isInstanceOf(IllegalArgumentException.class)
-        .hasMessage("The rule 'repo:rule' is already activated");
-    });
-  }
-
-  private Map<String, Map<String, BuiltInQualityProfile>> define(Consumer<BuiltInQualityProfilesDefinition.Context> consumer) {
-    BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
-    new FakeProfile(consumer).define(context);
-    return context.profilesByLanguageAndName();
-  }
-
-  private static class FakeProfile implements BuiltInQualityProfilesDefinition {
-
-    private Consumer<Context> consumer;
-
-    public FakeProfile(Consumer<Context> consumer) {
-      this.consumer = consumer;
-    }
-
-    @Override
-    public void define(Context context) {
-      consumer.accept(context);
-    }
-
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java
deleted file mode 100644 (file)
index 36b076b..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RuleParamTypeTest {
-
-  @Test
-  public void testEquals() {
-    RuleParamType noOptions = RuleParamType.INTEGER;
-    RuleParamType withOptions1 = RuleParamType.singleListOfValues("one", "two");
-    RuleParamType withOptions2 = RuleParamType.singleListOfValues("three", "four");
-
-    assertThat(RuleParamType.INTEGER)
-      .isEqualTo(RuleParamType.INTEGER)
-      .isNotEqualTo(RuleParamType.STRING)
-      .isNotEqualTo("INTEGER")
-      .isNotEqualTo(withOptions1)
-      .isNotNull();
-
-    assertThat(withOptions1)
-      .isEqualTo(withOptions1)
-      .isNotEqualTo(noOptions)
-      .isNotEqualTo(withOptions2)
-      .isNotEqualTo("SINGLE_SELECT_LIST,values=one,two,")
-      .isNotNull();
-  }
-
-  @Test
-  public void testHashCode() {
-    assertThat(RuleParamType.INTEGER).hasSameHashCodeAs(RuleParamType.INTEGER);
-  }
-
-  @Test
-  public void testInteger() {
-    RuleParamType type = RuleParamType.INTEGER;
-    assertThat(type.toString()).isEqualTo("INTEGER");
-    assertThat(RuleParamType.parse(type.toString()).type()).isEqualTo("INTEGER");
-    assertThat(RuleParamType.parse(type.toString()).values()).isEmpty();
-    assertThat(RuleParamType.parse(type.toString()).toString()).isEqualTo("INTEGER");
-  }
-
-  @Test
-  public void testListOfValues() {
-    RuleParamType selectList = RuleParamType.parse("SINGLE_SELECT_LIST,values=\"foo,bar\",");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "bar");
-    assertThat(selectList.multiple()).isFalse();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,values=\"foo,bar,\"");
-
-    selectList = RuleParamType.parse("SINGLE_SELECT_LIST,values=\"foo,bar\",multiple=false");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "bar");
-    assertThat(selectList.multiple()).isFalse();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,values=\"foo,bar,\"");
-
-    selectList = RuleParamType.parse("SINGLE_SELECT_LIST,\"values=foo,bar\",multiple=false");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "bar");
-    assertThat(selectList.multiple()).isFalse();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,values=\"foo,bar,\"");
-
-    // escape values
-    selectList = RuleParamType.singleListOfValues("foo", "one,two|three,four");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "one,two|three,four");
-    assertThat(selectList.multiple()).isFalse();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,values=\"foo,\"\"one,two|three,four\"\",\"");
-  }
-
-  @Test
-  public void testMultipleListOfValues() {
-    RuleParamType selectList = RuleParamType.parse("SINGLE_SELECT_LIST,values=\"foo,bar\",multiple=true");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "bar");
-    assertThat(selectList.multiple()).isTrue();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,multiple=true,values=\"foo,bar,\"");
-
-    selectList = RuleParamType.parse("SINGLE_SELECT_LIST,\"values=foo,bar\",multiple=true");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "bar");
-    assertThat(selectList.multiple()).isTrue();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,multiple=true,values=\"foo,bar,\"");
-
-    // escape values
-    selectList = RuleParamType.multipleListOfValues("foo", "one,two|three,four");
-    assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(selectList.values()).containsOnly("foo", "one,two|three,four");
-    assertThat(selectList.multiple()).isTrue();
-    assertThat(selectList.toString()).isEqualTo("SINGLE_SELECT_LIST,multiple=true,values=\"foo,\"\"one,two|three,four\"\",\"");
-  }
-
-  @Test
-  public void support_deprecated_formats() {
-    assertThat(RuleParamType.parse("b")).isEqualTo(RuleParamType.BOOLEAN);
-    assertThat(RuleParamType.parse("i")).isEqualTo(RuleParamType.INTEGER);
-    assertThat(RuleParamType.parse("i{}")).isEqualTo(RuleParamType.INTEGER);
-    assertThat(RuleParamType.parse("s")).isEqualTo(RuleParamType.STRING);
-    assertThat(RuleParamType.parse("s{}")).isEqualTo(RuleParamType.STRING);
-    assertThat(RuleParamType.parse("r")).isEqualTo(RuleParamType.STRING);
-    assertThat(RuleParamType.parse("TEXT")).isEqualTo(RuleParamType.TEXT);
-    assertThat(RuleParamType.parse("STRING")).isEqualTo(RuleParamType.STRING);
-    assertThat(RuleParamType.parse("REGULAR_EXPRESSION")).isEqualTo(RuleParamType.STRING);
-    RuleParamType list = RuleParamType.parse("s[FOO,BAR]");
-    assertThat(list.type()).isEqualTo("SINGLE_SELECT_LIST");
-    assertThat(list.values()).containsOnly("FOO", "BAR");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagFormatTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagFormatTest.java
deleted file mode 100644 (file)
index 8120a0e..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.util.Collections;
-import org.junit.Test;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class RuleTagFormatTest {
-
-  @Test
-  public void isValid() {
-    assertThat(RuleTagFormat.isValid(null)).isFalse();
-    assertThat(RuleTagFormat.isValid("")).isFalse();
-    assertThat(RuleTagFormat.isValid(" ")).isFalse();
-    assertThat(RuleTagFormat.isValid("coding style")).isFalse();
-    assertThat(RuleTagFormat.isValid("Style")).isFalse();
-    assertThat(RuleTagFormat.isValid("sTyle")).isFalse();
-    assertThat(RuleTagFormat.isValid("@style")).isFalse();
-
-    assertThat(RuleTagFormat.isValid("style")).isTrue();
-    assertThat(RuleTagFormat.isValid("c++")).isTrue();
-    assertThat(RuleTagFormat.isValid("f#")).isTrue();
-    assertThat(RuleTagFormat.isValid("c++11")).isTrue();
-    assertThat(RuleTagFormat.isValid("c.d")).isTrue();
-  }
-
-  @Test
-  public void validate() {
-    RuleTagFormat.validate("style");
-    // no error
-  }
-
-  @Test
-  public void validate_and_fail() {
-    try {
-      RuleTagFormat.validate("  ");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Tag '  ' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
-    }
-  }
-
-  @Test
-  public void validate_and_sanitize_collection_of_tags() {
-    assertThat(RuleTagFormat.validate(asList("style", "coding-style", ""))).containsExactly("coding-style", "style");
-    assertThat(RuleTagFormat.validate(asList("style", "coding-style", null))).containsExactly("coding-style", "style");
-    assertThat(RuleTagFormat.validate(asList("style", "style", null))).containsExactly("style");
-    assertThat(RuleTagFormat.validate(singletonList("Uppercase"))).containsExactly("uppercase");
-    assertThat(RuleTagFormat.validate(Collections.emptyList())).isEmpty();
-  }
-
-  @Test
-  public void fail_to_validate_collection_of_tags() {
-    try {
-      RuleTagFormat.validate(asList("coding style", "Stylé", "valid"));
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Tags 'coding style, stylé' are invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java
deleted file mode 100644 (file)
index 42f2910..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.util.Collections;
-import org.junit.Test;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.utils.TestUtils;
-
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.api.server.rule.RuleTagsToTypeConverter.convert;
-
-public class RuleTagsToTypeConverterTest {
-
-  @Test
-  public void type_is_bug_if_has_tag_bug() {
-    assertThat(convert(asList("misra", "bug"))).isEqualTo(RuleType.BUG);
-    // "bug" has priority on "security"
-    assertThat(convert(asList("security", "bug"))).isEqualTo(RuleType.BUG);
-  }
-
-  @Test
-  public void type_is_vulnerability_if_has_tag_security() {
-    assertThat(convert(asList("misra", "security"))).isEqualTo(RuleType.VULNERABILITY);
-  }
-
-  @Test
-  public void default_is_code_smell() {
-    assertThat(convert(asList("clumsy", "spring"))).isEqualTo(RuleType.CODE_SMELL);
-    assertThat(convert(Collections.emptyList())).isEqualTo(RuleType.CODE_SMELL);
-  }
-
-  @Test
-  public void only_statics() {
-    assertThat(TestUtils.hasOnlyPrivateConstructors(RuleTagsToTypeConverter.class)).isTrue();
-
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionAnnotationLoaderTest.java
deleted file mode 100644 (file)
index 884e618..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import org.junit.Test;
-import org.sonar.api.impl.server.RulesDefinitionContext;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.server.rule.RulesDefinition.NewRule;
-import org.sonar.check.Priority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RulesDefinitionAnnotationLoaderTest {
-
-
-  RulesDefinitionAnnotationLoader annotationLoader = new RulesDefinitionAnnotationLoader();
-
-  @Test
-  public void rule_with_property() {
-    RulesDefinition.Repository repository = load(RuleWithProperty.class);
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("foo");
-    assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
-    assertThat(rule.name()).isEqualTo("bar");
-    assertThat(rule.htmlDescription()).isEqualTo("Foo Bar");
-    assertThat(rule.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(rule.params()).hasSize(1);
-    assertThat(rule.tags()).isEmpty();
-
-    RulesDefinition.Param prop = rule.param("property");
-    assertThat(prop.key()).isEqualTo("property");
-    assertThat(prop.description()).isEqualTo("Ignore ?");
-    assertThat(prop.defaultValue()).isEqualTo("false");
-    assertThat(prop.type()).isEqualTo(RuleParamType.STRING);
-  }
-
-  @Test
-  public void override_annotation_programmatically() {
-    RulesDefinition.Context context = new RulesDefinitionContext();
-    RulesDefinition.NewRepository newRepository = context.createRepository("squid", "java");
-    NewRule newRule = annotationLoader.loadRule(newRepository, RuleWithProperty.class);
-    newRule.setName("Overridden name");
-    newRule.param("property").setDefaultValue("true");
-    newRule.param("property").setDescription("Overridden");
-    newRepository.done();
-
-    RulesDefinition.Repository repository = context.repository("squid");
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("foo");
-    assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
-    assertThat(rule.name()).isEqualTo("Overridden name");
-    assertThat(rule.htmlDescription()).isEqualTo("Foo Bar");
-    assertThat(rule.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(rule.params()).hasSize(1);
-
-    RulesDefinition.Param prop = rule.param("property");
-    assertThat(prop.key()).isEqualTo("property");
-    assertThat(prop.description()).isEqualTo("Overridden");
-    assertThat(prop.defaultValue()).isEqualTo("true");
-    assertThat(prop.type()).isEqualTo(RuleParamType.STRING);
-  }
-
-  @Test
-  public void rule_with_integer_property() {
-    RulesDefinition.Repository repository = load(RuleWithIntegerProperty.class);
-
-    RulesDefinition.Param prop = repository.rules().get(0).param("property");
-    assertThat(prop.description()).isEqualTo("Max");
-    assertThat(prop.defaultValue()).isEqualTo("12");
-    assertThat(prop.type()).isEqualTo(RuleParamType.INTEGER);
-  }
-
-  @Test
-  public void rule_with_text_property() {
-    RulesDefinition.Repository repository = load(RuleWithTextProperty.class);
-
-    RulesDefinition.Param prop = repository.rules().get(0).param("property");
-    assertThat(prop.description()).isEqualTo("text");
-    assertThat(prop.defaultValue()).isEqualTo("Long text");
-    assertThat(prop.type()).isEqualTo(RuleParamType.TEXT);
-  }
-
-  @Test
-  public void should_recognize_type() {
-    assertThat(RulesDefinitionAnnotationLoader.guessType(Integer.class)).isEqualTo(RuleParamType.INTEGER);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(int.class)).isEqualTo(RuleParamType.INTEGER);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(Float.class)).isEqualTo(RuleParamType.FLOAT);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(float.class)).isEqualTo(RuleParamType.FLOAT);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(Boolean.class)).isEqualTo(RuleParamType.BOOLEAN);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(boolean.class)).isEqualTo(RuleParamType.BOOLEAN);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(String.class)).isEqualTo(RuleParamType.STRING);
-    assertThat(RulesDefinitionAnnotationLoader.guessType(Object.class)).isEqualTo(RuleParamType.STRING);
-  }
-
-  @Test
-  public void use_classname_when_missing_key() {
-    RulesDefinition.Repository repository = load(RuleWithoutKey.class);
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo(RuleWithoutKey.class.getCanonicalName());
-    assertThat(rule.name()).isEqualTo("foo");
-  }
-
-  @Test
-  public void rule_with_tags() {
-    RulesDefinition.Repository repository = load(RuleWithTags.class);
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.tags()).containsOnly("misra", "clumsy");
-  }
-
-  @Test
-  public void overridden_class() {
-    RulesDefinition.Repository repository = load(OverridingRule.class);
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("overriding_foo");
-    assertThat(rule.name()).isEqualTo("Overriding Foo");
-    assertThat(rule.severity()).isEqualTo(Severity.MAJOR);
-    assertThat(rule.htmlDescription()).isEqualTo("Desc of Overriding Foo");
-    assertThat(rule.params()).hasSize(2);
-  }
-
-  private RulesDefinition.Repository load(Class annotatedClass) {
-    RulesDefinition.Context context = new RulesDefinitionContext();
-    RulesDefinition.NewExtendedRepository newRepository = context.createRepository("squid", "java");
-    annotationLoader.load(newRepository, annotatedClass);
-    newRepository.done();
-    return context.repository("squid");
-  }
-
-  @org.sonar.check.Rule(name = "foo", description = "Foo")
-  static class RuleWithoutKey {
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER, status = "BETA")
-  static class RuleWithProperty {
-    @org.sonar.check.RuleProperty(description = "Ignore ?", defaultValue = "false")
-    private String property;
-  }
-
-  @org.sonar.check.Rule(key = "overriding_foo", name = "Overriding Foo", description = "Desc of Overriding Foo")
-  static class OverridingRule extends RuleWithProperty {
-    @org.sonar.check.RuleProperty
-    private String additionalProperty;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
-  static class RuleWithIntegerProperty {
-    @org.sonar.check.RuleProperty(description = "Max", defaultValue = "12")
-    private Integer property;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
-  static class RuleWithTextProperty {
-    @org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "TEXT")
-    protected String property;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", priority = Priority.BLOCKER)
-  static class RuleWithInvalidPropertyType {
-    @org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "INVALID")
-    public String property;
-  }
-
-  @org.sonar.check.Rule(key = "foo", name = "bar", description = "Bar", tags = {"misra", "clumsy"})
-  static class RuleWithTags {
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java
deleted file mode 100644 (file)
index fc8d783..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Ordering;
-import com.tngtech.java.junit.dataprovider.DataProvider;
-import com.tngtech.java.junit.dataprovider.DataProviderRunner;
-import com.tngtech.java.junit.dataprovider.UseDataProvider;
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.junit.Assume;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.sonar.api.impl.server.RulesDefinitionContext;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.utils.log.LogTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.fail;
-
-@RunWith(DataProviderRunner.class)
-public class RulesDefinitionTest {
-
-  RulesDefinition.Context context = new RulesDefinitionContext();
-
-  @Rule
-  public LogTester logTester = new LogTester();
-
-  @Test
-  public void define_repositories() {
-    assertThat(context.repositories()).isEmpty();
-
-    context.createRepository("findbugs", "java").setName("Findbugs").done();
-    context.createRepository("checkstyle", "java").done();
-
-    assertThat(context.repositories()).hasSize(2);
-    RulesDefinition.Repository findbugs = context.repository("findbugs");
-    assertThat(findbugs).isNotNull();
-    assertThat(findbugs.key()).isEqualTo("findbugs");
-    assertThat(findbugs.language()).isEqualTo("java");
-    assertThat(findbugs.name()).isEqualTo("Findbugs");
-    assertThat(findbugs.rules()).isEmpty();
-    RulesDefinition.Repository checkstyle = context.repository("checkstyle");
-    assertThat(checkstyle).isNotNull();
-    assertThat(checkstyle.key()).isEqualTo("checkstyle");
-    assertThat(checkstyle.language()).isEqualTo("java");
-
-    // default name is key
-    assertThat(checkstyle.name()).isEqualTo("checkstyle");
-    assertThat(checkstyle.rules()).isEmpty();
-    assertThat(context.repository("unknown")).isNull();
-  }
-
-  @Test
-  public void override_sonaranalyzer_repositories_name() {
-    context.createRepository("k", "java").setName("SonarAnalyzer").done();
-    RulesDefinition.Repository repo = context.repository("k");
-    assertThat(repo).isNotNull();
-    assertThat(repo.name()).isEqualTo("SonarQube");
-  }
-
-  @Test
-  public void define_rules() {
-    RulesDefinition.NewRepository newRepo = context.createRepository("findbugs", "java");
-    newRepo.createRule("NPE")
-      .setName("Detect NPE")
-      .setHtmlDescription("Detect <code>java.lang.NullPointerException</code>")
-      .setSeverity(Severity.BLOCKER)
-      .setInternalKey("/something")
-      .setStatus(RuleStatus.BETA)
-      .setTags("one", "two")
-      .setScope(RuleScope.ALL)
-      .addOwaspTop10(RulesDefinition.OwaspTop10.A1, RulesDefinition.OwaspTop10.A3)
-      .addCwe(1, 2, 123)
-      .addTags("two", "three", "four");
-
-    newRepo.createRule("ABC").setName("ABC").setMarkdownDescription("ABC");
-    newRepo.done();
-
-    RulesDefinition.Repository repo = context.repository("findbugs");
-    assertThat(repo.rules()).hasSize(2);
-    assertThat(repo.isExternal()).isFalse();
-
-    RulesDefinition.Rule rule = repo.rule("NPE");
-    assertThat(rule).isNotNull();
-    assertThat(rule.scope()).isEqualTo(RuleScope.ALL);
-    assertThat(rule.key()).isEqualTo("NPE");
-    assertThat(rule.name()).isEqualTo("Detect NPE");
-    assertThat(rule.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(rule.htmlDescription()).isEqualTo("Detect <code>java.lang.NullPointerException</code>");
-    assertThat(rule.markdownDescription()).isNull();
-    assertThat(rule.tags()).containsOnly("one", "two", "three", "four");
-    assertThat(rule.securityStandards()).containsOnly("cwe:1", "cwe:123", "cwe:2", "owaspTop10:a1", "owaspTop10:a3");
-    assertThat(rule.params()).isEmpty();
-    assertThat(rule.internalKey()).isEqualTo("/something");
-    assertThat(rule.template()).isFalse();
-    assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
-    assertThat(rule.toString()).hasToString("[repository=findbugs, key=NPE]");
-    assertThat(rule.repository()).isSameAs(repo);
-
-    RulesDefinition.Rule otherRule = repo.rule("ABC");
-    assertThat(otherRule.htmlDescription()).isNull();
-    assertThat(otherRule.markdownDescription()).isEqualTo("ABC");
-  }
-
-  @Test
-  public void define_rules_with_remediation_function() {
-    RulesDefinition.NewRepository newRepo = context.createRepository("common-java", "java");
-    RulesDefinition.NewRule newRule = newRepo.createRule("InsufficientBranchCoverage")
-      .setName("Insufficient condition coverage")
-      .setHtmlDescription("Insufficient condition coverage by unit tests")
-      .setSeverity(Severity.MAJOR)
-      .setGapDescription("Effort to test one uncovered branch");
-    newRule.setDebtRemediationFunction(newRule.debtRemediationFunctions().linearWithOffset("1h", "10min"));
-    newRepo.done();
-
-    RulesDefinition.Repository repo = context.repository("common-java");
-    assertThat(repo.rules()).hasSize(1);
-
-    RulesDefinition.Rule rule = repo.rule("InsufficientBranchCoverage");
-    assertThat(rule.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
-    assertThat(rule.debtRemediationFunction().gapMultiplier()).isEqualTo("1h");
-    assertThat(rule.debtRemediationFunction().baseEffort()).isEqualTo("10min");
-    assertThat(rule.gapDescription()).isEqualTo("Effort to test one uncovered branch");
-  }
-
-  @Test
-  public void define_rule_with_default_fields() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java");
-    newFindbugs.createRule("NPE").setName("NPE").setHtmlDescription("NPE");
-    newFindbugs.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.key()).isEqualTo("NPE");
-    assertThat(rule.severity()).isEqualTo(Severity.MAJOR);
-    assertThat(rule.params()).isEmpty();
-    assertThat(rule.internalKey()).isNull();
-    assertThat(rule.status()).isEqualTo(RuleStatus.defaultStatus());
-    assertThat(rule.tags()).isEmpty();
-    assertThat(rule.securityStandards()).isEmpty();
-    assertThat(rule.debtRemediationFunction()).isNull();
-  }
-
-  @Test
-  public void define_external_rules() {
-    RulesDefinition.NewRepository newRepo = context.createExternalRepository("eslint", "js");
-    newRepo.createRule("NPE")
-      .setName("Detect NPE")
-      .setHtmlDescription("Detect <code>java.lang.NullPointerException</code>")
-      .setSeverity(Severity.BLOCKER)
-      .setInternalKey("/something")
-      .setStatus(RuleStatus.BETA)
-      .setTags("one", "two")
-      .setScope(RuleScope.ALL)
-      .addOwaspTop10(RulesDefinition.OwaspTop10.A1, RulesDefinition.OwaspTop10.A3)
-      .addCwe(1, 2, 123)
-      .addTags("two", "three", "four");
-
-    newRepo.createRule("ABC").setName("ABC").setMarkdownDescription("ABC");
-    newRepo.done();
-
-    assertThat(context.repository("eslint")).isNull();
-    RulesDefinition.Repository repo = context.repository("external_eslint");
-    assertThat(repo.rules()).hasSize(2);
-    assertThat(repo.isExternal()).isTrue();
-
-    RulesDefinition.Rule rule = repo.rule("NPE");
-    assertThat(rule).isNotNull();
-    assertThat(rule.scope()).isEqualTo(RuleScope.ALL);
-    assertThat(rule.key()).isEqualTo("NPE");
-    assertThat(rule.name()).isEqualTo("Detect NPE");
-    assertThat(rule.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(rule.htmlDescription()).isEqualTo("Detect <code>java.lang.NullPointerException</code>");
-    assertThat(rule.markdownDescription()).isNull();
-    assertThat(rule.tags()).containsOnly("one", "two", "three", "four");
-    assertThat(rule.securityStandards()).containsOnly("cwe:1", "cwe:123", "cwe:2", "owaspTop10:a1", "owaspTop10:a3");
-    assertThat(rule.params()).isEmpty();
-    assertThat(rule.internalKey()).isEqualTo("/something");
-    assertThat(rule.template()).isFalse();
-    assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
-    assertThat(rule.toString()).hasToString("[repository=external_eslint, key=NPE]");
-    assertThat(rule.repository()).isSameAs(repo);
-
-    RulesDefinition.Rule otherRule = repo.rule("ABC");
-    assertThat(otherRule.htmlDescription()).isNull();
-    assertThat(otherRule.markdownDescription()).isEqualTo("ABC");
-  }
-
-  @Test
-  public void define_rule_parameters() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java");
-    RulesDefinition.NewRule newNpe = newFindbugs.createRule("NPE").setName("NPE").setHtmlDescription("NPE");
-    newNpe.createParam("level").setDefaultValue("LOW").setName("Level").setDescription("The level").setType(RuleParamType.INTEGER);
-    newNpe.createParam("effort");
-    newFindbugs.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.params()).hasSize(2);
-
-    RulesDefinition.Param level = rule.param("level");
-    assertThat(level).isNotNull();
-    assertThat(level.key()).isEqualTo("level");
-    assertThat(level.name()).isEqualTo("Level");
-    assertThat(level.description()).isEqualTo("The level");
-    assertThat(level.defaultValue()).isEqualTo("LOW");
-    assertThat(level.type()).isEqualTo(RuleParamType.INTEGER);
-
-    RulesDefinition.Param effort = rule.param("effort");
-    assertThat(effort.key()).isEqualTo("effort").isEqualTo(effort.name());
-    assertThat(effort.description()).isNull();
-    assertThat(effort.defaultValue()).isNull();
-    assertThat(effort.type()).isEqualTo(RuleParamType.STRING);
-  }
-
-  @Test
-  public void define_rule_parameter_with_empty_default_value() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java");
-    RulesDefinition.NewRule newNpe = newFindbugs.createRule("NPE").setName("NPE").setHtmlDescription("NPE");
-    newNpe.createParam("level").setDefaultValue("").setName("Level").setDescription("The level").setType(RuleParamType.INTEGER);
-    newFindbugs.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.params()).hasSize(1);
-
-    RulesDefinition.Param level = rule.param("level");
-    assertThat(level.key()).isEqualTo("level");
-    assertThat(level.name()).isEqualTo("Level");
-    assertThat(level.description()).isEqualTo("The level");
-    // Empty value is converted in null value
-    assertThat(level.defaultValue()).isNull();
-    assertThat(level.type()).isEqualTo(RuleParamType.INTEGER);
-  }
-
-  @Test
-  @UseDataProvider("nullOrEmpty")
-  public void addDeprecatedRuleKey_fails_with_IAE_if_repository_is_null_or_empty(String nullOrEmpty) {
-    RulesDefinition.NewRepository newRepository = context.createRepository("foo", "bar");
-    RulesDefinition.NewRule newRule = newRepository.createRule("doh");
-
-    assertThatThrownBy(() -> newRule.addDeprecatedRuleKey(nullOrEmpty, "oldKey"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Repository must be set");
-  }
-
-  @Test
-  @UseDataProvider("nullOrEmpty")
-  public void addDeprecatedRuleKey_fails_with_IAE_if_key_is_null_or_empty(String nullOrEmpty) {
-    RulesDefinition.NewRepository newRepository = context.createRepository("foo", "bar");
-    RulesDefinition.NewRule newRule = newRepository.createRule("doh");
-
-    assertThatThrownBy(() -> newRule.addDeprecatedRuleKey("oldRepo", nullOrEmpty))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Rule must be set");
-  }
-
-  @DataProvider
-  public static Object[][] nullOrEmpty() {
-    return new Object[][]{
-      {null},
-      {""}
-    };
-  }
-
-  @Test
-  public void getDeprecatedKeys_returns_empty_if_addDeprecatedKeys_never_called() {
-    String repositoryKey = "foo";
-    String ruleKey = "doh";
-    RulesDefinition.NewRepository newRepository = context.createRepository(repositoryKey, "bar");
-    newRepository.createRule(ruleKey)
-      .setName("doh rule")
-      .setHtmlDescription("doh description");
-    newRepository.done();
-    RulesDefinition.Repository repository = context.repository(repositoryKey);
-    RulesDefinition.Rule rule = repository.rule(ruleKey);
-
-    assertThat(rule.deprecatedRuleKeys()).isEmpty();
-  }
-
-  @Test
-  public void getDeprecatedKeys_returns_keys_in_order_of_addDeprecatedKeys_calls() {
-    Set<RuleKey> ruleKeys = ImmutableSet.of(RuleKey.of("foo", "AAA"),
-      RuleKey.of("bar", "CCCC"), RuleKey.of("doh", "CCCC"), RuleKey.of("foo", "BBBBBBBBBB"));
-    List<RuleKey> sortedRuleKeys = ruleKeys.stream().sorted(Ordering.natural().onResultOf(RuleKey::toString)).collect(Collectors.toList());
-
-    // ensure we don't have the same order
-    Assume.assumeTrue(!ImmutableList.copyOf(ruleKeys).equals(sortedRuleKeys));
-
-    String repositoryKey = "foo";
-    String ruleKey = "doh";
-    RulesDefinition.NewRepository newRepository = context.createRepository(repositoryKey, "bar");
-    RulesDefinition.NewRule newRule = newRepository.createRule(ruleKey)
-      .setName("doh rule")
-      .setHtmlDescription("doh description");
-    sortedRuleKeys.forEach(r -> newRule.addDeprecatedRuleKey(r.repository(), r.rule()));
-    newRepository.done();
-    RulesDefinition.Repository repository = context.repository(repositoryKey);
-    RulesDefinition.Rule rule = repository.rule(ruleKey);
-
-    assertThat(ImmutableList.copyOf(rule.deprecatedRuleKeys()))
-      .isEqualTo(sortedRuleKeys);
-  }
-
-  @Test
-  public void getDeprecatedKeys_does_not_return_the_same_key_more_than_once() {
-    RuleKey duplicatedRuleKey = RuleKey.of("foo", "AAA");
-    RuleKey ruleKey2 = RuleKey.of("bar", "CCCC");
-    RuleKey ruleKey3 = RuleKey.of("foo", "BBBBBBBBBB");
-    List<RuleKey> ruleKeys = ImmutableList.of(duplicatedRuleKey, ruleKey2, duplicatedRuleKey, duplicatedRuleKey, ruleKey3);
-
-    String repositoryKey = "foo";
-    String ruleKey = "doh";
-    RulesDefinition.NewRepository newRepository = context.createRepository(repositoryKey, "bar");
-    RulesDefinition.NewRule newRule = newRepository.createRule(ruleKey)
-      .setName("doh rule")
-      .setHtmlDescription("doh description");
-    ruleKeys.forEach(r -> newRule.addDeprecatedRuleKey(r.repository(), r.rule()));
-    newRepository.done();
-    RulesDefinition.Repository repository = context.repository(repositoryKey);
-    RulesDefinition.Rule rule = repository.rule(ruleKey);
-
-    assertThat(rule.deprecatedRuleKeys())
-      .containsExactly(ruleKey2, duplicatedRuleKey, ruleKey3);
-  }
-
-  @Test
-  public void sanitize_rule_name() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java");
-    newFindbugs.createRule("NPE").setName("   \n  NullPointer   \n   ").setHtmlDescription("NPE");
-    newFindbugs.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.name()).isEqualTo("NullPointer");
-  }
-
-  @Test
-  public void default_scope_should_be_main() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java");
-    newFindbugs.createRule("key").setName("name").setHtmlDescription("NPE");
-    newFindbugs.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("key");
-    assertThat(rule.scope()).isEqualTo(RuleScope.MAIN);
-  }
-
-  @Test
-  public void add_rules_to_existing_repository() {
-    RulesDefinition.NewRepository newFindbugs = context.createRepository("findbugs", "java").setName("Findbugs");
-    newFindbugs.createRule("NPE").setName("NPE").setHtmlDescription("NPE");
-    newFindbugs.done();
-
-    RulesDefinition.NewRepository newFbContrib = context.createRepository("findbugs", "java");
-    newFbContrib.createRule("VULNERABILITY").setName("Vulnerability").setMarkdownDescription("Detect vulnerability");
-    newFbContrib.done();
-
-    assertThat(context.repositories()).hasSize(1);
-    RulesDefinition.Repository findbugs = context.repository("findbugs");
-    assertThat(findbugs.key()).isEqualTo("findbugs");
-    assertThat(findbugs.language()).isEqualTo("java");
-    assertThat(findbugs.name()).isEqualTo("Findbugs");
-    assertThat(findbugs.rules()).extracting("key").containsOnly("NPE", "VULNERABILITY");
-  }
-
-  /**
-   * This is temporarily accepted only for the support of the common-rules that are still declared
-   * by plugins. It could be removed in 7.0
-   *
-   * @since 5.2
-   */
-  @Test
-  public void allow_to_replace_an_existing_common_rule() {
-    RulesDefinition.NewRepository newCommonJava1 = context.createRepository("common-java", "java").setName("Common Java");
-    newCommonJava1.createRule("coverage").setName("Lack of coverage").setHtmlDescription("Coverage must be high");
-    newCommonJava1.done();
-
-    RulesDefinition.NewRepository newCommonJava2 = context.createRepository("common-java", "java");
-    newCommonJava2.createRule("coverage").setName("Lack of coverage (V2)").setMarkdownDescription("Coverage must be high (V2)");
-    newCommonJava2.done();
-
-    RulesDefinition.Repository commonJava = context.repository("common-java");
-    assertThat(commonJava.rules()).hasSize(1);
-    RulesDefinition.Rule rule = commonJava.rule("coverage");
-    assertThat(rule.name()).isEqualTo("Lack of coverage (V2)");
-
-    // replacement but not merge -> keep only the v2 (which has markdown but not html description)
-    assertThat(rule.markdownDescription()).isEqualTo("Coverage must be high (V2)");
-    assertThat(rule.htmlDescription()).isNull();
-
-    // do not log warning
-    assertThat(logTester.logs()).isEmpty();
-  }
-
-  @Test
-  public void cant_set_blank_repository_name() {
-    context.createRepository("findbugs", "java").setName(null).done();
-
-    assertThat(context.repository("findbugs").name()).isEqualTo("findbugs");
-  }
-
-  @Test
-  public void fail_if_duplicated_rule_keys_in_the_same_repository() {
-    RulesDefinition.NewRepository findbugs = context.createRepository("findbugs", "java");
-    findbugs.createRule("NPE");
-
-    assertThatThrownBy(() -> findbugs.createRule("NPE"))
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_duplicated_rule_param_keys() {
-    RulesDefinition.NewRule rule = context.createRepository("findbugs", "java").createRule("NPE");
-    rule.createParam("level");
-    try {
-      rule.createParam("level");
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("The parameter 'level' is declared several times on the rule [repository=findbugs, key=NPE]");
-    }
-  }
-
-  @Test
-  public void fail_if_blank_rule_name() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName(null).setHtmlDescription("NPE");
-    try {
-      newRepository.done();
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Name of rule [repository=findbugs, key=NPE] is empty");
-    }
-  }
-
-  @Test
-  public void fail_if_bad_rule_tag() {
-    try {
-      // whitespaces are not allowed in tags
-      context.createRepository("findbugs", "java").createRule("NPE").setTags("coding style");
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class)
-        .hasMessage("Tag 'coding style' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
-    }
-  }
-
-  @Test
-  public void load_rule_html_description_from_file() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription(getClass().getResource("/org/sonar/api/server/rule/RulesDefinitionTest/sample.html"));
-    newRepository.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.htmlDescription()).isEqualTo("description of rule loaded from file");
-  }
-
-  @Test
-  public void load_rule_markdown_description_from_file() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setMarkdownDescription(getClass().getResource("/org/sonar/api/server/rule/RulesDefinitionTest/sample.md"));
-    newRepository.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.markdownDescription()).isEqualTo("description of rule loaded from file");
-  }
-
-  @Test
-  public void fail_to_load_html_rule_description_from_file() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription((URL) null);
-    try {
-      newRepository.done();
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("One of HTML description or Markdown description must be defined for rule [repository=findbugs, key=NPE]");
-    }
-  }
-
-  @Test
-  public void fail_to_load_markdown_rule_description_from_file() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setMarkdownDescription((URL) null);
-    try {
-      newRepository.done();
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("One of HTML description or Markdown description must be defined for rule [repository=findbugs, key=NPE]");
-    }
-  }
-
-  @Test
-  public void fail_if_no_rule_description() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE");
-    try {
-      newRepository.done();
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("One of HTML description or Markdown description must be defined for rule [repository=findbugs, key=NPE]");
-    }
-  }
-
-  @Test
-  public void fail_if_rule_already_has_html_description() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    try {
-      newRepository.createRule("NPE").setName("NPE").setHtmlDescription("polop").setMarkdownDescription("palap");
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Rule '[repository=findbugs, key=NPE]' already has an HTML description");
-    }
-  }
-
-  @Test
-  public void fail_if_rule_already_has_markdown_description() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    try {
-      newRepository.createRule("NPE").setName("NPE").setMarkdownDescription("palap").setHtmlDescription("polop");
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Rule '[repository=findbugs, key=NPE]' already has a Markdown description");
-    }
-  }
-
-  @Test
-  public void fail_if_bad_rule_severity() {
-    try {
-      context.createRepository("findbugs", "java").createRule("NPE").setSeverity("VERY HIGH");
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Severity of rule [repository=findbugs, key=NPE] is not correct: VERY HIGH");
-    }
-  }
-
-  @Test
-  public void fail_if_removed_status() {
-    try {
-      context.createRepository("findbugs", "java").createRule("NPE").setStatus(RuleStatus.REMOVED);
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Status 'REMOVED' is not accepted on rule '[repository=findbugs, key=NPE]'");
-    }
-  }
-
-  @Test
-  public void type_is_defined() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription("desc")
-      .setType(RuleType.VULNERABILITY).setTags("bug", "misra");
-    newRepository.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    // type VULNERABILITY is kept even if the tag "bug" is present
-    assertThat(rule.type()).isEqualTo(RuleType.VULNERABILITY);
-    // tag "bug" is reserved and removed.
-    assertThat(rule.tags()).containsOnly("misra");
-  }
-
-  @Test
-  public void guess_type_from_tags_if_type_is_missing() {
-    RulesDefinition.NewRepository newRepository = context.createRepository("findbugs", "java");
-    newRepository.createRule("NPE").setName("NPE").setHtmlDescription("desc").setTags("bug", "misra");
-    newRepository.done();
-
-    RulesDefinition.Rule rule = context.repository("findbugs").rule("NPE");
-    assertThat(rule.type()).isEqualTo(RuleType.BUG);
-    // tag "bug" is reserved and removed
-    assertThat(rule.tags()).containsOnly("misra");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java
deleted file mode 100644 (file)
index 89dcb91..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule;
-
-import java.io.InputStream;
-import java.io.StringReader;
-import java.nio.charset.StandardCharsets;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import org.sonar.api.impl.server.RulesDefinitionContext;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rule.Severity;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class RulesDefinitionXmlLoaderTest {
-
-  RulesDefinitionXmlLoader underTest = new RulesDefinitionXmlLoader();
-
-  @Test
-  public void parse_xml() {
-    InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/rules.xml");
-    RulesDefinition.Repository repository = load(input, StandardCharsets.UTF_8.name());
-    assertThat(repository.rules()).hasSize(2);
-
-    RulesDefinition.Rule rule = repository.rule("complete");
-    assertThat(rule.key()).isEqualTo("complete");
-    assertThat(rule.name()).isEqualTo("Complete");
-    assertThat(rule.htmlDescription()).isEqualTo("Description of Complete");
-    assertThat(rule.severity()).isEqualTo(Severity.BLOCKER);
-    assertThat(rule.template()).isTrue();
-    assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
-    assertThat(rule.internalKey()).isEqualTo("Checker/TreeWalker/LocalVariableName");
-    assertThat(rule.type()).isEqualTo(RuleType.BUG);
-    assertThat(rule.tags()).containsOnly("misra", "spring");
-
-    assertThat(rule.params()).hasSize(2);
-    RulesDefinition.Param ignore = rule.param("ignore");
-    assertThat(ignore.key()).isEqualTo("ignore");
-    assertThat(ignore.description()).isEqualTo("Ignore ?");
-    assertThat(ignore.defaultValue()).isEqualTo("false");
-
-    rule = repository.rule("minimal");
-    assertThat(rule.key()).isEqualTo("minimal");
-    assertThat(rule.name()).isEqualTo("Minimal");
-    assertThat(rule.htmlDescription()).isEqualTo("Description of Minimal");
-    assertThat(rule.params()).isEmpty();
-    assertThat(rule.status()).isEqualTo(RuleStatus.READY);
-    assertThat(rule.severity()).isEqualTo(Severity.MAJOR);
-    assertThat(rule.type()).isEqualTo(RuleType.CODE_SMELL);
-  }
-
-  @Test
-  public void fail_if_missing_rule_key() {
-    assertThatThrownBy(() -> load(IOUtils.toInputStream("<rules><rule><name>Foo</name></rule></rules>"), StandardCharsets.UTF_8.name()))
-      .isInstanceOf(IllegalStateException.class);
-  }
-
-  @Test
-  public void fail_if_missing_property_key() {
-    assertThatThrownBy(() -> load(IOUtils.toInputStream("<rules><rule><key>foo</key><name>Foo</name><param></param></rule></rules>"),
-      StandardCharsets.UTF_8.name()))
-      .isInstanceOf(IllegalStateException.class);
-  }
-
-  @Test
-  public void fail_on_invalid_rule_parameter_type() {
-    assertThatThrownBy(() -> load(IOUtils.toInputStream("<rules><rule><key>foo</key><name>Foo</name><param><key>key</key><type>INVALID</type></param></rule></rules>"),
-      StandardCharsets.UTF_8.name()))
-      .isInstanceOf(IllegalStateException.class);
-  }
-
-  @Test
-  public void fail_if_invalid_xml() {
-    InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/invalid.xml");
-
-    assertThatThrownBy(() -> load(input, StandardCharsets.UTF_8.name()))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("XML is not valid");
-  }
-
-  @Test
-  public void test_utf8_encoding() {
-    InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/utf8.xml");
-    RulesDefinition.Repository repository = load(input, StandardCharsets.UTF_8.name());
-
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck");
-    assertThat(rule.name()).isEqualTo("M & M");
-    assertThat(rule.htmlDescription().charAt(0)).isEqualTo('\u00E9');
-    assertThat(rule.htmlDescription().charAt(1)).isEqualTo('\u00E0');
-    assertThat(rule.htmlDescription().charAt(2)).isEqualTo('\u0026');
-  }
-
-  @Test
-  public void test_utf8_encoding_with_bom() {
-    InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/utf8-with-bom.xml");
-    RulesDefinition.Repository repository = load(input, StandardCharsets.UTF_8.name());
-
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck");
-    assertThat(rule.name()).isEqualTo("M & M");
-    assertThat(rule.htmlDescription().charAt(0)).isEqualTo('\u00E9');
-    assertThat(rule.htmlDescription().charAt(1)).isEqualTo('\u00E0');
-    assertThat(rule.htmlDescription().charAt(2)).isEqualTo('\u0026');
-  }
-
-  @Test
-  public void support_deprecated_format() {
-    // the deprecated format uses some attributes instead of nodes
-    InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/deprecated.xml");
-    RulesDefinition.Repository repository = load(input, StandardCharsets.UTF_8.name());
-
-    assertThat(repository.rules()).hasSize(1);
-    RulesDefinition.Rule rule = repository.rules().get(0);
-    assertThat(rule.key()).isEqualTo("org.sonar.it.checkstyle.MethodsCountCheck");
-    assertThat(rule.internalKey()).isEqualTo("Checker/TreeWalker/org.sonar.it.checkstyle.MethodsCountCheck");
-    assertThat(rule.severity()).isEqualTo(Severity.CRITICAL);
-    assertThat(rule.htmlDescription()).isEqualTo("Count methods");
-    assertThat(rule.param("minMethodsCount")).isNotNull();
-  }
-
-  @Test
-  public void test_linear_remediation_function() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-
-      "    <gapDescription>lines</gapDescription>" +
-      "    <remediationFunction>LINEAR</remediationFunction>" +
-      "    <remediationFunctionGapMultiplier>2d 3h</remediationFunctionGapMultiplier>" +
-      "  </rule>" +
-      "</rules>";
-    RulesDefinition.Rule rule = load(xml).rule("1");
-    assertThat(rule.gapDescription()).isEqualTo("lines");
-    DebtRemediationFunction function = rule.debtRemediationFunction();
-    assertThat(function).isNotNull();
-    assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR);
-    assertThat(function.gapMultiplier()).isEqualTo("2d3h");
-    assertThat(function.baseEffort()).isNull();
-  }
-
-  @Test
-  public void test_linear_with_offset_remediation_function() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-
-      "    <effortToFixDescription>lines</effortToFixDescription>" +
-      "    <remediationFunction>LINEAR_OFFSET</remediationFunction>" +
-      "    <remediationFunctionGapMultiplier>2d 3h</remediationFunctionGapMultiplier>" +
-      "    <remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>" +
-      "  </rule>" +
-      "</rules>";
-    RulesDefinition.Rule rule = load(xml).rule("1");
-    assertThat(rule.gapDescription()).isEqualTo("lines");
-    DebtRemediationFunction function = rule.debtRemediationFunction();
-    assertThat(function).isNotNull();
-    assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
-    assertThat(function.gapMultiplier()).isEqualTo("2d3h");
-    assertThat(function.baseEffort()).isEqualTo("5min");
-  }
-
-  @Test
-  public void test_constant_remediation_function() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-      "    <remediationFunction>CONSTANT_ISSUE</remediationFunction>" +
-      "    <remediationFunctionBaseEffort>5min</remediationFunctionBaseEffort>" +
-      "  </rule>" +
-      "</rules>";
-    RulesDefinition.Rule rule = load(xml).rule("1");
-    DebtRemediationFunction function = rule.debtRemediationFunction();
-    assertThat(function).isNotNull();
-    assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE);
-    assertThat(function.gapMultiplier()).isNull();
-    assertThat(function.baseEffort()).isEqualTo("5min");
-  }
-
-  @Test
-  public void fail_if_invalid_remediation_function() {
-    assertThatThrownBy(() -> load("" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-      "    <remediationFunction>UNKNOWN</remediationFunction>" +
-      "  </rule>" +
-      "</rules>"))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Fail to load the rule with key [squid:1]")
-      .hasCauseInstanceOf(IllegalArgumentException.class)
-      .hasRootCauseMessage("No enum constant org.sonar.api.server.debt.DebtRemediationFunction.Type.UNKNOWN");
-  }
-
-  @Test
-  public void markdown_description() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-      "    <descriptionFormat>MARKDOWN</descriptionFormat>" +
-      "  </rule>" +
-      "</rules>";
-    RulesDefinition.Rule rule = load(xml).rule("1");
-    assertThat(rule.markdownDescription()).isEqualTo("Desc");
-    assertThat(rule.htmlDescription()).isNull();
-  }
-
-  @Test
-  public void fail_if_unsupported_description_format() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-      "    <descriptionFormat>UNKNOWN</descriptionFormat>" +
-      "  </rule>" +
-      "</rules>";
-
-    assertThatThrownBy(() -> load(xml).rule("1"))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Fail to load the rule with key [squid:1]")
-      .hasCauseInstanceOf(IllegalArgumentException.class)
-      .hasRootCauseMessage("No enum constant org.sonar.api.server.rule.RulesDefinitionXmlLoader.DescriptionFormat.UNKNOWN");
-  }
-
-  @Test
-  public void test_deprecated_remediation_function() {
-    String xml = "" +
-      "<rules>" +
-      "  <rule>" +
-      "    <key>1</key>" +
-      "    <name>One</name>" +
-      "    <description>Desc</description>" +
-      "    <effortToFixDescription>lines</effortToFixDescription>" +
-      "    <debtRemediationFunction>LINEAR_OFFSET</debtRemediationFunction>" +
-      "    <debtRemediationFunctionCoefficient>2d 3h</debtRemediationFunctionCoefficient>" +
-      "    <debtRemediationFunctionOffset>5min</debtRemediationFunctionOffset>" +
-      "  </rule>" +
-      "</rules>";
-    RulesDefinition.Rule rule = load(xml).rule("1");
-    assertThat(rule.gapDescription()).isEqualTo("lines");
-    DebtRemediationFunction function = rule.debtRemediationFunction();
-    assertThat(function).isNotNull();
-    assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
-    assertThat(function.gapMultiplier()).isEqualTo("2d3h");
-    assertThat(function.baseEffort()).isEqualTo("5min");
-  }
-
-  private RulesDefinition.Repository load(InputStream input, String encoding) {
-    RulesDefinition.Context context = new RulesDefinitionContext();
-    RulesDefinition.NewRepository newRepository = context.createRepository("squid", "java");
-    underTest.load(newRepository, input, encoding);
-    newRepository.done();
-    return context.repository("squid");
-  }
-
-  private RulesDefinition.Repository load(String xml) {
-    RulesDefinition.Context context = new RulesDefinitionContext();
-    RulesDefinition.NewRepository newRepository = context.createRepository("squid", "java");
-    underTest.load(newRepository, new StringReader(xml));
-    newRepository.done();
-    return context.repository("squid");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultNewRuleTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultNewRuleTest.java
deleted file mode 100644 (file)
index d4e82b5..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import org.junit.Test;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.server.rule.RulesDefinition;
-import org.sonar.api.server.rule.RulesDefinition.OwaspTop10;
-import org.sonar.api.server.rule.RulesDefinition.OwaspTop10Version;
-import org.sonar.api.server.rule.RulesDefinition.PciDssVersion;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
-
-public class DefaultNewRuleTest {
-
-  private final DefaultNewRule rule = new DefaultNewRule("plugin", "repo", "key");
-
-  @Test
-  public void testSimpleSetGet() {
-    assertThat(rule.pluginKey()).isEqualTo("plugin");
-    assertThat(rule.repoKey()).isEqualTo("repo");
-    assertThat(rule.key()).isEqualTo("key");
-
-    rule.setScope(RuleScope.MAIN);
-    assertThat(rule.scope()).isEqualTo(RuleScope.MAIN);
-
-    rule.setName("   name  ");
-    assertThat(rule.name()).isEqualTo("name");
-
-    rule.setHtmlDescription("   html  ");
-    assertThat(rule.htmlDescription()).isEqualTo("html");
-
-    rule.setTemplate(true);
-    assertThat(rule.template()).isTrue();
-
-    rule.setActivatedByDefault(true);
-    assertThat(rule.activatedByDefault()).isTrue();
-
-    RulesDefinition.NewParam param1 = rule.createParam("param1");
-    assertThat(rule.param("param1")).isEqualTo(param1);
-    assertThat(rule.params()).containsOnly(param1);
-
-    rule.setTags("tag1", "tag2");
-    rule.addTags("tag3");
-    assertThat(rule.tags()).containsExactly("tag1", "tag2", "tag3");
-
-    rule.setGapDescription("effort");
-    assertThat(rule.gapDescription()).isEqualTo("effort");
-
-    rule.setInternalKey("internal");
-    assertThat(rule.internalKey()).isEqualTo("internal");
-
-    rule.addDeprecatedRuleKey("deprecatedrepo", "deprecatedkey");
-    assertThat(rule.deprecatedRuleKeys()).containsOnly(RuleKey.of("deprecatedrepo", "deprecatedkey"));
-
-    rule.setStatus(RuleStatus.READY);
-    assertThat(rule.status()).isEqualTo(RuleStatus.READY);
-
-    rule.addCwe(12);
-    rule.addCwe(10);
-    assertThat(rule.securityStandards()).containsOnly("cwe:10", "cwe:12");
-
-    rule.addOwaspTop10(OwaspTop10.A1, OwaspTop10.A2);
-    rule.addOwaspTop10(OwaspTop10Version.Y2017, OwaspTop10.A4);
-    rule.addOwaspTop10(OwaspTop10Version.Y2021, OwaspTop10.A5, OwaspTop10.A3);
-    assertThat(rule.securityStandards())
-      .contains("owaspTop10:a1", "owaspTop10:a2", "owaspTop10:a4", "owaspTop10-2021:a3", "owaspTop10-2021:a5");
-
-    rule.addPciDss(PciDssVersion.V3_2, "6.5.1");
-    rule.addPciDss(PciDssVersion.V3_2, "6.5");
-    rule.addPciDss(PciDssVersion.V4_0, "6.5.2", "6.5.10");
-
-    assertThat(rule.securityStandards())
-      .contains("pciDss-3.2:6.5.1", "pciDss-3.2:6.5", "pciDss-4.0:6.5.2", "pciDss-4.0:6.5.10");
-
-    rule.setType(RuleType.SECURITY_HOTSPOT);
-    assertThat(rule.type()).isEqualTo(RuleType.SECURITY_HOTSPOT);
-
-    DebtRemediationFunction f = mock(DebtRemediationFunction.class);
-    rule.setDebtRemediationFunction(f);
-    assertThat(rule.debtRemediationFunction()).isEqualTo(f);
-
-    rule.setSeverity("MAJOR");
-    assertThat(rule.severity()).isEqualTo("MAJOR");
-  }
-
-  @Test
-  public void validate_fails() {
-    rule.setHtmlDescription("html");
-
-    assertThatThrownBy(() -> rule.validate())
-      .isInstanceOf(IllegalStateException.class);
-  }
-
-  @Test
-  public void validate_succeeds() {
-    rule.setHtmlDescription("html");
-    rule.setName("name");
-    rule.validate();
-  }
-
-  @Test
-  public void set_markdown_description() {
-    rule.setMarkdownDescription("markdown");
-    assertThat(rule.markdownDescription()).isEqualTo("markdown");
-  }
-
-  @Test
-  public void fail_if_severity_is_invalid() {
-    assertThatThrownBy(() -> rule.setSeverity("invalid"))
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_setting_markdown_if_html_is_set() {
-    rule.setHtmlDescription("html");
-
-    assertThatThrownBy(() -> rule.setMarkdownDescription("markdown"))
-      .isInstanceOf(IllegalStateException.class);
-  }
-
-  @Test
-  public void fail_if_set_status_to_removed() {
-    assertThatThrownBy(() -> rule.setStatus(RuleStatus.REMOVED))
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_null_owasp_version() {
-    assertThatThrownBy(() -> rule.addOwaspTop10((OwaspTop10Version) null, OwaspTop10.A1))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Owasp version must not be null");
-  }
-
-  @Test
-  public void fail_if_null_pci_dss_version() {
-    assertThatThrownBy(() -> rule.addPciDss(null, "6.5.1"))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("PCI DSS version must not be null");
-  }
-
-  @Test
-  public void fail_if_null_pci_dss_array() {
-    assertThatThrownBy(() -> rule.addPciDss(PciDssVersion.V3_2, null))
-      .isInstanceOf(NullPointerException.class)
-      .hasMessage("Requirements for PCI DSS standard must not be null");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java
deleted file mode 100644 (file)
index 522ac87..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import org.junit.Test;
-import org.sonar.api.impl.server.RulesDefinitionContext;
-import org.sonar.api.server.rule.RulesDefinition;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class DefaultRepositoryTest {
-  @Test
-  public void create_simple_repo() {
-    RulesDefinitionContext ctx = mock(RulesDefinitionContext.class);
-    DefaultNewRepository newRepo = new DefaultNewRepository(ctx, "key", "lang", false);
-    newRepo.createRule("rule1")
-      .setName("rule1")
-      .setHtmlDescription("desc");
-    newRepo.setName("name");
-    DefaultRepository repo = new DefaultRepository(newRepo, null);
-
-    assertThat(repo.isExternal()).isFalse();
-    assertThat(repo.key()).isEqualTo("key");
-    assertThat(repo.language()).isEqualTo("lang");
-    assertThat(repo.isExternal()).isFalse();
-    assertThat(repo.name()).isEqualTo("name");
-    assertThat(repo.rules()).extracting(RulesDefinition.Rule::key).containsOnly("rule1");
-
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRuleTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRuleTest.java
deleted file mode 100644 (file)
index 0116c3e..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.rule.internal;
-
-import org.junit.Test;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.rule.RuleScope;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.rules.RuleType;
-import org.sonar.api.server.debt.DebtRemediationFunction;
-import org.sonar.api.server.rule.RulesDefinition;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class DefaultRuleTest {
-  @Test
-  public void getters() {
-    DefaultRepository repo = mock(DefaultRepository.class);
-    DefaultNewRule rule = new DefaultNewRule("plugin", "repo", "key");
-
-    rule.setScope(RuleScope.MAIN);
-    rule.setName("   name  ");
-    rule.setHtmlDescription("   html  ");
-    rule.setTemplate(true);
-    rule.setActivatedByDefault(true);
-    RulesDefinition.NewParam param1 = rule.createParam("param1");
-    rule.setTags("tag1", "tag2");
-    rule.addTags("tag3");
-    rule.setGapDescription("gap");
-    rule.setInternalKey("internal");
-    rule.addDeprecatedRuleKey("deprecatedrepo", "deprecatedkey");
-    rule.setStatus(RuleStatus.READY);
-    rule.addCwe(12);
-    rule.addCwe(10);
-    rule.setType(RuleType.SECURITY_HOTSPOT);
-    DebtRemediationFunction f = mock(DebtRemediationFunction.class);
-    rule.setDebtRemediationFunction(f);
-    rule.setSeverity("MAJOR");
-
-    DefaultRule defaultRule = new DefaultRule(repo, rule);
-    assertThat(defaultRule.scope()).isEqualTo(RuleScope.MAIN);
-    assertThat(defaultRule.name()).isEqualTo("name");
-    assertThat(defaultRule.htmlDescription()).isEqualTo("html");
-    assertThat(defaultRule.template()).isTrue();
-    assertThat(defaultRule.activatedByDefault()).isTrue();
-    assertThat(defaultRule.params()).containsOnly(new DefaultParam(new DefaultNewParam("param1")));
-    assertThat(defaultRule.tags()).containsOnly("tag1", "tag2", "tag3");
-    assertThat(defaultRule.gapDescription()).isEqualTo("gap");
-    assertThat(defaultRule.internalKey()).isEqualTo("internal");
-    assertThat(defaultRule.deprecatedRuleKeys()).containsOnly(RuleKey.of("deprecatedrepo", "deprecatedkey"));
-    assertThat(defaultRule.status()).isEqualTo(RuleStatus.READY);
-    assertThat(rule.securityStandards()).containsOnly("cwe:10", "cwe:12");
-    assertThat(defaultRule.type()).isEqualTo(RuleType.SECURITY_HOTSPOT);
-    assertThat(defaultRule.debtRemediationFunction()).isEqualTo(f);
-    assertThat(defaultRule.markdownDescription()).isNull();
-    assertThat(defaultRule.severity()).isEqualTo("MAJOR");
-  }
-
-  @Test
-  public void to_string() {
-    DefaultRepository repo = mock(DefaultRepository.class);
-    DefaultNewRule rule = new DefaultNewRule("plugin", "repo", "key");
-    DefaultRule defaultRule = new DefaultRule(repo, rule);
-
-    assertThat(defaultRule).hasToString("[repository=repo, key=key]");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/RequestTest.java
deleted file mode 100644 (file)
index 4c491d0..0000000
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ListMultimap;
-import com.tngtech.java.junit.dataprovider.DataProvider;
-import com.tngtech.java.junit.dataprovider.DataProviderRunner;
-import com.tngtech.java.junit.dataprovider.UseDataProvider;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import javax.annotation.Nullable;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.sonar.api.impl.ws.PartImpl;
-import org.sonar.api.impl.ws.ValidatingRequest;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.utils.DateUtils;
-
-import static com.google.common.base.Strings.repeat;
-import static com.google.common.collect.Lists.newArrayList;
-import static java.lang.String.format;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.assertj.core.api.Assertions.fail;
-import static org.mockito.Mockito.mock;
-import static org.sonar.api.utils.DateUtils.parseDate;
-import static org.sonar.api.utils.DateUtils.parseDateTime;
-
-@RunWith(DataProviderRunner.class)
-public class RequestTest {
-
-  private FakeRequest underTest = new FakeRequest();
-
-  @Before
-  public void before() {
-    WebService.Context context = new WebService.Context();
-    new FakeWs().define(context);
-
-    underTest.setAction(context.controller("my_controller").action("my_action"));
-  }
-
-  @Test
-  public void has_param() {
-    underTest.setParam("a_required_string", "foo");
-
-    assertThat(underTest.hasParam("a_required_string")).isTrue();
-    assertThat(underTest.hasParam("unknown")).isFalse();
-  }
-
-  @Test
-  public void required_param_is_missing() {
-    assertThatThrownBy(() -> underTest.mandatoryParam("required_param"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'required_param' parameter is missing");
-  }
-
-  @Test
-  public void required_param() {
-    underTest.setParam("a_required_string", "foo");
-    underTest.setParam("a_required_number", "42");
-    underTest.setParam("a_required_boolean", "true");
-    underTest.setParam("a_required_enum", "BETA");
-
-    assertThat(underTest.mandatoryParam("a_required_string")).isEqualTo("foo");
-    assertThat(underTest.mandatoryParamAsBoolean("a_required_boolean")).isTrue();
-    assertThat(underTest.mandatoryParamAsInt("a_required_number")).isEqualTo(42);
-    assertThat(underTest.mandatoryParamAsLong("a_required_number")).isEqualTo(42L);
-    assertThat(underTest.mandatoryParamAsEnum("a_required_enum", RuleStatus.class)).isEqualTo(RuleStatus.BETA);
-  }
-
-  @Test
-  public void maximum_length_ok() {
-    String parameter = "maximum_length_param";
-    defineParameterTestAction(newParam -> newParam.setMaximumLength(10), parameter);
-    String value = repeat("X", 10);
-
-    String param = underTest.setParam(parameter, value).param(parameter);
-
-    assertThat(param).isEqualTo(value);
-  }
-
-  @Test
-  public void maximum_length_not_ok() {
-    String parameter = "maximum_length_param";
-    defineParameterTestAction(newParam -> newParam.setMaximumLength(10), parameter);
-
-    assertThatThrownBy(() -> underTest.setParam(parameter, repeat("X", 11)).param(parameter))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage(format("'%s' length (11) is longer than the maximum authorized (10)", parameter));
-  }
-
-  @Test
-  public void maximum_value_ok() {
-    String param = "maximum_value_param";
-    defineParameterTestAction(newParam -> newParam.setMaximumValue(10), param);
-    String expected = "10";
-
-    String actual = underTest.setParam(param, expected).param(param);
-
-    assertThat(actual).isEqualTo(expected);
-  }
-
-  @Test
-  public void maximum_value_not_ok() {
-    String param = "maximum_value_param";
-    defineParameterTestAction(newParam -> newParam.setMaximumValue(10), param);
-
-    assertThatThrownBy(() -> underTest.setParam(param, "11").param(param))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage(format("'%s' value (11) must be less than 10", param));
-  }
-
-  @Test
-  public void paramAsInt_throws_IAE_if_maximum_defined_and_value_not_a_number() {
-    String param = "maximum_value_param";
-    defineParameterTestAction(newParam -> newParam.setMaximumValue(10), param);
-
-    assertThatThrownBy(() -> underTest.setParam(param, "foo").paramAsInt(param))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("'maximum_value_param' value 'foo' cannot be parsed as an integer");
-  }
-
-  @Test
-  public void required_param_as_strings() {
-    underTest.setParam("a_required_string", "foo,bar");
-
-    assertThat(underTest.mandatoryParamAsStrings("a_required_string")).containsExactly("foo", "bar");
-  }
-
-  @Test
-  public void fail_if_no_required_param_as_strings() {
-    assertThatThrownBy(() -> underTest.mandatoryParamAsStrings("a_required_string"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'a_required_string' parameter is missing");
-  }
-
-  @Test
-  public void multi_param() {
-    assertThat(underTest.multiParam("a_required_multi_param")).isEmpty();
-
-    underTest.setMultiParam("a_required_multi_param", newArrayList("firstValue", "secondValue", "thirdValue"));
-    assertThat(underTest.multiParam("a_required_multi_param")).containsExactly("firstValue", "secondValue", "thirdValue");
-  }
-
-  @Test
-  public void fail_when_multi_param_has_more_values_than_maximum_values() {
-    underTest.setMultiParam("has_maximum_values", newArrayList("firstValue", "secondValue", "thirdValue"));
-
-    assertThatThrownBy(() -> underTest.multiParam("has_maximum_values"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("'has_maximum_values' can contains only 2 values, got 3");
-  }
-
-  @Test
-  public void mandatory_multi_param() {
-    underTest.setMultiParam("a_required_multi_param", newArrayList("firstValue", "secondValue", "thirdValue"));
-
-    List<String> result = underTest.mandatoryMultiParam("a_required_multi_param");
-
-    assertThat(result).containsExactly("firstValue", "secondValue", "thirdValue");
-  }
-
-  @Test
-  public void fail_when_no_multi_param() {
-    assertThatThrownBy(() -> underTest.mandatoryMultiParam("a_required_multi_param"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'a_required_multi_param' parameter is missing");
-  }
-
-  @Test
-  public void default_value_of_optional_param() {
-    assertThat(underTest.param("has_default_string")).isEqualTo("the_default_string");
-  }
-
-  @Test
-  public void param_as_string() {
-    assertThat(underTest.setParam("a_string", "foo").param("a_string")).isEqualTo("foo");
-    assertThat(underTest.setParam("a_string", " f o o \r\n ").param("a_string")).isEqualTo("f o o");
-  }
-
-  @Test
-  public void param_contains_NUL_char_should_throw_exception() {
-    underTest.setParam("a_string", "value\0value");
-
-    assertThatThrownBy(() -> underTest.param("a_string"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Request parameters are not allowed to contain NUL character");
-  }
-
-  @Test
-  public void null_param() {
-    assertThat(underTest.param("a_string")).isNull();
-    assertThat(underTest.paramAsBoolean("a_boolean")).isNull();
-    assertThat(underTest.paramAsInt("a_number")).isNull();
-    assertThat(underTest.paramAsLong("a_number")).isNull();
-  }
-
-  @Test
-  public void paramAsInt() {
-    assertThat(underTest.setParam("a_number", "123").paramAsInt("a_number")).isEqualTo(123);
-  }
-
-  @Test
-  public void fail_when_param_is_not_an_int() {
-    assertThatThrownBy(() -> underTest.setParam("a_number", "not-an-int").paramAsInt("a_number"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'a_number' parameter cannot be parsed as an integer value: not-an-int");
-  }
-
-  @Test
-  public void param_as_long() {
-    assertThat(underTest.setParam("a_number", "123").paramAsLong("a_number")).isEqualTo(123L);
-  }
-
-  @Test
-  public void fail_when_param_is_not_a_long() {
-    assertThatThrownBy(() -> underTest.setParam("a_number", "not_a_long").paramAsLong("a_number"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'a_number' parameter cannot be parsed as a long value: not_a_long");
-  }
-
-  @Test
-  public void param_as_boolean() {
-    assertThat(underTest.setParam("a_boolean", "true").paramAsBoolean("a_boolean")).isTrue();
-    assertThat(underTest.setParam("a_boolean", "yes").paramAsBoolean("a_boolean")).isTrue();
-    assertThat(underTest.setParam("a_boolean", "false").paramAsBoolean("a_boolean")).isFalse();
-    assertThat(underTest.setParam("a_boolean", "no").paramAsBoolean("a_boolean")).isFalse();
-  }
-
-  @Test
-  public void fail_if_incorrect_param_as_boolean() {
-    assertThatThrownBy(() -> underTest.setParam("a_boolean", "oui").paramAsBoolean("a_boolean"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Property a_boolean is not a boolean value: oui");
-  }
-
-  @Test
-  public void param_as_enum() {
-    assertThat(underTest.setParam("a_enum", "BETA").paramAsEnum("a_enum", RuleStatus.class)).isEqualTo(RuleStatus.BETA);
-  }
-
-  @Test
-  public void param_as_enums() {
-    assertThat(underTest.setParam("a_enum", "BETA,READY").paramAsEnums("a_enum", RuleStatus.class)).containsOnly(RuleStatus.BETA, RuleStatus.READY);
-    assertThat(underTest.setParam("a_enum", "").paramAsEnums("a_enum", RuleStatus.class)).isEmpty();
-  }
-
-  @Test
-  public void param_as_enums_returns_null_when_no_value() {
-    assertThat(underTest.paramAsEnums("a_enum", RuleStatus.class)).isNull();
-  }
-
-  @Test
-  public void fail_when_param_as_enums_has_more_values_than_maximum_values() {
-    assertThatThrownBy(() -> underTest.setParam("has_maximum_values", "BETA,READY,REMOVED").paramAsEnums("has_maximum_values", RuleStatus.class))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("'has_maximum_values' can contains only 2 values, got 3");
-  }
-
-  @Test
-  public void param_as_date() {
-    assertThat(underTest.setParam("a_date", "2014-05-27").paramAsDate("a_date")).isEqualTo(DateUtils.parseDate("2014-05-27"));
-  }
-
-  @Test
-  public void getParam_of_missing_string_parameter() {
-    Request.StringParam stringParam = underTest.getParam("a_string");
-
-    assertThat(stringParam.isPresent()).isFalse();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEqualTo("foo");
-    expectGetValueFailureWithISE(stringParam::getValue);
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isFalse();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isEqualTo("bar");
-    expectGetValueFailureWithISE(emptyAsNull::getValue);
-  }
-
-  @Test
-  public void getParam_of_existing_string_parameter_with_non_empty_value() {
-    underTest.setParam("a_string", "sorry");
-
-    Request.StringParam stringParam = underTest.getParam("a_string");
-
-    assertThat(stringParam.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEqualTo("sorry");
-    assertThat(stringParam.getValue()).isEqualTo("sorry");
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isEqualTo("sorry");
-    assertThat(emptyAsNull.getValue()).isEqualTo("sorry");
-  }
-
-  @Test
-  public void getParam_of_existing_string_parameter_with_empty_value() {
-    underTest.setParam("a_string", "");
-
-    Request.StringParam stringParam = underTest.getParam("a_string");
-
-    assertThat(stringParam.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEmpty();
-    assertThat(stringParam.getValue()).isEmpty();
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isNotSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isNull();
-    assertThat(emptyAsNull.getValue()).isNull();
-  }
-
-  @Test
-  public void getParam_with_validation_of_missing_string_parameter() {
-    Request.StringParam stringParam = underTest.getParam("a_string", (str) -> {
-      throw new IllegalStateException("validator should not be called");
-    });
-
-    assertThat(stringParam.isPresent()).isFalse();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEqualTo("foo");
-    expectGetValueFailureWithISE(stringParam::getValue);
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isFalse();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isEqualTo("bar");
-    expectGetValueFailureWithISE(emptyAsNull::getValue);
-  }
-
-  @Test
-  public void getParam_with_validation_of_existing_string_parameter_with_non_empty_value() {
-    underTest.setParam("a_string", "sorry");
-    AtomicInteger calls = new AtomicInteger();
-
-    Request.StringParam stringParam = underTest.getParam("a_string", (str) -> calls.incrementAndGet());
-
-    assertThat(calls.get()).isOne();
-    assertThat(stringParam.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEqualTo("sorry");
-    assertThat(stringParam.getValue()).isEqualTo("sorry");
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isEqualTo("sorry");
-    assertThat(emptyAsNull.getValue()).isEqualTo("sorry");
-  }
-
-  @Test
-  public void getParam_with_validation_of_existing_string_parameter_with_empty_value() {
-    underTest.setParam("a_string", "");
-    AtomicInteger calls = new AtomicInteger();
-
-    Request.StringParam stringParam = underTest.getParam("a_string", (str) -> calls.incrementAndGet());
-
-    assertThat(calls.get()).isOne();
-    assertThat(stringParam.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> stringParam.or(null));
-    assertThat(stringParam.or(() -> "foo")).isEmpty();
-    assertThat(stringParam.getValue()).isEmpty();
-
-    Request.StringParam emptyAsNull = stringParam.emptyAsNull();
-    assertThat(emptyAsNull).isNotSameAs(stringParam);
-    assertThat(emptyAsNull.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> emptyAsNull.or(null));
-    assertThat(emptyAsNull.or(() -> "bar")).isNull();
-    assertThat(emptyAsNull.getValue()).isNull();
-  }
-
-  @Test
-  public void getParam_with_validation_of_existing_string_parameter_does_not_catch_unchecked_exception_throws_by_validator() {
-    underTest.setParam("a_string", "boo");
-    IllegalArgumentException expected = new IllegalArgumentException("Faking validation of parameter value failed");
-
-    try {
-      underTest.getParam("a_string", (str) -> {
-        throw expected;
-      });
-      fail("an IllegalStateException should have been raised");
-    } catch (IllegalArgumentException e) {
-      assertThat(e).isSameAs(expected);
-    }
-  }
-
-  @Test
-  public void getParam_of_missing_parameter_of_unspecified_type() {
-    Request.Param<Object> param = underTest.getParam("a_string", (rqt, key) -> {
-      throw new IllegalStateException("retrieveAndValidate BiConsumer should not be called");
-    });
-
-    assertThat(param.isPresent()).isFalse();
-    expectSupplierCanNotBeNullNPE(() -> param.or(null));
-    assertThat(param.or(() -> "foo")).isEqualTo("foo");
-    expectGetValueFailureWithISE(param::getValue);
-  }
-
-  @Test
-  public void getParam_of_existing_parameter_of_unspecified_type_with_null_value() {
-    underTest.setParam("a_string", "value in fake request actually does not matter");
-
-    Request.Param<Object> param = underTest.getParam("a_string", (rqt, key) -> null);
-
-    assertThat(param.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> param.or(null));
-    assertThat(param.or(() -> "foo")).isNull();
-    assertThat(param.getValue()).isNull();
-  }
-
-  @Test
-  public void getParam_of_existing_parameter_of_unspecified_type_with_empty_string() {
-    underTest.setParam("a_string", "value in fake request actually does not matter");
-
-    Request.Param<Object> param = underTest.getParam("a_string", (rqt, key) -> "");
-
-    assertThat(param.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> param.or(null));
-    assertThat(param.or(() -> "foo")).isEqualTo("");
-    assertThat(param.getValue()).isEqualTo("");
-  }
-
-  @Test
-  public void getParam_of_existing_parameter_of_unspecified_type_with_object() {
-    underTest.setParam("a_string", "value in fake request actually does not matter");
-    Object value = new Object();
-    Request.Param<Object> param = underTest.getParam("a_string", (rqt, key) -> value);
-
-    assertThat(param.isPresent()).isTrue();
-    expectSupplierCanNotBeNullNPE(() -> param.or(null));
-    assertThat(param.or(() -> "foo")).isSameAs(value);
-    assertThat(param.getValue()).isSameAs(value);
-  }
-
-  @Test
-  public void getParam_of_existing_parameter_of_unspecified_type_does_not_catch_unchecked_exception_thrown_by_BiConsumer() {
-    underTest.setParam("a_string", "value in fake request actually does not matter");
-    RuntimeException expected = new RuntimeException("Faking BiConsumer throwing unchecked exception");
-
-    try {
-      underTest.getParam("a_string", (rqt, key) -> {
-        throw expected;
-      });
-      fail("an RuntimeException should have been raised");
-    } catch (RuntimeException e) {
-      assertThat(e).isSameAs(expected);
-    }
-  }
-
-  private void expectGetValueFailureWithISE(Runnable runnable) {
-    try {
-      runnable.run();
-      fail("An IllegalStateException should have been raised");
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Param has no value. Use isPresent() before calling getValue()");
-    }
-  }
-
-  private void expectSupplierCanNotBeNullNPE(Runnable runnable) {
-    try {
-      runnable.run();
-      fail("A NullPointerException should have been raised");
-    } catch (NullPointerException e) {
-      assertThat(e).hasMessage("default value supplier can't be null");
-    }
-  }
-
-  @DataProvider
-  public static Object[][] date_times() {
-    return new Object[][] {
-      {"2014-05-27", parseDate("2014-05-27")},
-      {"2014-05-27T15:50:45+0100", parseDateTime("2014-05-27T15:50:45+0100")},
-      {null, null}
-    };
-  }
-
-  @Test
-  @UseDataProvider("date_times")
-  public void param_as__date_time(String stringDate, Date expectedDate) {
-    assertThat(underTest.setParam("a_date", stringDate).paramAsDateTime("a_date")).isEqualTo(expectedDate);
-  }
-
-  @Test
-  public void fail_when_param_as_date_not_a_date() {
-    assertThatThrownBy(() -> underTest.setParam("a_date", "polop").paramAsDate("a_date"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The date 'polop' does not respect format 'yyyy-MM-dd'");
-  }
-
-  @Test
-  public void fail_when_param_as_datetime_not_a_datetime() {
-    assertThatThrownBy(() -> underTest.setParam("a_datetime", "polop").paramAsDateTime("a_datetime"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("'polop' cannot be parsed as either a date or date+time");
-  }
-
-  @Test
-  public void param_as_strings() {
-    assertThat(underTest.paramAsStrings("a_string")).isNull();
-    assertThat(underTest.setParam("a_string", "").paramAsStrings("a_string")).isEmpty();
-    assertThat(underTest.setParam("a_string", "bar").paramAsStrings("a_string")).containsExactly("bar");
-    assertThat(underTest.setParam("a_string", "bar,baz").paramAsStrings("a_string")).containsExactly("bar", "baz");
-    assertThat(underTest.setParam("a_string", "bar , baz").paramAsStrings("a_string")).containsExactly("bar", "baz");
-  }
-
-  @Test
-  public void fail_when_param_as_strings_has_more_values_than_maximum_values() {
-    assertThatThrownBy(() -> underTest.setParam("has_maximum_values", "foo,bar,baz").paramAsStrings("has_maximum_values"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("'has_maximum_values' can contains only 2 values, got 3");
-  }
-
-  @Test
-  public void deprecated_key() {
-    assertThat(underTest.setParam("deprecated_param", "bar").param("new_param")).isEqualTo("bar");
-  }
-
-  @Test
-  public void fail_if_param_is_not_defined() {
-    assertThatThrownBy(() -> underTest.param("unknown"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("BUG - parameter 'unknown' is undefined for action 'my_action'");
-  }
-
-  @Test
-  public void fail_if_multi_param_is_not_defined() {
-    assertThatThrownBy(() -> underTest.multiParam("unknown"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Parameter 'unknown' not found for action 'my_action'");
-  }
-
-  @Test
-  public void verify_possible_values() {
-    underTest.setParam("has_possible_values", "foo");
-    assertThat(underTest.param("has_possible_values")).isEqualTo("foo");
-  }
-
-  @Test
-  public void fail_if_not_a_possible_value() {
-    underTest.setParam("has_possible_values", "not_possible");
-
-    assertThatThrownBy(() -> underTest.param("has_possible_values"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Value of parameter 'has_possible_values' (not_possible) must be one of: [foo, bar]");
-  }
-
-  @Test
-  public void param_as_input_stream() throws Exception {
-    assertThat(underTest.paramAsInputStream("a_string")).isNull();
-    assertThat(IOUtils.toString(underTest.setParam("a_string", "").paramAsInputStream("a_string"))).isEmpty();
-    assertThat(IOUtils.toString(underTest.setParam("a_string", "foo").paramAsInputStream("a_string"))).isEqualTo("foo");
-  }
-
-  @Test
-  public void param_as_part() {
-    InputStream inputStream = mock(InputStream.class);
-    underTest.setPart("key", inputStream, "filename");
-
-    Request.Part part = underTest.paramAsPart("key");
-    assertThat(part.getInputStream()).isEqualTo(inputStream);
-    assertThat(part.getFileName()).isEqualTo("filename");
-
-    assertThat(underTest.paramAsPart("unknown")).isNull();
-  }
-
-  @Test
-  public void mandatory_param_as_part() {
-    assertThatThrownBy(() -> underTest.mandatoryParamAsPart("required_param"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("The 'required_param' parameter is missing");
-  }
-
-  private void defineParameterTestAction(Consumer<WebService.NewParam> newParam, String parameter) {
-    String controllerPath = "my_controller";
-    String actionPath = "my_action";
-    WebService.Context context = new WebService.Context();
-    WebService.NewController controller = context.createController(controllerPath);
-    WebService.NewAction action = controller
-      .createAction(actionPath)
-      .setHandler(mock(RequestHandler.class));
-    WebService.NewParam param = action.createParam(parameter);
-    newParam.accept(param);
-    controller.done();
-    underTest.setAction(context.controller(controllerPath).action(actionPath));
-  }
-
-  private static class FakeRequest extends ValidatingRequest {
-
-    private final ListMultimap<String, String> multiParams = ArrayListMultimap.create();
-    private final Map<String, String> params = new HashMap<>();
-    private final Map<String, Part> parts = new HashMap<>();
-    private final Map<String, String> headers = new HashMap<>();
-
-    @Override
-    public String method() {
-      return "GET";
-    }
-
-    @Override
-    public String getMediaType() {
-      return "application/json";
-    }
-
-    @Override
-    public boolean hasParam(String key) {
-      return params.containsKey(key);
-    }
-
-    @Override
-    public String getPath() {
-      return null;
-    }
-
-    public FakeRequest setParam(String key, @Nullable String value) {
-      if (value != null) {
-        params.put(key, value);
-      }
-      return this;
-    }
-
-    public FakeRequest setMultiParam(String key, List<String> values) {
-      multiParams.putAll(key, values);
-
-      return this;
-    }
-
-    @Override
-    protected String readParam(String key) {
-      return params.get(key);
-    }
-
-    @Override
-    public Map<String, String[]> getParams() {
-      ArrayListMultimap<String, String> result = ArrayListMultimap.create(multiParams);
-      params.forEach(result::put);
-      return result.asMap().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().toArray(new String[0])));
-    }
-
-    @Override
-    protected List<String> readMultiParam(String key) {
-      return multiParams.get(key);
-    }
-
-    @Override
-    protected InputStream readInputStreamParam(String key) {
-      String param = readParam(key);
-
-      return param == null ? null : IOUtils.toInputStream(param);
-    }
-
-    @Override
-    protected Part readPart(String key) {
-      return parts.get(key);
-    }
-
-    public FakeRequest setPart(String key, InputStream input, String fileName) {
-      parts.put(key, new PartImpl(input, fileName));
-      return this;
-    }
-
-    @Override
-    public Optional<String> header(String name) {
-      return Optional.ofNullable(headers.get(name));
-    }
-  }
-
-  private static class FakeWs implements WebService {
-
-    @Override
-    public void define(Context context) {
-      NewController controller = context.createController("my_controller");
-      NewAction action = controller.createAction("my_action")
-        .setDescription("Action Description")
-        .setPost(true)
-        .setSince("5.2")
-        .setHandler(mock(RequestHandler.class));
-      action
-        .createParam("required_param")
-        .setRequired(true);
-
-      action.createParam("a_string");
-      action.createParam("a_boolean");
-      action.createParam("a_number");
-      action.createParam("a_enum");
-      action.createParam("a_date");
-      action.createParam("a_datetime");
-
-      action.createParam("a_required_string").setRequired(true);
-      action.createParam("a_required_boolean").setRequired(true);
-      action.createParam("a_required_number").setRequired(true);
-      action.createParam("a_required_enum").setRequired(true);
-      action.createParam("a_required_multi_param").setRequired(true);
-
-      action.createParam("has_default_string").setDefaultValue("the_default_string");
-      action.createParam("has_default_number").setDefaultValue("10");
-      action.createParam("has_default_boolean").setDefaultValue("true");
-
-      action.createParam("has_possible_values").setPossibleValues("foo", "bar");
-
-      action.createParam("has_maximum_values").setMaxValuesAllowed(2);
-
-      action.createParam("new_param").setDeprecatedKey("deprecated_param", "6.3");
-      action.createParam("new_param_with_default_value").setDeprecatedKey("deprecated_new_param_with_default_value", "6.2").setDefaultValue("the_default_string");
-
-      controller.done();
-    }
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java
deleted file mode 100644 (file)
index 747514f..0000000
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.server.ws;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.rule.RuleStatus;
-import org.sonar.api.server.ws.WebService.NewAction;
-import org.sonar.api.server.ws.WebService.NewController;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.assertj.core.api.Assertions.tuple;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-public class WebServiceTest {
-
-  @Rule
-  public LogTester logTester = new LogTester();
-
-  private WebService.Context context = new WebService.Context();
-
-  @Test
-  public void no_web_services_by_default() {
-    assertThat(context.controllers()).isEmpty();
-    assertThat(context.controller("metric")).isNull();
-  }
-
-  @Test
-  public void define_web_service() {
-    MetricWs metricWs = new MetricWs();
-
-    metricWs.define(context);
-
-    WebService.Controller controller = context.controller("api/metric");
-    assertThat(controller).isNotNull();
-    assertThat(controller.path()).isEqualTo("api/metric");
-    assertThat(controller.description()).isEqualTo("Metrics");
-    assertThat(controller.since()).isEqualTo("3.2");
-    assertThat(controller.actions()).hasSize(2);
-    assertThat(controller.isInternal()).isFalse();
-    WebService.Action showAction = controller.action("show");
-    assertThat(showAction).isNotNull();
-    assertThat(showAction.key()).isEqualTo("show");
-    assertThat(showAction.description()).isEqualTo("Show metric");
-    assertThat(showAction.handler()).isNotNull();
-    assertThat(showAction.responseExample()).isNotNull();
-    assertThat(showAction.responseExampleFormat()).isNotEmpty();
-    assertThat(showAction.responseExampleAsString()).isNotEmpty();
-    assertThat(showAction.deprecatedSince()).isNull();
-    assertThat(showAction.changelog()).isEmpty();
-    // same as controller
-    assertThat(showAction.since()).isEqualTo("4.2");
-    assertThat(showAction.isPost()).isFalse();
-    assertThat(showAction.isInternal()).isFalse();
-    assertThat(showAction.path()).isEqualTo("api/metric/show");
-    WebService.Action createAction = controller.action("create");
-    assertThat(createAction).isNotNull();
-    assertThat(createAction.key()).isEqualTo("create");
-    assertThat(createAction.toString()).isEqualTo("api/metric/create");
-    assertThat(createAction.deprecatedSince()).isEqualTo("5.3");
-    // overrides controller version
-    assertThat(createAction.since()).isEqualTo("4.1");
-    assertThat(createAction.isPost()).isTrue();
-    assertThat(createAction.isInternal()).isTrue();
-    assertThat(createAction.changelog()).extracting(Change::getVersion, Change::getDescription).containsOnly(
-      tuple("6.4", "Last event"), tuple("6.0", "Old event"), tuple("4.5.6", "Very old event"));
-  }
-
-  @Test
-  public void add_changelog_if_called_twice() {
-    WebService webService = context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list")
-        .setDescription("desc")
-        .setChangelog(new Change("1.0", "change1"))
-        .setChangelog(new Change("2.0", "change2"));
-      newController.done();
-    };
-
-    webService.define(context);
-    assertThat(context.controller("api/rule").action("list").changelog())
-      .extracting(Change::getVersion, Change::getDescription)
-      .containsOnly(
-        tuple("1.0", "change1"),
-        tuple("2.0", "change2"));
-  }
-
-  @Test
-  public void fail_if_duplicated_ws_keys() {
-    MetricWs metricWs = new MetricWs();
-    metricWs.define(context);
-
-    assertThatThrownBy(() -> ((WebService) context -> {
-      NewController newController = context.createController("api/metric");
-      newDefaultAction(newController, "delete");
-      newController.done();
-    }).define(context))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("The web service 'api/metric' is defined multiple times");
-  }
-
-  @Test
-  public void fail_if_no_action_handler() {
-    assertThatThrownBy(() -> ((WebService) context -> {
-      NewController controller = context.createController("rule");
-      newDefaultAction(controller, "show")
-        .setHandler(null);
-      controller.done();
-    }).define(context))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("RequestHandler is not set on action rule/show");
-  }
-
-  @Test
-  public void fail_if_duplicated_action_keys() {
-    assertThatThrownBy(() -> ((WebService) context -> {
-      NewController newController = context.createController("rule");
-      newDefaultAction(newController, "create");
-      newDefaultAction(newController, "delete");
-      newDefaultAction(newController, "delete");
-      newController.done();
-    }).define(context))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("The action 'delete' is defined multiple times in the web service 'rule'");
-  }
-
-  @Test
-  public void fail_if_no_actions() {
-    assertThatThrownBy(() -> ((WebService) context -> context.createController("rule").done()).define(context))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("At least one action must be declared in the web service 'rule'");
-  }
-
-  @Test
-  public void fail_if_no_controller_path() {
-    assertThatThrownBy(() -> ((WebService) context -> context.createController(null).done()).define(context))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("WS controller path must not be empty");
-  }
-
-  @Test
-  public void controller_path_must_not_start_with_slash() {
-    assertThatThrownBy(() -> ((WebService) context -> context.createController("/hello").done()).define(context))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("WS controller path must not start or end with slash: /hello");
-  }
-
-  @Test
-  public void controller_path_must_not_end_with_slash() {
-    assertThatThrownBy(() -> ((WebService) context -> context.createController("hello/").done()).define(context))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("WS controller path must not start or end with slash: hello/");
-  }
-
-  @Test
-  public void handle_request() throws Exception {
-    MetricWs metricWs = new MetricWs();
-    metricWs.define(context);
-
-    assertThat(metricWs.showCalled).isFalse();
-    assertThat(metricWs.createCalled).isFalse();
-    context.controller("api/metric").action("show").handler().handle(mock(Request.class), mock(Response.class));
-    assertThat(metricWs.showCalled).isTrue();
-    assertThat(metricWs.createCalled).isFalse();
-    context.controller("api/metric").action("create").handler().handle(mock(Request.class), mock(Response.class));
-    assertThat(metricWs.createCalled).isTrue();
-  }
-
-  @Test
-  public void action_parameters() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      NewAction newAction = newDefaultAction(newController, "create");
-      newAction
-        .createParam("key")
-        .setDescription("Key of the new rule");
-      newAction
-        .createParam("severity")
-        .setDefaultValue("MAJOR")
-        .setSince("4.4")
-        .setDeprecatedSince("5.3")
-        .setDeprecatedKey("old-severity", "4.5")
-        .setPossibleValues("INFO", "MAJOR", "BLOCKER")
-        .setMaxValuesAllowed(10);
-      newAction.createParam("internal")
-        .setInternal(true);
-      newAction.addPagingParams(20);
-      newAction.addFieldsParam(Arrays.asList("name", "severity"));
-      newAction.addSortParams(Arrays.asList("name", "updatedAt", "severity"), "updatedAt", false);
-
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/rule").action("create");
-    assertThat(action.params()).hasSize(8);
-
-    WebService.Param keyParam = action.param("key");
-    assertThat(keyParam.key()).isEqualTo("key");
-    assertThat(keyParam.description()).isEqualTo("Key of the new rule");
-    assertThat(keyParam.isInternal()).isFalse();
-    assertThat(keyParam.toString()).isEqualTo("key");
-
-    WebService.Param severityParam = action.param("severity");
-    assertThat(severityParam.key()).isEqualTo("severity");
-    assertThat(severityParam.description()).isNull();
-    assertThat(severityParam.deprecatedSince()).isEqualTo("5.3");
-    assertThat(severityParam.since()).isEqualTo("4.4");
-    assertThat(severityParam.deprecatedKey()).isEqualTo("old-severity");
-    assertThat(severityParam.deprecatedKeySince()).isEqualTo("4.5");
-    assertThat(severityParam.defaultValue()).isEqualTo("MAJOR");
-    assertThat(severityParam.possibleValues()).containsOnly("INFO", "MAJOR", "BLOCKER");
-    assertThat(severityParam.maxValuesAllowed()).isEqualTo(10);
-
-    WebService.Param internalParam = action.param("internal");
-    assertThat(internalParam.isInternal()).isTrue();
-
-    // predefined fields
-    assertThat(action.param("p").defaultValue()).isEqualTo("1");
-    assertThat(action.param("p").description()).isNotEmpty();
-    assertThat(action.param("ps").defaultValue()).isEqualTo("20");
-    assertThat(action.param("ps").description()).isNotEmpty();
-    assertThat(action.param("f").possibleValues()).containsOnly("name", "severity");
-    assertThat(action.param("s").possibleValues()).containsOnly("name", "severity", "updatedAt");
-    assertThat(action.param("s").description()).isNotEmpty();
-    assertThat(action.param("asc").defaultValue()).isEqualTo("false");
-  }
-
-  @Test
-  public void param_metadata_as_objects() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("status")
-        .setDefaultValue(RuleStatus.BETA)
-        .setPossibleValues(RuleStatus.BETA, RuleStatus.READY)
-        .setExampleValue(RuleStatus.BETA);
-      create.createParam("max")
-        .setDefaultValue(11)
-        .setPossibleValues(11, 13, 17)
-        .setExampleValue(17);
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/rule").action("create");
-    assertThat(action.param("status").defaultValue()).isEqualTo("BETA");
-    assertThat(action.param("status").possibleValues()).containsOnly("BETA", "READY");
-    assertThat(action.param("status").exampleValue()).isEqualTo("BETA");
-    assertThat(action.param("max").defaultValue()).isEqualTo("11");
-    assertThat(action.param("max").possibleValues()).containsOnly("11", "13", "17");
-    assertThat(action.param("max").exampleValue()).isEqualTo("17");
-  }
-
-  @Test
-  public void param_null_metadata() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("status")
-        .setDefaultValue(null)
-        .setPossibleValues(Collections.emptyList())
-        .setExampleValue(null);
-      create.createParam("max")
-        .setPossibleValues((Object[]) null);
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/rule").action("create");
-    assertThat(action.param("status").defaultValue()).isNull();
-    assertThat(action.param("status").possibleValues()).isNull();
-    assertThat(action.param("status").exampleValue()).isNull();
-    assertThat(action.param("max").possibleValues()).isNull();
-  }
-
-  @Test
-  public void param_with_empty_possible_values() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("status")
-        .setPossibleValues(Collections.emptyList());
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/rule").action("create");
-    // no possible values -> return null but not empty
-    assertThat(action.param("status").possibleValues()).isNull();
-  }
-
-  @Test
-  public void param_with_maximum_length() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/custom_measures");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("string_value")
-        .setMaximumLength(24);
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/custom_measures").action("create");
-    assertThat(action.param("string_value").maximumLength()).isEqualTo(24);
-  }
-
-  @Test
-  public void param_with_minimum_length() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/custom_measures");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("string_value")
-        .setMinimumLength(3);
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/custom_measures").action("create");
-    assertThat(action.param("string_value").minimumLength()).isEqualTo(3);
-  }
-
-  @Test
-  public void param_with_maximum_value() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/custom_measures");
-      NewAction create = newDefaultAction(newController, "create");
-      create.createParam("numeric_value")
-        .setMaximumValue(10);
-      newController.done();
-    }).define(context);
-
-    WebService.Action action = context.controller("api/custom_measures").action("create");
-    assertThat(action.param("numeric_value").maximumValue()).isEqualTo(10);
-  }
-
-  @Test
-  public void fail_if_required_param_has_default_value() {
-    assertThatThrownBy(() -> ((WebService) context -> {
-      NewController controller = context.createController("api/rule");
-      NewAction action = newDefaultAction(controller, "create");
-      action.createParam("key").setRequired(true).setDefaultValue("abc");
-      controller.done();
-    }).define(context))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Default value must not be set on parameter 'api/rule/create?key' as it's marked as required");
-  }
-
-  @Test
-  public void fail_if_duplicated_action_parameters() {
-    assertThatThrownBy(() -> ((WebService) context -> {
-      NewController controller = context.createController("api/rule");
-      NewAction action = newDefaultAction(controller, "create");
-      action.createParam("key");
-      action.createParam("key");
-      controller.done();
-    }).define(context))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("The parameter 'key' is defined multiple times in the action 'create'");
-  }
-
-  @Test
-  public void ws_is_internal_if_all_actions_are_internal() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "create").setInternal(true);
-      newDefaultAction(newController, "update").setInternal(true);
-      newController.done();
-    }).define(context);
-
-    assertThat(context.controller("api/rule").isInternal()).isTrue();
-  }
-
-  @Test
-  public void response_example() {
-    MetricWs metricWs = new MetricWs();
-    metricWs.define(context);
-    WebService.Action action = context.controller("api/metric").action("create");
-
-    assertThat(action.responseExampleFormat()).isEqualTo("txt");
-    assertThat(action.responseExample()).isNotNull();
-    assertThat(StringUtils.trim(action.responseExampleAsString())).isEqualTo("example of WS response");
-  }
-
-  @Test
-  public void fail_to_open_response_example() {
-    WebService ws = context -> {
-      try {
-        NewController controller = context.createController("foo");
-        newDefaultAction(controller, "bar").setResponseExample(new URL("file:/does/not/exist"));
-        controller.done();
-      } catch (MalformedURLException e) {
-        e.printStackTrace();
-      }
-    };
-    ws.define(context);
-
-    WebService.Action action = context.controller("foo").action("bar");
-    try {
-      action.responseExampleAsString();
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Fail to load file:/does/not/exist");
-    }
-  }
-
-  @Test
-  public void post_action_without_response_example() {
-    WebService ws = context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list").setPost(true).setResponseExample(null);
-      newController.done();
-    };
-    ws.define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .doesNotContain("The response example is not set on action api/rule/list");
-  }
-
-  @Test
-  public void fail_if_get_and_no_response_example() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list").setResponseExample(null);
-      newController.done();
-    }).define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .contains("The response example is not set on action api/rule/list");
-  }
-
-  @Test
-  public void log_if_since_on_an_action_is_empty() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list")
-        .setSince("");
-      newController.done();
-    }).define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .contains("Since is not set on action api/rule/list");
-  }
-
-  @Test
-  public void log_if_since_on_an_action_is_null() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list")
-        .setSince(null);
-      newController.done();
-    }).define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .contains("Since is not set on action api/rule/list");
-  }
-
-  @Test
-  public void log_if_action_description_is_empty() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list")
-        .setDescription("");
-      newController.done();
-    }).define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .contains("Description is not set on action api/rule/list");
-  }
-
-  @Test
-  public void log_if_action_description_is_null() {
-    ((WebService) context -> {
-      NewController newController = context.createController("api/rule");
-      newDefaultAction(newController, "list")
-        .setDescription(null);
-      newController.done();
-    }).define(context);
-
-    assertThat(logTester.logs(LoggerLevel.WARN))
-      .contains("Description is not set on action api/rule/list");
-  }
-
-  static class MetricWs implements WebService {
-    boolean showCalled = false;
-    boolean createCalled = false;
-
-    @Override
-    public void define(Context context) {
-      NewController newController = context.createController("api/metric")
-        .setDescription("Metrics")
-        .setSince("3.2");
-
-      newController.createAction("show")
-        .setDescription("Show metric")
-        .setSince("4.2")
-        .setResponseExample(getClass().getResource("WebServiceTest/response-example.txt"))
-        .setHandler(this::show);
-
-      newController.createAction("create")
-        .setDescription("Create metric")
-        .setSince("4.1")
-        .setDeprecatedSince("5.3")
-        .setPost(true)
-        .setInternal(true)
-        .setResponseExample(getClass().getResource("WebServiceTest/response-example.txt"))
-        .setChangelog(
-          new Change("6.4", "Last event"),
-          new Change("6.0", "Old event"),
-          new Change("4.5.6", "Very old event"))
-        .setHandler(this::create);
-
-      newController.done();
-    }
-
-    void show(Request request, Response response) {
-      showCalled = true;
-    }
-
-    void create(Request request, Response response) {
-      createCalled = true;
-    }
-  }
-
-  private NewAction newDefaultAction(NewController controller, String actionKey) {
-    return controller.createAction(actionKey)
-      .setDescription("default description")
-      .setSince("5.3")
-      .setResponseExample(getClass().getResource("WebServiceTest/response-example.txt"))
-      .setHandler(mock(RequestHandler.class));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/task/TaskDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/task/TaskDefinitionTest.java
deleted file mode 100644 (file)
index b921e1a..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class TaskDefinitionTest {
-
-  @Test
-  public void should_build() {
-    TaskDefinition def = TaskDefinition.builder().key("foo").taskClass(FooTask.class).description("Foo").build();
-    assertThat(def.key()).isEqualTo("foo");
-    assertThat(def.description()).isEqualTo("Foo");
-    assertThat(def.taskClass()).isEqualTo(FooTask.class);
-    assertThat(def.toString()).isEqualTo("Task foo[class=org.sonar.api.task.TaskDefinitionTest$FooTask, desc=Foo]");
-  }
-
-  @Test
-  public void test_equals_and_hashcode() {
-    TaskDefinition def1 = TaskDefinition.builder().key("one").taskClass(FooTask.class).description("Foo").build();
-    TaskDefinition def1bis = TaskDefinition.builder().key("one").taskClass(FooTask.class).description("Foo").build();
-    TaskDefinition def2 = TaskDefinition.builder().key("two").taskClass(FooTask.class).description("Foo").build();
-
-    assertThat(def1)
-      .isEqualTo(def1)
-      .isEqualTo(def1bis);
-    assertThat(def2)
-      .isNotEqualTo(def1)
-      .isNotEqualTo("one")
-      .isNotNull();
-
-    assertThat(def1)
-      .hasSameHashCodeAs(def1)
-      .hasSameHashCodeAs(def1bis);
-  }
-
-  @Test
-  public void test_compare() {
-    TaskDefinition foo = TaskDefinition.builder().key("foo").taskClass(FooTask.class).description("Foo").build();
-    TaskDefinition bar = TaskDefinition.builder().key("bar").taskClass(FooTask.class).description("Bar").build();
-
-    assertThat(foo.compareTo(bar)).isGreaterThan(0);
-    assertThat(foo).isEqualByComparingTo(foo);
-    assertThat(bar.compareTo(foo)).isLessThan(0);
-  }
-
-  @Test
-  public void description_should_be_required() {
-    assertThatThrownBy(() -> TaskDefinition.builder().key("foo").taskClass(FooTask.class).build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Description must be set for task 'foo'");
-  }
-
-  @Test
-  public void key_should_be_required() {
-    assertThatThrownBy(() -> TaskDefinition.builder().description("Foo").taskClass(FooTask.class).build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Task key must be set");
-  }
-
-  @Test
-  public void key_should_not_contain_spaces() {
-    assertThatThrownBy(() -> TaskDefinition.builder().key("fo o").description("foo").taskClass(FooTask.class).build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Task key 'fo o' must match " + TaskDefinition.KEY_PATTERN);
-  }
-
-  @Test
-  public void class_should_be_required() {
-    assertThatThrownBy(() -> TaskDefinition.builder().key("foo").description("Foo").build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Class must be set for task 'foo'");
-  }
-
-  private static class FooTask implements Task {
-    public void execute() {
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java
deleted file mode 100644 (file)
index d6337de..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import com.google.common.base.Strings;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class UserGroupValidationTest {
-
-  @Test
-  public void fail_when_group_name_is_Anyone() {
-    assertThatThrownBy(() -> UserGroupValidation.validateGroupName("AnyOne"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Anyone group cannot be used");
-  }
-
-  @Test
-  public void fail_when_group_name_is_empty() {
-    assertThatThrownBy(() -> UserGroupValidation.validateGroupName(""))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-
-  @Test
-  public void fail_when_group_name_contains_only_blank() {
-    assertThatThrownBy(() -> UserGroupValidation.validateGroupName("     "))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-
-  @Test
-  public void fail_when_group_name_is_too_big() {
-    assertThatThrownBy(() -> UserGroupValidation.validateGroupName(Strings.repeat("name", 300)))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be longer than 255 characters");
-  }
-
-  @Test
-  public void fail_when_group_name_is_null() {
-    assertThatThrownBy(() -> UserGroupValidation.validateGroupName(null))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Group name cannot be empty");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java
deleted file mode 100644 (file)
index 9d8a0bb..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.user;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class UserQueryTest {
-  @Test
-  public void test_all_actives() {
-    assertThat(UserQuery.ALL_ACTIVES.includeDeactivated()).isFalse();
-    assertThat(UserQuery.ALL_ACTIVES.logins()).isNull();
-    assertThat(UserQuery.ALL_ACTIVES.searchText()).isNull();
-    assertThat(UserQuery.ALL_ACTIVES.searchTextSql).isNull();
-  }
-
-  @Test
-  public void test_all() {
-    UserQuery all = UserQuery.builder().includeDeactivated().build();
-    assertThat(all.includeDeactivated()).isTrue();
-    assertThat(all.logins()).isNull();
-  }
-
-  @Test
-  public void test_logins() {
-    UserQuery query = UserQuery.builder().logins("simon", "loic").build();
-    assertThat(query.includeDeactivated()).isFalse();
-    assertThat(query.logins()).containsOnly("simon", "loic");
-
-    query = UserQuery.builder().logins(Arrays.asList("simon", "loic")).build();
-    assertThat(query.logins()).containsOnly("simon", "loic");
-  }
-
-  @Test
-  public void should_limit_number_of_logins() {
-    List<String> logins = new ArrayList<>();
-    for (int i = 0; i < 1010; i++) {
-      logins.add(String.valueOf(i));
-    }
-    try {
-      UserQuery.builder().logins(logins).build();
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("Max number of logins is 1000. Got 1010");
-    }
-  }
-
-  @Test
-  public void searchText() {
-    UserQuery query = UserQuery.builder().searchText("sim").build();
-    assertThat(query.searchText()).isEqualTo("sim");
-    assertThat(query.searchTextSql).isEqualTo("%sim%");
-  }
-
-  @Test
-  public void searchText_escape_special_characters_in_like() {
-    UserQuery query = UserQuery.builder().searchText("%sim_").build();
-    assertThat(query.searchText()).isEqualTo("%sim_");
-    assertThat(query.searchTextSql).isEqualTo("%/%sim/_%");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/AnnotationUtilsTest.java
deleted file mode 100644 (file)
index f6d09eb..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class AnnotationUtilsTest {
-
-  @Test
-  public void getClassAnnotation() {
-    FakeAnnotation annotation = AnnotationUtils.getAnnotation(new SuperClass(), FakeAnnotation.class);
-    assertThat(annotation.value()).isEqualTo("foo");
-  }
-
-  @Test
-  public void searchClassAnnotationInSuperClass() {
-    FakeAnnotation annotation = AnnotationUtils.getAnnotation(new ChildClass(), FakeAnnotation.class);
-    assertThat(annotation.value()).isEqualTo("foo");
-  }
-
-  @Test
-  public void searchClassAnnotationInInterface() {
-    FakeAnnotation annotation = AnnotationUtils.getAnnotation(new ImplementedClass(), FakeAnnotation.class);
-    assertThat(annotation.value()).isEqualTo("foo");
-  }
-
-  @Test
-  public void noClassAnnotation() {
-    FakeAnnotation annotation = AnnotationUtils.getAnnotation("a string", FakeAnnotation.class);
-    assertThat(annotation).isNull();
-  }
-
-  @Test
-  public void shouldAcceptClasses() {
-    FakeAnnotation annotation = AnnotationUtils.getAnnotation(SuperClass.class, FakeAnnotation.class);
-    assertThat(annotation.value()).isEqualTo("foo");
-
-    annotation = AnnotationUtils.getAnnotation(ChildClass.class, FakeAnnotation.class);
-    assertThat(annotation.value()).isEqualTo("foo");
-  }
-
-}
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-    @interface FakeAnnotation {
-  String value();
-}
-
-@FakeAnnotation("foo")
-class SuperClass {
-}
-
-class ChildClass extends SuperClass {
-
-}
-
-@FakeAnnotation("foo")
-interface AnnotatedInterface {
-}
-
-abstract class AbstractClass implements AnnotatedInterface {
-  
-}
-class ImplementedClass extends AbstractClass {
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DateUtilsTest.java
deleted file mode 100644 (file)
index 60a9893..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import com.tngtech.java.junit.dataprovider.DataProvider;
-import com.tngtech.java.junit.dataprovider.DataProviderRunner;
-import com.tngtech.java.junit.dataprovider.UseDataProvider;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.util.Date;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.utils.DateUtils.parseDateOrDateTime;
-import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime;
-import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime;
-
-@RunWith(DataProviderRunner.class)
-public class DateUtilsTest {
-
-  @Test
-  public void parseDate_valid_format() {
-    Date date = DateUtils.parseDate("2010-05-18");
-    assertThat(date.getDate()).isEqualTo(18);
-  }
-
-  @Test
-  public void parseDate_not_valid_format() {
-    assertThatThrownBy(() -> DateUtils.parseDate("2010/05/18"))
-      .isInstanceOf(MessageException.class);
-  }
-
-  @Test
-  public void parseDate_not_lenient() {
-    assertThatThrownBy(() -> DateUtils.parseDate("2010-13-18"))
-      .isInstanceOf(MessageException.class);
-  }
-
-  @Test
-  public void parseDateQuietly() {
-    assertThat(DateUtils.parseDateQuietly("2010/05/18")).isNull();
-    Date date = DateUtils.parseDateQuietly("2010-05-18");
-    assertThat(date.getDate()).isEqualTo(18);
-  }
-
-  @Test
-  public void parseDate_fail_if_additional_characters() {
-    assertThatThrownBy(() -> DateUtils.parseDate("1986-12-04foo"))
-      .isInstanceOf(MessageException.class);
-  }
-
-  @Test
-  public void parseDateTime_valid_format() {
-    Date date = DateUtils.parseDateTime("2010-05-18T15:50:45+0100");
-    assertThat(date.getMinutes()).isEqualTo(50);
-  }
-
-  @Test
-  public void parseDateTime_not_valid_format() {
-    assertThatThrownBy(() -> DateUtils.parseDate("2010/05/18 10:55"))
-      .isInstanceOf(MessageException.class);
-  }
-
-  @Test
-  public void parseDateTime_fail_if_additional_characters() {
-    assertThatThrownBy(() -> DateUtils.parseDate("1986-12-04T01:02:03+0300foo"))
-      .isInstanceOf(MessageException.class);
-  }
-
-  @Test
-  public void parseDateTimeQuietly() {
-    assertThat(DateUtils.parseDateTimeQuietly("2010/05/18 10:55")).isNull();
-    Date date = DateUtils.parseDateTimeQuietly("2010-05-18T15:50:45+0100");
-    assertThat(date.getMinutes()).isEqualTo(50);
-  }
-
-  @Test
-  public void shouldFormatDate() {
-    assertThat(DateUtils.formatDate(new Date())).startsWith("20");
-    assertThat(DateUtils.formatDate(new Date())).hasSize(10);
-  }
-
-  @Test
-  public void shouldFormatDateTime() {
-    assertThat(DateUtils.formatDateTime(new Date())).startsWith("20");
-    assertThat(DateUtils.formatDateTime(new Date()).length()).isGreaterThan(20);
-  }
-
-  @Test
-  public void shouldFormatDateTime_with_long() {
-    assertThat(DateUtils.formatDateTime(System.currentTimeMillis())).startsWith("20");
-    assertThat(DateUtils.formatDateTime(System.currentTimeMillis()).length()).isGreaterThan(20);
-  }
-
-  @Test
-  public void format_date_time_null_safe() {
-    assertThat(DateUtils.formatDateTimeNullSafe(new Date())).startsWith("20");
-    assertThat(DateUtils.formatDateTimeNullSafe(new Date()).length()).isGreaterThan(20);
-    assertThat(DateUtils.formatDateTimeNullSafe(null)).isEmpty();
-  }
-
-  @Test
-  public void long_to_date() {
-    Date date = new Date();
-    assertThat(DateUtils.longToDate(date.getTime())).isEqualTo(date);
-    assertThat(DateUtils.longToDate(null)).isNull();
-  }
-
-  @Test
-  public void date_to_long() {
-    Date date = new Date();
-    assertThat(DateUtils.dateToLong(date)).isEqualTo(date.getTime());
-    assertThat(DateUtils.dateToLong(null)).isNull();
-  }
-
-  @DataProvider
-  public static Object[][] date_times() {
-    return new Object[][]{
-      {"2014-05-27", Date.from(LocalDate.parse("2014-05-27").atStartOfDay(ZoneId.systemDefault()).toInstant())},
-      {"2014-05-27T15:50:45+0100", Date.from(OffsetDateTime.parse("2014-05-27T15:50:45+01:00").toInstant())},
-      {null, null}
-    };
-  }
-
-  @Test
-  @UseDataProvider("date_times")
-  public void param_as__date_time(String stringDate, Date expectedDate) {
-    assertThat(parseDateOrDateTime(stringDate)).isEqualTo(expectedDate);
-    assertThat(parseStartingDateOrDateTime(stringDate)).isEqualTo(expectedDate);
-  }
-
-  @Test
-  public void param_as__date_time_provided_timezone() {
-    final ZoneId zoneId = ZoneId.of("Europe/Moscow");
-    assertThat(parseDateOrDateTime("2020-05-27", zoneId)).isEqualTo(Date.from(OffsetDateTime.parse("2020-05-27T00:00:00+03:00").toInstant()));
-    assertThat(parseStartingDateOrDateTime("2020-05-27", zoneId)).isEqualTo(Date.from(OffsetDateTime.parse("2020-05-27T00:00:00+03:00").toInstant()));
-  }
-
-  @Test
-  public void param_as_ending_date_time_default_timezone() {
-    assertThat(parseEndingDateOrDateTime("2014-05-27")).isEqualTo(Date.from(LocalDate.parse("2014-05-28").atStartOfDay(ZoneId.systemDefault()).toInstant()));
-    assertThat(parseEndingDateOrDateTime("2014-05-27T15:50:45+0100")).isEqualTo(Date.from(OffsetDateTime.parse("2014-05-27T15:50:45+01:00").toInstant()));
-    assertThat(parseEndingDateOrDateTime(null)).isNull();
-  }
-
-  @Test
-  public void param_as_ending_date_time_provided_timezone() {
-    final ZoneId zoneId = ZoneId.of("Europe/Moscow");
-    assertThat(parseEndingDateOrDateTime("2020-05-27", zoneId)).isEqualTo(Date.from(OffsetDateTime.parse("2020-05-28T00:00:00+03:00").toInstant()));
-    assertThat(parseEndingDateOrDateTime("2014-05-27T15:50:45+0100", zoneId)).isEqualTo(Date.from(OffsetDateTime.parse("2014-05-27T15:50:45+01:00").toInstant()));
-    assertThat(parseEndingDateOrDateTime(null, zoneId)).isNull();
-  }
-
-  @Test
-  public void fail_when_param_as_date_or_datetime_not_a_datetime() {
-    assertThatThrownBy(() -> parseDateOrDateTime("polop"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Date 'polop' cannot be parsed as either a date or date+time");
-  }
-
-  @Test
-  public void fail_when_param_as_starting_datetime_not_a_datetime() {
-    assertThatThrownBy(() -> parseStartingDateOrDateTime("polop"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Date 'polop' cannot be parsed as either a date or date+time");
-  }
-
-  @Test
-  public void fail_when_param_as_ending_datetime_not_a_datetime() {
-    assertThatThrownBy(() -> parseEndingDateOrDateTime("polop"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessageContaining("'polop' cannot be parsed as either a date or date+time");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationTest.java
deleted file mode 100644 (file)
index d0bf21f..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class DurationTest {
-
-  static final int HOURS_IN_DAY = 8;
-
-  static final Long ONE_MINUTE = 1L;
-  static final Long ONE_HOUR_IN_MINUTES = ONE_MINUTE * 60;
-  static final Long ONE_DAY_IN_MINUTES = ONE_HOUR_IN_MINUTES * HOURS_IN_DAY;
-
-  @Test
-  public void create_from_duration_in_minutes() {
-    Duration duration = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
-    assertThat(duration.toMinutes()).isEqualTo(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
-  }
-
-  @Test
-  public void encode() {
-    assertThat(Duration.create(2 * ONE_DAY_IN_MINUTES + 5 * ONE_HOUR_IN_MINUTES + 46 * ONE_MINUTE).encode(HOURS_IN_DAY)).isEqualTo("2d5h46min");
-    assertThat(Duration.create(ONE_DAY_IN_MINUTES).encode(HOURS_IN_DAY)).isEqualTo("1d");
-    assertThat(Duration.create(ONE_HOUR_IN_MINUTES).encode(HOURS_IN_DAY)).isEqualTo("1h");
-    assertThat(Duration.create(HOURS_IN_DAY * ONE_HOUR_IN_MINUTES).encode(HOURS_IN_DAY)).isEqualTo("1d");
-    assertThat(Duration.create(ONE_MINUTE).encode(HOURS_IN_DAY)).isEqualTo("1min");
-    assertThat(Duration.create(0).encode(HOURS_IN_DAY)).isEqualTo("0min");
-  }
-
-  @Test
-  public void decode() {
-    assertThat(Duration.decode("    15 d  23  h     42min  ", HOURS_IN_DAY)).isEqualTo(Duration.create(15 * ONE_DAY_IN_MINUTES + 23 * ONE_HOUR_IN_MINUTES + 42 * ONE_MINUTE));
-    assertThat(Duration.decode("15d23h42min", HOURS_IN_DAY)).isEqualTo(Duration.create(15 * ONE_DAY_IN_MINUTES + 23 * ONE_HOUR_IN_MINUTES + 42 * ONE_MINUTE));
-    assertThat(Duration.decode("23h", HOURS_IN_DAY)).isEqualTo(Duration.create(23 * ONE_HOUR_IN_MINUTES));
-    assertThat(Duration.decode("15d", HOURS_IN_DAY)).isEqualTo(Duration.create(15 * ONE_DAY_IN_MINUTES));
-    assertThat(Duration.decode("42min", HOURS_IN_DAY)).isEqualTo(Duration.create(42 * ONE_MINUTE));
-    assertThat(Duration.decode("0min", HOURS_IN_DAY)).isEqualTo(Duration.create(0));
-
-    assertThat(Duration.decode("25h61min", HOURS_IN_DAY)).isEqualTo(Duration.create(25 * ONE_HOUR_IN_MINUTES + 61));
-  }
-
-  @Test
-  public void fail_to_decode_if_unit_with_invalid_number() {
-    try {
-      Duration.decode("Xd", HOURS_IN_DAY);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Duration 'Xd' is invalid, it should use the following sample format : 2d 10h 15min");
-    }
-  }
-
-  @Test
-  public void fail_to_decode_if_no_valid_duration() {
-    try {
-      Duration.decode("foo", HOURS_IN_DAY);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Duration 'foo' is invalid, it should use the following sample format : 2d 10h 15min");
-    }
-  }
-
-  @Test
-  public void fail_to_decode_if_only_number() {
-    try {
-      Duration.decode("15", HOURS_IN_DAY);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Duration '15' is invalid, it should use the following sample format : 2d 10h 15min");
-    }
-  }
-
-  @Test
-  public void fail_to_decode_if_valid_unit_with_invalid_duration() {
-    try {
-      Duration.decode("15min foo", HOURS_IN_DAY);
-      fail();
-    } catch (Exception e) {
-      assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Duration '15min foo' is invalid, it should use the following sample format : 2d 10h 15min");
-    }
-  }
-
-  @Test
-  public void is_greater_than() {
-    assertThat(Duration.decode("1h", HOURS_IN_DAY).isGreaterThan(Duration.decode("1min", HOURS_IN_DAY))).isTrue();
-    assertThat(Duration.decode("1min", HOURS_IN_DAY).isGreaterThan(Duration.decode("1d", HOURS_IN_DAY))).isFalse();
-    assertThat(Duration.decode("1d", HOURS_IN_DAY).isGreaterThan(Duration.decode("1d", HOURS_IN_DAY))).isFalse();
-    assertThat(Duration.decode("1d", 10).isGreaterThan(Duration.decode("1d", 8))).isTrue();
-  }
-
-  @Test
-  public void add() {
-    assertThat(Duration.decode("1h", HOURS_IN_DAY).add(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("1h1min", HOURS_IN_DAY));
-  }
-
-  @Test
-  public void subtract() {
-    assertThat(Duration.decode("1h", HOURS_IN_DAY).subtract(Duration.decode("1min", HOURS_IN_DAY))).isEqualTo(Duration.decode("59min", HOURS_IN_DAY));
-  }
-
-  @Test
-  public void multiply() {
-    assertThat(Duration.decode("1h", HOURS_IN_DAY).multiply(2)).isEqualTo(Duration.decode("2h", HOURS_IN_DAY));
-  }
-
-  @Test
-  public void test_equals_and_hashcode() throws Exception {
-    Duration duration = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
-    Duration durationWithSameValue = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE);
-    Duration durationWithDifferentValue = Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES);
-
-    assertThat(duration)
-      .isEqualTo(duration)
-      .isEqualTo(durationWithSameValue)
-      .isNotEqualTo(durationWithDifferentValue)
-      .isNotNull()
-      .hasSameHashCodeAs(duration);
-    assertThat(durationWithSameValue).hasSameHashCodeAs(duration);
-    assertThat(durationWithDifferentValue.hashCode()).isNotEqualTo(duration.hashCode());
-  }
-
-  @Test
-  public void test_toString() throws Exception {
-    assertThat(Duration.create(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE).toString()).isNotNull();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/DurationsTest.java
deleted file mode 100644 (file)
index ef7de51..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DurationsTest {
-
-  private static final int HOURS_IN_DAY = 8;
-
-  private static final long ONE_MINUTE = 1L;
-  private static final long ONE_HOUR = ONE_MINUTE * 60;
-  private static final long ONE_DAY = HOURS_IN_DAY * ONE_HOUR;
-
-  private Durations underTest = new Durations();
-
-  @Test
-  public void create_from_minutes() {
-    assertThat(underTest.create(10L).toMinutes()).isEqualTo(10L);
-  }
-
-  @Test
-  public void decode() {
-    // 1 working day -> 8 hours
-    assertThat(underTest.decode("1d").toMinutes()).isEqualTo(8L * ONE_HOUR);
-    // 8 hours
-    assertThat(underTest.decode("8h").toMinutes()).isEqualTo(8L * ONE_HOUR);
-  }
-
-  @Test
-  public void format() {
-    assertThat(underTest.format(Duration.create(5 * ONE_DAY))).isEqualTo("5d");
-    assertThat(underTest.format(Duration.create(2 * ONE_HOUR))).isEqualTo("2h");
-    assertThat(underTest.format(Duration.create(ONE_MINUTE))).isEqualTo("1min");
-
-    assertThat(underTest.format(Duration.create(5 * ONE_DAY + 2 * ONE_HOUR))).isEqualTo("5d 2h");
-    assertThat(underTest.format(Duration.create(2 * ONE_HOUR + ONE_MINUTE))).isEqualTo("2h 1min");
-    assertThat(underTest.format(Duration.create(5 * ONE_DAY + 2 * ONE_HOUR + ONE_MINUTE))).isEqualTo("5d 2h");
-  }
-
-  @Test
-  public void not_display_following_element_when_bigger_than_ten() {
-    assertThat(underTest.format(Duration.create(15 * ONE_DAY + 7 * ONE_HOUR + ONE_MINUTE))).isEqualTo("15d");
-  }
-
-  @Test
-  public void display_zero_without_unit() {
-    assertThat(underTest.format(Duration.create(0))).isEqualTo("0");
-  }
-
-  @Test
-  public void display_negative_duration() {
-    assertThat(underTest.format(Duration.create(-5 * ONE_DAY))).isEqualTo("-5d");
-    assertThat(underTest.format(Duration.create(-2 * ONE_HOUR))).isEqualTo("-2h");
-    assertThat(underTest.format(Duration.create(-1 * ONE_MINUTE))).isEqualTo("-1min");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ExceptionCauseMatcher.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ExceptionCauseMatcher.java
deleted file mode 100644 (file)
index 90f2ee4..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.util.Objects;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-
-/**
- * Matchers designed to be used as an argument of {@link org.junit.rules.ExpectedException#expectCause(Matcher)} such as:
- *
- * <pre>
- * expectedException.expect(VisitException.class);
- * expectedException.expectCause(hasType(IllegalArgumentException.class).andMessage("file and otherFile Components can not be the same"));
- * </pre>
- *
- * Class strongly inspired from {@code CauseMatcher} class from {@code http://blog.codeleak.pl/2014/03/junit-expectedexception-rule-beyond.html}
- */
-@Immutable
-public class ExceptionCauseMatcher extends TypeSafeMatcher<Throwable> {
-  private static final String EXPECT_NO_MESSAGE_CONSTANT = "RQXG8QTUCXOT7HZ3APPKBKUE5";
-
-  private final Class<? extends Throwable> type;
-  @CheckForNull
-  private final String expectedMessage;
-
-  private ExceptionCauseMatcher(Class<? extends Throwable> type, @Nullable String expectedMessage) {
-    this.type = type;
-    this.expectedMessage = expectedMessage;
-  }
-
-  public static ExceptionCauseMatcher hasType(Class<? extends Throwable> type) {
-    return new ExceptionCauseMatcher(type, null);
-  }
-
-  public ExceptionCauseMatcher andMessage(String expectedMessage) {
-    return new ExceptionCauseMatcher(type, Objects.requireNonNull(expectedMessage));
-  }
-
-  public ExceptionCauseMatcher andNoMessage() {
-    return new ExceptionCauseMatcher(type, EXPECT_NO_MESSAGE_CONSTANT);
-  }
-
-  @Override
-  protected boolean matchesSafely(Throwable item) {
-    if (!type.isAssignableFrom(item.getClass())) {
-      return false;
-    }
-    if (expectedMessage == null) {
-      return true;
-    }
-    if (EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage)) {
-      return item.getMessage() == null;
-    }
-    return item.getMessage().contains(expectedMessage);
-  }
-
-  @Override
-  public void describeTo(Description description) {
-    description.appendText("of type ")
-      .appendValue(type);
-    if (EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage)) {
-      description.appendText(" and no message");
-    } else if (expectedMessage != null) {
-      description.appendText(" and message ")
-        .appendValue(expectedMessage);
-    }
-    description.appendText(" but");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java
deleted file mode 100644 (file)
index 1af2027..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.lang.reflect.Field;
-import java.util.List;
-import java.util.stream.Collectors;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class FieldUtils2Test {
-
-  @Test
-  public void shouldGetFieldsOfSingleClass() {
-    List<String> fields = fieldsName(FieldUtils2.getFields(FieldsWithDifferentModifiers.class, true));
-    assertThat(fields).contains("publicField");
-    assertThat(fields).contains("protectedField");
-    assertThat(fields).contains("packageField");
-    assertThat(fields).contains("privateField");
-    assertThat(fields).contains("publicStaticField");
-    assertThat(fields).contains("protectedStaticField");
-    assertThat(fields).contains("packageStaticField");
-    assertThat(fields).contains("privateStaticField");
-  }
-
-  @Test
-  public void shouldGetFieldsOfClassHierarchy() {
-    List<String> fields = fieldsName(FieldUtils2.getFields(Child.class, true));
-    assertThat(fields).contains("publicField");
-    assertThat(fields).contains("protectedField");
-    assertThat(fields).contains("packageField");
-    assertThat(fields).contains("privateField");
-    assertThat(fields).contains("publicStaticField");
-    assertThat(fields).contains("protectedStaticField");
-    assertThat(fields).contains("packageStaticField");
-    assertThat(fields).contains("privateStaticField");
-    assertThat(fields).contains("childPrivateField");
-  }
-
-  @Test
-  public void shouldGetOnlyAccessibleFields() {
-    List<String> fields = fieldsName(FieldUtils2.getFields(Child.class, false));
-
-    assertThat(fields).contains("publicField");
-    assertThat(fields).contains("publicStaticField");
-  }
-
-  @Test
-  public void shouldGetFieldsOfInterface() {
-    List<String> fields = fieldsName(FieldUtils2.getFields(InterfaceWithFields.class, true));
-
-    assertThat(fields).contains("INTERFACE_FIELD");
-  }
-
-  @Test
-  public void shouldGetFieldsOfInterfaceImplementation() {
-    List<String> fields = fieldsName(FieldUtils2.getFields(InterfaceImplementation.class, true));
-
-    assertThat(fields).contains("INTERFACE_FIELD");
-  }
-
-  private static List<String> fieldsName(List<Field> fields) {
-    return fields.stream().map(f -> f != null ? f.getName() : null).collect(Collectors.toList());
-  }
-
-  interface InterfaceWithFields {
-    String INTERFACE_FIELD = "foo";
-  }
-
-  static class InterfaceImplementation implements InterfaceWithFields {
-  }
-
-  static class FieldsWithDifferentModifiers {
-    public String publicField;
-    protected String protectedField;
-    String packageField;
-    private String privateField;
-
-    public static String publicStaticField;
-    protected static String protectedStaticField;
-    static String packageStaticField;
-    private static String privateStaticField;
-  }
-
-  static class Child extends FieldsWithDifferentModifiers {
-    private String childPrivateField;
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/KeyValueFormatTest.java
deleted file mode 100644 (file)
index 5f94023..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import com.google.common.collect.ImmutableMap;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.TreeMap;
-import org.junit.Test;
-import org.sonar.api.rules.RulePriority;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.entry;
-
-public class KeyValueFormatTest {
-
-  @Test
-  public void test_parser() {
-    KeyValueFormat.FieldParser reader = new KeyValueFormat.FieldParser("abc=def;ghi=jkl");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("def");
-    assertThat(reader.nextKey()).isEqualTo("ghi");
-    assertThat(reader.nextVal()).isEqualTo("jkl");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=1;ghi=2");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("1");
-    assertThat(reader.nextKey()).isEqualTo("ghi");
-    assertThat(reader.nextVal()).isEqualTo("2");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=;ghi=jkl");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEmpty();
-    assertThat(reader.nextKey()).isEqualTo("ghi");
-    assertThat(reader.nextVal()).isEqualTo("jkl");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=def");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("def");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=\"def\";ghi=\"jkl\"");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("def");
-    assertThat(reader.nextKey()).isEqualTo("ghi");
-    assertThat(reader.nextVal()).isEqualTo("jkl");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("\"abc\"=\"def\";\"ghi\"=\"jkl\"");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("def");
-    assertThat(reader.nextKey()).isEqualTo("ghi");
-    assertThat(reader.nextVal()).isEqualTo("jkl");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=\"def\\\"ghi\"");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("def\"ghi");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("");
-    assertThat(reader.nextKey()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=;def=");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEmpty();
-    assertThat(reader.nextKey()).isEqualTo("def");
-    assertThat(reader.nextVal()).isNull();
-
-    reader = new KeyValueFormat.FieldParser("abc=\"1=2;3\";def=\"4;5=6\"");
-    assertThat(reader.nextKey()).isEqualTo("abc");
-    assertThat(reader.nextVal()).isEqualTo("1=2;3");
-    assertThat(reader.nextKey()).isEqualTo("def");
-    assertThat(reader.nextVal()).isEqualTo("4;5=6");
-    assertThat(reader.nextKey()).isNull();
-  }
-
-  @Test
-  public void keep_order_of_linked_map() {
-    Map<String, String> map = new LinkedHashMap<>();
-    map.put("lucky", "luke");
-    map.put("aste", "rix");
-    String s = KeyValueFormat.format(map);
-    assertThat(s).isEqualTo("lucky=luke;aste=rix");
-  }
-
-  @Test
-  public void shouldFormatMapOfIntegerString() {
-    Map<Integer, String> map = new LinkedHashMap<>();
-    map.put(3, "three");
-    map.put(5, "five");
-    String s = KeyValueFormat.formatIntString(map);
-    assertThat(s).isEqualTo("3=three;5=five");
-  }
-
-  @Test
-  public void shouldFormatMapOfIntDouble() {
-    Map<Integer, Double> map = new LinkedHashMap<>();
-    map.put(13, 2.0);
-    map.put(5, 5.75);
-    String s = KeyValueFormat.formatIntDouble(map);
-    assertThat(s).isEqualTo("13=2.0;5=5.75");
-  }
-
-  @Test
-  public void shouldSetEmptyFieldWhenNullValue() {
-    Map<Integer, Double> map = new LinkedHashMap<>();
-    map.put(13, null);
-    map.put(5, 5.75);
-    String s = KeyValueFormat.formatIntDouble(map);
-    assertThat(s).isEqualTo("13=;5=5.75");
-  }
-
-  @Test
-  public void shouldFormatBlank() {
-    Map<Integer, String> map = new TreeMap<>();
-    String s = KeyValueFormat.formatIntString(map);
-    assertThat(s).isEmpty();
-  }
-
-  @Test
-  public void shouldFormatDate() throws ParseException {
-    Map<Integer, Date> map = new LinkedHashMap<>();
-    map.put(4, new SimpleDateFormat("yyyy-MM-dd").parse("2010-12-25"));
-    map.put(20, new SimpleDateFormat("yyyy-MM-dd").parse("2009-05-28"));
-    map.put(12, null);
-    String s = KeyValueFormat.formatIntDate(map);
-    assertThat(s).isEqualTo("4=2010-12-25;20=2009-05-28;12=");
-  }
-
-  @Test
-  public void shouldParseStrings() {
-    Map<String, String> map = KeyValueFormat.parse("one=un;two=deux");
-    assertThat(map.size()).isEqualTo(2);
-    assertThat(map)
-      .containsEntry("one", "un")
-      .containsEntry("two", "deux");
-    assertThat(map.keySet().iterator().next()).isEqualTo("one");// same order as in string
-  }
-
-  @Test
-  public void helper_parse_methods() {
-    assertThat(KeyValueFormat.parseIntDate("1=2014-01-15")).hasSize(1);
-    assertThat(KeyValueFormat.parseIntDateTime("1=2014-01-15T15:50:45+0100")).hasSize(1);
-    assertThat(KeyValueFormat.parseIntDouble("1=3.14")).hasSize(1);
-    assertThat(KeyValueFormat.parseIntInt("1=10")).containsOnly(entry(1, 10));
-    assertThat(KeyValueFormat.parseIntString("1=one")).containsOnly(entry(1, "one"));
-    assertThat(KeyValueFormat.parseIntString("1=\"escaped\"")).containsOnly(entry(1, "escaped"));
-    assertThat(KeyValueFormat.parseStringInt("one=1")).containsOnly(entry("one", 1));
-    assertThat(KeyValueFormat.parseStringDouble("pi=3.14")).containsOnly(entry("pi", 3.14));
-  }
-
-  @Test
-  public void helper_format_methods() {
-    assertThat(KeyValueFormat.formatIntDateTime(ImmutableMap.of(1, new Date()))).startsWith("1=");
-    assertThat(KeyValueFormat.formatIntDate(ImmutableMap.of(1, new Date()))).startsWith("1=");
-    assertThat(KeyValueFormat.formatIntDouble(ImmutableMap.of(1, 3.14))).startsWith("1=");
-    assertThat(KeyValueFormat.formatIntString(ImmutableMap.of(1, "one"))).isEqualTo("1=one");
-    assertThat(KeyValueFormat.formatStringInt(ImmutableMap.of("one", 1))).isEqualTo("one=1");
-  }
-
-  @Test
-  public void parse_blank() {
-    Map<String, String> map = KeyValueFormat.parse("");
-    assertThat(map).isEmpty();
-  }
-
-  @Test
-  public void parse_null() {
-    Map<String, String> map = KeyValueFormat.parse(null);
-    assertThat(map).isEmpty();
-  }
-
-  @Test
-  public void parse_empty_values() {
-    Map<Integer, Double> map = KeyValueFormat.parseIntDouble("4=4.2;2=;6=6.68");
-    assertThat(map.size()).isEqualTo(3);
-    assertThat(map.get(4)).isEqualTo(4.2);
-    // key is present but value is null
-    assertThat(map.containsKey(2)).isTrue();
-    assertThat(map.get(2)).isNull();
-    assertThat(map.get(6)).isEqualTo(6.68);
-  }
-
-  @Test
-  public void convert_deprecated_priority() {
-    assertThat(KeyValueFormat.newPriorityConverter().format(RulePriority.BLOCKER)).isEqualTo("BLOCKER");
-    assertThat(KeyValueFormat.newPriorityConverter().format(null)).isEmpty();
-
-    assertThat(KeyValueFormat.newPriorityConverter().parse("MAJOR")).isEqualTo(RulePriority.MAJOR);
-    assertThat(KeyValueFormat.newPriorityConverter().parse("")).isNull();
-  }
-
-  @Test
-  public void escape_strings() {
-    Map<String, String> input = new LinkedHashMap<>();
-    input.put("foo", "a=b=c");
-    input.put("bar", "a;b;c");
-    input.put("baz", "double\"quote");
-    String csv = KeyValueFormat.format(input);
-    assertThat(csv).isEqualTo("foo=\"a=b=c\";bar=\"a;b;c\";baz=double\"quote");
-
-    Map<String, String> output = KeyValueFormat.parse(csv);
-    assertThat(output)
-      .containsEntry("foo", "a=b=c")
-      .containsEntry("bar", "a;b;c")
-      .containsEntry("baz", "double\"quote");
-  }
-
-  @Test
-  public void not_instantiable() {
-    // only static methods. Bad pattern, should be improved.
-    TestUtils.hasOnlyPrivateConstructors(KeyValueFormat.class);
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/LocalizedMessagesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/LocalizedMessagesTest.java
deleted file mode 100644 (file)
index 18ff235..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Locale;
-import java.util.MissingResourceException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LocalizedMessagesTest {
-  private static final Locale DEFAULT_LOCALE = Locale.getDefault();
-
-  @BeforeClass
-  public static void beforeAll() {
-    Locale.setDefault(Locale.ENGLISH);
-  }
-
-  @AfterClass
-  public static void afterAll() {
-    Locale.setDefault(DEFAULT_LOCALE);
-  }
-
-  @Test
-  public void mergeBundles() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.ENGLISH, "Test", "PluginFoo");
-
-    assertThat(messages.getString("test.one")).isEqualTo("One");
-    assertThat(messages.getString("test.two")).isEqualTo("Two");
-    assertThat(messages.getString("foo.hello")).isEqualTo("Hello");
-  }
-
-  @Test
-  public void mergeBundlesByLocale() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.FRENCH, "Test", "PluginFoo");
-
-    assertThat(messages.getString("test.one")).isEqualTo("Un");
-    assertThat(messages.getString("test.two")).isEqualTo("Deux");
-    assertThat(messages.getString("foo.hello")).isEqualTo("Hello");// not in french, use the default locale
-  }
-
-  @Test
-  public void useDefaultWhenMissingLocale() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.JAPANESE, "Test", "PluginFoo");
-
-    assertThat(messages.getString("test.one")).isEqualTo("One");
-    assertThat(messages.getString("foo.hello")).isEqualTo("Hello");
-  }
-
-  @Test(expected = MissingResourceException.class)
-  public void failIfMissingKey() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.FRENCH, "Test", "PluginFoo");
-    messages.getString("unknown");
-  }
-
-  @Test
-  public void format() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.ENGLISH, "Test", "PluginFoo");
-    assertThat(messages.format("test.one")).isEqualTo("One");
-  }
-
-  @Test
-  public void formatNeverFails() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.ENGLISH, "Test", "PluginFoo");
-    assertThat(messages.format("unknown")).isEqualTo("unknown");
-  }
-
-  @Test
-  public void formatParameters() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.ENGLISH, "Test", "PluginFoo");
-    assertThat(messages.format("with.string.params", "inspection", "rock")).isEqualTo("Continuous inspection will rock !");
-    assertThat(messages.format("with.string.params", "rock", "inspection")).isEqualTo("Continuous rock will inspection !");
-  }
-
-  @Test
-  public void getKeys() {
-    LocalizedMessages messages = new LocalizedMessages(Locale.ENGLISH, "Test", "PluginFoo");
-    assertThat(toList(messages.getKeys())).contains("test.one", "test.two", "foo.hello");
-
-    LocalizedMessages spanishMessages = new LocalizedMessages(new Locale("es"), "Test", "PluginFoo");
-    assertThat(toList(spanishMessages.getKeys())).contains("test.one", "only.in.spanish");
-  }
-
-  private List<String> toList(Enumeration<String> enumeration) {
-    return Lists.newArrayList(Iterators.forEnumeration(enumeration));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ManifestUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ManifestUtilsTest.java
deleted file mode 100644 (file)
index 1c0f778..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.net.URLClassLoader;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ManifestUtilsTest {
-
-  @Rule
-  public TemporaryFolder tempDir = new TemporaryFolder();
-
-  @Test
-  public void emptyManifest() throws Exception {
-    Manifest mf = new Manifest();
-    File jar = createJar(mf, "emptyManifest.jar");
-
-    URLClassLoader classloader = new URLClassLoader(FileUtils.toURLs(jar));
-    assertThat(ManifestUtils.getPropertyValues(classloader, "foo")).isEmpty();
-  }
-
-  @Test
-  public void singleManifest() throws Exception {
-    Manifest mf = new Manifest();
-    mf.getMainAttributes().putValue("foo", "bar");
-    mf.getMainAttributes().putValue("other", "value");
-    File jar = createJar(mf, "singleManifest.jar");
-
-    URLClassLoader classloader = new URLClassLoader(FileUtils.toURLs(jar));
-    List<String> values = ManifestUtils.getPropertyValues(classloader, "foo");
-    assertThat(values).containsOnly("bar");
-  }
-
-  @Test
-  public void manyManifests() throws Exception {
-    Manifest mf1 = new Manifest();
-    mf1.getMainAttributes().putValue("foo", "bar");
-    File jar1 = createJar(mf1, "manyManifests-one.jar");
-
-    Manifest mf2 = new Manifest();
-    mf2.getMainAttributes().putValue("foo", "otherbar");
-    File jar2 = createJar(mf2, "manyManifests-two.jar");
-
-    URLClassLoader classloader = new URLClassLoader(FileUtils.toURLs(jar1, jar2));
-    List<String> values = ManifestUtils.getPropertyValues(classloader, "foo");
-    assertThat(values).containsOnly("bar", "otherbar");
-  }
-
-  private File createJar(Manifest mf, String name) throws Exception {
-    mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
-    File file = tempDir.newFile(name);
-    OutputStream out = new JarOutputStream(new FileOutputStream(file), mf);
-    out.flush();
-    IOUtils.closeQuietly(out);
-    return file;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/MessageExceptionTest.java
deleted file mode 100644 (file)
index eae9414..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class MessageExceptionTest {
-
-  @Test
-  public void should_create_exception() {
-    String message = "the message";
-    MessageException exception = MessageException.of(message);
-    assertThat(exception.getMessage()).isEqualTo(message);
-    assertThat(exception).isInstanceOf(RuntimeException.class);
-  }
-
-  @Test
-  public void should_create_exception_with_status_and_l10n_message_with_param(){
-    MessageException exception = MessageException.ofL10n("key", "value");
-    assertThat(exception.l10nKey()).isEqualTo("key");
-    assertThat(exception.l10nParams()).containsOnly("value");
-  }
-
-  @Test
-  public void should_create_exception_with_status_and_l10n_message_without_param(){
-    MessageException exception = MessageException.ofL10n("key", (Object[])null);
-    assertThat(exception.l10nKey()).isEqualTo("key");
-    assertThat(exception.l10nParams()).isEmpty();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PagingTest.java
deleted file mode 100644 (file)
index 20f9a6a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.utils.Paging.forPageIndex;
-
-public class PagingTest {
-
-  @Test
-  public void test_pagination() {
-    Paging paging = forPageIndex(1).withPageSize(5).andTotal(20);
-
-    assertThat(paging.pageSize()).isEqualTo(5);
-    assertThat(paging.pageIndex()).isOne();
-    assertThat(paging.total()).isEqualTo(20);
-
-    assertThat(paging.offset()).isZero();
-    assertThat(paging.pages()).isEqualTo(4);
-  }
-
-  @Test
-  public void test_offset() {
-    assertThat(forPageIndex(1).withPageSize(5).andTotal(20).offset()).isZero();
-    assertThat(forPageIndex(2).withPageSize(5).andTotal(20).offset()).isEqualTo(5);
-  }
-
-  @Test
-  public void test_number_of_pages() {
-    assertThat(forPageIndex(2).withPageSize(5).andTotal(20).pages()).isEqualTo(4);
-    assertThat(forPageIndex(2).withPageSize(5).andTotal(21).pages()).isEqualTo(5);
-    assertThat(forPageIndex(2).withPageSize(5).andTotal(25).pages()).isEqualTo(5);
-    assertThat(forPageIndex(2).withPageSize(5).andTotal(26).pages()).isEqualTo(6);
-  }
-
-  @Test
-  public void page_size_should_be_strictly_positive() {
-    assertThatThrownBy(() -> forPageIndex(5).withPageSize(0).andTotal(5))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Page size must be strictly positive. Got 0");
-  }
-
-  @Test
-  public void page_index_should_be_strictly_positive() {
-    assertThatThrownBy(() -> forPageIndex(0).withPageSize(5).andTotal(5))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Page index must be strictly positive. Got 0");
-  }
-
-  @Test
-  public void total_items_should_be_positive() {
-    assertThatThrownBy(() -> forPageIndex(5).withPageSize(5).andTotal(-1))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Total items must be positive. Got -1");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ParsingUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ParsingUtilsTest.java
deleted file mode 100644 (file)
index 565ddf6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.text.ParseException;
-import java.util.Locale;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ParsingUtilsTest {
-
-  @Test
-  public void scaleValue() {
-    assertThat(ParsingUtils.scaleValue(23.3333333)).isEqualTo(23.33);
-    assertThat(ParsingUtils.scaleValue(23.777777)).isEqualTo(23.78);
-
-    assertThat(ParsingUtils.scaleValue(23.3333333, 0)).isEqualTo(23.0);
-    assertThat(ParsingUtils.scaleValue(23.777777, 0)).isEqualTo(24.0);
-  }
-
-  @Test
-  public void parseString() throws ParseException {
-    assertThat(ParsingUtils.parseNumber("23.12", Locale.ENGLISH)).isEqualTo(23.12);
-    assertThat(ParsingUtils.parseNumber("12345.67", Locale.ENGLISH)).isEqualTo(12345.67);
-    assertThat(ParsingUtils.parseNumber("12345,67", Locale.FRENCH)).isEqualTo(12345.67);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/PathUtilsTest.java
deleted file mode 100644 (file)
index 92583ae..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.commons.io.FilenameUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * @since 4.0
- */
-public class PathUtilsTest {
-
-  @Rule
-  public TemporaryFolder temp = new TemporaryFolder();
-
-  @Test
-  public void sanitize_succeeds() {
-    assertThat(PathUtils.sanitize("foo/bar/..")).isEqualTo("foo/");
-    assertThat(PathUtils.sanitize("C:\\foo\\..\\bar")).isEqualTo("C:/bar");
-    assertThat(PathUtils.sanitize(null)).isNull();
-  }
-
-  @Test
-  public void sanitize_invalid_paths_returns_null() {
-    assertThat(PathUtils.sanitize("../foo")).isNull();
-  }
-
-  @Test
-  public void canonicalPath_succeeds() throws Exception {
-    File file = temp.newFile();
-    String path = PathUtils.canonicalPath(file);
-    assertThat(path).isEqualTo(FilenameUtils.separatorsToUnix(file.getCanonicalPath()));
-  }
-
-  @Test
-  public void canonicalPath_returns_null_if_null_input() {
-    assertThat(PathUtils.canonicalPath(null)).isNull();
-  }
-
-  @Test
-  public void canonicalPath_fails_to_get_canonical_path() throws Exception {
-    File file = mock(File.class);
-    when(file.getCanonicalPath()).thenThrow(new IOException());
-
-    try {
-      PathUtils.canonicalPath(file);
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getCause()).isInstanceOf(IOException.class);
-    }
-  }
-
-  @Test
-  public void only_statics() {
-    assertThat(TestUtils.hasOnlyPrivateConstructors(PathUtils.class)).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java
deleted file mode 100644 (file)
index 1292c7e..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TimeZone;
-import org.apache.commons.lang.SystemUtils;
-import org.junit.Test;
-
-import static java.util.UUID.randomUUID;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class System2Test {
-  @Test
-  public void testNow() {
-    long start = System.currentTimeMillis();
-    long now = System2.INSTANCE.now();
-    long end = System.currentTimeMillis();
-    assertThat(now).isGreaterThanOrEqualTo(start).isLessThanOrEqualTo(end);
-  }
-
-  @Test
-  public void testProperties() {
-    Properties expected = System.getProperties();
-    assertThat(System2.INSTANCE.properties()).isNotNull().isEqualTo(expected);
-  }
-
-  @Test
-  public void testProperty() {
-    String expected = System.getProperty("java.version");
-    assertThat(System2.INSTANCE.property("java.version")).isNotNull().isEqualTo(expected);
-  }
-
-  @Test
-  public void testSetProperty() {
-    String key = "System2Test.testSetProperty";
-    String value = randomUUID().toString();
-    System2.INSTANCE.setProperty(key, value);
-    assertThat(System2.INSTANCE.property(key)).isEqualTo(value);
-  }
-
-  @Test
-  public void testEnvVariables() {
-    Map<String, String> expected = System.getenv();
-    assertThat(System2.INSTANCE.envVariables()).isNotNull().isEqualTo(expected);
-  }
-
-  @Test
-  public void testEnvVariable() {
-    // assume that there's at least one env variable
-    if (System.getenv().isEmpty()) {
-      fail("Test can't succeed because there are no env variables. How is it possible ?");
-    }
-    String key = System.getenv().keySet().iterator().next();
-    String expected = System.getenv(key);
-    assertThat(System2.INSTANCE.envVariable(key)).isNotNull().isEqualTo(expected);
-    assertThat(System2.INSTANCE.envVariable("UNKNOWN_VAR")).isNull();
-  }
-
-  @Test
-  public void testIsOsWindows() {
-    assertThat(System2.INSTANCE.isOsWindows()).isEqualTo(SystemUtils.IS_OS_WINDOWS);
-  }
-
-  @Test
-  public void testIsOsMac() {
-    assertThat(System2.INSTANCE.isOsMac()).isEqualTo(SystemUtils.IS_OS_MAC);
-  }
-
-  @Test
-  public void testPrintln() {
-    // well, how to assert that ? Adding a System3 dependency to System2 ? :-)
-    System2.INSTANCE.println("foo");
-  }
-
-  @Test
-  public void testGetResource() {
-    String name = "META-INF/MANIFEST.MF";
-    assertThat(System2.INSTANCE.getResource(name)).isEqualTo(getClass().getResource(name));
-  }
-
-  @Test
-  public void close() {
-    class MyCloseable implements Closeable {
-      boolean isClosed = false;
-
-      @Override
-      public void close() {
-        isClosed = true;
-      }
-    }
-
-    MyCloseable closeable = new MyCloseable();
-    System2.INSTANCE.close(closeable);
-    assertThat(closeable.isClosed).isTrue();
-  }
-
-  @Test
-  public void close_throws_exception_on_error() {
-    Closeable closeable = () -> {
-      throw new IOException("expected");
-    };
-    try {
-      System2.INSTANCE.close(closeable);
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e.getCause().getMessage()).isEqualTo("expected");
-    }
-  }
-
-  @Test
-  public void getDefaultTimezone() {
-    assertThat(System2.INSTANCE.getDefaultTimeZone().getID()).isEqualTo(TimeZone.getDefault().getID());
-
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/TestUtils.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/TestUtils.java
deleted file mode 100644 (file)
index df2c7a9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Modifier;
-
-/**
- * Utilities for unit tests
- *
- * @since 2.2
- */
-public final class TestUtils {
-
-  private TestUtils() {
-  }
-
-  /**
-   * Asserts that all constructors are private, usually for helper classes with
-   * only static methods. If a constructor does not have any parameters, then
-   * it's instantiated.
-   */
-  public static boolean hasOnlyPrivateConstructors(Class clazz) {
-    boolean ok = true;
-    for (Constructor constructor : clazz.getDeclaredConstructors()) {
-      ok &= Modifier.isPrivate(constructor.getModifiers());
-      if (constructor.getParameterTypes().length == 0) {
-        constructor.setAccessible(true);
-        try {
-          constructor.newInstance();
-        } catch (Exception e) {
-          throw new IllegalStateException(String.format("Fail to instantiate %s", clazz), e);
-        }
-      }
-    }
-    return ok;
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/TimeUtilsTest.java
deleted file mode 100644 (file)
index 7c266b2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TimeUtilsTest {
-  @Test
-  public void formatDuration() {
-    assertThat(TimeUtils.formatDuration(0)).isEqualTo("0ms");
-    assertThat(TimeUtils.formatDuration(100)).isEqualTo("100ms");
-    assertThat(TimeUtils.formatDuration(1000)).isEqualTo("1s");
-    assertThat(TimeUtils.formatDuration(10000)).isEqualTo("10s");
-    assertThat(TimeUtils.formatDuration(100000)).isEqualTo("1min 40s");
-    assertThat(TimeUtils.formatDuration(600000)).isEqualTo("10min");
-    assertThat(TimeUtils.formatDuration(1000000)).isEqualTo("16min 40s");
-    assertThat(TimeUtils.formatDuration(10000000)).isEqualTo("166min 40s");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/UriReaderTest.java
deleted file mode 100644 (file)
index b60dbee..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class UriReaderTest {
-
-  private static URI testFile;
-
-  @Before
-  public void init() throws URISyntaxException {
-    testFile = UriReaderTest.class.getResource("/org/sonar/api/utils/UriReaderTest/foo.txt").toURI();
-  }
-
-  @Test
-  public void file_processor_is_always_available() {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-
-    assertThat(uriReader.searchForSupportedProcessor(testFile)).isNotNull();
-  }
-
-  @Test
-  public void file_readString() {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-    assertThat(uriReader.readString(testFile, StandardCharsets.UTF_8)).isEqualTo("in foo");
-  }
-
-  @Test
-  public void file_readBytes() {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-    assertThat(new String(uriReader.readBytes(testFile))).isEqualTo("in foo");
-  }
-
-  @Test
-  public void file_readString_fails_if_file_not_found() throws Exception {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-
-    assertThatThrownBy(() -> uriReader.readString(new URI("file:/notfound"), StandardCharsets.UTF_8))
-      .isInstanceOf(RuntimeException.class);
-  }
-
-  @Test
-  public void file_readBytes_fails_if_file_not_found() throws Exception {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-    assertThatThrownBy(() -> uriReader.readBytes(new URI("file:/notfound")))
-      .isInstanceOf(RuntimeException.class);
-  }
-
-  @Test
-  public void file_description() {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-
-    // the prefix file:/ is removed
-    assertThat(uriReader.description(testFile)).doesNotMatch("file:/.*");
-    assertThat(uriReader.description(testFile)).matches(".*foo\\.txt");
-  }
-
-  @Test
-  public void fail_if_unknown_scheme() {
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[0]);
-
-    assertThatThrownBy(() -> uriReader.readBytes(new URI("ftp://sonarsource.org")))
-      .isInstanceOf(RuntimeException.class);
-  }
-
-  @Test
-  public void register_processors() throws Exception {
-    UriReader.SchemeProcessor processor = mock(UriReader.SchemeProcessor.class);
-    when(processor.getSupportedSchemes()).thenReturn(new String[] {"ftp"});
-    UriReader uriReader = new UriReader(new UriReader.SchemeProcessor[] {processor});
-
-    assertThat(uriReader.searchForSupportedProcessor(new URI("ftp://sonarsource.org"))).isNotNull();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ValidationMessagesTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ValidationMessagesTest.java
deleted file mode 100644 (file)
index 31b6fdb..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-import org.sonar.api.utils.log.Logger;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.*;
-
-public class ValidationMessagesTest {
-
-  @Test
-  public void emptyMessages() {
-    ValidationMessages messages = ValidationMessages.create();
-    assertThat(messages.hasErrors()).isFalse();
-    assertThat(messages.hasWarnings()).isFalse();
-    assertThat(messages.hasInfos()).isFalse();
-
-    Logger logger = mock(Logger.class);
-    messages.log(logger);
-    verify(logger, never()).error(anyString());
-    verify(logger, never()).warn(anyString());
-    verify(logger, never()).info(anyString());
-
-    org.slf4j.Logger slf4j = mock(org.slf4j.Logger.class);
-    messages.log(slf4j);
-    verify(slf4j, never()).error(anyString());
-    verify(slf4j, never()).warn(anyString());
-    verify(slf4j, never()).info(anyString());
-  }
-
-  @Test
-  public void addError() {
-    ValidationMessages messages = ValidationMessages.create();
-    messages.addErrorText("my error");
-    assertThat(messages.hasErrors()).isTrue();
-    assertThat(messages.hasWarnings()).isFalse();
-    assertThat(messages.hasInfos()).isFalse();
-    assertThat(messages.getErrors()).hasSize(1);
-    assertThat(messages.getErrors()).contains("my error");
-    assertThat(messages.toString()).contains("my error");
-
-    Logger logger = mock(Logger.class);
-    messages.log(logger);
-    verify(logger, times(1)).error("my error");
-    verify(logger, never()).warn(anyString());
-    verify(logger, never()).info(anyString());
-
-    org.slf4j.Logger slf4j = mock(org.slf4j.Logger.class);
-    messages.log(slf4j);
-    verify(slf4j, times(1)).error("my error");
-    verify(slf4j, never()).warn(anyString());
-    verify(slf4j, never()).info(anyString());
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/VersionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/VersionTest.java
deleted file mode 100644 (file)
index f091eb0..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.utils.Version.parse;
-
-public class VersionTest {
-
-  @Test
-  public void test_parse() {
-    assertVersion(parse(""), 0, 0, 0, 0, "");
-    assertVersion(parse("1"), 1, 0, 0, 0, "");
-    assertVersion(parse("1.2"), 1, 2, 0, 0,"");
-    assertVersion(parse("1.2.3"), 1, 2, 3, 0,"");
-    assertVersion(parse("1.2-beta-1"), 1, 2, 0, 0,"beta-1");
-    assertVersion(parse("1.2.3-beta1"), 1, 2, 3, 0,"beta1");
-    assertVersion(parse("1.2.3-beta-1"), 1, 2, 3, 0,"beta-1");
-    assertVersion(parse("1.2.3.4567"), 1, 2, 3, 4567,"");
-    assertVersion(parse("1.2.3.4567-alpha"), 1, 2, 3, 4567,"alpha");
-  }
-
-  @Test
-  public void parse_throws_IAE_if_more_than_4_fields() {
-    assertThatThrownBy(() -> parse("1.2.3.456.7"))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Maximum 4 fields are accepted: 1.2.3.456.7");
-  }
-
-  @Test
-  public void test_equals() {
-    Version one = parse("1");
-    assertThat(one).isEqualTo(one);
-    assertThat(one).isEqualTo(parse("1"));
-    assertThat(one).isEqualTo(parse("1.0"));
-    assertThat(one).isEqualTo(parse("1.0.0"));
-    assertThat(one).isNotEqualTo(parse("1.2.3"));
-    assertThat(one).isNotEqualTo("1");
-
-    assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3"));
-    assertThat(parse("1.2.3")).isNotEqualTo(parse("1.2.4"));
-    assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3-b1"));
-    assertThat(parse("1.2.3-b1")).isEqualTo(parse("1.2.3-b2"));
-  }
-
-  @Test
-  public void test_hashCode() {
-    assertThat(parse("1")).hasSameHashCodeAs(parse("1"));
-    assertThat(parse("1")).hasSameHashCodeAs(parse("1.0.0"));
-    assertThat(parse("1.2.3-beta1")).hasSameHashCodeAs(parse("1.2.3"));
-  }
-
-  @Test
-  public void test_compareTo() {
-    assertThat(parse("1.2")).isEqualByComparingTo(parse("1.2.0"));
-    assertThat(parse("1.2.3")).isEqualByComparingTo(parse("1.2.3"));
-    assertThat(parse("1.2.3").compareTo(parse("1.2.4"))).isLessThan(0);
-    assertThat(parse("1.2.3").compareTo(parse("1.3"))).isLessThan(0);
-    assertThat(parse("1.2.3").compareTo(parse("2.1"))).isLessThan(0);
-    assertThat(parse("1.2.3").compareTo(parse("2.0.0"))).isLessThan(0);
-    assertThat(parse("2.0").compareTo(parse("1.2"))).isGreaterThan(0);
-  }
-
-  @Test
-  public void compareTo_handles_build_number() {
-    assertThat(parse("1.2")).isEqualByComparingTo(parse("1.2.0.0"));
-    assertThat(parse("1.2.3.1234").compareTo(parse("1.2.3.4567"))).isLessThan(0);
-    assertThat(parse("1.2.3.1234").compareTo(parse("1.2.3"))).isGreaterThan(0);
-    assertThat(parse("1.2.3.1234").compareTo(parse("1.2.4"))).isLessThan(0);
-    assertThat(parse("1.2.3.9999").compareTo(parse("1.2.4.1111"))).isLessThan(0);
-  }
-
-  @Test
-  public void qualifier_is_ignored_from_comparison() {
-    assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3-build1"));
-    assertThat(parse("1.2.3")).isEqualTo(parse("1.2.3-build1"));
-    assertThat(parse("1.2.3")).isEqualByComparingTo(parse("1.2.3-build1"));
-  }
-
-  @Test
-  public void test_toString() {
-    assertThat(parse("1").toString()).isEqualTo("1.0");
-    assertThat(parse("1.2").toString()).isEqualTo("1.2");
-    assertThat(parse("1.2.3").toString()).isEqualTo("1.2.3");
-    assertThat(parse("1.2-b1").toString()).isEqualTo("1.2-b1");
-    assertThat(parse("1.2.3-b1").toString()).isEqualTo("1.2.3-b1");
-    assertThat(parse("1.2.3.4567").toString()).isEqualTo("1.2.3.4567");
-    assertThat(parse("1.2.3.4567-beta1").toString()).isEqualTo("1.2.3.4567-beta1");
-
-    // do not display zero numbers when possible
-    assertThat(parse("1.2.0.0").toString()).isEqualTo("1.2");
-    assertThat(parse("1.2.0.1").toString()).isEqualTo("1.2.0.1");
-    assertThat(parse("1.2.1.0").toString()).isEqualTo("1.2.1");
-    assertThat(parse("1.2.1.0-beta").toString()).isEqualTo("1.2.1-beta");
-  }
-
-  @Test
-  public void test_create() {
-    assertVersion(Version.create(1, 2), 1, 2, 0, 0, "");
-    assertVersion(Version.create(1, 2, 3), 1, 2, 3, 0, "");
-
-  }
-
-  private static void assertVersion(Version version,
-                                    int expectedMajor, int expectedMinor, int expectedPatch, long expectedBuildNumber, String expectedQualifier) {
-    assertThat(version.major()).isEqualTo(expectedMajor);
-    assertThat(version.minor()).isEqualTo(expectedMinor);
-    assertThat(version.patch()).isEqualTo(expectedPatch);
-    assertThat(version.buildNumber()).isEqualTo(expectedBuildNumber);
-    assertThat(version.qualifier()).isEqualTo(expectedQualifier);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/WildcardPatternTest.java
deleted file mode 100644 (file)
index 14c2cea..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class WildcardPatternTest {
-
-  private boolean match(String pattern, String value, String separator) {
-    return new WildcardPattern(pattern, separator).match(value);
-  }
-
-  private boolean match(String pattern, String value) {
-    return new WildcardPattern(pattern, "/").match(value);
-  }
-
-  @Test
-  public void examples() {
-    assertThat(match("org/T?st.java", "org/Test.java")).isTrue();
-    assertThat(match("org/T?st.java", "org/Tost.java")).isTrue();
-
-    assertThat(match("org/*.java", "org/Foo.java")).isTrue();
-    assertThat(match("org/*.java", "org/Bar.java")).isTrue();
-
-    assertThat(match("org/**", "org/Foo.java")).isTrue();
-    assertThat(match("org/**", "org/foo/bar.jsp")).isTrue();
-
-    assertThat(match("org/**/Test.java", "org/Test.java")).isTrue();
-    assertThat(match("org/**/Test.java", "org/foo/Test.java")).isTrue();
-    assertThat(match("org/**/Test.java", "org/foo/bar/Test.java")).isTrue();
-
-    assertThat(match("org/**/*.java", "org/Foo.java")).isTrue();
-    assertThat(match("org/**/*.java", "org/foo/Bar.java")).isTrue();
-    assertThat(match("org/**/*.java", "org/foo/bar/Baz.java")).isTrue();
-  }
-
-  @Test
-  public void javaResourcesShouldMatchWildcards() {
-    assertThat(match("Foo", "Foo", ".")).isTrue();
-    assertThat(match("Foo", "Bar", ".")).isFalse();
-
-    assertThat(match("org/sonar/**", "org.sonar.commons.Foo", ".")).isTrue();
-    assertThat(match("org/sonar/**", "org.sonar.Foo", ".")).isTrue();
-    assertThat(match("xxx/org/sonar/**", "org.sonar.Foo", ".")).isFalse();
-
-    assertThat(match("org/sonar/**/**", "org.sonar.commons.Foo", ".")).isTrue();
-    assertThat(match("org/sonar/**/**", "org.sonar.commons.sub.Foo", ".")).isTrue();
-    assertThat(match("org/sonar/**/Foo", "org.sonar.commons.sub.Foo", ".")).isTrue();
-    assertThat(match("org/sonar/**/Foo", "org.sonar.Foo", ".")).isTrue();
-
-    assertThat(match("*/foo/*", "org.foo.Bar", ".")).isTrue();
-    assertThat(match("*/foo/*", "foo.Bar", ".")).isFalse();
-    assertThat(match("*/foo/*", "foo", ".")).isFalse();
-    assertThat(match("*/foo/*", "org.foo.bar.Hello", ".")).isFalse();
-
-    assertThat(match("hell?", "hello", ".")).isTrue();
-    assertThat(match("hell?", "helloworld", ".")).isFalse();
-    assertThat(match("hell?", "hell", ".")).isFalse();
-
-    assertThat(match("a.b.c", "a.b.c", ".")).isTrue();
-    assertThat(match("*/a.b.c", "foo.a.b.c", ".")).isTrue();
-    assertThat(match("*/a.b.c", "foo/aabbc", ".")).isFalse();
-
-    assertThat(match("**/Reader", "java.io.Reader", ".")).isTrue();
-    assertThat(match("**/Reader", "org.sonar.channel.CodeReader", ".")).isFalse();
-
-    assertThat(match("**", "java.io.Reader", ".")).isTrue();
-  }
-
-  @Test
-  public void directoriesShouldMatchWildcards() {
-    assertThat(match("Foo", "Foo")).isTrue();
-    assertThat(match("Foo", "Bar")).isFalse();
-
-    assertThat(match("org/sonar/**", "org/sonar/commons/Foo")).isTrue();
-    assertThat(match("org/sonar/**", "org/sonar/Foo.java")).isTrue();
-    assertThat(match("xxx/org/sonar/**", "org/sonar/Foo")).isFalse();
-
-    assertThat(match("org/sonar/**/**", "org/sonar/commons/Foo")).isTrue();
-    assertThat(match("org/sonar/**/**", "org/sonar/commons/sub/Foo.java")).isTrue();
-    assertThat(match("org/sonar/**/Foo", "org/sonar/commons/sub/Foo")).isTrue();
-    assertThat(match("org/sonar/**/Foo", "org/sonar/Foo")).isTrue();
-
-    assertThat(match("*/foo/*", "org/foo/Bar")).isTrue();
-    assertThat(match("*/foo/*", "foo/Bar")).isFalse();
-    assertThat(match("*/foo/*", "foo")).isFalse();
-    assertThat(match("*/foo/*", "org/foo/bar/Hello")).isFalse();
-
-    assertThat(match("hell?", "hello")).isTrue();
-    assertThat(match("hell?", "helloworld")).isFalse();
-    assertThat(match("hell?", "hell")).isFalse();
-
-    assertThat(match("a.b.c", "a.b.c")).isTrue();
-    assertThat(match("*/a.b.c", "foo/a.b.c")).isTrue();
-    assertThat(match("*/a.b.c", "foo/aabbc")).isFalse();
-
-    assertThat(match("**/Reader", "java/io/Reader")).isTrue();
-    assertThat(match("**/Reader", "org/sonar/channel/CodeReader")).isFalse();
-
-    assertThat(match("**", "java/io/Reader")).isTrue();
-  }
-
-  /**
-   * See http://jira.sonarsource.com/browse/SONAR-2193
-   */
-  @Test
-  public void issue2193() {
-    assertThat(match("**/app/**", "com.app.Utils", ".")).isTrue();
-    assertThat(match("**/app/**", "com.application.MyService", ".")).isFalse();
-
-    assertThat(match("**/app/**", "com/app/Utils")).isTrue();
-    assertThat(match("**/app/**", "com/application/MyService")).isFalse();
-  }
-
-  /**
-   * See SONAR-2762
-   */
-  @Test
-  public void shouldEscapeRegexpSpecificCharacters() {
-    assertThat(match("**/*$*", "foo/bar")).isFalse();
-    assertThat(match("**/*$*", "foo/bar$baz")).isTrue();
-
-    assertThat(match("a+", "aa")).isFalse();
-    assertThat(match("a+", "a+")).isTrue();
-
-    assertThat(match("[ab]", "a")).isFalse();
-    assertThat(match("[ab]", "[ab]")).isTrue();
-
-    assertThat(match("()[]^$.{}+|", "()[]^$.{}+|")).as("all regexp-specific characters").isTrue();
-  }
-
-  @Test
-  public void backslash() {
-    assertThat(match("\\n", "\n")).as("backslash is not an escape character").isFalse();
-    assertThat(match("foo\\bar", "foo/bar")).as("backslash is the same as forward slash").isTrue();
-  }
-
-  @Test
-  public void shouldIgnoreStartingSlash() {
-    assertThat(match("/foo", "foo")).isTrue();
-    assertThat(match("\\foo", "foo")).isTrue();
-  }
-
-  /**
-   * Godin: in my opinion this is invalid pattern, however it might be constructed by {@link org.sonar.api.resources.JavaFile#matchFilePattern(String)},
-   * so it should be supported at least for now for backward compatibility.
-   */
-  @Test
-  public void cornerCase() {
-    assertThat(match("org/**.*", "org.sonar.commons.Foo.java", ".")).isTrue();
-  }
-
-  @Test
-  public void multiplePatterns() {
-    WildcardPattern[] patterns = WildcardPattern.create(new String[] {"Foo", "Bar"});
-    assertThat(WildcardPattern.match(patterns, "Foo")).isTrue();
-    assertThat(WildcardPattern.match(patterns, "Bar")).isTrue();
-    assertThat(WildcardPattern.match(patterns, "Other")).isFalse();
-
-    assertThat(WildcardPattern.create((String[]) null)).isEmpty();
-  }
-
-  @Test
-  public void testToString() {
-    assertThat(WildcardPattern.create("foo*").toString()).isEqualTo("foo*");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java
deleted file mode 100644 (file)
index 31296d0..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import org.apache.commons.io.FileUtils;
-import org.assertj.core.util.Files;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class ZipUtilsTest {
-
-  @Rule
-  public TemporaryFolder temp = new TemporaryFolder();
-
-  @Test
-  public void zip_directory() throws IOException {
-    File foo = FileUtils.toFile(getClass().getResource("/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt"));
-    File dir = foo.getParentFile();
-    File zip = temp.newFile();
-
-    ZipUtils.zipDir(dir, zip);
-
-    assertThat(zip).exists().isFile();
-    assertThat(zip.length()).isGreaterThan(1L);
-    ArrayList<? extends ZipEntry> zipEntries = Collections.list(new ZipFile(zip).entries());
-    assertThat(zipEntries).hasSize(4);
-
-    File unzipDir = temp.newFolder();
-    ZipUtils.unzip(zip, unzipDir);
-    assertThat(new File(unzipDir, "bar.txt")).exists().isFile();
-    assertThat(new File(unzipDir, "foo.txt")).exists().isFile();
-    assertThat(new File(unzipDir, "dir1/hello.properties")).exists().isFile();
-  }
-
-  @Test
-  public void unzipping_creates_target_directory_if_it_does_not_exist() throws IOException {
-    File zip = FileUtils.toFile(urlToZip());
-    File tempDir = temp.newFolder();
-    Files.delete(tempDir);
-
-    File subDir = new File(tempDir, "subDir");
-    ZipUtils.unzip(zip, subDir);
-    assertThat(subDir.list()).hasSize(3);
-  }
-
-  @Test
-  public void unzip_file() throws IOException {
-    File zip = FileUtils.toFile(urlToZip());
-    File toDir = temp.newFolder();
-    ZipUtils.unzip(zip, toDir);
-    assertThat(toDir.list()).hasSize(3);
-  }
-
-  @Test
-  public void unzip_stream() throws Exception {
-    InputStream zip = urlToZip().openStream();
-    File toDir = temp.newFolder();
-    ZipUtils.unzip(zip, toDir);
-    assertThat(toDir.list()).hasSize(3);
-  }
-
-  @Test
-  public void fail_if_unzipping_file_outside_target_directory() throws Exception {
-    File zip = new File(getClass().getResource("ZipUtilsTest/zip-slip.zip").toURI());
-    File toDir = temp.newFolder();
-
-    assertThatThrownBy(() -> ZipUtils.unzip(zip, toDir))
-      .isInstanceOf(IllegalStateException.class)
-      .hasMessage("Unzipping an entry outside the target directory is not allowed: ../../../../../../../../../../../../../../../../" +
-        "../../../../../../../../../../../../../../../../../../../../../../../../tmp/evil.txt");
-  }
-
-  @Test
-  public void fail_if_unzipping_stream_outside_target_directory() throws Exception {
-    File zip = new File(getClass().getResource("ZipUtilsTest/zip-slip.zip").toURI());
-    File toDir = temp.newFolder();
-
-
-    try (InputStream input = new FileInputStream(zip)) {
-      assertThatThrownBy(() -> ZipUtils.unzip(input, toDir))
-        .isInstanceOf(IllegalStateException.class)
-        .hasMessage("Unzipping an entry outside the target directory is not allowed: ../../../../../../../../../../../../../../../../../.." +
-          "/../../../../../../../../../../../../../../../../../../../../../../tmp/evil.txt");
-    }
-  }
-
-  private URL urlToZip() {
-    return getClass().getResource("/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandExecutorTest.java
deleted file mode 100644 (file)
index 164e5cf..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-import org.sonar.api.utils.System2;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.fail;
-
-public class CommandExecutorTest {
-
-  @Rule
-  public TemporaryFolder tempFolder = new TemporaryFolder();
-
-  @Rule
-  public TestName testName = new TestName();
-
-  private File workDir;
-
-  @Before
-  public void before() throws IOException {
-    workDir = tempFolder.newFolder(testName.getMethodName());
-  }
-
-  @Test(timeout = 3000L)
-  public void should_consume_StdOut_and_StdErr() throws Exception {
-    // too many false-positives on MS windows
-    if (!SystemUtils.IS_OS_WINDOWS) {
-      StringBuilder stdOutBuilder = new StringBuilder();
-      StreamConsumer stdOutConsumer = line -> stdOutBuilder.append(line).append(SystemUtils.LINE_SEPARATOR);
-      StringBuilder stdErrBuilder = new StringBuilder();
-      StreamConsumer stdErrConsumer = line -> stdErrBuilder.append(line).append(SystemUtils.LINE_SEPARATOR);
-      Command command = Command.create(getScript("output")).setDirectory(workDir);
-      int exitCode = CommandExecutor.create().execute(command, stdOutConsumer, stdErrConsumer, 1000L);
-      assertThat(exitCode).isZero();
-
-      String stdOut = stdOutBuilder.toString();
-      String stdErr = stdErrBuilder.toString();
-      assertThat(stdOut).contains("stdOut: first line");
-      assertThat(stdOut).contains("stdOut: second line");
-      assertThat(stdErr).contains("stdErr: first line");
-      assertThat(stdErr).contains("stdErr: second line");
-    }
-  }
-
-  @Test(timeout = 3000L)
-  public void stdOut_consumer_can_throw_exception() throws Exception {
-    Command command = Command.create(getScript("output")).setDirectory(workDir);
-
-    assertThatThrownBy(() -> CommandExecutor.create().execute(command, BAD_CONSUMER, NOP_CONSUMER, 1000L))
-      .isInstanceOf(CommandException.class)
-      .hasMessageContaining("Error inside stdOut stream");
-  }
-
-  @Test(timeout = 3000L)
-  public void stdErr_consumer_can_throw_exception() throws Exception {
-    Command command = Command.create(getScript("output")).setDirectory(workDir);
-
-    assertThatThrownBy(() -> CommandExecutor.create().execute(command, NOP_CONSUMER, BAD_CONSUMER, 1500L))
-      .isInstanceOf(CommandException.class)
-      .hasMessageContaining("Error inside stdErr stream");
-  }
-
-  private static final StreamConsumer NOP_CONSUMER = line -> {
-  };
-
-  private static final StreamConsumer BAD_CONSUMER = line -> {
-    throw new RuntimeException();
-  };
-
-  @Test
-  public void should_use_working_directory_to_store_argument_and_environment_variable() throws Exception {
-    Command command = Command.create(getScript("echo"))
-      .setDirectory(workDir)
-      .addArgument("1")
-      .setEnvironmentVariable("ENVVAR", "2");
-    int exitCode = CommandExecutor.create().execute(command, 1000L);
-    assertThat(exitCode).isZero();
-    File logFile = new File(workDir, "echo.log");
-    assertThat(logFile).exists();
-    String log = FileUtils.readFileToString(logFile);
-    assertThat(log).contains(workDir.getAbsolutePath());
-    assertThat(log).contains("Parameter: 1");
-    assertThat(log).contains("Environment variable: 2");
-  }
-
-  @Test(timeout = 6000L)
-  public void should_stop_after_timeout() throws IOException {
-    try {
-      String executable = getScript("forever");
-      CommandExecutor.create().execute(Command.create(executable).setDirectory(workDir), 100);
-      fail();
-    } catch (TimeoutException e) {
-      // ok
-    }
-  }
-
-  @Test(timeout = 6000L)
-  public void should_stop_after_timeout_and_new_shell() throws IOException {
-    String executable = getScript("forever");
-
-    assertThatThrownBy(() -> {
-      CommandExecutor.create().execute(Command.create(executable).setNewShell(true).setDirectory(workDir), 100);
-      fail();
-
-    })
-      .isInstanceOf(TimeoutException.class);
-  }
-
-  @Test
-  public void should_fail_if_script_not_found() {
-    assertThatThrownBy(() -> CommandExecutor.create().execute(Command.create("notfound").setDirectory(workDir), 1000L))
-      .isInstanceOf(CommandException.class);
-  }
-
-  private static String getScript(String name) throws IOException {
-    String filename;
-    if (System2.INSTANCE.isOsWindows()) {
-      filename = name + ".bat";
-    } else {
-      filename = name + ".sh";
-    }
-    return new File("src/test/scripts/" + filename).getCanonicalPath();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/command/CommandTest.java
deleted file mode 100644 (file)
index 9700d5a..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.command;
-
-import com.google.common.collect.ImmutableMap;
-import java.io.File;
-import java.util.Arrays;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class CommandTest {
-
-  @Test
-  public void fail_if_blank_executable() {
-    assertThatThrownBy(() -> Command.create("  "))
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_null_executable() {
-    assertThatThrownBy(() -> Command.create(null))
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void create_command() {
-    Command command = Command.create("java");
-    command.addArgument("-Xmx512m");
-    command.addArguments(Arrays.asList("-a", "-b"));
-    command.addArguments(new String[] {"-x", "-y"});
-    assertThat(command.getExecutable()).isEqualTo("java");
-    assertThat(command.getArguments()).hasSize(5);
-    assertThat(command.toCommandLine()).isEqualTo("java -Xmx512m -a -b -x -y");
-  }
-
-  @Test
-  public void create_command_with_masked_arguments() {
-    Command command = Command.create("java");
-    command.addArgument("-Xmx512m");
-    command.addMaskedArgument("s3cr3t");
-    command.addArguments(new String[] {"-x", "-y"});
-    assertThat(command.getExecutable()).isEqualTo("java");
-    assertThat(command.getArguments()).hasSize(4);
-    assertThat(command.toCommandLine()).isEqualTo("java -Xmx512m s3cr3t -x -y");
-    assertThat(command.toString()).isEqualTo("java -Xmx512m ******** -x -y");
-  }
-
-  @Test
-  public void toString_is_the_command_line() {
-    Command command = Command.create("java");
-    command.addArgument("-Xmx512m");
-    assertThat(command.toString()).isEqualTo(command.toCommandLine());
-  }
-
-  @Test
-  public void working_directory() {
-    Command command = Command.create("java");
-    assertThat(command.getDirectory()).isNull();
-
-    File working = new File("working");
-    command = Command.create("java").setDirectory(working);
-    assertThat(command.getDirectory()).isEqualTo(working);
-  }
-
-  @Test
-  public void initialize_with_current_env() {
-    Command command = Command.create("java");
-    assertThat(command.getEnvironmentVariables()).isNotEmpty();
-  }
-
-  @Test
-  public void override_env_variables() {
-    System2 system = mock(System2.class);
-    when(system.envVariables()).thenReturn(ImmutableMap.of("JAVA_HOME", "/default/path/to/java"));
-
-    Command command = new Command("java", system);
-    command.setEnvironmentVariable("JAVA_HOME", "/new/path/to/java");
-    assertThat(command.getEnvironmentVariables()).containsEntry("JAVA_HOME", "/new/path/to/java");
-  }
-
-  @Test
-  public void should_use_cmd_for_new_shell_on_windows() {
-    System2 system = mock(System2.class);
-    when(system.isOsWindows()).thenReturn(true);
-    Command command = new Command("foo.bat", system);
-    command.setNewShell(true);
-    assertThat(command.toCommandLine()).isEqualTo("cmd /C call foo.bat");
-    assertThat(command.isNewShell()).isTrue();
-
-  }
-
-  @Test
-  public void should_use_sh_for_new_shell_on_unix() {
-    System2 system = mock(System2.class);
-    when(system.isOsWindows()).thenReturn(false);
-    Command command = new Command("foo.sh", system);
-
-    command.setNewShell(true);
-    assertThat(command.toCommandLine()).isEqualTo("sh foo.sh");
-    assertThat(command.isNewShell()).isTrue();
-  }
-
-  @Test
-  public void shouldnt_use_new_shell_by_default() {
-    Command command = Command.create("foo.sh");
-
-    assertThat(command.isNewShell()).isFalse();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/dag/DirectAcyclicGraphTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/dag/DirectAcyclicGraphTest.java
deleted file mode 100644 (file)
index ecd3085..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.dag;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-import java.util.List;
-
-public class DirectAcyclicGraphTest {
-
-  @Test(expected = CyclicDependenciesException.class)
-  public void shouldFailIfCyclicDependencies() {
-    DirectAcyclicGraph dag = new DirectAcyclicGraph();
-    dag.add("m3", "m1");
-    dag.add("m1", "m3");
-    dag.sort();
-  }
-
-  @Test
-  public void sortByDependencies() {
-    DirectAcyclicGraph dag = new DirectAcyclicGraph();
-    dag.add("m1", "m3");
-    dag.add("m3", "m2");
-    dag.add("m4");
-    dag.add("m2", "m4");
-    List result = dag.sort();
-    assertEquals(4, result.size());
-    assertEquals("m4", result.get(0));
-    assertEquals("m2", result.get(1));
-    assertEquals("m3", result.get(2));
-    assertEquals("m1", result.get(3));
-  }
-
-  @Test
-  public void keepInsertionOrderWhenNoDependencies() {
-    DirectAcyclicGraph dag = new DirectAcyclicGraph("m3", "m2", "m1");
-    List result = dag.sort();
-    assertEquals(3, result.size());
-    assertEquals("m3", result.get(0));
-    assertEquals("m2", result.get(1));
-    assertEquals("m1", result.get(2));
-  }
-
-  @Test
-  public void complexGraph() {
-    DirectAcyclicGraph dag = new DirectAcyclicGraph();
-    dag.add("m2", "m4");
-    dag.add("m1", "m2", "m3");
-    dag.add("m3", "m2");
-    List result = dag.sort();
-
-    assertEquals(4, result.size());
-    assertEquals("m4", result.get(0));
-    assertEquals("m2", result.get(1));
-    assertEquals("m3", result.get(2));
-    assertEquals("m1", result.get(3));
-  }
-
-  @Test
-  public void aNodeShouldDependOnItself() {
-    DirectAcyclicGraph graph = new DirectAcyclicGraph();
-    graph.add("m1", "m1");
-    List result = graph.sort();
-    assertEquals(1, result.size());
-    assertEquals("m1", result.get(0));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/BaseLoggerTest.java
deleted file mode 100644 (file)
index 1641733..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-
-public class BaseLoggerTest {
-
-  @Test
-  public void log() {
-    new ConsoleLogger().log(LoggerLevel.WARN, "message");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleFormatterTest.java
deleted file mode 100644 (file)
index 148531f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-import org.sonar.api.utils.TestUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ConsoleFormatterTest {
-
-  @Test
-  public void format() {
-    assertThat(ConsoleFormatter.format("foo")).isEqualTo("foo");
-    assertThat(ConsoleFormatter.format("arg: {}", "foo")).isEqualTo("arg: foo");
-    assertThat(ConsoleFormatter.format("two args: {} and {}", "foo", 42)).isEqualTo("two args: foo and 42");
-    assertThat(ConsoleFormatter.format("args: {}, {} and {}", true, 42, 2L)).isEqualTo("args: true, 42 and 2");
-    assertThat(ConsoleFormatter.format("args: {}, {} and {}", null, null, null)).isEqualTo("args: null, null and null");
-  }
-
-  @Test
-  public void only_static_methods() {
-    assertThat(TestUtils.hasOnlyPrivateConstructors(ConsoleFormatter.class)).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggerTest.java
deleted file mode 100644 (file)
index 0c4d98d..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.io.PrintStream;
-import org.junit.Rule;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.startsWith;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoInteractions;
-
-public class ConsoleLoggerTest {
-
-  private PrintStream stream = mock(PrintStream.class);
-  private ConsoleLogger underTest = new ConsoleLogger(stream);
-
-  @Rule
-  public LogTester tester = new LogTester();
-
-  @Test
-  public void debug_enabled() {
-    tester.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    underTest.debug("message");
-    underTest.debug("message {}", "foo");
-    underTest.debug("message {} {}", "foo", "bar");
-    underTest.debug("message {} {} {}", "foo", "bar", "baz");
-    verify(stream).println("DEBUG message");
-    verify(stream).println("DEBUG message foo");
-    verify(stream).println("DEBUG message foo bar");
-    verify(stream).println("DEBUG message foo bar baz");
-    assertThat(tester.logs(LoggerLevel.DEBUG)).containsExactly(
-      "message", "message foo", "message foo bar", "message foo bar baz");
-  }
-
-  @Test
-  public void debug_disabled() {
-    tester.setLevel(LoggerLevel.INFO);
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    underTest.debug("message");
-    underTest.debug("message {}", "foo");
-    underTest.debug("message {} {}", "foo", "bar");
-    underTest.debug("message {} {} {}", "foo", "bar", "baz");
-    verifyNoInteractions(stream);
-  }
-
-  @Test
-  public void trace_enabled() {
-    tester.setLevel(LoggerLevel.TRACE);
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isTrue();
-    underTest.trace("message");
-    underTest.trace("message {}", "foo");
-    underTest.trace("message {} {}", "foo", "bar");
-    underTest.trace("message {} {} {}", "foo", "bar", "baz");
-    verify(stream, times(4)).println(anyString());
-  }
-
-  @Test
-  public void trace_disabled() {
-    tester.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    underTest.trace("message");
-    underTest.trace("message {}", "foo");
-    underTest.trace("message {} {}", "foo", "bar");
-    underTest.trace("message {} {} {}", "foo", "bar", "baz");
-    verifyNoInteractions(stream);
-  }
-
-  @Test
-  public void log_info() {
-    underTest.info("message");
-    underTest.info("message {}", "foo");
-    underTest.info("message {} {}", "foo", "bar");
-    underTest.info("message {} {} {}", "foo", "bar", "baz");
-    verify(stream).println("INFO  message");
-    verify(stream).println("INFO  message foo");
-    verify(stream).println("INFO  message foo bar");
-    verify(stream).println("INFO  message foo bar baz");
-    assertThat(tester.logs(LoggerLevel.INFO)).containsExactly(
-      "message", "message foo", "message foo bar", "message foo bar baz");
-  }
-
-  @Test
-  public void log_warn() {
-    Throwable throwable = mock(Throwable.class);
-
-    underTest.warn("message");
-    underTest.warn("message {}", "foo");
-    underTest.warn("message {} {}", "foo", "bar");
-    underTest.warn("message {} {} {}", "foo", "bar", "baz");
-    underTest.warn("message with exception", throwable);
-    ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-    verify(stream, times(5)).println(captor.capture());
-    for (String msg : captor.getAllValues()) {
-      assertThat(msg).startsWith("WARN ");
-    }
-    verify(throwable).printStackTrace();
-    assertThat(tester.logs(LoggerLevel.WARN)).containsExactly(
-      "message", "message foo", "message foo bar", "message foo bar baz", "message with exception");
-  }
-
-  @Test
-  public void log_error() {
-    underTest.error("message");
-    underTest.error("message {}", "foo");
-    underTest.error("message {} {}", "foo", "bar");
-    underTest.error("message {} {} {}", "foo", "bar", "baz");
-    underTest.error("message with exception", new IllegalArgumentException());
-    verify(stream, times(5)).println(startsWith("ERROR "));
-    assertThat(tester.logs(LoggerLevel.ERROR)).containsExactly(
-      "message", "message foo", "message foo bar", "message foo bar baz", "message with exception");
-  }
-
-  @Test
-  public void level_change_not_implemented_yet() {
-    assertThat(underTest.setLevel(LoggerLevel.DEBUG)).isFalse();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ConsoleLoggersTest.java
deleted file mode 100644 (file)
index 79ea3b6..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ConsoleLoggersTest {
-
-  ConsoleLoggers underTest = new ConsoleLoggers();
-
-  @Test
-  public void newInstance() {
-    Logger logger = underTest.newInstance("foo");
-    assertThat(logger).isInstanceOf(ConsoleLogger.class);
-  }
-
-  @Test
-  public void level() {
-    // INFO by default
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
-
-    underTest.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.DEBUG);
-
-    underTest.setLevel(LoggerLevel.INFO);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
deleted file mode 100644 (file)
index 5b53d7b..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-
-public class DefaultProfilerTest {
-
-  @Rule
-  public LogTester tester = new LogTester();
-
-  Profiler underTest = Profiler.create(Loggers.get("DefaultProfilerTest"));
-
-  @Test
-  public void test_levels() {
-    // info by default
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-
-    tester.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-
-    tester.setLevel(LoggerLevel.TRACE);
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isTrue();
-  }
-
-  @Test
-  public void stop_reuses_start_message() {
-    tester.setLevel(LoggerLevel.TRACE);
-
-    // trace
-    underTest.startTrace("Register rules");
-    assertThat(tester.logs()).containsOnly("Register rules");
-    underTest.stopTrace();
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(1)).startsWith("Register rules (done) | time=");
-    tester.clear();
-
-    // debug
-    underTest.startDebug("Register rules");
-    assertThat(tester.logs()).containsOnly("Register rules");
-    underTest.stopTrace();
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(1)).startsWith("Register rules (done) | time=");
-    tester.clear();
-
-    // info
-    underTest.startInfo("Register rules");
-    assertThat(tester.logs()).containsOnly("Register rules");
-    underTest.stopTrace();
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(1)).startsWith("Register rules (done) | time=");
-  }
-
-  @Test
-  public void different_start_and_stop_messages() {
-    tester.setLevel(LoggerLevel.TRACE);
-
-    // start TRACE and stop DEBUG
-    underTest.startTrace("Register rules");
-    underTest.stopDebug("Rules registered");
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(0)).contains("Register rules");
-    assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
-    tester.clear();
-
-    // start DEBUG and stop INFO
-    underTest.startDebug("Register rules");
-    underTest.stopInfo("Rules registered");
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(0)).contains("Register rules");
-    assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
-    tester.clear();
-
-    // start INFO and stop TRACE
-    underTest.startInfo("Register rules");
-    underTest.stopTrace("Rules registered");
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(0)).contains("Register rules");
-    assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
-  }
-
-  @Test
-  public void log_on_at_stop() {
-    tester.setLevel(LoggerLevel.TRACE);
-
-    // trace
-    underTest.start();
-    underTest.stopTrace("Rules registered");
-    assertThat(tester.logs()).hasSize(1);
-    assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
-    tester.clear();
-
-    // debug
-    underTest.start();
-    underTest.stopDebug("Rules registered");
-    assertThat(tester.logs()).hasSize(1);
-    assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
-    tester.clear();
-
-    // info
-    underTest.start();
-    underTest.stopInfo("Rules registered");
-    assertThat(tester.logs()).hasSize(1);
-    assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
-  }
-
-  @Test
-  public void add_context() {
-    Profiler profiler = Profiler.create(Loggers.get("DefaultProfilerTest"));
-    profiler.addContext("a_string", "bar");
-    profiler.addContext("null_value", null);
-    profiler.addContext("an_int", 42);
-    profiler.start();
-    // do not write context as there's no message
-    assertThat(tester.logs()).isEmpty();
-
-    profiler.addContext("after_start", true);
-    profiler.stopInfo("Rules registered");
-    assertThat(tester.logs()).hasSize(1);
-    assertThat(tester.logs().get(0))
-      .startsWith("Rules registered | time=")
-      .endsWith("ms | a_string=bar | an_int=42 | after_start=true");
-  }
-
-  @Test
-  public void empty_message() {
-    underTest.addContext("foo", "bar");
-    underTest.startInfo("");
-    assertThat(tester.logs()).containsOnly("foo=bar");
-
-    underTest.addContext("after_start", true);
-    underTest.stopInfo("");
-    assertThat(tester.logs()).hasSize(2);
-    assertThat(tester.logs().get(1))
-      .startsWith("time=")
-      .endsWith("ms | foo=bar | after_start=true");
-  }
-
-  @Test
-  public void fail_if_stop_without_message() {
-    underTest.start();
-    try {
-      underTest.stopInfo();
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Profiler#stopXXX() can't be called without any message defined in start methods");
-    }
-  }
-
-  @Test
-  public void fail_if_stop_without_start() {
-    try {
-      underTest.stopDebug("foo");
-      fail();
-    } catch (IllegalStateException e) {
-      assertThat(e).hasMessage("Profiler must be started before being stopped");
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogInterceptorsTest.java
deleted file mode 100644 (file)
index 1306787..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-import org.sonar.api.utils.TestUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LogInterceptorsTest {
-
-  @Test
-  public void default_is_null_interceptor() {
-    // production-ready
-    assertThat(LogInterceptors.get()).isInstanceOf(NullInterceptor.class);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void instance_cant_be_null() {
-    LogInterceptors.set(null);
-  }
-
-  @Test
-  public void private_constructor() {
-    assertThat(TestUtils.hasOnlyPrivateConstructors(LogInterceptors.class)).isTrue();
-  }
-}
-
-
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterJUnit5Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterJUnit5Test.java
deleted file mode 100644 (file)
index 9d33ffc..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LogTesterJUnit5Test {
-
-  LogTesterJUnit5 underTest = new LogTesterJUnit5();
-
-  @Test
-  public void info_level_by_default() throws Throwable {
-    // when LogTester is used, then info logs are enabled by default
-    underTest.beforeTestExecution(null);
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.INFO);
-
-    // change
-    underTest.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.DEBUG);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.DEBUG);
-
-    // reset to initial level after execution of test
-    underTest.afterTestExecution(null);
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.INFO);
-  }
-
-  @Test
-  public void intercept_logs() throws Throwable {
-    underTest.beforeTestExecution(null);
-    Loggers.get("logger1").info("an information");
-    Loggers.get("logger2").warn("warning: {}", 42);
-
-    assertThat(underTest.logs()).containsExactly("an information", "warning: 42");
-    assertThat(underTest.logs(LoggerLevel.ERROR)).isEmpty();
-    assertThat(underTest.logs(LoggerLevel.INFO)).containsOnly("an information");
-    assertThat(underTest.logs(LoggerLevel.WARN)).containsOnly("warning: 42");
-
-    underTest.clear();
-    assertThat(underTest.logs()).isEmpty();
-    assertThat(underTest.logs(LoggerLevel.INFO)).isEmpty();
-
-    underTest.afterTestExecution(null);
-    assertThat(LogInterceptors.get()).isSameAs(NullInterceptor.NULL_INSTANCE);
-  }
-
-  @Test
-  public void use_suppliers() throws Throwable {
-    // when LogTester is used, then info logs are enabled by default
-    underTest.beforeTestExecution(null);
-    AtomicBoolean touchedTrace = new AtomicBoolean();
-    AtomicBoolean touchedDebug = new AtomicBoolean();
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).isEmpty();
-    assertThat(touchedTrace.get()).isFalse();
-    assertThat(touchedDebug.get()).isFalse();
-
-    // change level to DEBUG
-    underTest.setLevel(LoggerLevel.DEBUG);
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).containsOnly("a debug information");
-    assertThat(touchedTrace.get()).isFalse();
-    assertThat(touchedDebug.get()).isTrue();
-    touchedDebug.set(false);
-    underTest.clear();
-
-    // change level to TRACE
-    underTest.setLevel(LoggerLevel.TRACE);
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).containsExactly("a trace information", "a debug information");
-    assertThat(touchedTrace.get()).isTrue();
-    assertThat(touchedDebug.get()).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java
deleted file mode 100644 (file)
index 36ac39c..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LogTesterTest {
-
-  LogTester underTest = new LogTester();
-
-  @Test
-  public void info_level_by_default() throws Throwable {
-    // when LogTester is used, then info logs are enabled by default
-    underTest.before();
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.INFO);
-
-    // change
-    underTest.setLevel(LoggerLevel.DEBUG);
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.DEBUG);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.DEBUG);
-
-    // reset to initial level after execution of test
-    underTest.after();
-    assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
-    assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.INFO);
-  }
-
-  @Test
-  public void intercept_logs() throws Throwable {
-    underTest.before();
-    Loggers.get("logger1").info("an information");
-    Loggers.get("logger2").warn("warning: {}", 42);
-
-    assertThat(underTest.logs()).containsExactly("an information", "warning: 42");
-    assertThat(underTest.logs(LoggerLevel.ERROR)).isEmpty();
-    assertThat(underTest.logs(LoggerLevel.INFO)).containsOnly("an information");
-    assertThat(underTest.logs(LoggerLevel.WARN)).containsOnly("warning: 42");
-
-    underTest.clear();
-    assertThat(underTest.logs()).isEmpty();
-    assertThat(underTest.logs(LoggerLevel.INFO)).isEmpty();
-
-    underTest.after();
-    assertThat(LogInterceptors.get()).isSameAs(NullInterceptor.NULL_INSTANCE);
-  }
-
-  @Test
-  public void use_suppliers() throws Throwable {
-    // when LogTester is used, then info logs are enabled by default
-    underTest.before();
-    AtomicBoolean touchedTrace = new AtomicBoolean();
-    AtomicBoolean touchedDebug = new AtomicBoolean();
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).isEmpty();
-    assertThat(touchedTrace.get()).isFalse();
-    assertThat(touchedDebug.get()).isFalse();
-
-    // change level to DEBUG
-    underTest.setLevel(LoggerLevel.DEBUG);
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).containsOnly("a debug information");
-    assertThat(touchedTrace.get()).isFalse();
-    assertThat(touchedDebug.get()).isTrue();
-    touchedDebug.set(false);
-    underTest.clear();
-
-    // change level to TRACE
-    underTest.setLevel(LoggerLevel.TRACE);
-    Loggers.get("logger1").trace(() -> {
-      touchedTrace.set(true);
-      return "a trace information";
-    });
-    Loggers.get("logger1").debug(() -> {
-      touchedDebug.set(true);
-      return "a debug information";
-    });
-
-    assertThat(underTest.logs()).containsExactly("a trace information", "a debug information");
-    assertThat(touchedTrace.get()).isTrue();
-    assertThat(touchedDebug.get()).isTrue();
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java
deleted file mode 100644 (file)
index 5a1acbb..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import ch.qos.logback.classic.Level;
-import org.junit.Rule;
-import org.junit.Test;
-import org.slf4j.LoggerFactory;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LogbackLoggerTest {
-
-  LogbackLogger underTest = new LogbackLogger((ch.qos.logback.classic.Logger)LoggerFactory.getLogger(getClass()));
-
-  @Rule
-  public LogTester tester = new LogTester();
-
-  @Test
-  public void log() {
-    // no assertions. Simply verify that calls do not fail.
-    underTest.trace("message");
-    underTest.trace("message {}", "foo");
-    underTest.trace("message {} {}", "foo", "bar");
-    underTest.trace("message {} {} {}", "foo", "bar", "baz");
-
-    underTest.debug("message");
-    underTest.debug("message {}", "foo");
-    underTest.debug("message {} {}", "foo", "bar");
-    underTest.debug("message {} {} {}", "foo", "bar", "baz");
-
-    underTest.info("message");
-    underTest.info("message {}", "foo");
-    underTest.info("message {} {}", "foo", "bar");
-    underTest.info("message {} {} {}", "foo", "bar", "baz");
-
-    underTest.warn("message");
-    underTest.warn("message {}", "foo");
-    underTest.warn("message {} {}", "foo", "bar");
-    underTest.warn("message {} {} {}", "foo", "bar", "baz");
-    underTest.warn("message", new NullPointerException("boom!"));
-
-    underTest.error("message");
-    underTest.error("message {}", "foo");
-    underTest.error("message {} {}", "foo", "bar");
-    underTest.error("message {} {} {}", "foo", "bar", "baz");
-    underTest.error("message", new IllegalArgumentException(""));
-  }
-
-  @Test
-  public void change_level() {
-    assertThat(underTest.setLevel(LoggerLevel.ERROR)).isTrue();
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    assertThat(underTest.logbackLogger().getLevel()).isEqualTo(Level.ERROR);
-
-    assertThat(underTest.setLevel(LoggerLevel.WARN)).isTrue();
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    assertThat(underTest.logbackLogger().getLevel()).isEqualTo(Level.WARN);
-
-    assertThat(underTest.setLevel(LoggerLevel.INFO)).isTrue();
-    assertThat(underTest.logbackLogger().getLevel()).isEqualTo(Level.INFO);
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-
-    assertThat(underTest.setLevel(LoggerLevel.DEBUG)).isTrue();
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    assertThat(underTest.logbackLogger().getLevel()).isEqualTo(Level.DEBUG);
-
-    assertThat(underTest.setLevel(LoggerLevel.TRACE)).isTrue();
-    assertThat(underTest.isDebugEnabled()).isTrue();
-    assertThat(underTest.isTraceEnabled()).isTrue();
-    assertThat(underTest.logbackLogger().getLevel()).isEqualTo(Level.TRACE);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java
deleted file mode 100644 (file)
index dfb7c4e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-import org.sonar.api.Plugin;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class LoggersTest {
-
-  @Test
-  public void factory() {
-    // logback is used by sonar-plugin-api
-    assertThat(Loggers.getFactory()).isInstanceOf(LogbackLoggers.class);
-
-    assertThat(Loggers.get("foo")).isInstanceOf(LogbackLogger.class);
-    assertThat(Loggers.get(Plugin.class)).isInstanceOf(LogbackLogger.class);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java
deleted file mode 100644 (file)
index 06f42fb..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-
-import static org.mockito.Mockito.mock;
-
-public class NullInterceptorTest {
-
-  @Test
-  public void do_not_throws_exception() {
-    // verify that... it does nothing
-    NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo");
-    NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {}", 42);
-    NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {} {}", 42, 66);
-    NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {} {} {}", 42, 66, 84);
-    NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo", mock(Exception.class));
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullProfilerTest.java
deleted file mode 100644 (file)
index 93b47d2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class NullProfilerTest {
-
-  NullProfiler underTest = NullProfiler.NULL_INSTANCE;
-
-  @Test
-  public void do_not_fail() {
-    assertThat(underTest.start()).isSameAs(underTest);
-    assertThat(underTest.startTrace("")).isSameAs(underTest);
-    assertThat(underTest.startDebug("")).isSameAs(underTest);
-    assertThat(underTest.startInfo("")).isSameAs(underTest);
-
-    assertThat(underTest.stopTrace()).isSameAs(underTest);
-    assertThat(underTest.stopTrace("")).isSameAs(underTest);
-    assertThat(underTest.stopDebug("")).isSameAs(underTest);
-    assertThat(underTest.stopDebug()).isSameAs(underTest);
-    assertThat(underTest.stopInfo()).isSameAs(underTest);
-    assertThat(underTest.stopInfo("")).isSameAs(underTest);
-
-    assertThat(underTest.isDebugEnabled()).isFalse();
-    assertThat(underTest.isTraceEnabled()).isFalse();
-    assertThat(underTest.addContext("foo", "bar")).isSameAs(underTest);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/ProfilerTest.java
deleted file mode 100644 (file)
index 29e82be..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.log;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ProfilerTest {
-  @Rule
-  public LogTester tester = new LogTester();
-
-  @Test
-  public void create() {
-    Profiler profiler = Profiler.create(Loggers.get("foo"));
-    assertThat(profiler).isInstanceOf(DefaultProfiler.class);
-  }
-
-  @Test
-  public void create_null_profiler_if_trace_level_is_disabled() {
-    tester.setLevel(LoggerLevel.TRACE);
-    Profiler profiler = Profiler.createIfTrace(Loggers.get("foo"));
-    assertThat(profiler).isInstanceOf(DefaultProfiler.class);
-
-    tester.setLevel(LoggerLevel.DEBUG);
-    profiler = Profiler.createIfTrace(Loggers.get("foo"));
-    assertThat(profiler).isInstanceOf(NullProfiler.class);
-  }
-
-  @Test
-  public void create_null_profiler_if_debug_level_is_disabled() {
-    tester.setLevel(LoggerLevel.TRACE);
-    Profiler profiler = Profiler.createIfDebug(Loggers.get("foo"));
-    assertThat(profiler).isInstanceOf(DefaultProfiler.class);
-
-    tester.setLevel(LoggerLevel.INFO);
-    profiler = Profiler.createIfDebug(Loggers.get("foo"));
-    assertThat(profiler).isInstanceOf(NullProfiler.class);
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/CsvWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/CsvWriterTest.java
deleted file mode 100644 (file)
index 7854964..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
-public class CsvWriterTest {
-
-  @Test
-  public void write_csv() throws Exception {
-    StringWriter output = new StringWriter();
-    CsvWriter writer = CsvWriter.of(output);
-
-    writer.values("France", "Paris");
-    writer.values("Sweden", "Stockholm");
-    writer.close();
-
-    BufferedReader reader = new BufferedReader(new StringReader(output.toString()));
-    String line1 = reader.readLine();
-    assertThat(line1).isEqualTo("France,Paris");
-
-    String line2 = reader.readLine();
-    assertThat(line2).isEqualTo("Sweden,Stockholm");
-
-    assertThat(reader.readLine()).isNull();
-  }
-
-  @Test
-  public void escape_value() throws Exception {
-    StringWriter output = new StringWriter();
-    CsvWriter writer = CsvWriter.of(output);
-
-    writer.values("no double-quotes", "contains \"double-quotes\"", "contains , commas");
-    writer.close();
-
-    BufferedReader reader = new BufferedReader(new StringReader(output.toString()));
-    assertThat(reader.readLine()).isEqualTo("no double-quotes,\"contains \"\"double-quotes\"\"\",\"contains , commas\"");
-
-    assertThat(reader.readLine()).isNull();
-  }
-
-  @Test
-  public void fail_to_write_to_stream() throws Exception {
-    Writer output = mock(Writer.class);
-    IOException cause = new IOException("bad");
-    doThrow(cause).when(output).append(anyString());
-
-    CsvWriter writer = CsvWriter.of(output);
-
-    try {
-      writer.values("foo");
-      fail();
-    } catch (WriterException e) {
-      assertThat(e).hasMessage("Fail to generate CSV with value: foo");
-      assertThat(e.getCause()).isSameAs(cause);
-    }
-  }
-
-  @Test
-  public void fail_to_close_stream() throws Exception {
-    Writer output = mock(Writer.class);
-    IOException cause = new IOException("bad");
-    doThrow(cause).when(output).close();
-
-    CsvWriter writer = CsvWriter.of(output);
-    writer.values("foo");
-
-    try {
-      writer.close();
-      fail();
-    } catch (WriterException e) {
-      assertThat(e).hasMessage("Fail to close CSV output");
-      assertThat(e.getCause()).isSameAs(cause);
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/JsonWriterTest.java
deleted file mode 100644 (file)
index 5629ba5..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import com.google.common.collect.ImmutableMap;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.Test;
-import org.sonar.api.utils.DateUtils;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class JsonWriterTest {
-
-  private static final String EMPTY_STRING = "";
-
-  private StringWriter stringWriter = new StringWriter();
-
-  private JsonWriter underTest = JsonWriter.of(stringWriter);
-
-  @Test
-  public void empty_object() {
-    underTest.beginObject().endObject().close();
-    expect("{}");
-  }
-
-  @Test
-  public void empty_array() {
-    underTest.beginArray().endArray().close();
-    expect("[]");
-  }
-
-  @Test
-  public void stop_while_streaming() {
-    underTest.beginObject().name("foo").value("bar");
-    // endObject() and close() are missing
-    expect("{\"foo\":\"bar\"");
-  }
-
-  @Test
-  public void objects_and_arrays() {
-    underTest.beginObject().name("issues")
-      .beginArray()
-      .beginObject().prop("key", "ABC").endObject()
-      .beginObject().prop("key", "DEF").endObject()
-      .endArray()
-      .endObject().close();
-    expect("{\"issues\":[{\"key\":\"ABC\"},{\"key\":\"DEF\"}]}");
-  }
-
-  @Test
-  public void array_values() {
-    underTest.beginArray().values(Arrays.asList("foo", "bar", "baz")).endArray().close();
-    expect("[\"foo\",\"bar\",\"baz\"]");
-  }
-
-  @Test
-  public void type_of_values() {
-    Date date = DateUtils.parseDateTime("2010-05-18T15:50:45+0100");
-    underTest.beginObject()
-      .prop("aBoolean", true)
-      .prop("aInt", 123)
-      .prop("aLong", 1000L)
-      .prop("aDouble", 3.14)
-      .prop("aNumber", new AtomicInteger(123456789))
-      .prop("aString", "bar")
-      .propDate("aDate", date)
-      .endObject().close();
-    expect("{\"aBoolean\":true,\"aInt\":123,\"aLong\":1000,\"aDouble\":3.14,\"aNumber\":123456789,\"aString\":\"bar\",\"aDate\":\"2010-05-18\"}");
-  }
-
-  @Test
-  public void ignore_null_values_by_default() {
-    underTest.beginObject()
-      .prop("nullNumber", (Number) null)
-      .prop("nullString", (String) null)
-      .name("nullNumber").value((Number) null)
-      .name("nullString").value((String) null)
-      .name("nullDate").valueDate(null)
-      .name("nullDateTime").valueDate(null)
-      .endObject().close();
-    expect("{}");
-  }
-
-  @Test
-  public void serialize_null_values() {
-    underTest.setSerializeNulls(true);
-    underTest.beginObject()
-      .prop("nullNumber", (Number) null)
-      .prop("nullString", (String) null)
-      .name("nullNumber").value((Number) null)
-      .name("nullString").value((String) null)
-      .name("nullDate").valueDate(null)
-      .name("nullDateTime").valueDate(null)
-      .endObject().close();
-    expect("{\"nullNumber\":null,\"nullString\":null,\"nullNumber\":null,\"nullString\":null,\"nullDate\":null,\"nullDateTime\":null}");
-  }
-
-  @Test
-  public void serialize_empty_strings_by_default() {
-    underTest.beginObject()
-      .prop("emptyString", EMPTY_STRING)
-      .name("emptyStringAsObject").valueObject(EMPTY_STRING)
-      .endObject().close();
-    expect("{" +
-      "\"emptyString\":\"\"," +
-      "\"emptyStringAsObject\":\"\"" +
-      "}");
-  }
-
-  @Test
-  public void ignore_empty_strings_when_requested() {
-    underTest.setSerializeEmptys(false)
-      .beginObject()
-      .prop("emptyString", EMPTY_STRING)
-      .name("emptyStringAsObject").valueObject(EMPTY_STRING)
-      .endObject().close();
-    expect("{}");
-  }
-
-  @Test
-  public void escape_values() {
-    underTest.beginObject()
-      .prop("foo", "<hello \"world\">")
-      .endObject().close();
-    expect("{\"foo\":\"\\u003chello \\\"world\\\"\\u003e\"}");
-  }
-
-  @Test
-  public void escape_html_characters() {
-    underTest.beginObject()
-            .prop("foo", "123<>abc")
-            .endObject().close();
-    expect("{\"foo\":\"123\\u003c\\u003eabc\"}");
-  }
-
-  @Test
-  public void valueObject() {
-    underTest.beginObject()
-      .name("aString").valueObject("stringValue")
-      .name("aBoolean").valueObject(true)
-      .name("aInt").valueObject(42)
-      .name("aFloat").valueObject(3.14)
-      .name("aLong").valueObject(42L)
-      .name("aList").valueObject(Arrays.asList("one", 2, "three"))
-      .name("anEnum").valueObject(ColorEnum.GREEN)
-      .name("aMap").valueObject(ImmutableMap.of("hello", "world", "good", "bye"))
-      .endObject().close();
-    expect(
-      "{\"aString\":\"stringValue\",\"aBoolean\":true,\"aInt\":42,\"aFloat\":3.14,\"aLong\":42,\"aList\":[\"one\",2,\"three\"],\"anEnum\":\"GREEN\",\"aMap\":{\"hello\":\"world\",\"good\":\"bye\"}}");
-  }
-
-  @Test
-  public void valueObject_recursive() {
-    Map map = ImmutableMap.of("a", ImmutableMap.of("b", "c"));
-    underTest.valueObject(map).close();
-    expect("{\"a\":{\"b\":\"c\"}}");
-  }
-
-  @Test
-  public void valueObject_unsupported_type() {
-    try {
-      underTest.beginObject().valueObject(new StringWriter()).endObject().close();
-      fail();
-    } catch (IllegalArgumentException e) {
-      assertThat(e).hasMessage("class org.sonar.api.utils.text.JsonWriter does not support encoding of type: class java.io.StringWriter");
-    }
-  }
-
-  @Test
-  public void fail_on_NaN_value() {
-    assertThatThrownBy(() -> underTest.beginObject().prop("foo", Double.NaN).endObject().close())
-      .isInstanceOf(WriterException.class);
-  }
-
-  @Test
-  public void fail_if_not_valid() {
-    assertThatThrownBy(() -> underTest.beginObject().endArray().close())
-      .isInstanceOf(WriterException.class);
-  }
-
-  @Test
-  public void fail_to_begin_array() throws Exception {
-    com.google.gson.stream.JsonWriter gson = mock(com.google.gson.stream.JsonWriter.class);
-    when(gson.beginArray()).thenThrow(new IOException("the reason"));
-
-    assertThatThrownBy(() -> new JsonWriter(gson).beginArray())
-      .isInstanceOf(WriterException.class)
-      .hasMessage("Fail to write JSON");
-  }
-
-  private void expect(String s) {
-    assertThat(stringWriter.toString()).isEqualTo(s);
-  }
-
-  private enum ColorEnum {
-    RED, GREEN
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/text/XmlWriterTest.java
deleted file mode 100644 (file)
index e103662..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.utils.text;
-
-import java.io.StringWriter;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class XmlWriterTest {
-
-  StringWriter xml = new StringWriter();
-  XmlWriter writer = XmlWriter.of(xml);
-
-  private void expect(String s) {
-    assertThat(xml.toString()).isEqualTo(s);
-  }
-
-  @Test
-  public void declaration() {
-    writer.declaration().begin("foo").end().close();
-    expect("<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo></foo>");
-  }
-
-  @Test
-  public void end_with_unused_parameter() {
-    writer.begin("foo").end("foo").close();
-    expect("<foo></foo>");
-  }
-
-  @Test
-  public void only_root() {
-    writer.begin("foo").end().close();
-    expect("<foo></foo>");
-  }
-
-  @Test
-  public void escape_value() {
-    writer.prop("foo", "1<2 & 2>=2").close();
-    expect("<foo>1&lt;2 &amp; 2&gt;=2</foo>");
-  }
-
-  @Test
-  public void only_root_with_value() {
-    writer.prop("foo", "bar").close();
-    expect("<foo>bar</foo>");
-  }
-
-  @Test
-  public void ignore_null_values() {
-    writer.begin("root")
-      .prop("nullNumber", (Number) null)
-      .prop("nullString", (String) null)
-      .end().close();
-    expect("<root></root>");
-  }
-
-  @Test
-  public void fail_on_NaN_value() {
-    assertThatThrownBy(() -> writer.begin("root").prop("foo", Double.NaN).end().close())
-      .isInstanceOf(WriterException.class)
-      .hasMessage("Fail to write XML. Double value is not valid: NaN");
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/web/ServletFilterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/web/ServletFilterTest.java
deleted file mode 100644 (file)
index 1f21111..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-public class ServletFilterTest {
-
-  @Test
-  public void include_all() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.create("/*");
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/foo/ooo")).isTrue();
-
-    assertThat(pattern.getInclusions()).containsOnly("/*");
-    assertThat(pattern.getExclusions()).isEmpty();
-  }
-
-  @Test
-  public void include_end_of_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.create("*foo");
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/hello/foo")).isTrue();
-    assertThat(pattern.matches("/hello/bar")).isFalse();
-    assertThat(pattern.matches("/foo")).isTrue();
-    assertThat(pattern.matches("/foo2")).isFalse();
-  }
-
-  @Test
-  public void include_beginning_of_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.create("/foo/*");
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo")).isTrue();
-    assertThat(pattern.matches("/foo/bar")).isTrue();
-    assertThat(pattern.matches("/bar")).isFalse();
-  }
-
-  @Test
-  public void include_exact_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.create("/foo");
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo")).isTrue();
-    assertThat(pattern.matches("/foo/")).isFalse();
-    assertThat(pattern.matches("/bar")).isFalse();
-  }
-
-  @Test
-  public void exclude_all() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes("/*")
-      .build();
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo/ooo")).isFalse();
-  }
-
-  @Test
-  public void exclude_end_of_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes("*foo")
-      .build();
-
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/hello/foo")).isFalse();
-    assertThat(pattern.matches("/hello/bar")).isTrue();
-    assertThat(pattern.matches("/foo")).isFalse();
-    assertThat(pattern.matches("/foo2")).isTrue();
-  }
-
-  @Test
-  public void exclude_beginning_of_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes("/foo/*")
-      .build();
-
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/foo")).isFalse();
-    assertThat(pattern.matches("/foo/bar")).isFalse();
-    assertThat(pattern.matches("/bar")).isTrue();
-  }
-
-  @Test
-  public void exclude_exact_url() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes("/foo")
-      .build();
-
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/foo")).isFalse();
-    assertThat(pattern.matches("/foo/")).isTrue();
-    assertThat(pattern.matches("/bar")).isTrue();
-  }
-
-  @Test
-  public void use_multiple_include_patterns() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .includes("/foo", "/foo2")
-      .build();
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo")).isTrue();
-    assertThat(pattern.matches("/foo2")).isTrue();
-    assertThat(pattern.matches("/foo/")).isFalse();
-    assertThat(pattern.matches("/bar")).isFalse();
-  }
-
-  @Test
-  public void use_multiple_exclude_patterns() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes("/foo", "/foo2")
-      .build();
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/foo")).isFalse();
-    assertThat(pattern.matches("/foo2")).isFalse();
-    assertThat(pattern.matches("/foo/")).isTrue();
-    assertThat(pattern.matches("/bar")).isTrue();
-  }
-
-  @Test
-  public void use_include_and_exclude_patterns() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .includes("/foo/*", "/foo/lo*")
-      .excludes("/foo/login", "/foo/logout", "/foo/list")
-      .build();
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo")).isTrue();
-    assertThat(pattern.matches("/foo/login")).isFalse();
-    assertThat(pattern.matches("/foo/logout")).isFalse();
-    assertThat(pattern.matches("/foo/list")).isFalse();
-    assertThat(pattern.matches("/foo/locale")).isTrue();
-    assertThat(pattern.matches("/foo/index")).isTrue();
-  }
-
-  @Test
-  public void use_include_and_exclude_prefix() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .includes("/foo_2")
-      .excludes("/foo")
-      .build();
-    assertThat(pattern.matches("/")).isFalse();
-    assertThat(pattern.matches("/foo_2")).isTrue();
-    assertThat(pattern.matches("/foo")).isFalse();
-  }
-
-  @Test
-  public void exclude_pattern_has_higher_priority_than_include_pattern() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .includes("/foo")
-      .excludes("/foo")
-      .build();
-    assertThat(pattern.matches("/foo")).isFalse();
-  }
-
-  @Test
-  public void accept_empty_patterns() {
-    ServletFilter.UrlPattern pattern = ServletFilter.UrlPattern.builder()
-      .excludes()
-      .includes()
-      .build();
-    assertThat(pattern.matches("/")).isTrue();
-    assertThat(pattern.matches("/foo/bar")).isTrue();
-  }
-
-  @Test
-  public void create_throws_IAE_if_empty_url() {
-    assertThatThrownBy(() -> ServletFilter.UrlPattern.create(""))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("URL pattern must start with slash '/': ");
-  }
-
-  @Test
-  public void filter_should_return_url_pattern() {
-    ServletFilter filter = new FakeFilter();
-    assertThat(filter.doGetPattern()).isNotNull();
-  }
-
-  @Test
-  public void filter_should_apply_to_all_urls_by_default() {
-    ServletFilter filter = new DefaultFilter();
-    assertThat(filter.doGetPattern().matches("/")).isTrue();
-    assertThat(filter.doGetPattern().matches("/foo/bar")).isTrue();
-  }
-
-  @Test
-  public void getUrl_returns_single_inclusion() {
-    assertThat(ServletFilter.UrlPattern.create("/*").getInclusions()).containsOnly("/*");
-    assertThat(ServletFilter.UrlPattern.create("/foo/bar").getInclusions()).containsOnly("/foo/bar");
-  }
-
-  @Test
-  public void test_staticResourcePatterns() {
-    assertThat(ServletFilter.UrlPattern.Builder.staticResourcePatterns()).containsOnly(
-      "*.css",
-      "*.css.map",
-      "*.ico",
-      "*.png",
-      "*.jpg",
-      "*.jpeg",
-      "*.gif",
-      "*.svg",
-      "*.js",
-      "*.js.map",
-      "*.pdf",
-      "/json/*",
-      "/static/*",
-      "/robots.txt",
-      "/favicon.ico",
-      "/apple-touch-icon*",
-      "/mstile*");
-  }
-
-  @Test
-  public void test_label() {
-    assertThat(ServletFilter.UrlPattern.builder().build().label()).isEqualTo("UrlPattern{inclusions=[], exclusions=[]}");
-    assertThat(ServletFilter.UrlPattern.builder()
-      .includes("/foo/*")
-      .excludes("/foo/login")
-      .build().label()).isEqualTo("UrlPattern{inclusions=[/foo/*], exclusions=[/foo/login]}");
-    assertThat(ServletFilter.UrlPattern.builder()
-      .includes("/foo/*", "/foo/lo*")
-      .excludes("/foo/login", "/foo/logout", "/foo/list")
-      .build().label()).isEqualTo("UrlPattern{inclusions=[/foo/*, ...], exclusions=[/foo/login, ...]}");
-  }
-
-  private static class FakeFilter extends ServletFilter {
-    @Override
-    public UrlPattern doGetPattern() {
-      return UrlPattern.create("/fake");
-    }
-
-    public void init(FilterConfig filterConfig) {
-    }
-
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
-    }
-
-    public void destroy() {
-    }
-  }
-
-  private static class DefaultFilter extends ServletFilter {
-    public void init(FilterConfig filterConfig) {
-    }
-
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
-    }
-
-    public void destroy() {
-    }
-  }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/web/page/ContextTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/web/page/ContextTest.java
deleted file mode 100644 (file)
index f8348e3..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import java.util.Collection;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.assertj.core.api.Assertions.tuple;
-
-public class ContextTest {
-
-  private Context underTest = new Context();
-
-  private Page page = Page.builder("governance/project_export").setName("Project Export").build();
-
-  @Test
-  public void no_pages_with_the_same_path() {
-    underTest.addPage(page);
-
-    assertThatThrownBy(() -> underTest.addPage(page))
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Page 'Project Export' cannot be loaded. Another page with key 'governance/project_export' already exists.");
-  }
-
-  @Test
-  public void ordered_by_name() {
-    underTest
-      .addPage(Page.builder("fake/K1").setName("N2").build())
-      .addPage(Page.builder("fake/K2").setName("N3").build())
-      .addPage(Page.builder("fake/K3").setName("N1").build());
-
-    Collection<Page> result = underTest.getPages();
-
-    assertThat(result).extracting(Page::getKey, Page::getName)
-      .containsOnly(
-        tuple("fake/K3", "N1"),
-        tuple("fake/K1", "N2"),
-        tuple("fake/K2", "N3"));
-  }
-
-  @Test
-  public void empty_pages_by_default() {
-    Collection<Page> result = underTest.getPages();
-
-    assertThat(result).isEmpty();
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageDefinitionTest.java
deleted file mode 100644 (file)
index e9eee54..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Used for the documentation
- */
-public class PageDefinitionTest {
-  @Test
-  public void test_page_definition() {
-    PageDefinition underTest = context -> context.addPage(Page.builder("my_plugin/my_page").setName("My Page").build());
-    Context context = new Context();
-
-    underTest.define(context);
-
-    assertThat(context.getPages()).extracting(Page::getKey).contains("my_plugin/my_page");
-  }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/web/page/PageTest.java
deleted file mode 100644 (file)
index 68c03fe..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2022 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.web.page;
-
-import org.junit.Test;
-import org.sonar.api.resources.Qualifiers;
-import org.sonar.api.web.page.Page.Qualifier;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.sonar.api.web.page.Page.Qualifier.APP;
-import static org.sonar.api.web.page.Page.Qualifier.MODULE;
-import static org.sonar.api.web.page.Page.Qualifier.PROJECT;
-import static org.sonar.api.web.page.Page.Qualifier.SUB_VIEW;
-import static org.sonar.api.web.page.Page.Qualifier.VIEW;
-import static org.sonar.api.web.page.Page.Scope.COMPONENT;
-import static org.sonar.api.web.page.Page.Scope.GLOBAL;
-
-public class PageTest {
-
-  private Page.Builder underTest = Page.builder("governance/project_dump").setName("Project Dump");
-
-  @Test
-  public void full_test() {
-    Page result = underTest
-      .setComponentQualifiers(PROJECT, MODULE)
-      .setScope(COMPONENT)
-      .setAdmin(true)
-      .build();
-
-    assertThat(result.getKey()).isEqualTo("governance/project_dump");
-    assertThat(result.getPluginKey()).isEqualTo("governance");
-    assertThat(result.getName()).isEqualTo("Project Dump");
-    assertThat(result.getComponentQualifiers()).containsOnly(PROJECT, MODULE);
-    assertThat(result.getScope()).isEqualTo(COMPONENT);
-    assertThat(result.isAdmin()).isTrue();
-  }
-
-  @Test
-  public void qualifiers_map_to_key() {
-    assertThat(Qualifier.PROJECT.getKey()).isEqualTo(org.sonar.api.resources.Qualifiers.PROJECT);
-    assertThat(Qualifier.MODULE.getKey()).isEqualTo(org.sonar.api.resources.Qualifiers.MODULE);
-    assertThat(Qualifier.VIEW.getKey()).isEqualTo(org.sonar.api.resources.Qualifiers.VIEW);
-    assertThat(Qualifier.APP.getKey()).isEqualTo(org.sonar.api.resources.Qualifiers.APP);
-    assertThat(Qualifier.SUB_VIEW.getKey()).isEqualTo(org.sonar.api.resources.Qualifiers.SUBVIEW);
-  }
-
-  @Test
-  public void authorized_qualifiers() {
-    Qualifier[] qualifiers = Qualifier.values();
-
-    assertThat(qualifiers).containsExactlyInAnyOrder(PROJECT, MODULE, VIEW, SUB_VIEW, APP);
-  }
-
-  @Test
-  public void default_values() {
-    Page result = underTest.build();
-
-    assertThat(result.getComponentQualifiers()).isEmpty();
-    assertThat(result.getScope()).isEqualTo(GLOBAL);
-    assertThat(result.isAdmin()).isFalse();
-  }
-
-  @Test
-  public void all_qualifiers_when_component_page() {
-    Page result = underTest.setScope(COMPONENT).build();
-
-    assertThat(result.getComponentQualifiers()).containsOnly(Qualifier.values());
-  }
-
-  @Test
-  public void qualifiers_from_key() {
-    assertThat(Qualifier.fromKey(Qualifiers.PROJECT)).isEqualTo(Qualifier.PROJECT);
-    assertThat(Qualifier.fromKey("42")).isNull();
-  }
-
-  @Test
-  public void fail_if_null_qualifiers() {
-    assertThatThrownBy(() -> underTest.setComponentQualifiers((Qualifier[])null).build())
-      .isInstanceOf(NullPointerException.class);
-  }
-
-  @Test
-  public void fail_if_a_page_has_a_null_key() {
-    assertThatThrownBy(() -> Page.builder(null).setName("Say my name").build())
-      .isInstanceOf(NullPointerException.class);
-  }
-
-  @Test
-  public void fail_if_a_page_has_an_empty_key() {
-    assertThatThrownBy(() -> Page.builder("").setName("Say my name").build())
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_a_page_has_a_null_name() {
-    assertThatThrownBy(() -> Page.builder("governance/project_dump").build())
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_a_page_has_an_empty_name() {
-    assertThatThrownBy(() -> Page.builder("governance/project_dump").setName("").build())
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_qualifiers_without_scope() {
-    assertThatThrownBy(() -> underTest.setComponentQualifiers(PROJECT).build())
-      .isInstanceOf(IllegalArgumentException.class);
-  }
-
-  @Test
-  public void fail_if_key_does_not_contain_a_slash() {
-    assertThatThrownBy(() -> Page.builder("project_dump").setName("Project Dump").build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Page key [project_dump] is not valid. It must contain a single slash, for example my_plugin/my_page.");
-  }
-
-  @Test
-  public void fail_if_key_contains_more_than_one_slash() {
-    assertThatThrownBy(() -> Page.builder("governance/project/dump").setName("Project Dump").build())
-      .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Page key [governance/project/dump] is not valid. It must contain a single slash, for example my_plugin/my_page.");
-  }
-}
diff --git a/sonar-plugin-api/src/test/resources/META-INF/MANIFEST.MF b/sonar-plugin-api/src/test/resources/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index ce807b4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Archiver-Version: Plexus Archiver
-Created-By: Apache Maven
-Built-By: Sonar
-Build-Jdk: 1.5.0_09
-Plugin-Class: org.sonar.api.FakePlugin
diff --git a/sonar-plugin-api/src/test/resources/logback-test.xml b/sonar-plugin-api/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index e6a726d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<configuration debug="false">
-  <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
-
-  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-      <pattern>
-        [%d{yyyy.MM.dd HH:mm:ss}][%logger{15}][%-5level] %msg%n
-      </pattern>
-    </encoder>
-  </appender>
-
-  <root>
-    <level value="INFO"/>
-    <appender-ref ref="CONSOLE"/>
-  </root>
-
-  <logger name="ch.qos.logback">
-    <level value="WARN"/>
-  </logger>
-
-</configuration>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/getConfigurationFromReport.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/getConfigurationFromReport.xml
deleted file mode 100644 (file)
index 25bb3a6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>mygroup</groupId>
-        <artifactId>my.artifact</artifactId>
-        <version>0.9</version>
-        <configuration>
-          <foo>bar</foo>
-        </configuration>
-      </plugin>
-    </plugins>
-  </reporting>
-
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginDependencies.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginDependencies.xml
deleted file mode 100644 (file)
index fd83ec2..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>mygroup</groupId>
-        <artifactId>my.artifact</artifactId>
-        <version>0.9</version>
-        <dependencies>
-          <dependency>
-            <artifactId>commons-lang</artifactId>
-            <version>2.3</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginManagementDependencies.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/keepPluginManagementDependencies.xml
deleted file mode 100644 (file)
index 1e5250a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>mygroup</groupId>
-          <artifactId>my.artifact</artifactId>
-          <version>0.9</version>
-          <dependencies>
-            <dependency>
-              <artifactId>commons-lang</artifactId>
-              <version>2.3</version>
-            </dependency>
-          </dependencies>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/mergeSettings.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/mergeSettings.xml
deleted file mode 100644 (file)
index 4e06eed..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>mygroup</groupId>
-          <artifactId>my.artifact</artifactId>
-          <version>0.9</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-
-    <plugins>
-      <plugin>
-        <groupId>mygroup</groupId>
-        <artifactId>my.artifact</artifactId>
-        <configuration>
-          <foo>bar</foo>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overridePluginManagementSection.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overridePluginManagementSection.xml
deleted file mode 100644 (file)
index b062772..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>other</groupId>
-          <artifactId>my.artifact</artifactId>
-          <version>2.0</version>
-        </plugin>
-        <plugin>
-          <groupId>mygroup</groupId>
-          <artifactId>my.artifact</artifactId>
-          <version>0.9</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersion.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersion.xml
deleted file mode 100644 (file)
index 53187e0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-
-    <plugins>
-      <plugin>
-        <groupId>mygroup</groupId>
-        <artifactId>my.artifact</artifactId>
-        <version>0.9</version>
-        <configuration>
-          <foo>bar</foo>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersionFromPluginManagement.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/overrideVersionFromPluginManagement.xml
deleted file mode 100644 (file)
index 4e06eed..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>mygroup</groupId>
-          <artifactId>my.artifact</artifactId>
-          <version>0.9</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-
-    <plugins>
-      <plugin>
-        <groupId>mygroup</groupId>
-        <artifactId>my.artifact</artifactId>
-        <configuration>
-          <foo>bar</foo>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/registerNewPlugin.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPluginTest/registerNewPlugin.xml
deleted file mode 100644 (file)
index 5ea792e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPom.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPom.xml
deleted file mode 100644 (file)
index 8da37df..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.2-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>ch.hortis.sonar</groupId>
-        <artifactId>sonar-core-maven-plugin</artifactId>
-        <version>0.1.1</version>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.4</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomPM.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomPM.xml
deleted file mode 100644 (file)
index 77ce90d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.2-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>ch.hortis.sonar</groupId>
-          <artifactId>sonar-core-maven-plugin</artifactId>
-          <version>0.1.1</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <configuration>
-            <source>1.4</source>
-            <target>1.5</target>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomWithSourceEncoding.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenPomWithSourceEncoding.xml
deleted file mode 100644 (file)
index 3106fec..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.2-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.4</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <properties>
-    <project.build.sourceEncoding>UTF-16</project.build.sourceEncoding>
-  </properties>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenSurefireUtilsTest/MavenPom.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenSurefireUtilsTest/MavenPom.xml
deleted file mode 100644 (file)
index 15defb7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>foo</groupId>
-  <artifactId>bar</artifactId>
-  <version>0.2-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.4</source>
-          <target>1.5</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersion.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersion.xml
deleted file mode 100644 (file)
index 3949daf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.sonar.tests</groupId>
-  <artifactId>java4</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>Sonar tests - java4 syntax</name>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.4</source>
-          <target>1.4</target>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersionFromPluginManagement.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/batch/maven/MavenUtilsTest/getJavaVersionFromPluginManagement.xml
deleted file mode 100644 (file)
index e03f53f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.sonar.tests</groupId>
-  <artifactId>java4</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>Sonar tests - java4 syntax</name>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <configuration>
-            <source>1.4</source>
-            <target>1.4</target>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-
-  </build>
-</project>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfile.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfile.xml
deleted file mode 100644 (file)
index 772e980..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>CRITICAL</priority>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithRuleParameters.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithRuleParameters.xml
deleted file mode 100644 (file)
index 6df8c00..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>BLOCKER</priority>
-      <parameters>
-        <parameter>
-          <key>format</key>
-          <value>foo</value>
-        </parameter>
-        <parameter>
-          <key>message</key>
-          <value>with special characters &lt; &gt; &amp;</value>
-        </parameter>
-      </parameters>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithUnknownRuleParameter.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/importProfileWithUnknownRuleParameter.xml
deleted file mode 100644 (file)
index 4eea58f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>BLOCKER</priority>
-      <parameters>
-        <parameter>
-          <key>unknown</key>
-          <value>foo</value>
-        </parameter>
-      </parameters>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/nameAndLanguageShouldBeMandatory.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileParserTest/nameAndLanguageShouldBeMandatory.xml
deleted file mode 100644 (file)
index 4a58443..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>CRITICAL</priority>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportEmptyProfile.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportEmptyProfile.xml
deleted file mode 100644 (file)
index 351657f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportProfile.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportProfile.xml
deleted file mode 100644 (file)
index 70366f0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>BLOCKER</priority>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportRuleParameters.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/profiles/XMLProfileSerializerTest/exportRuleParameters.xml
deleted file mode 100644 (file)
index 6df8c00..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated by SonarQube -->
-<profile>
-  <name>sonar way</name>
-  <language>java</language>
-  <rules>
-    <rule>
-      <repositoryKey>checkstyle</repositoryKey>
-      <key>IllegalRegexp</key>
-      <priority>BLOCKER</priority>
-      <parameters>
-        <parameter>
-          <key>format</key>
-          <value>foo</value>
-        </parameter>
-        <parameter>
-          <key>message</key>
-          <value>with special characters &lt; &gt; &amp;</value>
-        </parameter>
-      </parameters>
-    </rule>
-  </rules>
-</profile>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.html b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.html
deleted file mode 100644 (file)
index 86c3693..0000000
+++ /dev/null
@@ -1 +0,0 @@
-description of rule loaded from file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.md b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.md
deleted file mode 100644 (file)
index 86c3693..0000000
+++ /dev/null
@@ -1 +0,0 @@
-description of rule loaded from file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/deprecated.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/deprecated.xml
deleted file mode 100644 (file)
index 2938ea7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<rules>
-  <rule key="org.sonar.it.checkstyle.MethodsCountCheck" priority="CRITICAL">
-    <name>Methods Count Check</name>
-    <configKey>Checker/TreeWalker/org.sonar.it.checkstyle.MethodsCountCheck</configKey>
-    <description>Count methods</description>
-    <param key="minMethodsCount" type="i">
-      <description>description of param</description>
-    </param>
-  </rule>
-</rules>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/invalid.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/invalid.xml
deleted file mode 100644 (file)
index de3d00c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<rules>
-  <rule>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/rules.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/rules.xml
deleted file mode 100644 (file)
index 05c3084..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<rules>
-  <rule>
-    <!-- with exhaustive fields -->
-    <key>complete</key>
-    <name>Complete</name>
-    <description>
-      <![CDATA[Description of Complete]]>
-    </description>
-    <internalKey>Checker/TreeWalker/LocalVariableName</internalKey>
-    <severity>BLOCKER</severity>
-    <cardinality>MULTIPLE</cardinality>
-    <status>BETA</status>
-    <type>BUG</type>
-    <tag>misra</tag>
-    <tag>spring</tag>
-    <param>
-      <key>tokens</key>
-      <description>
-        <![CDATA[
-          Controls whether the check applies to variable declarations or catch clause parameters
-          ]]>
-      </description>
-    </param>
-    <param>
-      <key>ignore</key>
-      <description>
-        Ignore ?
-      </description>
-      <defaultValue>false</defaultValue>
-    </param>
-  </rule>
-
-
-  <rule>
-    <!-- with only required fields -->
-    <key>minimal</key>
-    <name>Minimal</name>
-    <description>
-      <![CDATA[Description of Minimal]]>
-    </description>
-  </rule>
-</rules>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8-with-bom.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8-with-bom.xml
deleted file mode 100644 (file)
index 0c0b5c8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<rules>
-  <rule>
-    <key>com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck</key>
-    <priority>BLOCKER</priority>
-    <configKey>Checker/TreeWalker/LocalVariableName</configKey>
-    <name>M &amp; M</name>
-    <description>
-      <![CDATA[éà&]]>
-    </description>
-  </rule>
-</rules>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8.xml
deleted file mode 100644 (file)
index 6197e03..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<rules>
-  <rule>
-    <key>com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck</key>
-    <priority>BLOCKER</priority>
-    <configKey>Checker/TreeWalker/LocalVariableName</configKey>
-    <name>M &amp; M</name>
-    <description>
-      <![CDATA[éà&]]>
-    </description>
-  </rule>
-</rules>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/server/ws/WebServiceTest/response-example.txt b/sonar-plugin-api/src/test/resources/org/sonar/api/server/ws/WebServiceTest/response-example.txt
deleted file mode 100644 (file)
index 21c78dd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-example of WS response
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-dtd-test.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-dtd-test.xml
deleted file mode 100644 (file)
index 7e643b8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE test SYSTEM "http://com.foo.bar/fake.dtd">
-<test>
-  <another-test/>
-</test>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-xsd-test.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/StaxParserTest/xml-xsd-test.xml
deleted file mode 100644 (file)
index 69f7f0e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<test xmlns="http://www.test.org"
-      xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
-      xsi:schemaLocation="http://www.test.org http://foo.bar.org/test.xsd">
-  <another-test/>
-</test>
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/UriReaderTest/foo.txt b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/UriReaderTest/foo.txt
deleted file mode 100644 (file)
index be36d7b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-in foo
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/sample.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/sample.xml
deleted file mode 100644 (file)
index 84ad412..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<samples>
-  <sample id="1" name="one">
-    <foo>bar</foo>
-  </sample>
-
-  <sample id="2" name="two">
-    <foo>toto</foo>
-  </sample>
-</samples>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/unvalid.xml b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/XpathParserTest/unvalid.xml
deleted file mode 100644 (file)
index 148118c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<samples>
-  <sample  not valid
-</samples>
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip
deleted file mode 100644 (file)
index a540bc5..0000000
Binary files a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip and /dev/null differ
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/bar.txt b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/bar.txt
deleted file mode 100644 (file)
index 164ff71..0000000
+++ /dev/null
@@ -1 +0,0 @@
-barrrrrrrrr
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/dir1/hello.properties b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/dir1/hello.properties
deleted file mode 100644 (file)
index 1c6a1a9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-a=b
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt
deleted file mode 100644 (file)
index 4c29018..0000000
+++ /dev/null
@@ -1 +0,0 @@
-fooooooooooo
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip b/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip
deleted file mode 100644 (file)
index 38b3f49..0000000
Binary files a/sonar-plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip and /dev/null differ
diff --git a/sonar-plugin-api/src/test/resources/org/sonar/api/web/AbstractRubyTemplateTest/template.erb b/sonar-plugin-api/src/test/resources/org/sonar/api/web/AbstractRubyTemplateTest/template.erb
deleted file mode 100644 (file)
index b5754e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ok
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo.properties b/sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo.properties
deleted file mode 100644 (file)
index 7669c6d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-foo.hello=Hello
-foo.world=World
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo_es.properties b/sonar-plugin-api/src/test/resources/sonar/bundles/PluginFoo_es.properties
deleted file mode 100644 (file)
index 61318fa..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-foo.hello=Hola
-foo.world=Mundo
-only.in.spanish=bueno
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/sonar/bundles/Test.properties b/sonar-plugin-api/src/test/resources/sonar/bundles/Test.properties
deleted file mode 100644 (file)
index e707685..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-test.one=One
-test.two=Two
-with.string.params=Continuous %1$s will %2$s !
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/resources/sonar/bundles/Test_fr.properties b/sonar-plugin-api/src/test/resources/sonar/bundles/Test_fr.properties
deleted file mode 100644 (file)
index 4765adc..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-test.one=Un
-test.two=Deux
\ No newline at end of file
diff --git a/sonar-plugin-api/src/test/scripts/echo.bat b/sonar-plugin-api/src/test/scripts/echo.bat
deleted file mode 100755 (executable)
index 6622b99..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@ECHO OFF
-@ECHO %CD% > echo.log
-@ECHO Parameter: %1 >> echo.log
-@ECHO Environment variable: %ENVVAR% >> echo.log
diff --git a/sonar-plugin-api/src/test/scripts/echo.sh b/sonar-plugin-api/src/test/scripts/echo.sh
deleted file mode 100755 (executable)
index 8931fd8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-WORKING_DIR=`pwd`
-echo $WORKING_DIR > echo.log
-echo "Parameter: $1" >> echo.log
-echo "Environment variable: $ENVVAR" >> echo.log
diff --git a/sonar-plugin-api/src/test/scripts/forever.bat b/sonar-plugin-api/src/test/scripts/forever.bat
deleted file mode 100755 (executable)
index a7d9218..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-@ECHO OFF
-
-:LOOP
-  @rem Next line may lead to freeze of build process on Windows 7 due to non-terminated ping-processes
-  @rem ping 1.1.1.1 -n 2 -w 60000 > nul
-GOTO LOOP
diff --git a/sonar-plugin-api/src/test/scripts/forever.sh b/sonar-plugin-api/src/test/scripts/forever.sh
deleted file mode 100755 (executable)
index b055254..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-while test "notempty"
-do
-  sleep 5s
-done
diff --git a/sonar-plugin-api/src/test/scripts/output.bat b/sonar-plugin-api/src/test/scripts/output.bat
deleted file mode 100755 (executable)
index 967bc60..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-@ECHO OFF
-@ECHO stdOut: first line
-@ECHO stdOut: second line
-@ECHO stdErr: first line 1>&2
-@ECHO stdErr: second line 1>&2
diff --git a/sonar-plugin-api/src/test/scripts/output.sh b/sonar-plugin-api/src/test/scripts/output.sh
deleted file mode 100755 (executable)
index cbb0fea..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-echo stdOut: first line
-echo stdOut: second line
-echo stdErr: first line 1>&2
-echo stdErr: second line 1>&2
diff --git a/sonar-plugin-api/test-resources/README.txt b/sonar-plugin-api/test-resources/README.txt
deleted file mode 100644 (file)
index 3f09e62..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory is a workaround for opening the project into Intellij Idea.
-Indeed it tries to compile Java sources found in src/test/resources, and fail because of syntax errors or specific encoding.
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/.gitignore b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/.gitignore
deleted file mode 100644 (file)
index ecbefd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-.sonar
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/sonar-project.properties b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/sonar-project.properties
deleted file mode 100644 (file)
index 50adabc..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=0.1-SNAPSHOT
-sonar.sources=xources
-sonar.tests=testx
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/testx b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/testx
deleted file mode 120000 (symlink)
index 7385ebd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../sample/testx/
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/xources b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample-with-symlink/xources
deleted file mode 120000 (symlink)
index 15dca9d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../sample/xources/
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/sonar-project.properties b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/sonar-project.properties
deleted file mode 100644 (file)
index 50adabc..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-sonar.projectKey=sample
-sonar.projectName=Sample
-sonar.projectVersion=0.1-SNAPSHOT
-sonar.sources=xources
-sonar.tests=testx
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo
deleted file mode 100644 (file)
index 8c0967e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.sonar.tests;
-
-import org.junit.Test;
-
-public class ClassOneTest  {
-
-  @Test
-  public void nothing() {
-
-  }
-}
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.measures b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.measures
deleted file mode 100644 (file)
index 23b08dc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-lines:11
-ncloc:7
-tests:1
-test_execution_time:1
-skipped_tests:0
-test_errors:0
-test_failures:0
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.scm b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/testx/ClassOneTest.xoo.scm
deleted file mode 100644 (file)
index 2cec35b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-1,user1,2013-01-04
-1,user1,2013-01-04
-1,user1,2013-01-04
-1,user1,2013-01-04
-2,user2,2013-01-05
-2,user2,2013-01-05
-3,user3,2013-01-06
-4,user4,2013-01-07
-4,user4,2013-01-07
-4,user4,2013-01-07
-4,user4,2013-01-07
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo
deleted file mode 100644 (file)
index 1d9c60d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-package hello;
-
-public class HelloJava {
-
-  public static void main(String[] args) {
-    System.out.println("Hello");
-  }
-}
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.measures b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.measures
deleted file mode 100644 (file)
index 9eaf8ba..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ncloc:3
-complexity:1
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.scm b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/HelloJava.xoo.scm
deleted file mode 100644 (file)
index 03a9de2..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-1,user1,2013-01-04
-1,user1,2013-01-04
-1,user1,2013-01-04
-1,user1,2013-01-04
-2,user2,2013-01-05
-2,user2,2013-01-05
-3,user3,2013-01-06
-4,user4,2013-01-07
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo
deleted file mode 100644 (file)
index 53cb085..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-  object HelloWorld {
-    def main(args: Array[String]) {
-      println("Hello, world of xoo!")
-    }
-  }
-  
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo.measures b/sonar-plugin-api/test-resources/org/sonar/api/filesystem/sample/xources/hello/helloscala.xoo.measures
deleted file mode 100644 (file)
index d2c8386..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ncloc:5
-complexity:2
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.dirPrefixedWithDot/Excluded.java b/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.dirPrefixedWithDot/Excluded.java
deleted file mode 100644 (file)
index 9578920..0000000
+++ /dev/null
@@ -1 +0,0 @@
-public class Excluded2 {}
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.sonar/Excluded2.java b/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/.sonar/Excluded2.java
deleted file mode 100644 (file)
index 9578920..0000000
+++ /dev/null
@@ -1 +0,0 @@
-public class Excluded2 {}
\ No newline at end of file
diff --git a/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/sonar/Included.java b/sonar-plugin-api/test-resources/org/sonar/api/resources/DefaultProjectFileSystemTest/shouldExcludeDirectoriesStartingWithDot/src/org/sonar/Included.java
deleted file mode 100644 (file)
index ec5235a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-package org.sonar;
-
-public class Included {}