diff options
2 files changed, 20 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java index 80e23249daa..a49cee30015 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java @@ -76,6 +76,15 @@ public interface IssueHandler { boolean reassign(IssueId issueId, User assignee); /** + * Reassign the issue with the given ID to the given user, and returns the outcome of this. + * + * @param issueId ID of the issue to be watched. + * @param watcher watcher to add to the issue. + * @return Whether adding the watcher was successful. + */ + boolean addWatcher(IssueId issueId, String watcher); + + /** * Escalate an issue filed with the given property. * * @param issueId ID of the issue to escalate. diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java index deabbcabac8..cf0b467c790 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java @@ -7,6 +7,7 @@ import java.net.URI; import java.time.Clock; import java.time.Duration; import java.time.Instant; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -83,6 +84,12 @@ public class MockIssueHandler implements IssueHandler { } @Override + public boolean addWatcher(IssueId issueId, String watcher) { + issues.get(issueId).addWatcher(watcher); + return true; + } + + @Override public Optional<User> escalate(IssueId issueId, Contact contact) { List<List<User>> contacts = getContactUsers(contact); Optional<User> assignee = assigneeOf(issueId); @@ -145,17 +152,21 @@ public class MockIssueHandler implements IssueHandler { private Instant updated; private boolean open; private User assignee; + private List<String> watchers; private MockIssue(Issue issue) { this.issue = issue; this.updated = clock.instant(); this.open = true; this.assignee = issue.assignee().orElse(null); + this.watchers = new ArrayList<>(); } public Issue issue() { return issue; } public User assignee() { return assignee; } public boolean isOpen() { return open; } + public List<String> watchers() { return List.copyOf(watchers); } + public void addWatcher(String watcher) { watchers.add(watcher); } } |