From b4cb14d34a686f5f12b5d5d5facc46512b840cc0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Mon, 13 Apr 2015 15:16:56 +0200 Subject: [PATCH] SONAR-6308 Allow date+time in since/to parameters --- .../server/qualityprofile/ws/QProfileChangelogAction.java | 8 ++++---- .../qualityprofile/ws/QProfileChangelogActionTest.java | 8 ++++---- 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"); } -- 2.39.5