diff options
author | Alain Kermis <alain.kermis@sonarsource.com> | 2024-09-27 12:13:01 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-09-30 14:11:11 +0000 |
commit | c9e5cb766d03ed90e22e8e659ffefb8236e20e21 (patch) | |
tree | 56cfdaef2de5cdb292be2ce920cf8e6aad213573 | |
parent | e1b5c43a94b67ca6774f67451ca5a45cd2c9036f (diff) | |
download | sonarqube-c9e5cb766d03ed90e22e8e659ffefb8236e20e21.tar.gz sonarqube-c9e5cb766d03ed90e22e8e659ffefb8236e20e21.zip |
SONAR-23207 Fix telemetry metrics for Cpp autoconfig
3 files changed, 13 insertions, 11 deletions
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java index 6209b00b976..3f4003019cf 100644 --- a/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java @@ -488,17 +488,17 @@ class ProjectDaoIT { .collect(Collectors.toSet()); } - private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ProjectDto project, ComponentDto componentDto) { + private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ComponentDto componentDto) { return liveMeasure -> liveMeasure .setMetricUuid(metric.getUuid()) .setComponentUuid(componentDto.uuid()) - .setProjectUuid(project.getUuid()) + .setProjectUuid(componentDto.uuid()) .setData(language + "=" + random.nextInt(10)); } private Consumer<ProjectData> insertLiveMeasure(String language, MetricDto metric) { return (projectData) -> db.measures().insertLiveMeasure(projectData.getMainBranchComponent(), metric, - configureLiveMeasure(language, metric, projectData.getProjectDto(), projectData.getMainBranchComponent())); + configureLiveMeasure(language, metric, projectData.getMainBranchComponent())); } private void insertProjectsLiveMeasures(String language, Set<ProjectData> projects) { diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml index abfd58f2f88..575a4356117 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml @@ -129,15 +129,15 @@ <select id="selectProjectUuidsAssociatedToDefaultQualityProfileByLanguage" parameterType="map" resultType="string"> select - lm.project_uuid + p.uuid from live_measures lm inner join - projects p on p.uuid = lm.project_uuid + project_branches pb on pb.uuid = lm.component_uuid inner join - metrics m on m.uuid = lm.metric_uuid + projects p on p.uuid = pb.project_uuid inner join - project_branches pb on pb.uuid = lm.component_uuid + metrics m on m.uuid = lm.metric_uuid where m.name = 'ncloc_language_distribution' and pb.is_main = ${_true} @@ -154,7 +154,9 @@ from live_measures lm inner join - projects p on p.uuid = lm.project_uuid + project_branches pb on pb.uuid = lm.project_uuid and pb.is_main = ${_true} + inner join + projects p on p.uuid = pb.project_uuid inner join metrics m on m.uuid = lm.metric_uuid where diff --git a/server/sonar-webserver/src/it/java/org/sonar/server/platform/telemetry/ProjectCppAutoconfigTelemetryProviderIT.java b/server/sonar-webserver/src/it/java/org/sonar/server/platform/telemetry/ProjectCppAutoconfigTelemetryProviderIT.java index 3ad5a8f3d6a..56dcbd731b1 100644 --- a/server/sonar-webserver/src/it/java/org/sonar/server/platform/telemetry/ProjectCppAutoconfigTelemetryProviderIT.java +++ b/server/sonar-webserver/src/it/java/org/sonar/server/platform/telemetry/ProjectCppAutoconfigTelemetryProviderIT.java @@ -123,16 +123,16 @@ class ProjectCppAutoconfigTelemetryProviderIT { ); } - private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ProjectDto project, ComponentDto componentDto) { + private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ComponentDto componentDto) { return liveMeasure -> liveMeasure .setMetricUuid(metric.getUuid()) .setComponentUuid(componentDto.uuid()) - .setProjectUuid(project.getUuid()) + .setProjectUuid(componentDto.uuid()) .setData(language + "=" + 100); } private Consumer<ProjectData> insertLiveMeasure(String language, MetricDto metric) { return projectData -> db.measures().insertLiveMeasure(projectData.getMainBranchComponent(), metric, - configureLiveMeasure(language, metric, projectData.getProjectDto(), projectData.getMainBranchComponent())); + configureLiveMeasure(language, metric, projectData.getMainBranchComponent())); } } |