Skip to content

Commit dd9148d

Browse files
authored
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.
1 parent e6935d9 commit dd9148d

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public void testPluginWithVerbose() throws Exception {
154154
"Elasticsearch Version: " + Version.CURRENT.toString(),
155155
"Java Version: 1.8",
156156
"Native Controller: false",
157+
"Licensed: false",
157158
"Type: isolated",
158159
"Extended Plugins: []",
159160
" * Classname: org.fake"
@@ -177,6 +178,7 @@ public void testPluginWithNativeController() throws Exception {
177178
"Elasticsearch Version: " + Version.CURRENT.toString(),
178179
"Java Version: 1.8",
179180
"Native Controller: true",
181+
"Licensed: false",
180182
"Type: isolated",
181183
"Extended Plugins: []",
182184
" * Classname: org.fake"
@@ -201,6 +203,7 @@ public void testPluginWithVerboseMultiplePlugins() throws Exception {
201203
"Elasticsearch Version: " + Version.CURRENT.toString(),
202204
"Java Version: 1.8",
203205
"Native Controller: false",
206+
"Licensed: false",
204207
"Type: isolated",
205208
"Extended Plugins: []",
206209
" * Classname: org.fake",
@@ -212,6 +215,7 @@ public void testPluginWithVerboseMultiplePlugins() throws Exception {
212215
"Elasticsearch Version: " + Version.CURRENT.toString(),
213216
"Java Version: 1.8",
214217
"Native Controller: false",
218+
"Licensed: false",
215219
"Type: isolated",
216220
"Extended Plugins: []",
217221
" * Classname: org.fake2"

server/src/main/java/org/elasticsearch/plugins/PluginInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,7 @@ public String getJavaOpts() {
359359
}
360360

361361
/**
362-
* Whether a license must be accepted before this plugin can be installed.
363-
*
364-
* @return {@code true} if a license must be accepted.
362+
* Whether this plugin is subject to the Elastic License.
365363
*/
366364
public boolean isLicensed() {
367365
return isLicensed;
@@ -379,6 +377,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
379377
builder.field("classname", classname);
380378
builder.field("extended_plugins", extendedPlugins);
381379
builder.field("has_native_controller", hasNativeController);
380+
builder.field("licensed", isLicensed);
382381
builder.field("type", type);
383382
if (type == PluginType.BOOTSTRAP) {
384383
builder.field("java_opts", javaOpts);
@@ -422,6 +421,7 @@ public String toString(String prefix) {
422421
.append(prefix).append("Elasticsearch Version: ").append(elasticsearchVersion).append("\n")
423422
.append(prefix).append("Java Version: ").append(javaVersion).append("\n")
424423
.append(prefix).append("Native Controller: ").append(hasNativeController).append("\n")
424+
.append(prefix).append("Licensed: ").append(isLicensed).append("\n")
425425
.append(prefix).append("Type: ").append(type).append("\n");
426426

427427
if (type == PluginType.BOOTSTRAP) {

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsMonitoringDocTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ public void testToXContent() throws IOException {
544544
+ " \"classname\": \"_plugin_class\","
545545
+ " \"extended_plugins\": [],"
546546
+ " \"has_native_controller\": false,"
547+
+ " \"licensed\": false,"
547548
+ " \"type\": \"isolated\""
548549
+ " }"
549550
+ " ],"

0 commit comments

Comments
 (0)