From 876e294baafdf4020e45f166f67c3a6b5250d447 Mon Sep 17 00:00:00 2001 From: Prabhas Kurapati Date: Thu, 18 Jan 2024 10:45:28 -0800 Subject: [PATCH] use version class to get current version of opensearch Signed-off-by: Prabhas Kurapati --- .../org/opensearch/security/setting/DeprecatedSettings.java | 3 ++- .../opensearch/security/setting/DeprecatedSettingsTest.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/opensearch/security/setting/DeprecatedSettings.java b/src/main/java/org/opensearch/security/setting/DeprecatedSettings.java index 947b7b8add..e5ec33300a 100644 --- a/src/main/java/org/opensearch/security/setting/DeprecatedSettings.java +++ b/src/main/java/org/opensearch/security/setting/DeprecatedSettings.java @@ -5,6 +5,7 @@ package org.opensearch.security.setting; +import org.opensearch.Version; import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; @@ -35,7 +36,7 @@ public static void checkForDeprecatedSetting(final Settings settings, final Stri public static void logCustomDeprecationMessage(final String deprecationLocationInformation, final String deprecatedSettingKey) { DEPRECATION_LOGGER.deprecate( deprecatedSettingKey, - "In OpenSearch v2.0.0+ the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: " + "In OpenSearch " + Version.CURRENT + " the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: " + deprecationLocationInformation, deprecatedSettingKey ); diff --git a/src/test/java/org/opensearch/security/setting/DeprecatedSettingsTest.java b/src/test/java/org/opensearch/security/setting/DeprecatedSettingsTest.java index 5504f0d8be..d2a4fd8b4e 100644 --- a/src/test/java/org/opensearch/security/setting/DeprecatedSettingsTest.java +++ b/src/test/java/org/opensearch/security/setting/DeprecatedSettingsTest.java @@ -10,7 +10,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; - +import org.opensearch.Version; import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; import org.opensearch.security.securityconf.impl.CType; @@ -103,12 +103,12 @@ public void testForTransportEnabledDeprecationMessageOnYamlLoad() throws Excepti ); verify(logger).deprecate( "transport_enabled", - "In OpenSearch v2.0.0+ the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: In AuthcDomain, using http_authenticator=HttpAuthenticator [challenge=true, type=null, config={}], authentication_backend=AuthcBackend [type=org.opensearch.security.auth.internal.InternalAuthenticationBackend, config={}]", + "In OpenSearch " + Version.CURRENT + " the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: In AuthcDomain, using http_authenticator=HttpAuthenticator [challenge=true, type=null, config={}], authentication_backend=AuthcBackend [type=org.opensearch.security.auth.internal.InternalAuthenticationBackend, config={}]", "transport_enabled" ); verify(logger).deprecate( "transport_enabled", - "In OpenSearch v2.0.0+ the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: In AuthzDomain, using authorization_backend=AuthzBackend [type=noop, config={}]", + "In OpenSearch " + Version.CURRENT + " the setting '{}' is deprecated, it should be removed from the relevant config file using the following location information: In AuthzDomain, using authorization_backend=AuthzBackend [type=noop, config={}]", "transport_enabled" ); }