summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2022-05-02 21:08:17 +0200
committerGitHub <noreply@github.com>2022-05-02 21:08:17 +0200
commit6058f5f8d2ed19ca3c0461e7080680a093834823 (patch)
tree3e09032c623789406abfa2d42ea74b7064cb7087 /controller-api
parent04898b34190a3e3bb9d3053e11eb892bc48ff842 (diff)
Revert "Jonmv/remove last controller jersey client [run-systemtest]"
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueHandler.java21
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueInfo.java65
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/MockIssueHandler.java20
3 files changed, 5 insertions, 101 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 8123b6f2ce6..dc8b22ac32d 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
@@ -2,13 +2,8 @@
package com.yahoo.vespa.hosted.controller.api.integration.organization;
-import com.yahoo.vespa.hosted.controller.api.integration.jira.JiraIssue;
-
-import java.io.InputStream;
import java.time.Duration;
-import java.util.List;
import java.util.Optional;
-import java.util.function.Supplier;
/**
* @author jonmv
@@ -24,22 +19,12 @@ public interface IssueHandler {
IssueId file(Issue issue);
/**
- * Returns all open issues similar to the given.
- *
- * @param issue The issue to search for; relevant fields are the summary and the owner (propertyId).
- * @return All open, similar issues.
- */
- List<IssueInfo> findAllBySimilarity(Issue issue);
-
- /**
* Returns the ID of this issue, if it exists and is open, based on a similarity search.
*
* @param issue The issue to search for; relevant fields are the summary and the owner (propertyId).
* @return ID of the issue, if it is found.
*/
- default Optional<IssueId> findBySimilarity(Issue issue) {
- return findAllBySimilarity(issue).stream().findFirst().map(IssueInfo::id);
- }
+ Optional<IssueId> findBySimilarity(Issue issue);
/**
* Update the description of the issue with the given ID.
@@ -123,8 +108,4 @@ public interface IssueHandler {
* @throws RuntimeException exception if project not found
*/
ProjectInfo projectInfo(String projectKey);
-
- /** Upload an attachment to the issue, with indicated filename, from the given input stream. */
- void addAttachment(IssueId id, String filename, Supplier<InputStream> contentAsStream);
-
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueInfo.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueInfo.java
deleted file mode 100644
index 52c022bebdf..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueInfo.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.yahoo.vespa.hosted.controller.api.integration.organization;
-
-import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.User;
-
-import java.time.Instant;
-import java.util.Optional;
-
-/**
- * Information about a stored issue.
- *
- * @author jonmv
- */
-public class IssueInfo {
-
- private final IssueId id;
- private final Instant updated;
- private final Status status;
- private final User assignee;
-
- public IssueInfo(IssueId id, Instant updated, Status status, User assignee) {
- this.id = id;
- this.updated = updated;
- this.status = status;
- this.assignee = assignee;
- }
-
- public IssueId id() {
- return id;
- }
-
- public Instant updated() {
- return updated;
- }
-
- public Status status() {
- return status;
- }
-
- public Optional<User> assignee() {
- return Optional.ofNullable(assignee);
- }
-
-
- public enum Status {
-
- toDo("To Do"),
- inProgress("In Progress"),
- done("Done"),
- noCategory("No Category");
-
- private final String value;
-
- Status(String value) { this.value = value; }
-
- public static Status fromValue(String value) {
- for (Status status : Status.values())
- if (status.value.equals(value))
- return status;
- throw new IllegalArgumentException(value + " is not a valid status.");
- }
-
- }
-
-}
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 a62f43d1cf5..257d2ff5e67 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
@@ -2,9 +2,7 @@
package com.yahoo.vespa.hosted.controller.api.integration.organization;
import com.google.inject.Inject;
-import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueInfo.Status;
-import java.io.InputStream;
import java.net.URI;
import java.time.Clock;
import java.time.Duration;
@@ -16,7 +14,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.Supplier;
import java.util.stream.Collectors;
/**
@@ -27,7 +24,6 @@ public class MockIssueHandler implements IssueHandler {
private final Clock clock;
private final AtomicLong counter = new AtomicLong();
private final Map<IssueId, MockIssue> issues = new HashMap<>();
- private final Map<IssueId, Map<String, InputStream>> attachments = new HashMap<>();
private final Map<String, ProjectInfo> projects = new HashMap<>();
@Inject
@@ -49,14 +45,11 @@ public class MockIssueHandler implements IssueHandler {
}
@Override
- public List<IssueInfo> findAllBySimilarity(Issue issue) {
+ public Optional<IssueId> findBySimilarity(Issue issue) {
return issues.entrySet().stream()
- .filter(entry -> entry.getValue().issue.summary().equals(issue.summary()))
- .map(entry -> new IssueInfo(entry.getKey(),
- entry.getValue().updated,
- entry.getValue().isOpen() ? Status.toDo : Status.done,
- entry.getValue().assignee))
- .collect(Collectors.toList());
+ .filter(entry -> entry.getValue().issue.summary().equals(issue.summary()))
+ .findFirst()
+ .map(Map.Entry::getKey);
}
@Override
@@ -125,11 +118,6 @@ public class MockIssueHandler implements IssueHandler {
return projects.get(projectKey);
}
- @Override
- public void addAttachment(IssueId id, String filename, Supplier<InputStream> contentAsStream) {
- attachments.computeIfAbsent(id, __ -> new HashMap<>()).put(filename, contentAsStream.get());
- }
-
public MockIssueHandler close(IssueId issueId) {
issues.get(issueId).open = false;
touch(issueId);