diff options
Diffstat (limited to 'controller-api')
3 files changed, 60 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java index 0ca4acdcf49..31b0b3e5f37 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeHistory.java @@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.util.Objects; + /** * Wire class for node-repository representation of the history of a node * @@ -33,4 +36,27 @@ public class NodeHistory { return event; } + @Override + public String toString() { + return "NodeHistory{" + + "at=" + (at == null ? "null" : Instant.ofEpochSecond(at)) + + ", agent='" + agent + '\'' + + ", event='" + event + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + NodeHistory that = (NodeHistory) o; + return Objects.equals(at, that.at) && + Objects.equals(agent, that.agent) && + Objects.equals(event, that.event); + } + + @Override + public int hashCode() { + return Objects.hash(at, agent, event); + } } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java index 3d3bbddd349..4a17532d069 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeMembership.java @@ -4,6 +4,8 @@ package com.yahoo.vespa.hosted.controller.api.integration.noderepository; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + /** * @author mpolden */ @@ -40,4 +42,32 @@ public class NodeMembership { public Boolean getRetired() { return retired; } + + @Override + public String toString() { + return "NodeMembership{" + + "clustertype='" + clustertype + '\'' + + ", clusterid='" + clusterid + '\'' + + ", group='" + group + '\'' + + ", index=" + index + + ", retired=" + retired + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + NodeMembership that = (NodeMembership) o; + return Objects.equals(clustertype, that.clustertype) && + Objects.equals(clusterid, that.clusterid) && + Objects.equals(group, that.group) && + Objects.equals(index, that.index) && + Objects.equals(retired, that.retired); + } + + @Override + public int hashCode() { + return Objects.hash(clustertype, clusterid, group, index, retired); + } } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java index 076d81aa5aa..ac5e2c9d52a 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeOwner.java @@ -34,6 +34,9 @@ public class NodeOwner { } @Override + public String toString() { return tenant + '.' + application + '.' + instance; } + + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @@ -44,7 +47,5 @@ public class NodeOwner { } @Override - public int hashCode() { - return Objects.hash(tenant, application, instance); - } + public int hashCode() { return Objects.hash(tenant, application, instance); } } |