]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4563 complete web service client
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 12 Aug 2013 16:32:19 +0000 (18:32 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 12 Aug 2013 16:33:03 +0000 (18:33 +0200)
sonar-ws-client/src/main/java/org/sonar/wsclient/issue/IssueQuery.java
sonar-ws-client/src/test/java/org/sonar/wsclient/issue/IssueQueryTest.java

index f291d31051aeadcbea4ec494851eab4daf9d1b37..23f200f6053cf1d298e2422015233909c784db6d 100644 (file)
@@ -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;
index 941894aee783747d90c0b451610f25ee4b3dff25..14b352d5eae4b39b4ea964853f090b4840705b7d 100644 (file)
@@ -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));