diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2022-09-27 14:04:38 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-09-28 20:04:08 +0000 |
commit | bb3d825f81eff913d50e7e2773e6773387268233 (patch) | |
tree | 7cbdc902f5f5974a195f18338e30aa43ebaddd07 /server/sonar-webserver-core | |
parent | 5e7e46a917b4cf4f301701e5bb4455e98c9b4775 (diff) | |
download | sonarqube-bb3d825f81eff913d50e7e2773e6773387268233.tar.gz sonarqube-bb3d825f81eff913d50e7e2773e6773387268233.zip |
SONAR-17195 Use "devopsPlatform" field name instead "alm" in telemetry
Diffstat (limited to 'server/sonar-webserver-core')
2 files changed, 6 insertions, 10 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java index 9952ad298c3..8a91caa4505 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java @@ -45,7 +45,6 @@ import org.sonar.db.alm.setting.ProjectAlmKeyAndProject; import org.sonar.db.component.AnalysisPropertyValuePerProject; import org.sonar.db.component.PrAndBranchCountByProjectDto; import org.sonar.db.measure.ProjectMeasureDto; -import org.sonar.server.measure.index.ProjectMeasuresIndex; import org.sonar.server.platform.DockerSupport; import org.sonar.server.property.InternalProperties; import org.sonar.server.telemetry.TelemetryData.Database; @@ -138,14 +137,14 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader { Long pullRequestCount = Optional.ofNullable(prAndBranchCountByProjects.get(projectUuid)).map(PrAndBranchCountByProjectDto::getPullRequest).orElse(0L); String scm = Optional.ofNullable(scmByProject.get(projectUuid)).orElse(UNDETECTED); String ci = Optional.ofNullable(ciByProject.get(projectUuid)).orElse(UNDETECTED); - String alm = null; + String devopsPlatform = null; if (almAndUrlByProject.containsKey(projectUuid)) { ProjectAlmKeyAndProject projectAlmKeyAndProject = almAndUrlByProject.get(projectUuid); - alm = getAlmName(projectAlmKeyAndProject.getAlmId(), projectAlmKeyAndProject.getUrl()); + devopsPlatform = getAlmName(projectAlmKeyAndProject.getAlmId(), projectAlmKeyAndProject.getUrl()); } - alm = Optional.ofNullable(alm).orElse(UNDETECTED); + devopsPlatform = Optional.ofNullable(devopsPlatform).orElse(UNDETECTED); - projectStatistics.add(new TelemetryData.ProjectStatistics(projectUuid, branchCount, pullRequestCount, scm, ci, alm)); + projectStatistics.add(new TelemetryData.ProjectStatistics(projectUuid, branchCount, pullRequestCount, scm, ci, devopsPlatform)); } data.setProjectStatistics(projectStatistics); 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 ab59d5c0803..b4fa868a8df 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 @@ -41,9 +41,6 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.metric.MetricDto; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserTelemetryDto; -import org.sonar.server.es.EsTester; -import org.sonar.server.measure.index.ProjectMeasuresIndex; -import org.sonar.server.measure.index.ProjectMeasuresIndexer; import org.sonar.server.platform.DockerSupport; import org.sonar.server.property.InternalProperties; import org.sonar.server.property.MapInternalProperties; @@ -176,7 +173,7 @@ public class TelemetryDataLoaderImplTest { tuple(project2.uuid(), "js", 20L, analysisDate)); assertThat(data.getProjectStatistics()) .extracting(TelemetryData.ProjectStatistics::getBranchCount, TelemetryData.ProjectStatistics::getPullRequestCount, - TelemetryData.ProjectStatistics::getScm, TelemetryData.ProjectStatistics::getCi, TelemetryData.ProjectStatistics::getAlm) + TelemetryData.ProjectStatistics::getScm, TelemetryData.ProjectStatistics::getCi, TelemetryData.ProjectStatistics::getDevopsPlatform) .containsExactlyInAnyOrder( tuple(1L, 0L, "scm-1", "ci-1", "azure_devops_cloud"), tuple(1L, 0L, "scm-2", "ci-2", "github_cloud")); @@ -386,7 +383,7 @@ public class TelemetryDataLoaderImplTest { db.components().insertPublicProject(); TelemetryData data = communityUnderTest.load(); assertThat(data.getProjectStatistics()) - .extracting(TelemetryData.ProjectStatistics::getAlm, TelemetryData.ProjectStatistics::getScm, TelemetryData.ProjectStatistics::getCi) + .extracting(TelemetryData.ProjectStatistics::getDevopsPlatform, TelemetryData.ProjectStatistics::getScm, TelemetryData.ProjectStatistics::getCi) .containsExactlyInAnyOrder(tuple("undetected", "undetected", "undetected")); } |