]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9993 Issue search WS should return comment functional date
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 17 Oct 2017 08:28:33 +0000 (10:28 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Fri, 20 Oct 2017 08:45:15 +0000 (18:45 +1000)
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java

index 7fe847768429d51e8d33c41a476c25a9fc8778f3..e883b562d2e1cc1b0b3874a2aa527ae57602af69 100644 (file)
@@ -48,21 +48,21 @@ import org.sonar.server.issue.workflow.Transition;
 import org.sonar.server.ws.WsResponseCommonFormat;
 import org.sonarqube.ws.Common;
 import org.sonarqube.ws.Issues;
+import org.sonarqube.ws.Issues.Actions;
+import org.sonarqube.ws.Issues.Comment;
+import org.sonarqube.ws.Issues.Comments;
+import org.sonarqube.ws.Issues.Component;
+import org.sonarqube.ws.Issues.Flow;
+import org.sonarqube.ws.Issues.Issue;
+import org.sonarqube.ws.Issues.Location;
+import org.sonarqube.ws.Issues.Operation;
+import org.sonarqube.ws.Issues.SearchWsResponse;
+import org.sonarqube.ws.Issues.Transitions;
+import org.sonarqube.ws.Issues.Users;
 
 import static com.google.common.base.Strings.emptyToNull;
 import static com.google.common.base.Strings.nullToEmpty;
 import static org.sonar.core.util.Protobuf.setNullable;
-import static org.sonarqube.ws.Issues.Actions;
-import static org.sonarqube.ws.Issues.Comment;
-import static org.sonarqube.ws.Issues.Comments;
-import static org.sonarqube.ws.Issues.Component;
-import static org.sonarqube.ws.Issues.Flow;
-import static org.sonarqube.ws.Issues.Issue;
-import static org.sonarqube.ws.Issues.Location;
-import static org.sonarqube.ws.Issues.Operation;
-import static org.sonarqube.ws.Issues.SearchWsResponse;
-import static org.sonarqube.ws.Issues.Transitions;
-import static org.sonarqube.ws.Issues.Users;
 
 public class SearchResponseFormat {
 
@@ -272,7 +272,7 @@ public class SearchResponseFormat {
           .setKey(comment.getKey())
           .setLogin(nullToEmpty(comment.getUserLogin()))
           .setUpdatable(data.isUpdatableComment(comment.getKey()))
-          .setCreatedAt(DateUtils.formatDateTime(new Date(comment.getCreatedAt())));
+          .setCreatedAt(DateUtils.formatDateTime(new Date(comment.getIssueChangeCreationDate())));
         if (markdown != null) {
           wsComment
             .setHtmlText(Markdown.convertToHtml(markdown))
index 78f288e877490414ed04a9d5f2191ebed5340bf7..29bacc9551b5a827475d6fafded1c9b95f4bc434 100644 (file)
@@ -206,14 +206,14 @@ public class SearchActionTest {
         .setChangeData("*My comment*")
         .setChangeType(IssueChangeDto.TYPE_COMMENT)
         .setUserLogin("john")
-        .setCreatedAt(DateUtils.parseDateTime("2014-09-09T12:00:00+0000").getTime()));
+        .setIssueChangeCreationDate(DateUtils.parseDateTime("2014-09-09T12:00:00+0000").getTime()));
     dbClient.issueChangeDao().insert(session,
       new IssueChangeDto().setIssueKey(issue.getKey())
         .setKey("COMMENT-ABCE")
         .setChangeData("Another comment")
         .setChangeType(IssueChangeDto.TYPE_COMMENT)
         .setUserLogin("fabrice")
-        .setCreatedAt(DateUtils.parseDateTime("2014-09-10T12:00:00+0000").getTime()));
+        .setIssueChangeCreationDate(DateUtils.parseDateTime("2014-09-10T12:00:00+0000").getTime()));
     session.commit();
     indexIssues();