diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2022-12-14 11:16:17 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-12-15 20:03:33 +0000 |
commit | 2bf2395c57dd82e6e2557e7497f8854d755479bc (patch) | |
tree | e9fd80577657b23273dbc708bb8da334eb77f6e1 /server/sonar-db-dao | |
parent | 6943335f31a66164ebd6d4c8934136692f6b83a9 (diff) | |
download | sonarqube-2bf2395c57dd82e6e2557e7497f8854d755479bc.tar.gz sonarqube-2bf2395c57dd82e6e2557e7497f8854d755479bc.zip |
SONAR-17254 added coverage for renaming the main branch of the application
Diffstat (limited to 'server/sonar-db-dao')
4 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java index 1dff7ccc75b..65f60177741 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java @@ -53,9 +53,9 @@ public class BranchDao implements Dao { } } - public int updateMainBranchName(DbSession dbSession, String projectUuid, String newBranchKey) { + public int updateBranchName(DbSession dbSession, String branchUuid, String newBranchKey) { long now = system2.now(); - return mapper(dbSession).updateMainBranchName(projectUuid, newBranchKey, now); + return mapper(dbSession).updateBranchName(branchUuid, newBranchKey, now); } public int updateExcludeFromPurge(DbSession dbSession, String branchUuid, boolean excludeFromPurge) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java index eebd797906a..a840d00be87 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchMapper.java @@ -32,7 +32,7 @@ public interface BranchMapper { int update(@Param("dto") BranchDto dto, @Param("now") long now); - int updateMainBranchName(@Param("projectUuid") String projectUuid, @Param("newBranchName") String newBranchName, @Param("now") long now); + int updateBranchName(@Param("branchUuid") String branchUuid, @Param("newBranchName") String newBranchName, @Param("now") long now); int updateExcludeFromPurge(@Param("uuid") String uuid, @Param("excludeFromPurge") boolean excludeFromPurge, @Param("now") long now); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml index ab077238c9f..fc6074dd865 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml @@ -39,13 +39,13 @@ ) </insert> - <update id="updateMainBranchName" parameterType="map"> + <update id="updateBranchName" parameterType="map"> update project_branches set kee = #{newBranchName, jdbcType=VARCHAR}, updated_at = #{now, jdbcType=BIGINT} where - uuid = #{projectUuid, jdbcType=VARCHAR} + uuid = #{branchUuid, jdbcType=VARCHAR} </update> <update id="updateExcludeFromPurge"> diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java index 1c6589f3190..be3f1d37711 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java @@ -106,7 +106,7 @@ public class BranchDaoTest { dto2.setKey("branch"); underTest.insert(dbSession, dto2); - underTest.updateMainBranchName(dbSession, "U1", "master"); + underTest.updateBranchName(dbSession, "U1", "master"); BranchDto loaded = underTest.selectByBranchKey(dbSession, "U1", "master").get(); assertThat(loaded.getMergeBranchUuid()).isNull(); assertThat(loaded.getProjectUuid()).isEqualTo("U1"); |