Include licensed field in PluginInfo xcontent and toString (#65830)

When #65409 was merged, it didn't include the new PluginInfo field licensed in the
toString() or toXContent() outputs. This PR adds them and updates the tests accordingly.
This commit is contained in:
Rory Hunter 2020-12-08 10:30:06 +00:00 committed by GitHub
parent e6935d941f
commit dd9148de7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -154,6 +154,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Elasticsearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8",
"Native Controller: false",
"Licensed: false",
"Type: isolated",
"Extended Plugins: []",
" * Classname: org.fake"
@ -177,6 +178,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Elasticsearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8",
"Native Controller: true",
"Licensed: false",
"Type: isolated",
"Extended Plugins: []",
" * Classname: org.fake"
@ -201,6 +203,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Elasticsearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8",
"Native Controller: false",
"Licensed: false",
"Type: isolated",
"Extended Plugins: []",
" * Classname: org.fake",
@ -212,6 +215,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Elasticsearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8",
"Native Controller: false",
"Licensed: false",
"Type: isolated",
"Extended Plugins: []",
" * Classname: org.fake2"

View file

@ -359,9 +359,7 @@ public class PluginInfo implements Writeable, ToXContentObject {
}
/**
* Whether a license must be accepted before this plugin can be installed.
*
* @return {@code true} if a license must be accepted.
* Whether this plugin is subject to the Elastic License.
*/
public boolean isLicensed() {
return isLicensed;
@ -379,6 +377,7 @@ public class PluginInfo implements Writeable, ToXContentObject {
builder.field("classname", classname);
builder.field("extended_plugins", extendedPlugins);
builder.field("has_native_controller", hasNativeController);
builder.field("licensed", isLicensed);
builder.field("type", type);
if (type == PluginType.BOOTSTRAP) {
builder.field("java_opts", javaOpts);
@ -422,6 +421,7 @@ public class PluginInfo implements Writeable, ToXContentObject {
.append(prefix).append("Elasticsearch Version: ").append(elasticsearchVersion).append("\n")
.append(prefix).append("Java Version: ").append(javaVersion).append("\n")
.append(prefix).append("Native Controller: ").append(hasNativeController).append("\n")
.append(prefix).append("Licensed: ").append(isLicensed).append("\n")
.append(prefix).append("Type: ").append(type).append("\n");
if (type == PluginType.BOOTSTRAP) {

View file

@ -544,6 +544,7 @@ public class ClusterStatsMonitoringDocTests extends BaseMonitoringDocTestCase<Cl
+ " \"classname\": \"_plugin_class\","
+ " \"extended_plugins\": [],"
+ " \"has_native_controller\": false,"
+ " \"licensed\": false,"
+ " \"type\": \"isolated\""
+ " }"
+ " ],"