aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Marion <steve.marion@sonarsource.com>2024-08-29 15:16:42 +0200
committersonartech <sonartech@sonarsource.com>2024-09-09 20:02:50 +0000
commit7c792fd39a2e67f2688e9f5b9aa8fce5488efb61 (patch)
tree13a94f4e10e38b7cac54ed1a29563893e01942cf
parente21e8474d4c2af05aca478fc0ab5163ff5668901 (diff)
downloadsonarqube-7c792fd39a2e67f2688e9f5b9aa8fce5488efb61.tar.gz
sonarqube-7c792fd39a2e67f2688e9f5b9aa8fce5488efb61.zip
SONAR-22891 add file sources to the database populator
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/createdb/PopulateDb.java8
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/source/FileSourceTester.java2
2 files changed, 6 insertions, 4 deletions
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/PopulateDb.java b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/PopulateDb.java
index b77c4bcb869..6730b2862fc 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/PopulateDb.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/PopulateDb.java
@@ -98,7 +98,7 @@ public class PopulateDb {
executorService.shutdown();
executorService.awaitTermination(100, TimeUnit.DAYS);
- createUsers(sqContext, 100_000);
+ createUsers(sqContext, 100);
allPortfolios = new ArrayList<>(dbTester.getDbClient().portfolioDao().selectAll(initSession));
allPortfolios.addAll(createPortfolios(sqContext, new PortfolioGenerationSettings(allPortfolios.size(), 100, 10)));
@@ -222,9 +222,13 @@ public class PopulateDb {
// for every file in branch
for (int file = 0; file < pj.filePerBranch; file++) {
ComponentDto fileComponentDto = sqContext.dbTester.components().insertFile(branchAndComponentDto.compo);
+ sqContext.dbTester.fileSources().insertFileSource(fileComponentDto, pj.issuePerFile,
+ fs -> fs.setSourceData(fs.getSourceData()));
// for every issue in file
for (int issue = 0; issue < pj.issuePerFile; issue++) {
- IssueDto issueDto = sqContext.dbTester.issues().insertIssue(sqContext.findNotSecurityHotspotRule(), branchAndComponentDto.compo, fileComponentDto);
+ final int issueLine = issue + 1;
+ IssueDto issueDto = sqContext.dbTester.issues().insertIssue(sqContext.findNotSecurityHotspotRule(), branchAndComponentDto.compo, fileComponentDto,
+ iDto -> iDto.setLine(issueLine));
// for every issue change in issue
for (int issueChange = 0; issueChange < pj.issueChangePerIssue; issueChange++) {
sqContext.dbTester.issues().insertChange(issueDto);
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/source/FileSourceTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/source/FileSourceTester.java
index 7f612fdb82b..9e2bb1000a3 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/source/FileSourceTester.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/source/FileSourceTester.java
@@ -92,8 +92,6 @@ public class FileSourceTester {
.setLineHits(RandomUtils.nextInt(4))
.setConditions(RandomUtils.nextInt(4))
.setCoveredConditions(RandomUtils.nextInt(4))
- .setHighlighting(randomAlphanumeric(40))
- .setSymbols(randomAlphanumeric(30))
.addAllDuplication(Arrays.asList(RandomUtils.nextInt(200), RandomUtils.nextInt(200)))
.build();
}