aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/test/java/org/sonar
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-22 11:17:01 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-22 11:17:01 +0200
commit70b2098567fea4cd5619aa81b3757c7a8172088c (patch)
tree9a441bbf90be133c2efeff3aa3d2c3b79f5fcf84 /sonar-ws-client/src/test/java/org/sonar
parentac076a048acaadc3945b76da6ad282c60fcd7096 (diff)
downloadsonarqube-70b2098567fea4cd5619aa81b3757c7a8172088c.tar.gz
sonarqube-70b2098567fea4cd5619aa81b3757c7a8172088c.zip
SONAR-4301 Update IssueFinder to first retreive authorized root projects for user and then search for authorized issues based on issue query. Also add project in Issue.
Diffstat (limited to 'sonar-ws-client/src/test/java/org/sonar')
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueParserTest.java15
1 files changed, 15 insertions, 0 deletions
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 1d84ad11cbc..6bc95d9fdc3 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
@@ -39,6 +39,7 @@ public class IssueParserTest {
Issue first = list.get(0);
assertThat(first.key()).isEqualTo("ABCDE");
assertThat(first.componentKey()).isEqualTo("Action.java");
+ assertThat(first.projectKey()).isEqualTo("struts");
assertThat(first.ruleKey()).isEqualTo("squid:CycleBetweenPackages");
assertThat(first.severity()).isEqualTo("CRITICAL");
assertThat(first.line()).isEqualTo(10);
@@ -155,4 +156,18 @@ public class IssueParserTest {
assertThat(component.name()).isEqualTo("Action");
assertThat(component.longName()).isEqualTo("org.struts.Action");
}
+
+ @Test
+ public void should_parse_projects() throws Exception {
+ String json = IOUtils.toString(getClass().getResourceAsStream("/org/sonar/wsclient/issue/IssueParserTest/issue-with-projects.json"));
+ Issues issues = new IssueParser().parseIssues(json);
+
+ assertThat(issues.projects()).hasSize(1);
+
+ Component component = issues.project(issues.list().get(0));
+ assertThat(component.key()).isEqualTo("struts");
+ assertThat(component.qualifier()).isEqualTo("TRK");
+ assertThat(component.name()).isEqualTo("Struts");
+ assertThat(component.longName()).isEqualTo("org.struts");
+ }
}