diff options
author | Viktor Vorona <viktor.vorona@sonarsource.com> | 2024-09-19 14:48:00 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-19 20:03:00 +0000 |
commit | d1f19d8e1bce83563cd0ff087bcc18cc591994dc (patch) | |
tree | 552bd01d65438e910e6e090a164b8f177df4eda7 /server/sonar-webserver/src | |
parent | a90049828d6c0dbb8d7b07af6b20d7a8e836a7d8 (diff) | |
download | sonarqube-d1f19d8e1bce83563cd0ff087bcc18cc591994dc.tar.gz sonarqube-d1f19d8e1bce83563cd0ff087bcc18cc591994dc.zip |
MMF-3988 Hide ratings and remove legacy mode setting
Diffstat (limited to 'server/sonar-webserver/src')
3 files changed, 0 insertions, 140 deletions
diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index ea7c7271e4b..a839d435b17 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -189,7 +189,6 @@ import org.sonar.server.platform.WebCoreExtensionsInstaller; import org.sonar.server.platform.db.CheckAnyonePermissionsAtStartup; import org.sonar.server.platform.telemetry.ProjectCppAutoconfigTelemetryProvider; import org.sonar.server.platform.telemetry.TelemetryFipsEnabledProvider; -import org.sonar.server.platform.telemetry.TelemetryLegacyModePropertyProvider; import org.sonar.server.platform.telemetry.TelemetryNclocProvider; import org.sonar.server.platform.telemetry.TelemetryUserEnabledProvider; import org.sonar.server.platform.telemetry.TelemetryVersionProvider; @@ -670,7 +669,6 @@ public class PlatformLevel4 extends PlatformLevel { // new telemetry metrics ProjectCppAutoconfigTelemetryProvider.class, TelemetryVersionProvider.class, - TelemetryLegacyModePropertyProvider.class, TelemetryNclocProvider.class, TelemetryUserEnabledProvider.class, TelemetryFipsEnabledProvider.class, diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProvider.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProvider.java deleted file mode 100644 index 97c8bb80af7..00000000000 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.platform.telemetry; - -import java.util.Optional; -import org.sonar.db.DbClient; -import org.sonar.db.property.PropertyDto; -import org.sonar.telemetry.core.Dimension; -import org.sonar.telemetry.core.Granularity; -import org.sonar.telemetry.core.TelemetryDataProvider; -import org.sonar.telemetry.core.TelemetryDataType; - -import static org.sonar.core.config.LegacyRatingConstants.LEGACY_RATING_MODE_ENABLED; -import static org.sonar.telemetry.core.Dimension.INSTALLATION; -import static org.sonar.telemetry.core.Granularity.WEEKLY; -import static org.sonar.telemetry.core.TelemetryDataType.BOOLEAN; - -public class TelemetryLegacyModePropertyProvider implements TelemetryDataProvider<Boolean> { - private final DbClient dbClient; - - public TelemetryLegacyModePropertyProvider(DbClient dbClient) { - this.dbClient = dbClient; - } - - @Override - public String getMetricKey() { - return "legacy_rating_mode_enabled"; - } - - @Override - public Dimension getDimension() { - return INSTALLATION; - } - - @Override - public Granularity getGranularity() { - return WEEKLY; - } - - @Override - public TelemetryDataType getType() { - return BOOLEAN; - } - - @Override - public Optional<Boolean> getValue() { - PropertyDto property = dbClient.propertiesDao().selectGlobalProperty(LEGACY_RATING_MODE_ENABLED); - return property == null ? Optional.of(false) : Optional.of(Boolean.valueOf(property.getValue())); - } -} diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProviderTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProviderTest.java deleted file mode 100644 index 7a1aadac4f5..00000000000 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryLegacyModePropertyProviderTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.platform.telemetry; - -import java.util.Optional; -import java.util.stream.Stream; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.sonar.db.DbClient; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.sonar.core.config.LegacyRatingConstants.LEGACY_RATING_MODE_ENABLED; -import static org.sonar.telemetry.core.Dimension.INSTALLATION; -import static org.sonar.telemetry.core.Granularity.WEEKLY; -import static org.sonar.telemetry.core.TelemetryDataType.BOOLEAN; - -class TelemetryLegacyModePropertyProviderTest { - private final DbClient dbClient = mock(); - private final PropertiesDao propertiesDao = mock(); - private final TelemetryLegacyModePropertyProvider underTest = new TelemetryLegacyModePropertyProvider(dbClient); - - @ParameterizedTest - @MethodSource("getValues") - void getter_should_return_correct_values(Boolean value, Boolean expected) { - when(dbClient.propertiesDao()).thenReturn(propertiesDao); - if (value == null) { - when(dbClient.propertiesDao().selectGlobalProperty(LEGACY_RATING_MODE_ENABLED)) - .thenReturn(null); - } else { - when(dbClient.propertiesDao().selectGlobalProperty(LEGACY_RATING_MODE_ENABLED)) - .thenReturn(new PropertyDto().setValue(value.toString())); - } - - assertEquals("legacy_rating_mode_enabled", underTest.getMetricKey()); - assertEquals(INSTALLATION, underTest.getDimension()); - assertEquals(WEEKLY, underTest.getGranularity()); - assertEquals(BOOLEAN, underTest.getType()); - assertEquals(Optional.of(expected), underTest.getValue()); - } - - public static Stream<Arguments> getValues() { - return Stream.of( - Arguments.of(true, true), - Arguments.of(false, false), - Arguments.of(null, false) - ); - } - -} |