From ef11bc3f05fcb920797f62e812ecd3b6d1b35447 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Wed, 19 Aug 2015 17:02:58 -0400 Subject: [PATCH] remove using License.builder in marvel test Original commit: elastic/x-pack-elasticsearch@bef6683b1237bf2a2860c66f516bd34017fb258a --- .../marvel/agent/renderer/licenses/LicensesRenderer.java | 6 +++++- .../marvel/agent/renderer/licenses/LicensesRendererIT.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRenderer.java b/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRenderer.java index b3a2a20ae01..fea92468d0b 100644 --- a/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRenderer.java +++ b/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRenderer.java @@ -67,7 +67,11 @@ public class LicensesRenderer extends AbstractRenderer { } public static String hash(License license, String clusterName) { - String toHash = status(license) + license.uid() + license.type() + String.valueOf(license.expiryDate()) + clusterName; + return hash(status(license), license.uid(), license.type(), String.valueOf(license.expiryDate()), clusterName); + } + + public static String hash(String licenseStatus, String licenseUid, String licenseType, String licenseExpiryDate, String clusterName) { + String toHash = licenseStatus + licenseUid + licenseType + licenseExpiryDate + clusterName; return Hashing.sha256().hashString(toHash, Charsets.UTF_8).toString(); } diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRendererIT.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRendererIT.java index 66fac3a9681..61442487bf1 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRendererIT.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/licenses/LicensesRendererIT.java @@ -94,7 +94,7 @@ public class LicensesRendererIT extends ESIntegTestCase { // We basically recompute the hash here String hkey = (String) ((Map) license).get(LicensesRenderer.Fields.HKEY.underscore().toString()); - String recalculated = LicensesRenderer.hash(License.builder().uid(uid).type(type).expiryDate(expiryDate).build(), cluster().getClusterName()); + String recalculated = LicensesRenderer.hash(status, uid, type, String.valueOf(expiryDate), cluster().getClusterName()); assertThat(hkey, equalTo(recalculated)); assertThat((String) ((Map) license).get(LicensesRenderer.Fields.FEATURE.underscore().toString()), not(isEmptyOrNullString()));