diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2015-02-17 15:19:26 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2015-02-18 17:02:26 +0100 |
commit | 61d14a06dee80ee4dc062d471d85e898b16ba051 (patch) | |
tree | 681d448f316fcefbd03a4315f4ce152549190649 | |
parent | 6577fa3914afc7274a6258f9c3975f2cf12a88ff (diff) | |
download | sonarqube-61d14a06dee80ee4dc062d471d85e898b16ba051.tar.gz sonarqube-61d14a06dee80ee4dc062d471d85e898b16ba051.zip |
SONAR-5345 Revert createdAfter/createdBefore to their old meaning (exclude bounds)
3 files changed, 8 insertions, 11 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java index 260a3a43169..523e0bacba1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java @@ -318,13 +318,13 @@ public class IssueIndex extends BaseIndex { if (createdAfter != null) { filters.put("__createdAfter", FilterBuilders .rangeFilter(IssueIndexDefinition.FIELD_ISSUE_FUNC_CREATED_AT) - .gte(createdAfter) + .gt(createdAfter) .cache(false)); } if (createdBefore != null) { filters.put("__createdBefore", FilterBuilders .rangeFilter(IssueIndexDefinition.FIELD_ISSUE_FUNC_CREATED_AT) - .lte(createdBefore) + .lt(createdBefore) .cache(false)); } Date createdAt = query.createdAt(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 528aa02d5af..10677ed8977 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -63,12 +63,7 @@ import org.sonar.server.user.UserSession; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Maps.newHashMap; @@ -188,7 +183,7 @@ public class SearchAction implements BaseIssuesWsAction { .setDescription("To retrieve issues created at a given date. Format: date or datetime ISO formats") .setExampleValue("2013-05-01 (or 2013-05-01T13:00:00+0100)"); action.createParam(IssueFilterParameters.CREATED_AFTER) - .setDescription("To retrieve issues created after the given date (inclusive). Format: date or datetime ISO formats") + .setDescription("To retrieve issues created after the given date (exclusive). Format: date or datetime ISO formats") .setExampleValue("2013-05-01 (or 2013-05-01T13:00:00+0100)"); action.createParam(IssueFilterParameters.CREATED_BEFORE) .setDescription("To retrieve issues created before the given date (exclusive). Format: date or datetime ISO formats") diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java index 60a533f7df2..e8073a7791c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java @@ -619,7 +619,8 @@ public class IssueIndexTest { IssueTesting.newDoc("ISSUE2", file).setFuncCreationDate(DateUtils.parseDate("2014-09-23"))); assertThat(index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-19")).build(), new SearchOptions()).getDocs()).hasSize(2); - assertThat(index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).hasSize(2); + // Lower bound is excluded + assertThat(index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).hasSize(1); assertThat(index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-21")).build(), new SearchOptions()).getDocs()).hasSize(1); assertThat(index.search(IssueQuery.builder().createdAfter(DateUtils.parseDate("2014-09-25")).build(), new SearchOptions()).getDocs()).isEmpty(); } @@ -634,7 +635,8 @@ public class IssueIndexTest { IssueTesting.newDoc("ISSUE2", file).setFuncCreationDate(DateUtils.parseDate("2014-09-23"))); assertThat(index.search(IssueQuery.builder().createdBefore(DateUtils.parseDate("2014-09-19")).build(), new SearchOptions()).getDocs()).isEmpty(); - assertThat(index.search(IssueQuery.builder().createdBefore(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).hasSize(1); + // Upper bound is excluded + assertThat(index.search(IssueQuery.builder().createdBefore(DateUtils.parseDate("2014-09-20")).build(), new SearchOptions()).getDocs()).isEmpty(); assertThat(index.search(IssueQuery.builder().createdBefore(DateUtils.parseDate("2014-09-21")).build(), new SearchOptions()).getDocs()).hasSize(1); assertThat(index.search(IssueQuery.builder().createdBefore(DateUtils.parseDate("2014-09-25")).build(), new SearchOptions()).getDocs()).hasSize(2); } |