aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Vinot <antoine.vinot@sonarsource.com>2023-01-27 10:55:06 +0100
committersonartech <sonartech@sonarsource.com>2023-02-03 14:41:20 +0000
commit7814557b79535357723ebc9c36e949915d2f70ed (patch)
tree526bdb09a85bb041993ee91a6915b38515712647
parentcf55c2180b2217738e29a3ebe7236a9c5b572379 (diff)
downloadsonarqube-7814557b79535357723ebc9c36e949915d2f70ed.tar.gz
sonarqube-7814557b79535357723ebc9c36e949915d2f70ed.zip
SONAR-18219 Change type of telemetry data
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/telemetry/TelemetryData.java16
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/telemetry/TelemetryDataJsonWriterTest.java14
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java2
3 files changed, 16 insertions, 16 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 9ab24fcde4a..c7bc4a0b1d9 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
@@ -294,8 +294,8 @@ public class TelemetryData {
private final Long bugs;
private final Long vulnerabilities;
private final Long securityHotspots;
- private final Double technicalDebt;
- private final Double developmentCost;
+ private final Long technicalDebt;
+ private final Long developmentCost;
ProjectStatistics(Builder builder) {
this.projectUuid = builder.projectUuid;
@@ -352,11 +352,11 @@ public class TelemetryData {
return Optional.ofNullable(securityHotspots);
}
- public Optional<Double> getTechnicalDebt() {
+ public Optional<Long> getTechnicalDebt() {
return Optional.ofNullable(technicalDebt);
}
- public Optional<Double> getDevelopmentCost() {
+ public Optional<Long> getDevelopmentCost() {
return Optional.ofNullable(developmentCost);
}
@@ -371,8 +371,8 @@ public class TelemetryData {
private Long bugs;
private Long vulnerabilities;
private Long securityHotspots;
- private Double technicalDebt;
- private Double developmentCost;
+ private Long technicalDebt;
+ private Long developmentCost;
public Builder setProjectUuid(String projectUuid) {
this.projectUuid = projectUuid;
@@ -425,12 +425,12 @@ public class TelemetryData {
}
public Builder setTechnicalDebt(@Nullable Number technicalDebt) {
- this.technicalDebt = technicalDebt != null ? technicalDebt.doubleValue() : null;
+ this.technicalDebt = technicalDebt != null ? technicalDebt.longValue() : null;
return this;
}
public Builder setDevelopmentCost(@Nullable Number developmentCost) {
- this.developmentCost = developmentCost != null ? developmentCost.doubleValue() : null;
+ this.developmentCost = developmentCost != null ? developmentCost.longValue() : null;
return this;
}
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 67814020702..cfd2521e969 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
@@ -364,7 +364,7 @@ public class TelemetryDataJsonWriterTest {
}
@Test
- public void writes_all_projects_stats_with_analyzed_languages() {
+ public void writeTelemetryData_whenAnalyzedLanguages_shouldwriteAllProjectsStats() {
TelemetryData data = telemetryBuilder()
.setProjectStatistics(attachProjectStatsWithMetrics())
.build();
@@ -385,8 +385,8 @@ public class TelemetryDataJsonWriterTest {
"bugs": 2,
"vulnerabilities": 3,
"securityHotspots": 4,
- "technicalDebt": 60.0,
- "developmentCost": 30.0
+ "technicalDebt": 60,
+ "developmentCost": 30
},
{
"projectUuid": "uuid-1",
@@ -399,8 +399,8 @@ public class TelemetryDataJsonWriterTest {
"bugs": 4,
"vulnerabilities": 6,
"securityHotspots": 8,
- "technicalDebt": 120.0,
- "developmentCost": 60.0
+ "technicalDebt": 120,
+ "developmentCost": 60
},
{
"projectUuid": "uuid-2",
@@ -413,8 +413,8 @@ public class TelemetryDataJsonWriterTest {
"bugs": 6,
"vulnerabilities": 9,
"securityHotspots": 12,
- "technicalDebt": 180.0,
- "developmentCost": 90.0
+ "technicalDebt": 180,
+ "developmentCost": 90
}
]
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
index 95b472f58ac..ffcbc9f0411 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
@@ -226,7 +226,7 @@ public class TelemetryDataLoaderImplTest {
TelemetryData.ProjectStatistics::getBugs, TelemetryData.ProjectStatistics::getVulnerabilities, TelemetryData.ProjectStatistics::getSecurityHotspots,
TelemetryData.ProjectStatistics::getDevelopmentCost, TelemetryData.ProjectStatistics::getTechnicalDebt)
.containsExactlyInAnyOrder(
- tuple(1L, 0L, qualityGate1.getUuid(), "scm-1", "ci-1", "azure_devops_cloud", Optional.of(1L), Optional.of(1L), Optional.of(1L), Optional.of(50.0), Optional.of(5.0)),
+ tuple(1L, 0L, qualityGate1.getUuid(), "scm-1", "ci-1", "azure_devops_cloud", Optional.of(1L), Optional.of(1L), Optional.of(1L), Optional.of(50L), Optional.of(5L)),
tuple(1L, 0L, builtInDefaultQualityGate.getUuid(), "scm-2", "ci-2", "github_cloud", Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
assertThat(data.getQualityGates())
.extracting(TelemetryData.QualityGate::uuid, TelemetryData.QualityGate::isCaycCompliant)