diff options
author | Matteo Mara <matteo.mara@sonarsource.com> | 2023-01-27 16:16:07 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-02-03 14:41:21 +0000 |
commit | ca5790f9c26dcd9fdb291a91193dcf3ffe7bf7de (patch) | |
tree | fd13a52ea8fea3ec35b777c0f83e9e4f8a9f909b /server/sonar-server-common | |
parent | f507535da5cc4f1f2d25d6cd3c7c742cda1e8465 (diff) | |
download | sonarqube-ca5790f9c26dcd9fdb291a91193dcf3ffe7bf7de.tar.gz sonarqube-ca5790f9c26dcd9fdb291a91193dcf3ffe7bf7de.zip |
SONAR-17815 implement updated logic for CaYC quality gates
Diffstat (limited to 'server/sonar-server-common')
3 files changed, 8 insertions, 7 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java b/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java index c7bc4a0b1d9..1682ef8ab8f 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java @@ -280,7 +280,7 @@ public class TelemetryData { record Project(String projectUuid, Long lastAnalysis, String language, Long loc) { } - record QualityGate(String uuid, boolean isCaycCompliant) { + record QualityGate(String uuid, String caycStatus) { } public static class ProjectStatistics { diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryDataJsonWriter.java b/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryDataJsonWriter.java index 57171896fdb..62ae8e49d2c 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryDataJsonWriter.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryDataJsonWriter.java @@ -174,7 +174,7 @@ public class TelemetryDataJsonWriter { statistics.getQualityGates().forEach(qualityGate -> { json.beginObject(); json.prop("uuid", qualityGate.uuid()); - json.prop("isCaycCompliant", qualityGate.isCaycCompliant()); + json.prop("caycStatus", qualityGate.caycStatus()); json.endObject(); }); json.endArray(); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java index cfd2521e969..59c2f805cd4 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java @@ -453,15 +453,15 @@ public class TelemetryDataJsonWriterTest { "quality-gates": [ { "uuid": "uuid-0", - "isCaycCompliant": true + "caycStatus": "non-compliant" }, { "uuid": "uuid-1", - "isCaycCompliant": false + "caycStatus": "compliant" }, { "uuid": "uuid-2", - "isCaycCompliant": true + "caycStatus": "over-compliant" } ] } @@ -518,8 +518,9 @@ public class TelemetryDataJsonWriterTest { } private List<TelemetryData.QualityGate> attachQualityGates() { - return IntStream.range(0, 3).mapToObj(i -> new TelemetryData.QualityGate("uuid-" + i, i % 2 == 0)) - .collect(Collectors.toList()); + return List.of(new TelemetryData.QualityGate("uuid-0", "non-compliant"), + new TelemetryData.QualityGate("uuid-1", "compliant"), + new TelemetryData.QualityGate("uuid-2", "over-compliant")); } @DataProvider |