diff options
author | Dejan Milisavljevic <dejan.milisavljevic@sonarsource.com> | 2024-12-05 14:41:09 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-12-06 20:03:27 +0000 |
commit | 3f72d838ca9f4c15f172d91cdbd98756a173343a (patch) | |
tree | 2763e34d334e3bc5d61a5d1c1b17903eefaf6813 /server/sonar-webserver | |
parent | 56895882c11db5862d8ad4784f070fa6038157a9 (diff) | |
download | sonarqube-3f72d838ca9f4c15f172d91cdbd98756a173343a.tar.gz sonarqube-3f72d838ca9f4c15f172d91cdbd98756a173343a.zip |
SONAR-23732 Migrate telemetry key from 'portfolio_reports_confidential_flag' to 'pdf_reports_confidential_flag' and define it only for Enterprise+
Diffstat (limited to 'server/sonar-webserver')
3 files changed, 0 insertions, 116 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 b4a696928df..3a1587f66a5 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 @@ -195,7 +195,6 @@ import org.sonar.server.platform.db.CheckAnyonePermissionsAtStartup; import org.sonar.server.platform.telemetry.TelemetryFipsEnabledProvider; import org.sonar.server.platform.telemetry.TelemetryMQRModePropertyProvider; import org.sonar.server.platform.telemetry.TelemetryNclocProvider; -import org.sonar.server.platform.telemetry.TelemetryPortfolioConfidentialFlagProvider; import org.sonar.server.platform.telemetry.TelemetryUserEnabledProvider; import org.sonar.server.platform.telemetry.TelemetryVersionProvider; import org.sonar.server.platform.web.ActionDeprecationLoggerInterceptor; @@ -683,7 +682,6 @@ public class PlatformLevel4 extends PlatformLevel { TelemetryNclocProvider.class, TelemetryUserEnabledProvider.class, TelemetryFipsEnabledProvider.class, - TelemetryPortfolioConfidentialFlagProvider.class, // Reports telemetry TelemetryApplicationSubscriptionsProvider.class, diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProvider.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProvider.java deleted file mode 100644 index e0351ae7917..00000000000 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProvider.java +++ /dev/null @@ -1,43 +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.AbstractTelemetryDataProvider; -import org.sonar.telemetry.core.Dimension; -import org.sonar.telemetry.core.Granularity; -import org.sonar.telemetry.core.TelemetryDataType; - -public class TelemetryPortfolioConfidentialFlagProvider extends AbstractTelemetryDataProvider<Boolean> { - private final DbClient dbClient; - - public TelemetryPortfolioConfidentialFlagProvider(DbClient dbClient) { - super("portfolio_reports_confidential_flag", Dimension.INSTALLATION, Granularity.WEEKLY, TelemetryDataType.BOOLEAN); - this.dbClient = dbClient; - } - - @Override - public Optional<Boolean> getValue() { - PropertyDto property = dbClient.propertiesDao().selectGlobalProperty("sonar.portfolios.confidential.header"); - return property == null ? Optional.of(true) : Optional.of(Boolean.valueOf(property.getValue())); - } -} diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProviderTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProviderTest.java deleted file mode 100644 index 4ce562740b5..00000000000 --- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/telemetry/TelemetryPortfolioConfidentialFlagProviderTest.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.mockito.Mockito; -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.telemetry.core.Dimension.INSTALLATION; -import static org.sonar.telemetry.core.Granularity.WEEKLY; -import static org.sonar.telemetry.core.TelemetryDataType.BOOLEAN; - -class TelemetryPortfolioConfidentialFlagProviderTest { - - private final DbClient dbClient = Mockito.mock(); - private final PropertiesDao propertiesDao = mock(); - private final TelemetryPortfolioConfidentialFlagProvider underTest = new TelemetryPortfolioConfidentialFlagProvider(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("sonar.portfolios.confidential.header")) - .thenReturn(null); - } else { - when(dbClient.propertiesDao().selectGlobalProperty("sonar.portfolios.confidential.header")) - .thenReturn(new PropertyDto().setValue(value.toString())); - } - - assertEquals("portfolio_reports_confidential_flag", 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, true) - ); - } -} |