aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-04-24 15:48:23 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-04-24 15:48:23 +0200
commit69bab4f4d7b9344ed379c6553ad39c09688c434b (patch)
tree18358ea4fc9b4d23d95e8a2650bbf94085ba0170 /sonar-ws-client
parent23cbff2d62cbe9326176209587daba1f0229a769 (diff)
downloadsonarqube-69bab4f4d7b9344ed379c6553ad39c09688c434b.tar.gz
sonarqube-69bab4f4d7b9344ed379c6553ad39c09688c434b.zip
SONAR-3755 Add parameter to IssueFinder to know if there were security exclusions
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueParser.java3
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java12
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java10
-rw-r--r--sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json11
4 files changed, 30 insertions, 6 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueParser.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueParser.java
index af538b4b277..ef76e3630a6 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueParser.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueParser.java
@@ -20,6 +20,7 @@
package org.sonar.wsclient.issue;
import org.json.simple.JSONValue;
+import org.sonar.wsclient.unmarshallers.JsonUtils;
import java.util.List;
import java.util.Map;
@@ -34,6 +35,8 @@ class IssueParser {
}
Map paging = (Map) jRoot.get("paging");
result.setPaging(new Paging(paging));
+
+ result.setSecurityExclusions(JsonUtils.getBoolean(jRoot, "securityExclusions"));
return result;
}
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
index e4663e8ea24..7f9c655aa6b 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issues.java
@@ -29,6 +29,7 @@ public class Issues {
private final List<Issue> list = new ArrayList<Issue>();
private Paging paging;
+ private Boolean securityExclusions;
Issues add(Issue issue) {
list.add(issue);
@@ -38,12 +39,21 @@ public class Issues {
return list;
}
- void setPaging(Paging paging) {
+ Issues setPaging(Paging paging) {
this.paging = paging;
+ return this;
}
public Paging paging(){
return paging;
}
+ public Boolean securityExclusions() {
+ return securityExclusions;
+ }
+
+ Issues setSecurityExclusions(Boolean securityExclusions) {
+ this.securityExclusions = securityExclusions;
+ return this;
+ }
}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java
index 003bd527a60..363e08ec08f 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java
@@ -60,5 +60,15 @@ public class IssueParserTest {
assertThat(second.description()).isNull();
assertThat(second.attribute("JIRA")).isNull();
assertThat(second.attributes()).isEmpty();
+
+ assertThat(issues.paging()).isNotNull();
+ Paging paging = issues.paging();
+ assertThat(paging.pageIndex()).isEqualTo(1);
+ assertThat(paging.pageSize()).isEqualTo(100);
+ assertThat(paging.pages()).isEqualTo(1);
+ assertThat(paging.total()).isEqualTo(2);
+
+ assertThat(issues.securityExclusions()).isTrue();
}
+
}
diff --git a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json
index d253a8642ef..14b1a6a402d 100644
--- a/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json
+++ b/sonar-ws-client/src/test/resources/org/sonar/wsclient/issue/IssueParserTest/search.json
@@ -29,11 +29,12 @@
"status": "OPEN"
}
],
- "pagination":
+ "paging":
{
- "page": 1,
- "limit": 100,
- "size": 2,
+ "pageIndex": 1,
+ "pageSize": 100,
+ "total": 2,
"pages": 1
- }
+ },
+ "securityExclusions": true
} \ No newline at end of file