aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver
diff options
context:
space:
mode:
authorAlain Kermis <alain.kermis@sonarsource.com>2024-07-18 10:46:37 +0200
committersonartech <sonartech@sonarsource.com>2024-07-24 20:02:48 +0000
commit0ce62a09539920b477873c2c26e9a6d2fc62a15e (patch)
tree0b1d8bad035a2b2c19ae839df91a7fa383899426 /server/sonar-webserver
parentb128adde3ba0a0b20189f90fde15d94490c7de52 (diff)
downloadsonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.tar.gz
sonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.zip
SONAR-22479 Introduce ADHOC granularity
Diffstat (limited to 'server/sonar-webserver')
-rw-r--r--server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryVersionProvider.java5
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryVersionProviderTest.java3
2 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryVersionProvider.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryVersionProvider.java
index 850190948ba..101f694f99e 100644
--- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryVersionProvider.java
+++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryVersionProvider.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.platform.telemetry;
+import java.util.Optional;
import org.sonar.api.platform.Server;
import org.sonar.telemetry.core.Dimension;
import org.sonar.telemetry.core.Granularity;
@@ -54,7 +55,7 @@ public class TelemetryVersionProvider implements TelemetryDataProvider<String> {
}
@Override
- public String getValue() {
- return server.getVersion();
+ public Optional<String> getValue() {
+ return Optional.ofNullable(server.getVersion());
}
}
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryVersionProviderTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryVersionProviderTest.java
index 1a14d52bbf3..d13295312b8 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryVersionProviderTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryVersionProviderTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.platform.telemetry;
+import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.sonar.api.platform.Server;
import org.sonar.telemetry.core.Dimension;
@@ -46,7 +47,7 @@ class TelemetryVersionProviderTest {
assertEquals(Dimension.INSTALLATION, telemetryVersionProvider.getDimension());
assertEquals(Granularity.DAILY, telemetryVersionProvider.getGranularity());
assertEquals(TelemetryDataType.STRING, telemetryVersionProvider.getType());
- assertEquals("10.6", telemetryVersionProvider.getValue());
+ assertEquals(Optional.of("10.6"), telemetryVersionProvider.getValue());
assertThrows(IllegalStateException.class, telemetryVersionProvider::getUuidValues);
}
}