diff options
Diffstat (limited to 'server/sonar-webserver-core')
2 files changed, 2 insertions, 7 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StatisticsSupport.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StatisticsSupport.java index 29325634dce..4d8f07d5c06 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StatisticsSupport.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StatisticsSupport.java @@ -21,7 +21,6 @@ package org.sonar.server.platform; import org.sonar.db.DbClient; import org.sonar.db.DbSession; -import org.sonar.db.measure.SumNclocDbQuery; public class StatisticsSupport { @@ -33,10 +32,7 @@ public class StatisticsSupport { public long getLinesOfCode(){ try (DbSession dbSession = dbClient.openSession(false)) { - SumNclocDbQuery query = SumNclocDbQuery.builder() - .setOnlyPrivateProjects(false) - .build(); - return dbClient.liveMeasureDao().sumNclocOfBiggestBranch(dbSession, query); + return dbClient.projectDao().getNclocSum(dbSession); } } } diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StatisticsSupportTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StatisticsSupportTest.java index 872862a0699..052ab11bbea 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StatisticsSupportTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StatisticsSupportTest.java @@ -22,7 +22,6 @@ package org.sonar.server.platform; import org.junit.Test; import org.sonar.db.DbClient; import org.sonar.db.DbSession; -import org.sonar.db.measure.SumNclocDbQuery; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -37,7 +36,7 @@ public class StatisticsSupportTest { @Test public void should_return_metric_from_liveMeasureDao() { - when(dbClient.liveMeasureDao().sumNclocOfBiggestBranch(any(DbSession.class), any(SumNclocDbQuery.class))).thenReturn(1800999L); + when(dbClient.projectDao().getNclocSum(any(DbSession.class))).thenReturn(1800999L); long linesOfCode = statisticsSupport.getLinesOfCode(); |