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 | |
parent | 9d6221dde611b7ba5a09b0e90185cfc034db0b1f (diff) | |
download | sonarqube-27679449745382c2f1ec39aa84975d7eb19ae9f9.tar.gz sonarqube-27679449745382c2f1ec39aa84975d7eb19ae9f9.zip |
SONAR-3755 Add pagination on Issues WS
27 files changed, 188 insertions, 751 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java index d40120f32db..59257860eaf 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java @@ -48,7 +48,7 @@ public interface IssueFinder extends ServerComponent { Collection<Component> components(); - Pagination pagination(); + Paging paging(); } Results find(IssueQuery query, @Nullable Integer currentUserId, String role); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java index b481db42961..bde2cab4488 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueQuery.java @@ -46,11 +46,11 @@ public class IssueQuery { private final Date createdAfter; private final Date createdBefore; - // max results - private final int limit; + // max results per page + private final int pageSize; // index of selected page. Start with 1. - private final int page; + private final int pageIndex; private IssueQuery(Builder builder) { this.keys = builder.keys; @@ -64,8 +64,8 @@ public class IssueQuery { this.assignees = builder.assignees; this.createdAfter = builder.createdAfter; this.createdBefore = builder.createdBefore; - this.limit = builder.limit; - this.page = builder.page; + this.pageSize = builder.pageSize; + this.pageIndex = builder.pageIndex; } public Collection<String> keys() { @@ -112,12 +112,12 @@ public class IssueQuery { return createdBefore; } - public int limit() { - return limit; + public int pageSize() { + return pageSize; } - public int page() { - return page; + public int pageIndex() { + return pageIndex; } @Override @@ -134,9 +134,9 @@ public class IssueQuery { * @since 3.6 */ public static class Builder { - private static final int DEFAULT_LIMIT = 100; - private static final int MAX_LIMIT = 1000; - private static final int DEFAULT_PAGE = 1; + private static final int DEFAULT_PAGE_SIZE = 100; + private static final int MAX_PAGE_SIZE = 1000; + private static final int DEFAULT_PAGE_INDEX = 1; private Collection<String> keys; private Collection<String> severities; @@ -149,8 +149,8 @@ public class IssueQuery { private Collection<String> assignees; private Date createdAfter; private Date createdBefore; - private int limit = DEFAULT_LIMIT; - private int page = DEFAULT_PAGE; + private int pageSize = DEFAULT_PAGE_SIZE; + private int pageIndex = DEFAULT_PAGE_INDEX; private Builder() { } @@ -210,16 +210,16 @@ public class IssueQuery { return this; } - public Builder limit(Integer i) { - Preconditions.checkArgument(i == null || i.intValue() > 0, "Limit must be greater than 0 (got " + i + ")"); - Preconditions.checkArgument(i == null || i.intValue() < MAX_LIMIT, "Limit must be less than " + MAX_LIMIT + " (got " + i + ")"); - this.limit = (i == null ? DEFAULT_LIMIT : i.intValue()); + public Builder pageSize(Integer i) { + Preconditions.checkArgument(i == null || i.intValue() > 0, "Page size must be greater than 0 (got " + i + ")"); + Preconditions.checkArgument(i == null || i.intValue() < MAX_PAGE_SIZE, "Page size must be less than " + MAX_PAGE_SIZE + " (got " + i + ")"); + this.pageSize = (i == null ? DEFAULT_PAGE_SIZE : i.intValue()); return this; } - public Builder page(Integer i) { - Preconditions.checkArgument(i == null || i.intValue() > 0, "Page must be greater than 0 (got " + i + ")"); - this.page = (i == null ? DEFAULT_PAGE : i.intValue()); + public Builder pageIndex(Integer i) { + Preconditions.checkArgument(i == null || i.intValue() > 0, "Page index must be greater than 0 (got " + i + ")"); + this.pageIndex = (i == null ? DEFAULT_PAGE_INDEX : i.intValue()); return this; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Pagination.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Paging.java index b519145ab0a..95f610948f0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Pagination.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Paging.java @@ -20,43 +20,42 @@ package org.sonar.api.issue; -public class Pagination { +/** + * @since 3.6 + */ +public class Paging { - private int limit; - private int page; - private int size; + private int pageSize; + private int pageIndex; + private int total; - public Pagination(int limit, int page, int size) { - this.limit = limit; - this.page = page; - this.size = size; + public Paging(int pageSize, int pageIndex, int total) { + this.pageSize = pageSize; + this.pageIndex = pageIndex; + this.total = total; } - public int page() { - return page; + public int pageIndex() { + return pageIndex; } - public int limit() { - return limit; + public int pageSize() { + return pageSize; } - public int size() { - return size; + public int total() { + return total; } public int offset(){ - return (page - 1) * limit; + return (pageIndex - 1) * pageSize; } public int pages() { - int p = (size / limit); - if ((size % limit) > 0) { + int p = (total / pageSize); + if ((total % pageSize) > 0) { p++; } return p; } - - public boolean empty() { - return size == 0; - } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java index 8f46066a642..cb47aec4e18 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/IssueQueryTest.java @@ -44,8 +44,8 @@ public class IssueQueryTest { .assignees(Lists.newArrayList("gargantua")) .createdAfter(new Date()) .createdBefore(new Date()) - .limit(10) - .page(2) + .pageSize(10) + .pageIndex(2) .build(); assertThat(query.keys()).containsOnly("ABCDE"); assertThat(query.severities()).containsOnly(Severity.BLOCKER); @@ -58,7 +58,7 @@ public class IssueQueryTest { assertThat(query.rules()).containsOnly(RuleKey.of("squid", "AvoidCycle")); assertThat(query.createdAfter()).isNotNull(); assertThat(query.createdBefore()).isNotNull(); - assertThat(query.limit()).isEqualTo(10); - assertThat(query.page()).isEqualTo(2); + assertThat(query.pageSize()).isEqualTo(10); + assertThat(query.pageIndex()).isEqualTo(2); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/issue/PaginationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/issue/PagingTest.java index 0801bd0e61d..5229fdad344 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/issue/PaginationTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/issue/PagingTest.java @@ -24,27 +24,26 @@ import org.junit.Test; import static org.fest.assertions.Assertions.assertThat; -public class PaginationTest { +public class PagingTest { @Test public void test_pagination(){ - Pagination pagination = new Pagination(5, 1, 20); + Paging paging = new Paging(5, 1, 20); - assertThat(pagination.limit()).isEqualTo(5); - assertThat(pagination.page()).isEqualTo(1); - assertThat(pagination.size()).isEqualTo(20); - assertThat(pagination.empty()).isFalse(); + assertThat(paging.pageSize()).isEqualTo(5); + assertThat(paging.pageIndex()).isEqualTo(1); + assertThat(paging.total()).isEqualTo(20); - assertThat(pagination.offset()).isEqualTo(0); - assertThat(pagination.pages()).isEqualTo(4); + assertThat(paging.offset()).isEqualTo(0); + assertThat(paging.pages()).isEqualTo(4); } @Test public void test_pagination_on_second_page(){ - Pagination pagination = new Pagination(5, 2, 20); + Paging paging = new Paging(5, 2, 20); - assertThat(pagination.offset()).isEqualTo(5); - assertThat(pagination.pages()).isEqualTo(4); + assertThat(paging.offset()).isEqualTo(5); + assertThat(paging.pages()).isEqualTo(4); } } diff --git a/sonar-server/src/main/java/org/sonar/server/issue/DefaultJRubyIssues.java b/sonar-server/src/main/java/org/sonar/server/issue/DefaultJRubyIssues.java index 678cde67fab..b657a2dc794 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/DefaultJRubyIssues.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/DefaultJRubyIssues.java @@ -83,8 +83,8 @@ public class DefaultJRubyIssues implements JRubyIssues { builder.assignees(toStrings(props.get("assignees"))); builder.createdAfter(toDate(props.get("createdAfter"))); builder.createdBefore(toDate(props.get("createdBefore"))); - builder.limit(toInteger(props.get("limit"))); - builder.page(toInteger(props.get("page"))); + builder.pageSize(toInteger(props.get("pageSize"))); + builder.pageIndex(toInteger(props.get("pageIndex"))); return builder.build(); } diff --git a/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueFinder.java b/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueFinder.java index cfe08b790d9..c57ce7ffb97 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueFinder.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueFinder.java @@ -29,7 +29,7 @@ import org.sonar.api.component.Component; import org.sonar.api.issue.Issue; import org.sonar.api.issue.IssueFinder; import org.sonar.api.issue.IssueQuery; -import org.sonar.api.issue.Pagination; +import org.sonar.api.issue.Paging; import org.sonar.api.rules.Rule; import org.sonar.core.issue.IssueDao; import org.sonar.core.issue.IssueDto; @@ -76,8 +76,8 @@ public class ServerIssueFinder implements IssueFinder { Set<Integer> componentIds = getResourceIds(allIssuesDto); Set<Integer> authorizedComponentIds = authorizationDao.keepAuthorizedComponentIds(componentIds, currentUserId, role, sqlSession); List<IssueDto> authorizedIssues = getAuthorizedIssues(allIssuesDto, authorizedComponentIds); - Pagination pagination = new Pagination(query.limit(), query.page(), authorizedIssues.size()); - Set<Long> paginatedAuthorizedIssueIds = getPaginatedAuthorizedIssueIds(authorizedIssues, pagination); + Paging paging = new Paging(query.pageSize(), query.pageIndex(), authorizedIssues.size()); + Set<Long> paginatedAuthorizedIssueIds = getPaginatedAuthorizedIssueIds(authorizedIssues, paging); Collection<IssueDto> dtos = issueDao.selectByIds(paginatedAuthorizedIssueIds, sqlSession); Set<Integer> ruleIds = Sets.newLinkedHashSet(); @@ -89,7 +89,7 @@ public class ServerIssueFinder implements IssueFinder { } } - return new DefaultResults(issues, getRulesByIssue(issues, ruleIds), getComponentsByIssue(issues, componentIds), pagination); + return new DefaultResults(issues, getRulesByIssue(issues, ruleIds), getComponentsByIssue(issues, componentIds), paging); } finally { MyBatis.closeQuietly(sqlSession); } @@ -112,13 +112,13 @@ public class ServerIssueFinder implements IssueFinder { })); } - private Set<Long> getPaginatedAuthorizedIssueIds(List<IssueDto> authorizedIssues, Pagination pagination) { + private Set<Long> getPaginatedAuthorizedIssueIds(List<IssueDto> authorizedIssues, Paging paging) { Set<Long> issueIds = Sets.newLinkedHashSet(); int index = 0; for (IssueDto issueDto : authorizedIssues) { - if (index >= pagination.offset() && issueIds.size() < pagination.limit()) { + if (index >= paging.offset() && issueIds.size() < paging.pageSize()) { issueIds.add(issueDto.getId()); - } else if (issueIds.size() >= pagination.limit()) { + } else if (issueIds.size() >= paging.pageSize()) { break; } index++; @@ -169,15 +169,15 @@ public class ServerIssueFinder implements IssueFinder { static class DefaultResults implements Results { private final List<Issue> issues; - private final Pagination pagination; + private final Paging paging; private final Map<Issue, Rule> rulesByIssue; private final Map<Issue, Component> componentsByIssue; - DefaultResults(List<Issue> issues, Map<Issue, Rule> rulesByIssue, Map<Issue, Component> componentsByIssue, Pagination pagination) { + DefaultResults(List<Issue> issues, Map<Issue, Rule> rulesByIssue, Map<Issue, Component> componentsByIssue, Paging paging) { this.issues = issues; this.rulesByIssue = rulesByIssue; this.componentsByIssue = componentsByIssue; - this.pagination = pagination; + this.paging = paging; } @Override @@ -201,8 +201,8 @@ public class ServerIssueFinder implements IssueFinder { return componentsByIssue.values(); } - public Pagination pagination() { - return pagination; + public Paging paging() { + return paging; } } } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb index a9ec074c4bb..010ce384b92 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb @@ -50,6 +50,7 @@ class Api::IssuesController < Api::ApiController def results_to_json(results) json = {} json[:issues] = results.issues.map { |issue| issue_to_json(issue) } + json[:paging] = pagination_to_json(results.paging) json end @@ -74,6 +75,16 @@ class Api::IssuesController < Api::ApiController json end + def pagination_to_json(paging) + json = { + :pageIndex => paging.pageIndex, + :pageSize => paging.pageSize, + :total => paging.total, + :pages => paging.pages + } + json + end + def format_java_datetime(java_date) java_date ? Api::Utils.format_datetime(Time.at(java_date.time/1000)) : nil end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb index 9b8bb0fb507..af2ad7ab831 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb @@ -21,9 +21,9 @@ class IssuesController < ApplicationController def index - page = params[:page_id] || 1 - issues_result = find_issues({'limit' => 25, 'page' => page}) - @pagination = issues_result.pagination + page_index = params[:page_index] || 1 + issues_result = find_issues({'pageSize' => 25, 'pageIndex' => page_index}) + @paging = issues_result.paging @issues = issues_result.issues.collect {|issue| issue} end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 0b232a13089..a16f41d5098 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -545,23 +545,23 @@ module ApplicationHelper # * page_size: the number of elements to display at the same time (= the pagination size) # def paginate_java(pagination) - size = pagination.size.to_i - page_id = pagination.page ? pagination.page.to_i : 1 - page_size = pagination.limit.to_i || 20 - page_count = pagination.pages.to_i + total = pagination.total.to_i + page_index = pagination.page_index ? pagination.page_index.to_i : 1 + page_size = pagination.page_size.to_i || 20 + pages = pagination.pages.to_i - html = size.to_s + " " + message('results').downcase + html = total.to_s + " " + message('results').downcase - if size > page_size + if total > page_size # render the pagination links html += " | " - html += link_to_if page_id>1, message('paging_previous'), {:overwrite_params => {:page_id => page_id-1}} + html += link_to_if page_index>1, message('paging_previous'), {:overwrite_params => {:page_index => page_index-1}} html += " " - for index in 1..page_count - html += link_to_unless index==page_id, index.to_s, {:overwrite_params => {:page_id => index}} + for index in 1..pages + html += link_to_unless index==page_index, index.to_s, {:overwrite_params => {:page_index => index}} html += " " end - html += link_to_if page_id<page_count, message('paging_next'), {:overwrite_params => {:page_id => 1+page_id}} + html += link_to_if page_index<pages, message('paging_next'), {:overwrite_params => {:page_index => 1+page_index}} end html diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb index a8b1f02f826..d0b5db736a1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb @@ -54,7 +54,7 @@ <tfoot> <tr> <td colspan="6"> - <%= paginate_java(@pagination) -%> + <%= paginate_java(@paging) -%> </td> </tr> </tfoot> diff --git a/sonar-server/src/test/java/org/sonar/server/issue/DefaultJRubyIssuesTest.java b/sonar-server/src/test/java/org/sonar/server/issue/DefaultJRubyIssuesTest.java index 89c0433ac4a..39e07faa43b 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/DefaultJRubyIssuesTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/DefaultJRubyIssuesTest.java @@ -70,8 +70,8 @@ public class DefaultJRubyIssuesTest { map.put("createdAfter", "2013-04-16T09:08:24+0200"); map.put("createdBefore", "2013-04-17T09:08:24+0200"); map.put("rules", "squid:AvoidCycle,findbugs:NullReference"); - map.put("limit", 10l); - map.put("page", 50); + map.put("pageSize", 10l); + map.put("pageIndex", 50); IssueQuery query = new DefaultJRubyIssues(finder, changes).toQuery(map); assertThat(query.keys()).containsOnly("ABCDE1234"); @@ -85,8 +85,8 @@ public class DefaultJRubyIssuesTest { assertThat(query.rules()).hasSize(2); assertThat(query.createdAfter()).isEqualTo(DateUtils.parseDateTime("2013-04-16T09:08:24+0200")); assertThat(query.createdBefore()).isEqualTo(DateUtils.parseDateTime("2013-04-17T09:08:24+0200")); - assertThat(query.limit()).isEqualTo(10); - assertThat(query.page()).isEqualTo(50); + assertThat(query.pageSize()).isEqualTo(10); + assertThat(query.pageIndex()).isEqualTo(50); } @Test diff --git a/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueFinderTest.java b/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueFinderTest.java index 5fd1ef8a476..b82e21562ac 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueFinderTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/ServerIssueFinderTest.java @@ -97,7 +97,7 @@ public class ServerIssueFinderTest { @Test public void should_find_only_authorized_issues() { IssueQuery issueQuery = mock(IssueQuery.class); - when(issueQuery.limit()).thenReturn(100); + when(issueQuery.pageSize()).thenReturn(100); IssueDto issue1 = new IssueDto().setId(1L).setRuleId(50).setResourceId(123) .setComponentKey_unit_test_only("Action.java") @@ -110,7 +110,7 @@ public class ServerIssueFinderTest { when(authorizationDao.keepAuthorizedComponentIds(anySet(), anyInt(), anyString(), any(SqlSession.class))).thenReturn(newHashSet(123)); when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(newArrayList(issue1)); - IssueFinder.Results results = finder.find(issueQuery, null, UserRole.USER); + finder.find(issueQuery, null, UserRole.USER); verify(issueDao).selectByIds(eq(newHashSet(1L)), any(SqlSession.class)); } @@ -120,8 +120,8 @@ public class ServerIssueFinderTest { grantAccessRights(); IssueQuery issueQuery = mock(IssueQuery.class); - when(issueQuery.limit()).thenReturn(1); - when(issueQuery.page()).thenReturn(1); + when(issueQuery.pageSize()).thenReturn(1); + when(issueQuery.pageIndex()).thenReturn(1); IssueDto issue1 = new IssueDto().setId(1L).setRuleId(50).setResourceId(123) .setComponentKey_unit_test_only("Action.java") @@ -134,9 +134,9 @@ public class ServerIssueFinderTest { when(issueDao.selectByIds(anyCollection(), any(SqlSession.class))).thenReturn(dtoList); IssueFinder.Results results = finder.find(issueQuery, null, UserRole.USER); - assertThat(results.pagination().offset()).isEqualTo(0); - assertThat(results.pagination().size()).isEqualTo(2); - assertThat(results.pagination().pages()).isEqualTo(2); + assertThat(results.paging().offset()).isEqualTo(0); + assertThat(results.paging().total()).isEqualTo(2); + assertThat(results.paging().pages()).isEqualTo(2); // Only one result is expected because the limit is 1 verify(issueDao).selectByIds(eq(newHashSet(1L)), any(SqlSession.class)); 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 |