aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-13 15:16:56 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-14 10:05:02 +0200
commitb4cb14d34a686f5f12b5d5d5facc46512b840cc0 (patch)
treef547db7bb4d433260942fe992c536bec53edd6d0
parent5a2ce47eefb8bd680c48862e8d995f97001600ca (diff)
downloadsonarqube-b4cb14d34a686f5f12b5d5d5facc46512b840cc0.tar.gz
sonarqube-b4cb14d34a686f5f12b5d5d5facc46512b840cc0.zip
SONAR-6308 Allow date+time in since/to parameters
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileChangelogAction.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java8
2 files changed, 8 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileChangelogAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileChangelogAction.java
index fa3cbc08187..50d9ed6c4d9 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileChangelogAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileChangelogAction.java
@@ -76,11 +76,11 @@ public class QProfileChangelogAction implements BaseQProfileWsAction {
changelog.createParam(PARAM_SINCE)
.setDescription("Start date for the changelog.")
- .setExampleValue("2011-04-25");
+ .setExampleValue("2011-04-25T01:15:42+0100");
changelog.createParam(PARAM_TO)
.setDescription("End date for the changelog.")
- .setExampleValue("2013-07-25");
+ .setExampleValue("2013-07-25T07:35:42+0200");
}
@Override
@@ -93,11 +93,11 @@ public class QProfileChangelogAction implements BaseQProfileWsAction {
}
QProfileActivityQuery query = new QProfileActivityQuery().setQprofileKey(profileKey);
- Date since = request.paramAsDate(PARAM_SINCE);
+ Date since = request.paramAsDateTime(PARAM_SINCE);
if (since != null) {
query.setSince(since);
}
- Date to = request.paramAsDate(PARAM_TO);
+ Date to = request.paramAsDateTime(PARAM_TO);
if (to != null) {
query.setTo(to);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java
index 613f48b1d66..5e9b7659533 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfileChangelogActionTest.java
@@ -126,18 +126,18 @@ public class QProfileChangelogActionTest {
// Tests with "since"
wsTester.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam("profileKey", XOO_P1_KEY).setParam("since",
- DateUtils.formatDate(yesterday))
+ DateUtils.formatDateTime(yesterday))
.execute().assertJson(getClass(), "changelog_nominal.json");
wsTester.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam("profileKey", XOO_P1_KEY).setParam("since",
- DateUtils.formatDate(tomorrow))
+ DateUtils.formatDateTime(tomorrow))
.execute().assertJson(getClass(), "changelog_empty.json");
// Tests with "to"
wsTester.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam("profileKey", XOO_P1_KEY).setParam("to",
- DateUtils.formatDate(yesterday))
+ DateUtils.formatDateTime(yesterday))
.execute().assertJson(getClass(), "changelog_empty.json");
wsTester.newGetRequest(QProfilesWs.API_ENDPOINT, "changelog").setParam("profileKey", XOO_P1_KEY).setParam("to",
- DateUtils.formatDate(tomorrow))
+ DateUtils.formatDateTime(tomorrow))
.execute().assertJson(getClass(), "changelog_nominal.json");
}