diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-12 18:32:19 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-12 18:33:03 +0200 |
commit | 71ba082eb96d16a2d96cb6e57bd1a93263da09c5 (patch) | |
tree | 824fc12e5fbc2256c6c19a85bd9b2589022249b2 /sonar-ws-client | |
parent | 9579161e966c5f6df3d5090f693617dc378935d8 (diff) | |
download | sonarqube-71ba082eb96d16a2d96cb6e57bd1a93263da09c5.tar.gz sonarqube-71ba082eb96d16a2d96cb6e57bd1a93263da09c5.zip |
SONAR-4563 complete web service client
Diffstat (limited to 'sonar-ws-client')
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java | 9 | ||||
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java | 14 |
2 files changed, 17 insertions, 6 deletions
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 f291d31051a..23f200f6053 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 @@ -101,6 +101,15 @@ public class IssueQuery { return this; } + /** + * Require second precision. + * @since 3.7 + */ + public IssueQuery createdAt(Date d) { + params.put("createdAt", EncodingUtils.toQueryParam(d, true)); + return this; + } + public IssueQuery createdAfter(Date d) { params.put("createdAfter", EncodingUtils.toQueryParam(d, true)); return this; 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 941894aee78..14b352d5eae 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 @@ -36,7 +36,7 @@ public class IssueQueryTest { @Test public void get_all_issues_by_parameter() throws ParseException { - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); IssueQuery query = IssueQuery.create() .issues("ABCDE", "FGHIJ") .assignees("arthur", "perceval") @@ -51,14 +51,15 @@ public class IssueQueryTest { .statuses("OPEN", "CLOSED") .severities("BLOCKER", "INFO") .reporters("login1", "login2") - .createdBefore(df.parse("2015-12-13T05:59")) - .createdAfter(df.parse("2012-01-23T13:40")) + .createdAt(df.parse("2015-01-02T05:59:50:50")) + .createdBefore(df.parse("2015-12-13T05:59:50")) + .createdAfter(df.parse("2012-01-23T13:40:50")) .sort("ASSIGNEE") .asc(false) .pageSize(5) .pageIndex(4); - assertThat(query.urlParams()).hasSize(19); + assertThat(query.urlParams()).hasSize(20); assertThat(query.urlParams()).includes(entry("issues", "ABCDE,FGHIJ")); assertThat(query.urlParams()).includes(entry("assignees", "arthur,perceval")); assertThat(query.urlParams()).includes(entry("assigned", true)); @@ -72,8 +73,9 @@ public class IssueQueryTest { assertThat(query.urlParams()).includes(entry("statuses", "OPEN,CLOSED")); assertThat(query.urlParams()).includes(entry("severities", "BLOCKER,INFO")); assertThat(query.urlParams()).includes(entry("reporters", "login1,login2")); - assertThat((String)query.urlParams().get("createdBefore")).startsWith("2015-12-13T05:59"); - assertThat((String)query.urlParams().get("createdAfter")).startsWith("2012-01-23T13:40:00"); + assertThat((String)query.urlParams().get("createdBefore")).startsWith("2015-12-13T05:59:50"); + assertThat((String)query.urlParams().get("createdAfter")).startsWith("2012-01-23T13:40:50"); + assertThat((String)query.urlParams().get("createdAt")).startsWith("2015-01-02T05:59:50"); assertThat(query.urlParams()).includes(entry("sort", "ASSIGNEE")); assertThat(query.urlParams()).includes(entry("asc", false)); assertThat(query.urlParams()).includes(entry("pageSize", 5)); |