From 3246470e8134258859b1e98eab0604bb9ea789b6 Mon Sep 17 00:00:00 2001 From: Alain Kermis Date: Fri, 2 Jun 2023 14:35:05 +0200 Subject: [PATCH] SONAR-19340 Fix hotspot propagation issue for branches --- .../it/java/org/sonar/server/hotspot/ws/AssignActionIT.java | 2 +- .../org/sonar/server/hotspot/ws/ChangeStatusActionIT.java | 4 ++-- .../main/java/org/sonar/server/hotspot/ws/AssignAction.java | 2 +- .../java/org/sonar/server/hotspot/ws/ChangeStatusAction.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/AssignActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/AssignActionIT.java index bab03f3c1df..b30bbd2e0b2 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/AssignActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/AssignActionIT.java @@ -352,7 +352,7 @@ public class AssignActionIT { when(issueFieldsSetter.assign(eq(hotspot.toDefaultIssue()), userMatcher(assignee), any(IssueChangeContext.class))).thenReturn(true); executeRequest(hotspot, assignee.getLogin(), null); - verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(project.uuid()), any(HotspotChangedEvent.class)); + verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(project.getMainBranchProjectUuid()), any(HotspotChangedEvent.class)); } @Test diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/ChangeStatusActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/ChangeStatusActionIT.java index b0b02683772..480401f1f7f 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/ChangeStatusActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/hotspot/ws/ChangeStatusActionIT.java @@ -453,7 +453,7 @@ public class ChangeStatusActionIT { newRequest(hotspot, STATUS_REVIEWED, RESOLUTION_FIXED, NO_COMMENT).execute(); - verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(project.uuid()), any(HotspotChangedEvent.class)); + verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(project.getMainBranchProjectUuid()), any(HotspotChangedEvent.class)); } @Test @@ -472,7 +472,7 @@ public class ChangeStatusActionIT { .addProjectPermission(UserRole.SECURITYHOTSPOT_ADMIN, projectComponentDto, branchComponentDto); newRequest(hotspot, STATUS_REVIEWED, RESOLUTION_FIXED, NO_COMMENT).execute(); - verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(branchComponentDto.uuid()), any(HotspotChangedEvent.class)); + verify(hotspotChangeEventService).distributeHotspotChangedEvent(eq(branchDto.getProjectUuid()), any(HotspotChangedEvent.class)); } @Test diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/AssignAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/AssignAction.java index 24f141d7efb..2095b04e6e5 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/AssignAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/AssignAction.java @@ -131,7 +131,7 @@ public class AssignAction implements HotspotsWsAction { BranchDto branch = issueUpdater.getBranch(dbSession, defaultIssue); if (BRANCH.equals(branch.getBranchType())) { HotspotChangedEvent hotspotChangedEvent = buildEventData(defaultIssue, assignee, hotspotDto.getFilePath()); - hotspotChangeEventService.distributeHotspotChangedEvent(defaultIssue.projectUuid(), hotspotChangedEvent); + hotspotChangeEventService.distributeHotspotChangedEvent(branch.getProjectUuid(), hotspotChangedEvent); } } } diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ChangeStatusAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ChangeStatusAction.java index 98cb5a079a0..37f23646e29 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ChangeStatusAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/hotspot/ws/ChangeStatusAction.java @@ -167,7 +167,7 @@ public class ChangeStatusAction implements HotspotsWsAction { BranchDto branch = issueUpdater.getBranch(session, defaultIssue); if (BRANCH.equals(branch.getBranchType())) { HotspotChangedEvent hotspotChangedEvent = buildEventData(defaultIssue, issueDto); - hotspotChangeEventService.distributeHotspotChangedEvent(defaultIssue.projectUuid(), hotspotChangedEvent); + hotspotChangeEventService.distributeHotspotChangedEvent(branch.getProjectUuid(), hotspotChangedEvent); } } } -- 2.39.5