From 93944f27f2d346b6d95cac7907af169123fac8e1 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Tue, 4 Nov 2014 17:38:14 -0500 Subject: [PATCH] minor fixes Original commit: elastic/x-pack-elasticsearch@6dae7b4ee68d02b9331ec0ed6a1ff26a98aefa62 --- .../elasticsearch/license/plugin/core/LicensesService.java | 7 ++++++- .../elasticsearch/license/plugin/LicensesServiceTests.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java index a643001e1e1..dcbb17815df 100644 --- a/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java +++ b/src/main/java/org/elasticsearch/license/plugin/core/LicensesService.java @@ -51,6 +51,11 @@ import static org.elasticsearch.license.core.ESLicenses.reduceAndMap; * - LicensesManagerService - responsible for managing signed and one-time-trial licenses * - LicensesClientService - responsible for feature registration and notification to consumer plugin(s) *

+ * Registration Scheme: + * A consumer plugin (feature) is registered with {@link LicensesClientService#register(String, TrialLicenseOptions, LicensesClientService.Listener)} + * This method can be called at any time during the life-cycle of the consumer plugin. + * + * *

* Notification Scheme: *

@@ -430,6 +435,7 @@ public class LicensesService extends AbstractLifecycleComponent return; } notifyFeaturesAndScheduleNotification(currentLicensesMetaData); + lastObservedLicensesState.set(currentLicensesMetaData); } /** @@ -495,7 +501,6 @@ public class LicensesService extends AbstractLifecycleComponent } } - lastObservedLicensesState.set(currentLicensesMetaData); return nextScheduleFrequency; } diff --git a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java index 0ad5558433e..9ea15eeb0ef 100644 --- a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java +++ b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceTests.java @@ -293,7 +293,7 @@ public class LicensesServiceTests extends AbstractLicensesIntegrationTests { } putAndCheckSignedLicensesAction(masterLicensesManagerService, Arrays.asList(license), LicensesStatus.VALID); } - }, 0, 1, "should trigger onEnable once [signed license]"); + }, 0, 1, "should trigger onEnable for " + feature + " once [signed license]"); } private Action registerWithoutTrialLicense(final LicensesClientService clientService, final LicensesClientService.Listener clientListener, final String feature) { @@ -317,7 +317,7 @@ public class LicensesServiceTests extends AbstractLicensesIntegrationTests { ClusterChangedEvent event = new ClusterChangedEvent("", clusterService().state(), clusterService().state()); licensesService.clusterChanged(event); } - }, 0, 1, "should trigger onEnable once [trial license]"); + }, 0, 1, "should trigger onEnable for " + feature + " once [trial license]"); } private Action assertExpiryAction(String licenseType, TimeValue expiryDuration) {