]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7637 WS api/issues/search 'createdAter' parameter should be inclusive
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 13 May 2016 17:22:59 +0000 (19:22 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 13 May 2016 17:22:59 +0000 (19:22 +0200)
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java

index d5ffa3bbb77e937f635807c78a481db5037c037d..0631d8e00c5f6efa14799dfb29d9077d8bc23ddc 100644 (file)
@@ -363,7 +363,7 @@ public class IssueIndex extends BaseIndex {
     if (createdAfter != null) {
       filters.put("__createdAfter", FilterBuilders
         .rangeFilter(IssueIndexDefinition.FIELD_ISSUE_FUNC_CREATED_AT)
-        .gt(createdAfter)
+        .gte(createdAfter)
         .cache(false));
     }
     if (createdBefore != null) {
index 2e5e2163412e55cb2ad1b380d77dd11a7a43a96d..94796e7e8b9ec2689e6b82054ce55d4b02ae976a 100644 (file)
@@ -203,7 +203,7 @@ public class SearchAction implements IssuesWsAction {
       .setDescription("To retrieve issues created in a specific analysis, identified by an ISO-formatted datetime stamp.")
       .setExampleValue("2013-05-01T13:00:00+0100");
     action.createParam(CREATED_AFTER)
-      .setDescription("To retrieve issues created after the given date (exclusive). Format: date or datetime ISO formats. If this parameter is set, createdSince must not be set")
+      .setDescription("To retrieve issues created after the given date (inclusive). Format: date or datetime ISO formats. If this parameter is set, createdSince must not be set")
       .setExampleValue("2013-05-01 (or 2013-05-01T13:00:00+0100)");
     action.createParam(CREATED_BEFORE)
       .setDescription("To retrieve issues created before the given date (exclusive). Format: date or datetime ISO formats")
index 3d5230ca2eaaf5bf68172013263dd9871ec37d52..cbacb61bb508c8ba765242e4931ccd34918baf3d 100644 (file)
@@ -606,8 +606,8 @@ public class IssueIndexTest {
       IssueTesting.newDoc("ISSUE2", file).setFuncCreationDate(DateUtils.parseDate("2014-09-23")));
 
     assertThat(index.search(IssueQuery.builder(userSessionRule).createdAfter(DateUtils.parseDate("2014-09-19")).build(), new SearchOptions()).getDocs()).hasSize(2);
-    // Lower bound is excluded
-    assertThat(index.search(IssueQuery.builder(userSessionRule).createdAfter(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).hasSize(1);
+    // Lower bound is included
+    assertThat(index.search(IssueQuery.builder(userSessionRule).createdAfter(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).hasSize(2);
     assertThat(index.search(IssueQuery.builder(userSessionRule).createdAfter(DateUtils.parseDate("2014-09-21")).build(), new SearchOptions()).getDocs()).hasSize(1);
     assertThat(index.search(IssueQuery.builder(userSessionRule).createdAfter(DateUtils.parseDate("2014-09-25")).build(), new SearchOptions()).getDocs()).isEmpty();
   }
@@ -645,7 +645,7 @@ public class IssueIndexTest {
     // 20 < createdAt < 25: excludes first issue
     assertThat(index.search(IssueQuery.builder(userSessionRule)
       .createdAfter(DateUtils.parseDate("2014-09-20")).createdBefore(DateUtils.parseDate("2014-09-25"))
-      .build(), new SearchOptions()).getDocs()).hasSize(1);
+      .build(), new SearchOptions()).getDocs()).hasSize(2);
 
     // 21 < createdAt < 25
     assertThat(index.search(IssueQuery.builder(userSessionRule)