org.opensearch.test.TestClusterStateCustom Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
OpenSearch subproject :test:framework
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
package org.opensearch.test;
import org.opensearch.Version;
import org.opensearch.cluster.AbstractNamedDiffable;
import org.opensearch.cluster.ClusterState;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.core.xcontent.XContentBuilder;
import java.io.IOException;
public abstract class TestClusterStateCustom extends AbstractNamedDiffable implements ClusterState.Custom {
private final String value;
protected TestClusterStateCustom(String value) {
this.value = value;
}
protected TestClusterStateCustom(StreamInput in) throws IOException {
this.value = in.readString();
}
@Override
public Version getMinimalSupportedVersion() {
return Version.CURRENT;
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(value);
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder;
}
@Override
public boolean isPrivate() {
return true;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TestClusterStateCustom that = (TestClusterStateCustom) o;
if (!value.equals(that.value)) return false;
return true;
}
@Override
public int hashCode() {
return value.hashCode();
}
}