diff options
author | Alain Kermis <alain.kermis@sonarsource.com> | 2024-07-18 10:46:37 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-07-24 20:02:48 +0000 |
commit | 0ce62a09539920b477873c2c26e9a6d2fc62a15e (patch) | |
tree | 0b1d8bad035a2b2c19ae839df91a7fa383899426 /server/sonar-telemetry-core | |
parent | b128adde3ba0a0b20189f90fde15d94490c7de52 (diff) | |
download | sonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.tar.gz sonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.zip |
SONAR-22479 Introduce ADHOC granularity
Diffstat (limited to 'server/sonar-telemetry-core')
3 files changed, 4 insertions, 1 deletions
diff --git a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java index be5cd22bb93..e66b2a83f87 100644 --- a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java +++ b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java @@ -27,6 +27,7 @@ import com.fasterxml.jackson.annotation.JsonValue; * Modifying this enum needs to be discussed beforehand with Data Platform team. */ public enum Granularity { + ADHOC("adhoc"), DAILY("daily"), WEEKLY("weekly"), MONTHLY("monthly"); diff --git a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java index a464014e767..b29fec4057b 100644 --- a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java +++ b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java @@ -20,6 +20,7 @@ package org.sonar.telemetry.core; import java.util.Map; +import java.util.Optional; /** * This interface is used to provide data to the telemetry system. The telemetry system will call the methods of this interface to get the @@ -61,7 +62,7 @@ public interface TelemetryDataProvider<T> { * * @return the value of the data provided by this instance. */ - default T getValue() { + default Optional<T> getValue() { throw new IllegalStateException("Not implemented"); } diff --git a/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java b/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java index a4b01e93305..44ef21c9298 100644 --- a/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java +++ b/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java @@ -30,6 +30,7 @@ class GranularityTest { assertEquals("daily", Granularity.DAILY.getValue()); assertEquals("weekly", Granularity.WEEKLY.getValue()); assertEquals("monthly", Granularity.MONTHLY.getValue()); + assertEquals("adhoc", Granularity.ADHOC.getValue()); } } |