diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2024-02-14 09:25:14 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-16 20:02:31 +0000 |
commit | 33de33ad99df936004546f37ecbfac62ce73f8d6 (patch) | |
tree | 9b2ba82b5dc9d95721e266302721d6429afeed9d /server/sonar-webserver-core | |
parent | 119aca6c8cac066f8de9da229e52d2f6213a0406 (diff) | |
download | sonarqube-33de33ad99df936004546f37ecbfac62ce73f8d6.tar.gz sonarqube-33de33ad99df936004546f37ecbfac62ce73f8d6.zip |
SONAR-21165 Remove uuid from issues_impacts and rules_default_impacts table
Diffstat (limited to 'server/sonar-webserver-core')
3 files changed, 8 insertions, 10 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/NewRuleCreator.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/NewRuleCreator.java index 3e6f5d392fb..49664e6d51b 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/NewRuleCreator.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/NewRuleCreator.java @@ -79,7 +79,7 @@ public class NewRuleCreator { ruleDto.setCleanCodeAttribute(cleanCodeAttribute != null ? cleanCodeAttribute : CleanCodeAttribute.defaultCleanCodeAttribute()); ruleDto.replaceAllDefaultImpacts(ruleDef.defaultImpacts().entrySet() .stream() - .map(e -> new ImpactDto().setUuid(uuidFactory.create()).setSoftwareQuality(e.getKey()).setSeverity(e.getValue())) + .map(e -> new ImpactDto().setSoftwareQuality(e.getKey()).setSeverity(e.getValue())) .collect(Collectors.toSet())); } diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/StartupRuleUpdater.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/StartupRuleUpdater.java index 20f42ac2a16..80c41708866 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/StartupRuleUpdater.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/registration/StartupRuleUpdater.java @@ -203,7 +203,7 @@ public class StartupRuleUpdater { if (!Objects.equals(impactsFromDb, impactsFromPlugin)) { dto.replaceAllDefaultImpacts(impactsFromPlugin.entrySet() .stream() - .map(e -> new ImpactDto().setUuid(uuidFactory.create()).setSoftwareQuality(e.getKey()).setSeverity(e.getValue())) + .map(e -> new ImpactDto().setSoftwareQuality(e.getKey()).setSeverity(e.getValue())) .collect(Collectors.toSet())); ruleChange.addImpactsChange(removeDuplicatedImpacts(impactsFromDb, impactsFromPlugin), removeDuplicatedImpacts(impactsFromPlugin, impactsFromDb)); diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/registration/StartupRuleUpdaterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/registration/StartupRuleUpdaterTest.java index 15cb04a3e5f..f6583588583 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/registration/StartupRuleUpdaterTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/registration/StartupRuleUpdaterTest.java @@ -34,8 +34,8 @@ import org.sonar.db.DbClient; import org.sonar.db.issue.ImpactDto; import org.sonar.db.rule.RuleDto; import org.sonar.server.rule.RuleDescriptionSectionsGeneratorResolver; + import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -58,7 +58,7 @@ public class StartupRuleUpdaterTest { RuleDto rule = getDefaultRuleDto(); when(rule.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE); - Set<ImpactDto> oldImpacts = Set.of(new ImpactDto("uuid", SoftwareQuality.RELIABILITY, Severity.LOW)); + Set<ImpactDto> oldImpacts = Set.of(new ImpactDto(SoftwareQuality.RELIABILITY, Severity.LOW)); when(rule.getDefaultImpacts()).thenReturn(oldImpacts); StartupRuleUpdater.RuleChange changesAndUpdateRule = underTest.findChangesAndUpdateRule(ruleDef, rule); @@ -79,9 +79,8 @@ public class StartupRuleUpdaterTest { RuleDto rule = getDefaultRuleDto(); when(rule.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE); - Set<ImpactDto> oldImpacts = Set.of(new ImpactDto("uuid", - SoftwareQuality.RELIABILITY, Severity.LOW), - new ImpactDto("uuid2", SoftwareQuality.SECURITY, Severity.HIGH)); + Set<ImpactDto> oldImpacts = Set.of(new ImpactDto(SoftwareQuality.RELIABILITY, Severity.LOW), + new ImpactDto(SoftwareQuality.SECURITY, Severity.HIGH)); when(rule.getDefaultImpacts()).thenReturn(oldImpacts); StartupRuleUpdater.RuleChange changesAndUpdateRule = underTest.findChangesAndUpdateRule(ruleDef, rule); @@ -100,8 +99,7 @@ public class StartupRuleUpdaterTest { RuleDto rule = getDefaultRuleDto(); when(rule.getCleanCodeAttribute()).thenReturn(CleanCodeAttribute.COMPLETE); - Set<ImpactDto> oldImpacts = Set.of(new ImpactDto("uuid", - SoftwareQuality.MAINTAINABILITY, Severity.LOW)); + Set<ImpactDto> oldImpacts = Set.of(new ImpactDto(SoftwareQuality.MAINTAINABILITY, Severity.LOW)); when(rule.getDefaultImpacts()).thenReturn(oldImpacts); StartupRuleUpdater.RuleChange changesAndUpdateRule = underTest.findChangesAndUpdateRule(ruleDef, rule); @@ -123,4 +121,4 @@ public class StartupRuleUpdaterTest { when(ruleDto.getScope()).thenReturn(RuleDto.Scope.TEST); return ruleDto; } -}
\ No newline at end of file +} |