aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-04 16:36:28 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-05 14:30:41 +0100
commitbd42c02478857a60fccb2c0d71ad2f5b6031df2f (patch)
tree7514d518765b329957922264549ade758e727446 /sonar-plugin-api
parenta5b8494ecaa600826ee1148992c192c216e5a11e (diff)
downloadsonarqube-bd42c02478857a60fccb2c0d71ad2f5b6031df2f.tar.gz
sonarqube-bd42c02478857a60fccb2c0d71ad2f5b6031df2f.zip
SONAR-6954 Add 'since' tag to WS parameters
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java16
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java2
2 files changed, 18 insertions, 0 deletions
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
index 5053284f3bc..045d0db25b5 100644
--- 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
@@ -548,6 +548,7 @@ public interface WebService extends Definable<WebService.Context> {
class NewParam {
private String key;
+ private String since;
private String deprecatedSince;
private String deprecatedKey;
private String description;
@@ -560,6 +561,11 @@ public interface WebService extends Definable<WebService.Context> {
this.key = key;
}
+ public NewParam setSince(@Nullable String since) {
+ this.since = since;
+ return this;
+ }
+
public NewParam setDeprecatedSince(@Nullable String deprecatedSince) {
this.deprecatedSince = deprecatedSince;
return this;
@@ -687,6 +693,7 @@ public interface WebService extends Definable<WebService.Context> {
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 description;
@@ -697,6 +704,7 @@ public interface WebService extends Definable<WebService.Context> {
protected Param(Action action, NewParam newParam) {
this.key = newParam.key;
+ this.since = newParam.since;
this.deprecatedSince = newParam.deprecatedSince;
this.deprecatedKey = newParam.deprecatedKey;
this.description = newParam.description;
@@ -717,6 +725,14 @@ public interface WebService extends Definable<WebService.Context> {
* @since 5.3
*/
@CheckForNull
+ public String since() {
+ return since;
+ }
+
+ /**
+ * @since 5.3
+ */
+ @CheckForNull
public String deprecatedSince() {
return deprecatedSince;
}
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
index 4455897f769..bdca29a4702 100644
--- 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
@@ -266,6 +266,7 @@ public class WebServiceTest {
newAction
.createParam("severity")
.setDefaultValue("MAJOR")
+ .setSince("4.4")
.setDeprecatedSince("5.3")
.setDeprecatedKey("old-severity")
.setPossibleValues("INFO", "MAJOR", "BLOCKER");
@@ -288,6 +289,7 @@ public class WebServiceTest {
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.defaultValue()).isEqualTo("MAJOR");
assertThat(severityParam.possibleValues()).containsOnly("INFO", "MAJOR", "BLOCKER");