Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ public int hashCode() {
builder.append(imagePullSecrets).append(adminServer).append(managedServers).append(clusters);
else
builder
.append(imagePullSecret)
.append(replicas)
.append(startupControl)
.append(clusterStartup)
Expand Down Expand Up @@ -915,6 +916,7 @@ public boolean equals(Object other) {
.append(clusters, rhs.clusters);
else
builder
.append(imagePullSecret, rhs.imagePullSecret)
.append(replicas, rhs.replicas)
.append(startupControl, rhs.startupControl)
.append(clusterStartup, rhs.clusterStartup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import java.util.Optional;
import javax.annotation.Nonnull;
import oracle.kubernetes.operator.KubernetesConstants;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/** Represents the effective configuration for a server, as seen by the operator runtime. */
@SuppressWarnings("WeakerAccess")
Expand Down Expand Up @@ -184,4 +187,27 @@ public V1PodSecurityContext getPodSecurityContext() {
public V1SecurityContext getContainerSecurityContext() {
return null;
}

@Override
public String toString() {
return new ToStringBuilder(this).append("domainSpec", domainSpec).toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;

if (o == null || getClass() != o.getClass()) return false;

if (!(o instanceof ServerSpec)) return false;

ServerSpec that = (ServerSpec) o;

return new EqualsBuilder().append(domainSpec, that.domainSpec).isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(domainSpec).toHashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/** The effective configuration for a server configured by the version 1 domain model. */
public class ServerSpecV1Impl extends ServerSpec {
Expand Down Expand Up @@ -80,4 +83,41 @@ private int getReplicaCount() {
private boolean isSpecified() {
return serverStartup != null || clusterStartup != null;
}

@Override
public String toString() {
return new ToStringBuilder(this)
.appendSuper(super.toString())
.append("clusterName", clusterName)
.append("serverStartup", serverStartup)
.append("clusterStartup", clusterStartup)
.toString();
}

@Override
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
.append(clusterName)
.append(serverStartup)
.append(clusterStartup)
.toHashCode();
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof ServerSpecV1Impl) == false) {
return false;
}
ServerSpecV1Impl rhs = ((ServerSpecV1Impl) other);
return new EqualsBuilder()
.appendSuper(super.equals(rhs))
.append(clusterName, rhs.clusterName)
.append(serverStartup, rhs.serverStartup)
.append(clusterStartup, rhs.clusterStartup)
.isEquals();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import javax.annotation.Nonnull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

public class ManagedServer extends Server {
/** The name of the managed server. Required. */
Expand All @@ -26,4 +29,36 @@ ManagedServer withServerName(@Nonnull String serverName) {
setServerName(serverName);
return this;
}

@Override
public String toString() {
return new ToStringBuilder(this)
.appendSuper(super.toString())
.append("serverName", serverName)
.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;

if (o == null || getClass() != o.getClass()) return false;

if (!(o instanceof ManagedServer)) return false;

ManagedServer that = (ManagedServer) o;

return new EqualsBuilder()
.appendSuper(super.equals(o))
.append(serverName, that.serverName)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.appendSuper(super.hashCode())
.append(serverName)
.toHashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

public class Server extends BaseConfiguration {
/** The node port associated with this server. The introspector will override this value. */
Expand All @@ -27,4 +30,33 @@ public void setNodePort(Integer nodePort) {
public Integer getNodePort() {
return nodePort;
}

@Override
public String toString() {
return new ToStringBuilder(this)
.appendSuper(super.toString())
.append("nodePort", nodePort)
.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;

if (o == null || getClass() != o.getClass()) return false;

if (!(o instanceof Server)) return false;

Server that = (Server) o;

return new EqualsBuilder()
.appendSuper(super.equals(o))
.append(nodePort, that.nodePort)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).appendSuper(super.hashCode()).append(nodePort).toHashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import javax.annotation.Nonnull;
import oracle.kubernetes.weblogic.domain.v1.DomainSpec;
import oracle.kubernetes.weblogic.domain.v1.ServerSpec;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/** The effective configuration for a server configured by the version 2 domain model. */
public abstract class ServerSpecV2Impl extends ServerSpec {
Expand Down Expand Up @@ -94,4 +97,39 @@ public V1Probe getLivenessProbe() {
public V1Probe getReadinessProbe() {
return server.getReadinessProbe();
}

@Override
public String toString() {
return new ToStringBuilder(this)
.appendSuper(super.toString())
.append("server", server)
.append("clusterLimit", clusterLimit)
.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;

if (o == null || getClass() != o.getClass()) return false;

if (!(o instanceof ServerSpecV2Impl)) return false;

ServerSpecV2Impl that = (ServerSpecV2Impl) o;

return new EqualsBuilder()
.appendSuper(super.equals(o))
.append(server, that.server)
.append(clusterLimit, that.clusterLimit)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.appendSuper(super.hashCode())
.append(server)
.append(clusterLimit)
.toHashCode();
}
}