]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11950 add revision to response of WS api/project_analysis/search
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 6 May 2019 15:06:50 +0000 (17:06 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 22 May 2019 18:21:17 +0000 (20:21 +0200)
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/projectanalysis/ws/SearchResponseBuilder.java
server/sonar-server/src/main/resources/org/sonar/server/projectanalysis/ws/search-example.json
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
sonar-ws/src/main/protobuf/ws-projectanalyses.proto

index b64b8fb2563ed69437f84a9ace9717a68475580e..9f384906a4b317e84019faa32db7f562c711f504 100644 (file)
@@ -120,7 +120,6 @@ public class SearchAction implements ProjectAnalysesWsAction {
         "Either a date (server timezone) or datetime can be provided")
       .setExampleValue("2017-10-19 or 2017-10-19T13:00:00+0200")
       .setSince("6.5");
-
   }
 
   @Override
index 6e15593c4af8cd2b53a286ed0e797224e0d60ca5..c1529b9de0b02ada60a909fdf1d2ba5860eca926 100644 (file)
@@ -85,6 +85,7 @@ class SearchResponseBuilder {
       .setManualNewCodePeriodBaseline(searchData.getManualBaseline().filter(dbAnalysis.getUuid()::equals).isPresent());
     ofNullable(dbAnalysis.getProjectVersion()).ifPresent(builder::setProjectVersion);
     ofNullable(dbAnalysis.getBuildString()).ifPresent(builder::setBuildString);
+    ofNullable(dbAnalysis.getRevision()).ifPresent(builder::setRevision);
 
     return builder;
   }
index a3197eb5d295f080fc95699504369524696bdb80..841ac0d14a122e88ee2a947449e4761a913a7985 100644 (file)
@@ -10,6 +10,7 @@
       "date": "2016-12-12T17:12:45+0100",
       "projectVersion": "1.2.1",
       "buildString": "1.2.1.423",
+      "revision": "be6c75b85da526349c44e3978374c95e0b80a96d",
       "manualNewCodePeriodBaseline": false,
       "events": [
         {
@@ -29,6 +30,7 @@
       "date": "2016-12-11T17:12:45+0100",
       "projectVersion": "1.2",
       "buildString": "1.2.0.322",
+      "revision": "bfe36592eb7f9f2708b5d358b5b5f33ed535c8cf",
       "manualNewCodePeriodBaseline": true,
       "events": [
         {
index 6e90ff4601662a7ae2a81e6573be5ac81ab19051..4c75c70c12267821fbe711b0206d2a4e8b591d73 100644 (file)
@@ -124,16 +124,24 @@ public class SearchActionTest {
 
     userSession.addProjectPermission(UserRole.USER, project);
     SnapshotDto a1 = db.components().insertSnapshot(newAnalysis(project)
-      .setUuid("A1").setCreatedAt(parseDateTime("2016-12-11T17:12:45+0100").getTime())
-      .setProjectVersion("1.2").setBuildString("1.2.0.322")
+      .setUuid("A1")
+      .setCreatedAt(parseDateTime("2016-12-11T17:12:45+0100").getTime())
+      .setProjectVersion("1.2")
+      .setBuildString("1.2.0.322")
+      .setRevision("bfe36592eb7f9f2708b5d358b5b5f33ed535c8cf")
     );
     SnapshotDto a2 = db.components().insertSnapshot(newAnalysis(project)
-      .setUuid("A2").setCreatedAt(parseDateTime("2016-12-12T17:12:45+0100").getTime())
-      .setProjectVersion("1.2.1").setBuildString("1.2.1.423")
+      .setUuid("A2")
+      .setCreatedAt(parseDateTime("2016-12-12T17:12:45+0100").getTime())
+      .setProjectVersion("1.2.1")
+      .setBuildString("1.2.1.423")
+      .setRevision("be6c75b85da526349c44e3978374c95e0b80a96d")
     );
     SnapshotDto a3 = db.components().insertSnapshot(newAnalysis(project)
-      .setUuid("P1").setCreatedAt(parseDateTime("2015-11-11T10:00:00+0100").getTime())
-      .setProjectVersion("1.2").setBuildString("1.2.0.321"));
+      .setUuid("P1")
+      .setCreatedAt(parseDateTime("2015-11-11T10:00:00+0100").getTime())
+      .setProjectVersion("1.2")
+      .setBuildString("1.2.0.321"));
     db.getDbClient().branchDao().insert(db.getSession(), newBranchDto(project, LONG)
       .setManualBaseline(a1.getUuid()));
     db.commit();
index bde8d5aad80becfb120c994056e641d35ce1fecc..c04117ca5400e95137101745ada3fa03f6b8c020 100644 (file)
@@ -59,6 +59,7 @@ message Analysis {
   optional string projectVersion = 4;
   optional string buildString = 5;
   optional bool manualNewCodePeriodBaseline = 6;
+  optional string revision = 7;
 }
 
 message QualityGate {