IssueChangedEvent event = new IssueChangedEvent(projectKey, new Issue[]{changedIssue},
resolved, severity, type);
- persistEvent(event, issue.projectUuid());
+ persistEvent(event, branch.getProjectUuid());
}
@Override
IssueChangedEvent event = getIssueChangedEvent(projectKey, issuesInProject, issueChanges);
if (event != null) {
- persistEvent(event, entry.getValue().branchUuid());
+ BranchDto branchDto = branchesByProjectUuid.get(entry.getKey());
+ persistEvent(event, branchDto.getProjectUuid());
}
}
}
public final IssueChangeEventServiceImpl underTest = new IssueChangeEventServiceImpl(db.getDbClient());
@Test
- public void distributeIssueChangeEvent_singleIssueChange_severityChange() {
+ public void distributeIssueChangeEvent_whenSingleIssueChange_shouldChangeSeverity() {
ComponentDto componentDto = db.components().insertPublicProject().getMainBranchComponent();
ProjectDto project = db.getDbClient().projectDao().selectByUuid(db.getSession(), componentDto.uuid()).get();
BranchDto branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), project.getUuid()).get();
}
@Test
- public void distributeIssueChangeEvent_singleIssueChange_typeChange() {
+ public void distributeIssueChangeEvent_whenSingleIssueChange_shouldChangeType() {
ComponentDto componentDto = db.components().insertPublicProject().getMainBranchComponent();
ProjectDto project = db.getDbClient().projectDao().selectByUuid(db.getSession(), componentDto.uuid()).get();
BranchDto branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), project.getUuid()).get();
}
@Test
- public void distributeIssueChangeEvent_singleIssueChange_transitionChanges() {
+ public void distributeIssueChangeEvent_whenSingleIssueChange_shouldExecuteTransitionChanges() {
ComponentDto componentDto = db.components().insertPublicProject().getMainBranchComponent();
ProjectDto project = db.getDbClient().projectDao().selectByUuid(db.getSession(), componentDto.uuid()).get();
BranchDto branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), project.getUuid()).get();
}
@Test
- public void distributeIssueChangeEvent_singleIssueChange_severalChanges() {
+ public void distributeIssueChangeEvent_whenSingleIssueChangeOnABranch_shouldChangeSeverity() {
+ ComponentDto componentDto = db.components().insertPublicProject().getMainBranchComponent();
+ ProjectDto project = db.getDbClient().projectDao().selectByUuid(db.getSession(), componentDto.uuid()).get();
+ BranchDto featureBranch = db.components().insertProjectBranch(project, b -> b.setKey("feature1"));
+ ComponentDto branchComponent = db.components().insertFile(featureBranch);
+ RuleDto rule = db.rules().insert();
+ IssueDto issue = db.issues().insert(rule, project, branchComponent, i -> i.setSeverity(MAJOR.name()));
+ assertPushEventIsPersisted(project, featureBranch, issue, BLOCKER.name(), null, null, null, 1);
+ }
+
+ @Test
+ public void distributeIssueChangeEvent_whenSingleIssueChange_shouldExecuteSeveralChanges() {
ComponentDto componentDto = db.components().insertPublicProject().getMainBranchComponent();
ProjectDto project = db.getDbClient().projectDao().selectByUuid(db.getSession(), componentDto.uuid()).get();
BranchDto branch = db.getDbClient().branchDao().selectByUuid(db.getSession(), project.getUuid()).get();
}
@Test
- public void distributeIssueChangeEvent_bulkIssueChange() {
+ public void distributeIssueChangeEvent_whenBulkIssueChange_shouldDistributesEvents() {
RuleDto rule = db.rules().insert();
ComponentDto componentDto1 = db.components().insertPublicProject().getMainBranchComponent();
}
@Test
- public void doNotDistributeIssueChangeEvent_forPullRequestIssues() {
+ public void distributeIssueChangeEvent_whenPullRequestIssues_shouldNotDistributeEvents() {
RuleDto rule = db.rules().insert();
ComponentDto project = db.components().insertPublicProject().getMainBranchComponent();