Add 'tagline' back to MainResponse in server that was removed in PR #427 (#913)

* Add "tagline" field back to "MainResponse" in sever side (not in rest-high-level-client side) that removed in PR #427 .
* Replace with a new tagline "The OpenSearch Project: https://opensearch.org/".
* Turn the tagline into a constant in server/src/main/java/org/opensearch/action/main/MainResponse.java.
This commit is contained in:
Tianli Feng 2021-07-01 15:30:29 -07:00 committed by GitHub
parent 2335194ebe
commit 4a1add9481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -56,6 +56,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
private String clusterUuid;
private Build build;
private String versionNumber;
public static final String TAGLINE = "The OpenSearch Project: https://opensearch.org/";
MainResponse() {}
@ -151,6 +152,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
.field("minimum_wire_compatibility_version", version.minimumCompatibilityVersion().toString())
.field("minimum_index_compatibility_version", version.minimumIndexCompatibilityVersion().toString())
.endObject();
builder.field("tagline", TAGLINE);
builder.endObject();
return builder;
}
@ -168,6 +170,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject {
PARSER.declareString((response, value) -> response.nodeName = value, new ParseField("name"));
PARSER.declareString((response, value) -> response.clusterName = new ClusterName(value), new ParseField("cluster_name"));
PARSER.declareString((response, value) -> response.clusterUuid = value, new ParseField("cluster_uuid"));
PARSER.declareString((response, value) -> {}, new ParseField("tagline"));
PARSER.declareObject((response, value) -> {
final String buildType = (String) value.get("build_type");
response.build =

View File

@ -48,6 +48,8 @@ import org.opensearch.test.VersionUtils;
import java.io.IOException;
import java.util.Date;
import static org.opensearch.action.main.MainResponse.TAGLINE;
public class MainResponseTests extends AbstractSerializingTestCase<MainResponse> {
@Override
@ -98,7 +100,8 @@ public class MainResponseTests extends AbstractSerializingTestCase<MainResponse>
+ "\"build_snapshot\":" + current.isSnapshot() + ","
+ "\"lucene_version\":\"" + version.luceneVersion.toString() + "\","
+ "\"minimum_wire_compatibility_version\":\"" + version.minimumCompatibilityVersion().toString() + "\","
+ "\"minimum_index_compatibility_version\":\"" + version.minimumIndexCompatibilityVersion().toString() + "\"}"
+ "\"minimum_index_compatibility_version\":\"" + version.minimumIndexCompatibilityVersion().toString() + "\"},"
+ "\"tagline\":\"" + TAGLINE + "\""
+ "}", Strings.toString(builder));
}