aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java/org/sonar
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-05 13:37:25 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-09 11:41:05 +0100
commit0ea7c0cedcadefe53e5ea7aab1e66592c0cb9279 (patch)
tree0a2e73d6426086970cd82726b1436670f01202c6 /sonar-plugin-api/src/test/java/org/sonar
parent2d34b833738ddc86750d058aa11f1ffef75916c8 (diff)
downloadsonarqube-0ea7c0cedcadefe53e5ea7aab1e66592c0cb9279.tar.gz
sonarqube-0ea7c0cedcadefe53e5ea7aab1e66592c0cb9279.zip
Refactor issue search stack in order to remove dependency with
SearchRequestHandler
Diffstat (limited to 'sonar-plugin-api/src/test/java/org/sonar')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/ws/WebServiceTest.java22
1 files changed, 18 insertions, 4 deletions
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 550b959019f..9226ea1af60 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
@@ -25,6 +25,7 @@ import org.sonar.api.rule.RuleStatus;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -257,15 +258,18 @@ public class WebServiceTest {
@Override
public void define(Context context) {
NewController newController = context.createController("api/rule");
- NewAction create = newController.createAction("create").setHandler(mock(RequestHandler.class));
- create.createParam("key").setDescription("Key of the new rule");
- create.createParam("severity").setDefaultValue("MAJOR").setPossibleValues("INFO", "MAJOR", "BLOCKER");
+ NewAction newAction = newController.createAction("create").setHandler(mock(RequestHandler.class));
+ newAction.createParam("key").setDescription("Key of the new rule");
+ newAction.createParam("severity").setDefaultValue("MAJOR").setPossibleValues("INFO", "MAJOR", "BLOCKER");
+ 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(2);
+ assertThat(action.params()).hasSize(7);
assertThat(action.param("key").key()).isEqualTo("key");
assertThat(action.param("key").description()).isEqualTo("Key of the new rule");
@@ -275,6 +279,16 @@ public class WebServiceTest {
assertThat(action.param("severity").description()).isNull();
assertThat(action.param("severity").defaultValue()).isEqualTo("MAJOR");
assertThat(action.param("severity").possibleValues()).containsOnly("INFO", "MAJOR", "BLOCKER");
+
+ // 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