/** * Used to set the author when it was null */ public boolean setNewAuthor(DefaultIssue issue, @Nullable String newAuthorLogin, IssueChangeContext context) { if (isNullOrEmpty(newAuthorLogin)) { return false; } checkState(issue.authorLogin() == null, "It's not possible to update the author with this method, please use setAuthorLogin()"); issue.setFieldChange(context, AUTHOR, null, newAuthorLogin); issue.setAuthorLogin(newAuthorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; }
public boolean setAuthorLogin(DefaultIssue issue, @Nullable String authorLogin, IssueChangeContext context) { if (!Objects.equals(authorLogin, issue.authorLogin())) { issue.setFieldChange(context, AUTHOR, issue.authorLogin(), authorLogin); issue.setAuthorLogin(authorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; } return false; }
@Test public void do_not_reset_author_if_already_set() { setSingleChangeset("john", 123456789L, "rev-1"); DefaultIssue issue = newIssueOnLines(1) .setAuthorLogin("jane"); underTest.onIssue(FILE, issue); assertThat(issue.authorLogin()).isEqualTo("jane"); }
@Test public void fail_with_ISE_when_setting_new_author_on_issue() { issue.setAuthorLogin("simon"); thrown.expect(IllegalStateException.class); thrown.expectMessage("It's not possible to update the author with this method, please use setAuthorLogin()"); underTest.setNewAuthor(issue, "julien", context); }
@Test public void do_not_assign_issue_if_unassigned_but_already_authored() { addScmUser("john", "u1234"); setSingleChangeset("john", 123456789L, "rev-1"); DefaultIssue issue = newIssueOnLines(1) .setAuthorLogin("john") .setAssigneeUuid(null); underTest.onIssue(FILE, issue); assertThat(issue.authorLogin()).isEqualTo("john"); assertThat(issue.assignee()).isNull(); }
.setResolution(Issue.RESOLUTION_FIXED) .setAssigneeUuid("julien") .setAuthorLogin("steph") .setChecksum("c7b5db46591806455cf082bb348631e8") .setNew(true)
.setSeverity(BLOCKER) .setAssigneeUuid("base assignee uuid") .setAuthorLogin("base author") .setTags(newArrayList("base tag")) .setOnDisabledRule(true)
issue.setSeverity(Severity.BLOCKER); issue.setManualSeverity(false); issue.setAuthorLogin("simon"); issue.setChecksum("CHECKSUM-ABCDE"); issue.setResolution(null);
.setSeverity(BLOCKER) .setAssigneeUuid("base assignee uuid") .setAuthorLogin("base author") .setTags(newArrayList("base tag")) .setOnDisabledRule(true)
.setSeverity(BLOCKER) .setAssigneeUuid("base assignee uuid") .setAuthorLogin("base author") .setTags(newArrayList("base tag")) .setSelectedAt(1000L)
private void copyFields(DefaultIssue toIssue, DefaultIssue fromIssue) { toIssue.setType(fromIssue.type()); toIssue.setCreationDate(fromIssue.creationDate()); toIssue.setUpdateDate(fromIssue.updateDate()); toIssue.setCloseDate(fromIssue.closeDate()); toIssue.setResolution(fromIssue.resolution()); toIssue.setStatus(fromIssue.status()); toIssue.setAssigneeUuid(fromIssue.assignee()); toIssue.setAuthorLogin(fromIssue.authorLogin()); toIssue.setTags(fromIssue.tags()); toIssue.setAttributes(fromIssue.attributes()); toIssue.setEffort(debtCalculator.calculate(toIssue)); toIssue.setOnDisabledRule(fromIssue.isOnDisabledRule()); toIssue.setSelectedAt(fromIssue.selectedAt()); } }
issue.setTags(getTags()); issue.setLanguage(language); issue.setAuthorLogin(authorLogin); issue.setNew(false); issue.setCreationDate(longToDate(issueCreationDate));
.setEffort(Duration.create(issue.effortInMinutes() + 10L)) .setChecksum("FFFFF") .setAuthorLogin("simon") .setAssigneeUuid("loic") .setFieldChange(IssueChangeContext.createUser(new Date(), "user_uuid"), "severity", "INFO", "BLOCKER")
/** * Used to set the author when it was null */ public boolean setNewAuthor(DefaultIssue issue, @Nullable String newAuthorLogin, IssueChangeContext context) { if (isNullOrEmpty(newAuthorLogin)) { return false; } checkState(issue.authorLogin() == null, "It's not possible to update the author with this method, please use setAuthorLogin()"); issue.setFieldChange(context, AUTHOR, null, newAuthorLogin); issue.setAuthorLogin(newAuthorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; }
public boolean setAuthorLogin(DefaultIssue issue, @Nullable String authorLogin, IssueChangeContext context) { if (!Objects.equals(authorLogin, issue.authorLogin())) { issue.setFieldChange(context, AUTHOR, issue.authorLogin(), authorLogin); issue.setAuthorLogin(authorLogin); issue.setUpdateDate(context.date()); issue.setChanged(true); // do not send notifications to prevent spam when installing the developer cockpit plugin return true; } return false; }
private void copyFields(DefaultIssue toIssue, DefaultIssue fromIssue) { toIssue.setType(fromIssue.type()); toIssue.setCreationDate(fromIssue.creationDate()); toIssue.setUpdateDate(fromIssue.updateDate()); toIssue.setCloseDate(fromIssue.closeDate()); toIssue.setResolution(fromIssue.resolution()); toIssue.setStatus(fromIssue.status()); toIssue.setAssigneeUuid(fromIssue.assignee()); toIssue.setAuthorLogin(fromIssue.authorLogin()); toIssue.setTags(fromIssue.tags()); toIssue.setAttributes(fromIssue.attributes()); toIssue.setEffort(debtCalculator.calculate(toIssue)); toIssue.setOnDisabledRule(fromIssue.isOnDisabledRule()); toIssue.setSelectedAt(fromIssue.selectedAt()); } }
issue.setTags(getTags()); issue.setLanguage(language); issue.setAuthorLogin(authorLogin); issue.setNew(false); issue.setCreationDate(longToDate(issueCreationDate));