aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorJon Bratseth <jonbratseth@yahoo.com>2018-01-05 13:06:51 +0100
committerGitHub <noreply@github.com>2018-01-05 13:06:51 +0100
commitc1c186a34500e3eacd9d813eba4138b6cdd3e428 (patch)
tree8490a421ea1fe310097c0c5c6c94f9e6e5c651b8 /controller-api
parent2efcf655364d82a083b0e886829b45c55e21c331 (diff)
parentfff9c4a16c7d57f4535b08980d778785bf9ef6fe (diff)
Merge pull request #4556 from vespa-engine/jvenstad/pushing-build-system
Jvenstad/pushing build system
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java25
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java15
2 files changed, 37 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java
index 7933a23c45f..5e9c8d73b38 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java
@@ -1,18 +1,21 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration;
+import java.util.Objects;
+
/**
* @author jvenstad
*/
public interface BuildService {
/**
- * Enqueue a job defined by "buildJob in an external build system, and return the outcome of the enqueue request.
- * This method should return @false only when a retry is in order, and @true otherwise, e.g., on success, or for
+ * Enqueue a job defined by buildJob in an external build system, and return the outcome of the enqueue request.
+ * This method should return false only when a retry is in order, and true otherwise, e.g., on success, or for
* invalid jobs.
*/
boolean trigger(BuildJob buildJob);
+
class BuildJob {
private final long projectId;
@@ -27,7 +30,23 @@ public interface BuildService {
public String jobName() { return jobName; }
@Override
- public String toString() { return jobName + "@" + projectId; }
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if ( ! (o instanceof BuildJob)) return false;
+ BuildJob buildJob = (BuildJob) o;
+ return projectId == buildJob.projectId &&
+ Objects.equals(jobName, buildJob.jobName);
+ }
+
+ @Override
+ public String toString() {
+ return jobName + "@" + projectId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(projectId, jobName);
+ }
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java
new file mode 100644
index 00000000000..786a26a2330
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java
@@ -0,0 +1,15 @@
+package com.yahoo.vespa.hosted.controller.api.integration.stubs;
+
+import com.yahoo.vespa.hosted.controller.api.integration.BuildService;
+
+/**
+ * @author jvenstad
+ */
+public class MockBuildService implements BuildService {
+
+ @Override
+ public boolean trigger(BuildJob buildJob) {
+ return true;
+ }
+
+}