From 2652559a004e9535196831746224669e54a2d721 Mon Sep 17 00:00:00 2001 From: Klaudio Sinani Date: Thu, 4 Nov 2021 15:30:52 +0100 Subject: [PATCH] SONAR-15501 Fix response example for `api/project_analyses/search` endpoint + unit tests --- .../projectanalysis/ws/search-example.json | 28 ++++++++++--------- .../projectanalysis/ws/SearchActionTest.java | 8 +++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/projectanalysis/ws/search-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/projectanalysis/ws/search-example.json index e9dd58e7470..27fa8cfadf9 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/projectanalysis/ws/search-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/projectanalysis/ws/search-example.json @@ -34,13 +34,13 @@ "manualNewCodePeriodBaseline": true, "events": [ { - "key": "E11", + "key": "AXt91FkXy_c4CIP4ds6A", "category": "QUALITY_GATE", - "name": "Quality Gate is Red (was Orange)", - "description": "Coverage is \u003c 80%" + "name": "Failed", + "description": "Coverage on New Code < 85, Reliability Rating > 4, Maintainability Rating on New Code > 1, Reliability Rating on New Code > 1, Security Rating on New Code > 1, Duplicated Lines (%) on New Code > 3" }, { - "key": "E12", + "key": "AXx_QFJ6Wa8wkfuJ6r5P", "category": "VERSION", "name": "6.3" } @@ -62,15 +62,17 @@ "qualityGate": { "status": "ERROR", "stillFailing": true, - "failing": [{ - "key": "app1", - "name": "My project", - "branch": "master" - },{ - "key": "app2", - "name": "Another project", - "branch": "master" - } + "failing": [ + { + "key": "app1", + "name": "My project", + "branch": "master" + }, + { + "key": "app2", + "name": "Another project", + "branch": "master" + } ] } } diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java index c4d6e850c0d..d2b6938ac08 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java @@ -152,11 +152,11 @@ public class SearchActionTest { .setType(NewCodePeriodType.SPECIFIC_ANALYSIS) .setValue(a1.getUuid())); db.commit(); - db.events().insertEvent(newEvent(a1).setUuid("E11") - .setName("Quality Gate is Red (was Orange)") + db.events().insertEvent(newEvent(a1).setUuid("AXt91FkXy_c4CIP4ds6A") + .setName("Failed") .setCategory(QUALITY_GATE.getLabel()) - .setDescription("Coverage is < 80%")); - db.events().insertEvent(newEvent(a1).setUuid("E12") + .setDescription("Coverage on New Code < 85, Reliability Rating > 4, Maintainability Rating on New Code > 1, Reliability Rating on New Code > 1, Security Rating on New Code > 1, Duplicated Lines (%) on New Code > 3")); + db.events().insertEvent(newEvent(a1).setUuid("AXx_QFJ6Wa8wkfuJ6r5P") .setName("6.3").setCategory(VERSION.getLabel())); db.events().insertEvent(newEvent(a2).setUuid("E21") .setName("Quality Profile changed to Sonar Way") -- 2.39.5