diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-24 14:41:05 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-24 14:54:08 +0200 |
commit | 27679449745382c2f1ec39aa84975d7eb19ae9f9 (patch) | |
tree | 92ebbdf27768c5a8ee591c4f19cc9de289859b3c /sonar-ws-client | |
parent | 9d6221dde611b7ba5a09b0e90185cfc034db0b1f (diff) | |
download | sonarqube-27679449745382c2f1ec39aa84975d7eb19ae9f9.tar.gz sonarqube-27679449745382c2f1ec39aa84975d7eb19ae9f9.zip |
SONAR-3755 Add pagination on Issues WS
Diffstat (limited to 'sonar-ws-client')
14 files changed, 82 insertions, 654 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 0376f8f3e86..af538b4b277 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 @@ -32,6 +32,8 @@ class IssueParser { for (Map jIssue : jIssues) { result.add(new Issue(jIssue)); } + Map paging = (Map) jRoot.get("paging"); + result.setPaging(new Paging(paging)); return result; } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java index f151ca4905c..34b822230f5 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java @@ -90,13 +90,13 @@ public class IssueQuery { return this; } - public IssueQuery limit(int limit) { - params.put("limit", limit); + public IssueQuery pageSize(int pageSize) { + params.put("pageSize", pageSize); return this; } - public IssueQuery offset(int offset) { - params.put("offset", offset); + public IssueQuery pageIndex(int pageIndex) { + params.put("pageIndex", pageIndex); return this; } 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 8b8f5178dab..e4663e8ea24 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 @@ -28,6 +28,7 @@ import java.util.List; public class Issues { private final List<Issue> list = new ArrayList<Issue>(); + private Paging paging; Issues add(Issue issue) { list.add(issue); @@ -36,4 +37,13 @@ public class Issues { public List<Issue> list() { return list; } + + void setPaging(Paging paging) { + this.paging = paging; + } + + public Paging paging(){ + return paging; + } + } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Paging.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Paging.java new file mode 100644 index 00000000000..e9f701a76f1 --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Paging.java @@ -0,0 +1,54 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2013 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonar.wsclient.issue; + +import org.sonar.wsclient.unmarshallers.JsonUtils; + +import java.util.Map; + +/** + * @since 3.6 + */ +public class Paging { + + private final Map json; + + Paging(Map json) { + this.json = json; + } + + public Integer pageSize() { + return JsonUtils.getInteger(json, "pageSize"); + } + + public Integer pageIndex() { + return JsonUtils.getInteger(json, "pageIndex"); + } + + public Integer total() { + return JsonUtils.getInteger(json, "total"); + } + + public Integer pages() { + return JsonUtils.getInteger(json, "pages"); + } + +} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Issue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Issue.java deleted file mode 100644 index 4be0dc65cc2..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Issue.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.wsclient.services; - -import java.util.Date; - -/** - * @since 3.6 - */ -public class Issue extends Model { - - private String key; - private String componentKey; - private String ruleRepositoryKey; - private String ruleKey; - private String severity; - private String title; - private String message; - private Integer line; - private Double cost; - private String status; - private String resolution; - private String userLogin; - private String assigneeLogin; - private Date createdAt; - private Date updatedAt; - private Date closedAt; - - public String getKey() { - return key; - } - - public Issue setKey(String key) { - this.key = key; - return this; - } - - public String getComponentKey() { - return componentKey; - } - - public Issue setComponentKey(String componentKey) { - this.componentKey = componentKey; - return this; - } - - public String getRuleRepositoryKey() { - return ruleRepositoryKey; - } - - public Issue setRuleRepositoryKey(String ruleRepositoryKey) { - this.ruleRepositoryKey = ruleRepositoryKey; - return this; - } - - public String getRuleKey() { - return ruleKey; - } - - public Issue setRuleKey(String ruleKey) { - this.ruleKey = ruleKey; - return this; - } - - public String getSeverity() { - return severity; - } - - public Issue setSeverity(String severity) { - this.severity = severity; - return this; - } - - public String getTitle() { - return title; - } - - public Issue setTitle(String title) { - this.title = title; - return this; - } - - public String getMessage() { - return message; - } - - public Issue setMessage(String message) { - this.message = message; - return this; - } - - public Integer getLine() { - return line; - } - - public Issue setLine(Integer line) { - this.line = line; - return this; - } - - public Double getCost() { - return cost; - } - - public Issue setCost(Double cost) { - this.cost = cost; - return this; - } - - public String getStatus() { - return status; - } - - public Issue setStatus(String status) { - this.status = status; - return this; - } - - public String getResolution() { - return resolution; - } - - public Issue setResolution(String resolution) { - this.resolution = resolution; - return this; - } - - public String getUserLogin() { - return userLogin; - } - - public Issue setUserLogin(String userLogin) { - this.userLogin = userLogin; - return this; - } - - public String getAssignee() { - return assigneeLogin; - } - - public Issue setAssigneeLogin(String assigneeLogin) { - this.assigneeLogin = assigneeLogin; - return this; - } - - public Date getCreatedAt() { - return createdAt; - } - - public Issue setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - return this; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public Issue setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - public Date getClosedAt() { - return closedAt; - } - - public Issue setClosedAt(Date closedAt) { - this.closedAt = closedAt; - return this; - } - - @Override - public String toString() { - return new StringBuilder() - .append("[key=").append(key).append("], ") - .append("[componentKey=").append(componentKey).append("], ") - .append("[ruleRepositoryKey=").append(ruleRepositoryKey).append("], ") - .append("[ruleKey=").append(ruleKey).append("], ") - .append("[severity=").append(severity).append("], ") - .append("[title=").append(title).append("], ") - .append("[message=").append(message).append("], ") - .append("[line=").append(line).append("], ") - .append("[cost=").append(cost).append("], ") - .append("[status=").append(status).append("], ") - .append("[resolution=").append(resolution).append("], ") - .append("[userLogin=").append(userLogin).append("], ") - .append("[assigneeLogin=").append(assigneeLogin).append("], ") - .append("[createdAt=").append(createdAt).append("], ") - .append("[updatedAt=").append(updatedAt).append("], ") - .append("[closedAt=").append(closedAt).append("]") - .toString(); - } -} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/IssueQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/IssueQuery.java deleted file mode 100644 index fd44bbd47dc..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/IssueQuery.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.wsclient.services; - -import java.util.Date; - -/** - * @since 3.6 - */ -public final class IssueQuery extends Query<Issue> { - - public static final String BASE_URL = "/api/issues/search"; - - private String[] keys; - private String[] severities; - private String[] status; - private String[] resolutions; - private String[] components; - private String[] componentRoots; - private String[] rules; - private String[] userLogins; - private String[] assigneeLogins; - private Date createdAfter; - private Date createdBefore; - private Integer limit; - private Integer offset; - - private IssueQuery() { - } - - public static String getBaseUrl() { - return BASE_URL; - } - - public static IssueQuery create() { - return new IssueQuery(); - } - - public String[] getKeys() { - return keys; - } - - public IssueQuery setKeys(String... keys) { - this.keys = keys; - return this; - } - - public String[] getSeverities() { - return severities; - } - - public IssueQuery setSeverities(String... severities) { - this.severities = severities; - return this; - } - - public String[] getStatus() { - return status; - } - - public IssueQuery setStatus(String... status) { - this.status = status; - return this; - } - - public String[] getResolutions() { - return resolutions; - } - - public IssueQuery setResolutions(String... resolutions) { - this.resolutions = resolutions; - return this; - } - - public String[] getComponents() { - return components; - } - - public IssueQuery setComponents(String... components) { - this.components = components; - return this; - } - - public String[] getComponentRoots() { - return componentRoots; - } - - public IssueQuery setComponentRoots(String... componentRoots) { - this.componentRoots = componentRoots; - return this; - } - - public String[] getRules() { - return rules; - } - - public IssueQuery setRules(String... s) { - this.rules = s; - return this; - } - - public String[] getUserLogins() { - return userLogins; - } - - public IssueQuery setUserLogins(String... userLogins) { - this.userLogins = userLogins; - return this; - } - - public String[] getAssigneeLogins() { - return assigneeLogins; - } - - public IssueQuery setAssigneeLogins(String... assigneeLogins) { - this.assigneeLogins = assigneeLogins; - return this; - } - - public Date getCreatedAfter() { - return createdAfter; - } - - public IssueQuery setCreatedAfter(Date createdAfter) { - this.createdAfter = createdAfter; - return this; - } - - public Date getCreatedBefore() { - return createdBefore; - } - - public IssueQuery setCreatedBefore(Date createdBefore) { - this.createdBefore = createdBefore; - return this; - } - - public Integer getLimit() { - return limit; - } - - public IssueQuery setLimit(Integer limit) { - this.limit = limit; - return this; - } - - public Integer getOffset() { - return offset; - } - - public IssueQuery setOffset(Integer offset) { - this.offset = offset; - return this; - } - - @Override - public String getUrl() { - StringBuilder url = new StringBuilder(BASE_URL); - url.append('?'); - appendUrlParameter(url, "keys", keys); - appendUrlParameter(url, "severities", severities); - appendUrlParameter(url, "statuses", status); - appendUrlParameter(url, "resolutions", resolutions); - appendUrlParameter(url, "components", components); - appendUrlParameter(url, "componentRoots", componentRoots); - appendUrlParameter(url, "rules", rules); - appendUrlParameter(url, "userLogins", userLogins); - appendUrlParameter(url, "assignees", assigneeLogins); - appendUrlParameter(url, "createdAfter", createdAfter); - appendUrlParameter(url, "createdBefore", createdBefore); - appendUrlParameter(url, "limit", limit); - appendUrlParameter(url, "offset", offset); - return url.toString(); - } - - @Override - public Class<Issue> getModelClass() { - return Issue.class; - } -} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/IssueUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/IssueUnmarshaller.java deleted file mode 100644 index 3e7d91ef0cd..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/IssueUnmarshaller.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.wsclient.unmarshallers; - -import org.sonar.wsclient.services.Issue; -import org.sonar.wsclient.services.WSUtils; - -public class IssueUnmarshaller extends AbstractUnmarshaller<Issue> { - - @Override - protected Issue parse(Object json) { - WSUtils utils = WSUtils.getINSTANCE(); - return new Issue() - .setKey(utils.getString(json, "key")) - .setComponentKey(utils.getString(json, "component")) - .setRuleKey(utils.getString(json, "rule")) - .setRuleRepositoryKey(utils.getString(json, "ruleRepository")) - .setSeverity(utils.getString(json, "severity")) - .setTitle(utils.getString(json, "title")) - .setMessage(utils.getString(json, "message")) - .setLine(utils.getInteger(json, "line")) - .setCost(utils.getDouble(json, "cost")) - .setStatus(utils.getString(json, "status")) - .setResolution(utils.getString(json, "resolution")) - .setUserLogin(utils.getString(json, "userLogin")) - .setAssigneeLogin(utils.getString(json, "assignee")) - .setCreatedAt(utils.getDateTime(json, "createdAt")) - .setUpdatedAt(utils.getDateTime(json, "updatedAt")) - .setClosedAt(utils.getDateTime(json, "closedAt")); - } -} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java index d0e623ef185..f2e8069a833 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java @@ -51,7 +51,6 @@ public final class Unmarshallers { unmarshallers.put(ManualMeasure.class, new ManualMeasureUnmarshaller()); unmarshallers.put(Authentication.class, new AuthenticationUnmarshaller()); unmarshallers.put(ResourceSearchResult.class, new ResourceSearchUnmarshaller()); - unmarshallers.put(Issue.class, new IssueUnmarshaller()); } public static <M extends Model> Unmarshaller<M> forModel(Class<M> modelClass) { diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java index c11e2a1819c..a82a6658f1b 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java @@ -43,8 +43,8 @@ public class IssueQueryTest { .statuses("OPEN", "CLOSED") .severities("BLOCKER", "INFO") .userLogins("login1", "login2") - .limit(5) - .offset(4); + .pageSize(5) + .pageIndex(4); assertThat(query.urlParams()).hasSize(11); assertThat(query.urlParams()).includes(entry("keys", "ABCDE,FGHIJ")); @@ -55,8 +55,8 @@ public class IssueQueryTest { assertThat(query.urlParams()).includes(entry("statuses", "OPEN,CLOSED")); assertThat(query.urlParams()).includes(entry("severities", "BLOCKER,INFO")); assertThat(query.urlParams()).includes(entry("userLogins", "login1,login2")); - assertThat(query.urlParams()).includes(entry("limit", 5)); - assertThat(query.urlParams()).includes(entry("offset", 4)); + assertThat(query.urlParams()).includes(entry("pageSize", 5)); + assertThat(query.urlParams()).includes(entry("pageIndex", 4)); } @Test diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/IssueQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/IssueQueryTest.java deleted file mode 100644 index 20428140048..00000000000 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/IssueQueryTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.sonar.wsclient.services; - -import org.junit.Test; - -import java.text.SimpleDateFormat; - -import static org.fest.assertions.Assertions.assertThat; - -public class IssueQueryTest extends QueryTestCase { - - @Test - public void get_all_issues() { - IssueQuery query = IssueQuery.create(); - assertThat(query.getUrl()).isEqualTo("/api/issues/search?"); - } - - @Test - public void get_all_issues_by_parameter() { - IssueQuery query = IssueQuery.create() - .setKeys("ABCDE", "FGHIJ") - .setAssigneeLogins("arthur", "perceval") - .setComponents("component1", "component2") - .setComponentRoots("componentRoot1", "componentRoot2") - .setLimit(1) - .setResolutions("resolution1", "resolution2") - .setRules("squid:AvoidCycle") - .setStatus("OPEN", "CLOSED") - .setSeverities("BLOCKER", "INFO") - .setUserLogins("userLogin1", "userLogin2") - ; - assertThat(query.getUrl()).isEqualTo("/api/issues/search?keys=ABCDE,FGHIJ&severities=BLOCKER,INFO&statuses=OPEN,CLOSED&" + - "resolutions=resolution1,resolution2&components=component1,component2&componentRoots=componentRoot1,componentRoot2&rules=squid%3AAvoidCycle&" + - "userLogins=userLogin1,userLogin2&assignees=arthur,perceval&limit=1&"); - } - - @Test - public void get_all_issues_by_created_at() throws Exception { - IssueQuery query = IssueQuery.create() - .setCreatedAfter(new SimpleDateFormat("yyyy-MM-dd").parse("2013-04-16")) - .setCreatedBefore(new SimpleDateFormat("yyyy-MM-dd").parse("2010-02-18")) - ; - assertThat(query.getUrl()).isEqualTo("/api/issues/search?createdAfter=Tue+Apr+16+00%3A00%3A00+CEST+2013&createdBefore=Thu+Feb+18+00%3A00%3A00+CET+2010&"); - } - -} diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/IssueUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/IssueUnmarshallerTest.java deleted file mode 100644 index 899df56946f..00000000000 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/IssueUnmarshallerTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.sonar.wsclient.unmarshallers; - -import org.junit.Test; -import org.sonar.wsclient.services.Issue; - -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; - -public class IssueUnmarshallerTest extends UnmarshallerTestCase { - - @Test - public void should_return_nothing() { - Issue issue = new IssueUnmarshaller().toModel("[]"); - assertThat(issue).isNull(); - } - - @Test - public void should_return_one_issue() { - Issue issue = new IssueUnmarshaller().toModel(loadFile("/issues/single_issue.json")); - assertThat(issue.getKey()).isEqualTo("029d283a-072b-4ef8-bdda-e4b212aa39e3"); - assertThat(issue.getComponentKey()).isEqualTo("com.sonarsource.it.samples:simple-sample:sample"); - assertThat(issue.getRuleKey()).isEqualTo("NM_FIELD_NAMING_CONVENTION"); - assertThat(issue.getRuleRepositoryKey()).isEqualTo("findbugs"); - assertThat(issue.getSeverity()).isEqualTo("MAJOR"); - assertThat(issue.getTitle()).isEqualTo("title"); - assertThat(issue.getMessage()).isEqualTo("message"); - assertThat(issue.getLine()).isEqualTo(1); - assertThat(issue.getCost()).isEqualTo(1.2); - assertThat(issue.getStatus()).isEqualTo("OPEN"); - assertThat(issue.getResolution()).isEqualTo("FIXED"); - assertThat(issue.getUserLogin()).isEqualTo("admin"); - assertThat(issue.getAssignee()).isEqualTo("admin"); - assertThat(issue.getCreatedAt()).isNotNull(); - assertThat(issue.getUpdatedAt()).isNotNull(); - assertThat(issue.getClosedAt()).isNull(); - } - - @Test - public void should_return_all_issues() { - List<Issue> issues = new IssueUnmarshaller().toModels(loadFile("/issues/all_issues.json")); - assertThat(issues).hasSize(2); - } - -} diff --git a/sonar-ws-client/src/test/resources/issues/all_issues.json b/sonar-ws-client/src/test/resources/issues/all_issues.json deleted file mode 100644 index fa695a66146..00000000000 --- a/sonar-ws-client/src/test/resources/issues/all_issues.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "key": "029d283a-072b-4ef8-bdda-e4b212aa39e3", - "component": "com.sonarsource.it.samples:simple-sample:sample", - "ruleKey": "NM_FIELD_NAMING_CONVENTION", - "ruleRepositoryKey": "findbugs", - "severity": "MAJOR", - "title": "title", - "message": "message", - "line": 1, - "cost": 1.2, - "status": "OPEN", - "resolution": "FIXED", - "userLogin": "admin", - "assignee": "admin", - "createdAt": "2013-04-10T18:21:15+0200", - "updatedAt": "2013-04-10T18:21:15+0200", - "closedAt": null - }, - { - "key": "029d283a-072b-4ef8-bdda-e4b212aa39e4", - "component": "com.sonarsource.it.samples:simple-sample:sample", - "ruleKey": "RULE_KEY", - "ruleRepositoryKey": "pmd", - "severity": "MAJOR", - "title": "title", - "message": "message", - "line": 1, - "cost": 1.2, - "status": "OPEN", - "resolution": null, - "userLogin": null, - "assignee": null, - "createdAt": "2013-04-10T18:21:15+0200", - "updatedAt": "2013-04-10T18:21:15+0200", - "closedAt": null - } -] diff --git a/sonar-ws-client/src/test/resources/issues/single_issue.json b/sonar-ws-client/src/test/resources/issues/single_issue.json deleted file mode 100644 index 4e6b5abc168..00000000000 --- a/sonar-ws-client/src/test/resources/issues/single_issue.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "key": "029d283a-072b-4ef8-bdda-e4b212aa39e3", - "component": "com.sonarsource.it.samples:simple-sample:sample", - "rule": "NM_FIELD_NAMING_CONVENTION", - "ruleRepository": "findbugs", - "severity": "MAJOR", - "title": "title", - "message": "message", - "line": 1, - "cost": 1.2, - "status": "OPEN", - "resolution": "FIXED", - "userLogin": "admin", - "assignee": "admin", - "createdAt": "2013-04-10T18:21:15+0200", - "updatedAt": "2013-04-10T18:21:15+0200", - "closedAt": null - } -] 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 85b84cea03c..d253a8642ef 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 @@ -28,5 +28,12 @@ "resolution": "FIXED", "status": "OPEN" } - ] + ], + "pagination": + { + "page": 1, + "limit": 100, + "size": 2, + "pages": 1 + } }
\ No newline at end of file |