diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-06-06 16:20:22 -0500 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-06-11 20:21:13 +0200 |
commit | fd0b1a9c43ff7e50d3b817cb0f0359b6db4c6206 (patch) | |
tree | fb57039409ac46c226c9b226dc2cc782170df646 /server/sonar-server | |
parent | a3adc270aa0db9453d2020b21076aef3df79c4e8 (diff) | |
download | sonarqube-fd0b1a9c43ff7e50d3b817cb0f0359b6db4c6206.tar.gz sonarqube-fd0b1a9c43ff7e50d3b817cb0f0359b6db4c6206.zip |
SONAR-11027 Fix the documentation of api/qualityprofiles/inheritance
Diffstat (limited to 'server/sonar-server')
4 files changed, 17 insertions, 15 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java index df95810a658..4f14e909639 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileReference.java @@ -42,8 +42,8 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters. * Reference to a Quality profile as defined by requests to web services api/qualityprofiles. * The two exclusive options to reference a profile are: * <ul> - * <li>by its id (to be deprecated)</li> - * <li>by the tuple {organizationKey, language, name}</li> + * <li>by its id (to be deprecated)</li> + * <li>by the tuple {organizationKey, language, name}</li> * </ul> */ public class QProfileReference { @@ -75,8 +75,8 @@ public class QProfileReference { /** * @return {@code true} if key is defined and {@link #getKey()} can be called. If {@code false}, then - * the couple {language, name} is defined and the methods {@link #getLanguage()}/{@link #getName()} - * can be called. + * the couple {language, name} is defined and the methods {@link #getLanguage()}/{@link #getName()} + * can be called. */ public boolean hasKey() { return type == Type.KEY; @@ -159,10 +159,12 @@ public class QProfileReference { public static QProfileReference from(@Nullable String key, @Nullable String organizationKey, @Nullable String lang, @Nullable String name) { if (key != null) { - checkArgument(isEmpty(organizationKey) && isEmpty(lang) && isEmpty(name), "When providing a quality profile key, neither of organization/language/name must be set"); + checkArgument(isEmpty(organizationKey) && isEmpty(lang) && isEmpty(name), + "When a quality profile key is set, '%s' '%s' and '%s' can't be set", PARAM_ORGANIZATION, PARAM_LANGUAGE, PARAM_QUALITY_PROFILE); return fromKey(key); } - checkArgument(!isEmpty(lang) && !isEmpty(name), "If no quality profile key is specified, language and name must be set"); + checkArgument(!isEmpty(lang) && !isEmpty(name), + "If '%s' is not specified, '%s' and '%s' must be set", PARAM_KEY, PARAM_QUALITY_PROFILE, PARAM_LANGUAGE); return fromName(organizationKey, lang, name); } @@ -176,18 +178,18 @@ public class QProfileReference { public static void defineParams(WebService.NewAction action, Languages languages) { action.createParam(PARAM_KEY) - .setDescription("Quality profile key") + .setDescription("Quality profile key. Mandatory unless 'qualityProfile' and 'language' are specified.") .setDeprecatedKey("profileKey", "6.5") .setDeprecatedSince("6.6") .setExampleValue(UUID_EXAMPLE_01); action.createParam(PARAM_QUALITY_PROFILE) - .setDescription("Quality profile name") + .setDescription("Quality profile name. Mandatory if 'key' is not set.") .setDeprecatedKey("profileName", "6.6") .setExampleValue("Sonar way"); action.createParam(PARAM_LANGUAGE) - .setDescription("Quality profile language") + .setDescription("Quality profile language. Mandatory if 'key' is not set.") .setPossibleValues(Arrays.stream(languages.all()).map(Language::getKey).collect(MoreCollectors.toSet())); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java index 48cdeca47ff..2b68cec4651 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/DeleteActionTest.java @@ -204,7 +204,7 @@ public class DeleteActionTest { userSession.logIn(); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("If no quality profile key is specified, language and name must be set"); + expectedException.expectMessage("If 'key' is not specified, 'qualityProfile' and 'language' must be set"); ws.newRequest() .setMethod("POST") @@ -218,7 +218,7 @@ public class DeleteActionTest { logInAsQProfileAdministrator(organization); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("If no quality profile key is specified, language and name must be set"); + expectedException.expectMessage("If 'key' is not specified, 'qualityProfile' and 'language' must be set"); ws.newRequest() .setMethod("POST") @@ -234,7 +234,7 @@ public class DeleteActionTest { logInAsQProfileAdministrator(organization); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("If no quality profile key is specified, language and name must be set"); + expectedException.expectMessage("If 'key' is not specified, 'qualityProfile' and 'language' must be set"); ws.newRequest() .setMethod("POST") @@ -250,7 +250,7 @@ public class DeleteActionTest { logInAsQProfileAdministrator(organization); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("When providing a quality profile key, neither of organization/language/name must be set"); + expectedException.expectMessage("When a quality profile key is set, 'organization' 'language' and 'qualityProfile' can't be set"); ws.newRequest() .setMethod("POST") diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileReferenceTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileReferenceTest.java index b15a3800c75..8320116e216 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileReferenceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileReferenceTest.java @@ -138,7 +138,7 @@ public class QProfileReferenceTest { req.setParam("profileName", "the name"); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("If no quality profile key is specified, language and name must be set"); + expectedException.expectMessage("If 'key' is not specified, 'qualityProfile' and 'language' must be set"); QProfileReference.from(req); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java index c97854fea42..fc23a0b1ee8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java @@ -233,7 +233,7 @@ public class SetDefaultActionTest { userSessionRule.logIn(); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("When providing a quality profile key, neither of organization/language/name must be set"); + expectedException.expectMessage("When a quality profile key is set, 'organization' 'language' and 'qualityProfile' can't be set"); ws.newRequest().setMethod("POST") .setParam(PARAM_KEY, xoo2Profile.getKee()) |