From 4a1add9481e300e09b90a20d3bca7691b6273096 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Thu, 1 Jul 2021 15:30:29 -0700 Subject: [PATCH] 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. --- .../main/java/org/opensearch/action/main/MainResponse.java | 3 +++ .../java/org/opensearch/action/main/MainResponseTests.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/action/main/MainResponse.java b/server/src/main/java/org/opensearch/action/main/MainResponse.java index 2ae3110106b..c1c0a71b243 100644 --- a/server/src/main/java/org/opensearch/action/main/MainResponse.java +++ b/server/src/main/java/org/opensearch/action/main/MainResponse.java @@ -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 = diff --git a/server/src/test/java/org/opensearch/action/main/MainResponseTests.java b/server/src/test/java/org/opensearch/action/main/MainResponseTests.java index 49647d92463..aa62a3880f4 100644 --- a/server/src/test/java/org/opensearch/action/main/MainResponseTests.java +++ b/server/src/test/java/org/opensearch/action/main/MainResponseTests.java @@ -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 { @Override @@ -98,7 +100,8 @@ public class MainResponseTests extends AbstractSerializingTestCase + "\"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)); }