diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-10-23 15:33:39 -0500 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2020-01-31 20:46:09 +0100 |
commit | ace9a50d55d831ec71b7db421aa04d1198392c6c (patch) | |
tree | 3bf598bfe3f760d45310b2a65d014a53370a9930 /server/sonar-db-dao/src/main/java/org/sonar/db/issue | |
parent | 1ff9a01fd6e822793ef223f9ce259b15d17eecc4 (diff) | |
download | sonarqube-ace9a50d55d831ec71b7db421aa04d1198392c6c.tar.gz sonarqube-ace9a50d55d831ec71b7db421aa04d1198392c6c.zip |
SONAR-12689 Separate storage of projects/apps from their components and branches
Diffstat (limited to 'server/sonar-db-dao/src/main/java/org/sonar/db/issue')
-rw-r--r-- | server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java index c700eef4330..37f74824907 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueTesting.java @@ -29,6 +29,7 @@ import org.sonar.api.utils.DateUtils; import org.sonar.core.util.UuidFactoryFast; import org.sonar.core.util.Uuids; import org.sonar.db.component.ComponentDto; +import org.sonar.db.project.ProjectDto; import org.sonar.db.rule.RuleDefinitionDto; import org.sonar.db.rule.RuleDto; @@ -47,13 +48,22 @@ public class IssueTesting { public static IssueDto newIssue(RuleDefinitionDto rule, ComponentDto project, ComponentDto file) { checkArgument(project.qualifier().equals(Qualifiers.PROJECT), "Second parameter should be a project"); - checkArgument(file.projectUuid().equals(project.uuid()), "The file doesn't belong to the project"); + return newIssue(rule, project.uuid(), project.getDbKey(), file); + } + + public static IssueDto newIssue(RuleDefinitionDto rule, ProjectDto project, ComponentDto file) { + return newIssue(rule, project.getUuid(), project.getKey(), file); + } + + public static IssueDto newIssue(RuleDefinitionDto rule, String projectUuid, String projectKey, ComponentDto file) { + checkArgument(file.projectUuid().equals(projectUuid), "The file doesn't belong to the project"); return new IssueDto() .setKee("uuid_" + randomAlphabetic(5)) .setRule(rule) .setType(RuleType.values()[nextInt(RuleType.values().length)]) - .setProject(project) + .setProjectUuid(projectUuid) + .setProjectKey(projectKey) .setComponent(file) .setStatus(Issue.STATUS_OPEN) .setResolution(null) |