Skip to content

Commit 7995c79

Browse files
committed
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 1596b93 commit 7995c79

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
@@ -393,9 +393,7 @@ public String getJavaOpts() {
393393
}
394394

395395
/**
396-
* Whether a license must be accepted before this plugin can be installed.
397-
*
398-
* @return {@code true} if a license must be accepted.
396+
* Whether this plugin is subject to the Elastic License.
399397
*/
400398
public boolean isLicensed() {
401399
return isLicensed;
@@ -413,6 +411,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
413411
builder.field("classname", classname);
414412
builder.field("extended_plugins", extendedPlugins);
415413
builder.field("has_native_controller", hasNativeController);
414+
builder.field("licensed", isLicensed);
416415
builder.field("type", type);
417416
if (type == PluginType.BOOTSTRAP) {
418417
builder.field("java_opts", javaOpts);
@@ -456,6 +455,7 @@ public String toString(String prefix) {
456455
.append(prefix).append("Elasticsearch Version: ").append(elasticsearchVersion).append("\n")
457456
.append(prefix).append("Java Version: ").append(javaVersion).append("\n")
458457
.append(prefix).append("Native Controller: ").append(hasNativeController).append("\n")
458+
.append(prefix).append("Licensed: ").append(isLicensed).append("\n")
459459
.append(prefix).append("Type: ").append(type).append("\n");
460460

461461
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
@@ -541,6 +541,7 @@ public void testToXContent() throws IOException {
541541
+ "\"classname\":\"_plugin_class\","
542542
+ "\"extended_plugins\":[],"
543543
+ "\"has_native_controller\":false,"
544+
+ "\"licensed\":false,"
544545
+ "\"type\":\"isolated\""
545546
+ "}"
546547
+ "],"

0 commit comments

Comments
 (0)