From 33697954f9c78cf01e4879da60394bf8c96463d4 Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Sat, 15 Jul 2023 15:33:52 +0800 Subject: [PATCH] Fix core refactor: StreamIO from common to core.common (#707) Signed-off-by: Hailong Cui (cherry picked from commit fd8fe22570987759869da4267464686643614805) --- notifications/build.gradle | 2 +- .../notifications/spi/model/SecureDestinationSettings.kt | 2 +- .../notifications/core/NotificationCorePlugin.kt | 2 +- .../notifications/core/client/DestinationHttpClient.kt | 2 +- .../notifications/core/client/DestinationSesClient.kt | 2 +- .../notifications/core/client/DestinationSmtpClient.kt | 4 ++-- .../notifications/core/client/DestinationSnsClient.kt | 2 +- .../notifications/core/setting/PluginSettings.kt | 2 +- .../core/transport/SesDestinationTransport.kt | 2 +- .../core/transport/SmtpDestinationTransport.kt | 2 +- .../core/transport/SnsDestinationTransport.kt | 2 +- .../core/transport/WebhookDestinationTransport.kt | 2 +- .../org/opensearch/notifications/core/utils/Helpers.kt | 2 +- .../core/destinations/ChimeDestinationTests.kt | 2 +- .../core/destinations/CustomWebhookDestinationTests.kt | 2 +- .../core/destinations/SlackDestinationTests.kt | 2 +- .../core/destinations/SmtpDestinationTests.kt | 4 ++-- .../core/destinations/SnsDestinationTests.kt | 2 +- .../opensearch/notifications/core/smtp/SmtpEmailTests.kt | 2 +- .../org/opensearch/notifications/NotificationPlugin.kt | 2 +- .../opensearch/notifications/action/PluginBaseAction.kt | 4 ++-- .../notifications/index/ConfigIndexingActions.kt | 2 +- .../opensearch/notifications/index/ConfigOperations.kt | 2 +- .../opensearch/notifications/index/ConfigQueryHelper.kt | 2 +- .../opensearch/notifications/index/EventQueryHelper.kt | 2 +- .../notifications/index/NotificationConfigIndex.kt | 2 +- .../org/opensearch/notifications/model/DocMetadata.kt | 2 +- .../notifications/model/NotificationConfigDoc.kt | 2 +- .../notifications/model/SendTestNotificationRequest.kt | 8 ++++---- .../resthandler/NotificationChannelListRestHandler.kt | 2 +- .../resthandler/NotificationConfigRestHandler.kt | 2 +- .../resthandler/NotificationFeaturesRestHandler.kt | 2 +- .../resthandler/NotificationStatsRestHandler.kt | 2 +- .../resthandler/RestResponseToXContentListener.kt | 2 +- .../resthandler/SendTestMessageRestHandler.kt | 2 +- .../notifications/security/UserAccessManager.kt | 2 +- .../notifications/send/SendMessageActionHelper.kt | 2 +- .../kotlin/org/opensearch/integtest/PluginRestTestCase.kt | 2 +- .../org/opensearch/integtest/SecurityNotificationIT.kt | 2 +- .../bwc/NotificationsBackwardsCompatibilityIT.kt | 2 +- .../integtest/config/ChimeNotificationConfigCrudIT.kt | 2 +- .../integtest/config/CreateNotificationConfigIT.kt | 2 +- .../integtest/config/DeleteNotificationConfigIT.kt | 2 +- .../integtest/config/EmailNotificationConfigCrudIT.kt | 2 +- .../integtest/config/QueryNotificationConfigIT.kt | 2 +- .../integtest/config/SlackNotificationConfigCrudIT.kt | 2 +- .../integtest/config/SnsNotificationConfigCrudIT.kt | 2 +- .../integtest/config/WebhookNotificationConfigCrudIT.kt | 2 +- .../integtest/features/GetNotificationChannelListIT.kt | 2 +- .../opensearch/integtest/features/GetPluginFeaturesIT.kt | 2 +- .../integtest/send/SendTestMessageRestHandlerIT.kt | 2 +- .../integtest/send/SendTestMessageWithMockServerIT.kt | 2 +- .../opensearch/notifications/action/PluginActionTests.kt | 2 +- 53 files changed, 59 insertions(+), 59 deletions(-) diff --git a/notifications/build.gradle b/notifications/build.gradle index df186b08..26ad6b02 100644 --- a/notifications/build.gradle +++ b/notifications/build.gradle @@ -21,7 +21,7 @@ buildscript { } opensearch_no_snapshot = opensearch_version.replace("-SNAPSHOT","") common_utils_version = System.getProperty("common_utils.version", opensearch_build) - kotlin_version = System.getProperty("kotlin.version", "1.6.10") + kotlin_version = System.getProperty("kotlin.version", "1.8.21") junit_version = System.getProperty("junit.version", "5.7.2") aws_version = System.getProperty("aws.version", "1.12.48") } diff --git a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/SecureDestinationSettings.kt b/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/SecureDestinationSettings.kt index 62166ee6..0839daae 100644 --- a/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/SecureDestinationSettings.kt +++ b/notifications/core-spi/src/main/kotlin/org/opensearch/notifications/spi/model/SecureDestinationSettings.kt @@ -5,6 +5,6 @@ package org.opensearch.notifications.spi.model -import org.opensearch.common.settings.SecureString +import org.opensearch.core.common.settings.SecureString data class SecureDestinationSettings(val emailUsername: SecureString, val emailPassword: SecureString) diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/NotificationCorePlugin.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/NotificationCorePlugin.kt index a97e407e..cfffb924 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/NotificationCorePlugin.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/NotificationCorePlugin.kt @@ -8,9 +8,9 @@ package org.opensearch.notifications.core import org.opensearch.client.Client import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.NamedWriteableRegistry import org.opensearch.common.settings.Setting import org.opensearch.common.settings.Settings +import org.opensearch.core.common.io.stream.NamedWriteableRegistry import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.env.Environment import org.opensearch.env.NodeEnvironment diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt index 5764f852..aab211fb 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationHttpClient.kt @@ -22,6 +22,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager import org.apache.http.util.EntityUtils import org.opensearch.common.xcontent.XContentFactory import org.opensearch.common.xcontent.XContentType +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.setting.PluginSettings import org.opensearch.notifications.core.utils.OpenForTesting import org.opensearch.notifications.core.utils.logger @@ -32,7 +33,6 @@ import org.opensearch.notifications.spi.model.destination.ChimeDestination import org.opensearch.notifications.spi.model.destination.CustomWebhookDestination import org.opensearch.notifications.spi.model.destination.SlackDestination import org.opensearch.notifications.spi.model.destination.WebhookDestination -import org.opensearch.rest.RestStatus import java.io.IOException import java.nio.charset.StandardCharsets import java.util.Collections diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSesClient.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSesClient.kt index c5917c0b..3ab92875 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSesClient.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSesClient.kt @@ -15,6 +15,7 @@ import com.amazonaws.services.simpleemail.model.MailFromDomainNotVerifiedExcepti import com.amazonaws.services.simpleemail.model.MessageRejectedException import com.amazonaws.services.simpleemail.model.RawMessage import com.amazonaws.services.simpleemail.model.SendRawEmailRequest +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCorePlugin.Companion.LOG_PREFIX import org.opensearch.notifications.core.credentials.SesClientFactory import org.opensearch.notifications.core.setting.PluginSettings @@ -23,7 +24,6 @@ import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.SesDestination -import org.opensearch.rest.RestStatus import java.io.ByteArrayOutputStream import java.nio.ByteBuffer import java.util.Properties diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSmtpClient.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSmtpClient.kt index 703b6453..d444cab6 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSmtpClient.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSmtpClient.kt @@ -6,7 +6,8 @@ package org.opensearch.notifications.core.client import com.sun.mail.util.MailConnectException -import org.opensearch.common.settings.SecureString +import org.opensearch.core.common.settings.SecureString +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.setting.PluginSettings import org.opensearch.notifications.core.utils.SecurityAccess import org.opensearch.notifications.core.utils.logger @@ -14,7 +15,6 @@ import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.SecureDestinationSettings import org.opensearch.notifications.spi.model.destination.SmtpDestination -import org.opensearch.rest.RestStatus import java.util.Properties import javax.mail.Authenticator import javax.mail.Message diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSnsClient.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSnsClient.kt index 1b58b199..046d6e8f 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSnsClient.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/client/DestinationSnsClient.kt @@ -24,13 +24,13 @@ import com.amazonaws.services.sns.model.KMSThrottlingException import com.amazonaws.services.sns.model.NotFoundException import com.amazonaws.services.sns.model.PlatformApplicationDisabledException import com.amazonaws.services.sns.model.PublishResult +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCorePlugin.Companion.LOG_PREFIX import org.opensearch.notifications.core.credentials.SnsClientFactory import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.SnsDestination -import org.opensearch.rest.RestStatus /** * This class handles the SNS connections to the given Destination. diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/setting/PluginSettings.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/setting/PluginSettings.kt index 6537ba5f..70401dee 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/setting/PluginSettings.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/setting/PluginSettings.kt @@ -8,13 +8,13 @@ package org.opensearch.notifications.core.setting import org.opensearch.bootstrap.BootstrapInfo import org.opensearch.cluster.service.ClusterService import org.opensearch.common.settings.SecureSetting -import org.opensearch.common.settings.SecureString import org.opensearch.common.settings.Setting import org.opensearch.common.settings.Setting.Property.Deprecated import org.opensearch.common.settings.Setting.Property.Dynamic import org.opensearch.common.settings.Setting.Property.Final import org.opensearch.common.settings.Setting.Property.NodeScope import org.opensearch.common.settings.Settings +import org.opensearch.core.common.settings.SecureString import org.opensearch.notifications.core.NotificationCorePlugin.Companion.LOG_PREFIX import org.opensearch.notifications.core.NotificationCorePlugin.Companion.PLUGIN_NAME import org.opensearch.notifications.core.utils.OpenForTesting diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SesDestinationTransport.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SesDestinationTransport.kt index 1da4bb7e..e79a52b0 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SesDestinationTransport.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SesDestinationTransport.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.transport +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.client.DestinationClientPool import org.opensearch.notifications.core.client.DestinationSesClient import org.opensearch.notifications.core.utils.OpenForTesting @@ -12,7 +13,6 @@ import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.SesDestination -import org.opensearch.rest.RestStatus import java.io.IOException import javax.mail.MessagingException import javax.mail.internet.AddressException diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SmtpDestinationTransport.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SmtpDestinationTransport.kt index d8dfb4fb..903c26f7 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SmtpDestinationTransport.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SmtpDestinationTransport.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.transport +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.client.DestinationClientPool import org.opensearch.notifications.core.client.DestinationSmtpClient import org.opensearch.notifications.core.utils.OpenForTesting @@ -12,7 +13,6 @@ import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.SmtpDestination -import org.opensearch.rest.RestStatus import java.io.IOException import javax.mail.MessagingException import javax.mail.internet.AddressException diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SnsDestinationTransport.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SnsDestinationTransport.kt index f7dc1afd..8abf0406 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SnsDestinationTransport.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/SnsDestinationTransport.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.transport +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.client.DestinationClientPool import org.opensearch.notifications.core.client.DestinationSnsClient import org.opensearch.notifications.core.utils.OpenForTesting @@ -12,7 +13,6 @@ import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.SnsDestination -import org.opensearch.rest.RestStatus import java.io.IOException /** diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/WebhookDestinationTransport.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/WebhookDestinationTransport.kt index 2ebc4f68..258a5160 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/WebhookDestinationTransport.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/transport/WebhookDestinationTransport.kt @@ -5,6 +5,7 @@ package org.opensearch.notifications.core.transport +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.client.DestinationClientPool import org.opensearch.notifications.core.client.DestinationHttpClient import org.opensearch.notifications.core.utils.OpenForTesting @@ -12,7 +13,6 @@ import org.opensearch.notifications.core.utils.logger import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.WebhookDestination -import org.opensearch.rest.RestStatus import java.io.IOException /** diff --git a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/utils/Helpers.kt b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/utils/Helpers.kt index b6e6ef5f..c3e1fe46 100644 --- a/notifications/core/src/main/kotlin/org/opensearch/notifications/core/utils/Helpers.kt +++ b/notifications/core/src/main/kotlin/org/opensearch/notifications/core/utils/Helpers.kt @@ -7,7 +7,7 @@ package org.opensearch.notifications.core.utils import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.Logger -import org.opensearch.common.bytes.BytesReference +import org.opensearch.core.common.bytes.BytesReference import org.opensearch.core.xcontent.XContentBuilder fun logger(forClass: Class): Lazy { diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt index 46bf3a23..55456eee 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt @@ -22,6 +22,7 @@ import org.junit.jupiter.api.assertThrows import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.client.DestinationHttpClient import org.opensearch.notifications.core.transport.DestinationTransportProvider @@ -30,7 +31,6 @@ import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.ChimeDestination import org.opensearch.notifications.spi.model.destination.DestinationType -import org.opensearch.rest.RestStatus import java.net.MalformedURLException import java.util.stream.Stream diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt index a8f3fa68..c354a2c4 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/CustomWebhookDestinationTests.kt @@ -25,6 +25,7 @@ import org.junit.jupiter.api.assertThrows import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.client.DestinationHttpClient import org.opensearch.notifications.core.transport.DestinationTransportProvider @@ -33,7 +34,6 @@ import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.CustomWebhookDestination import org.opensearch.notifications.spi.model.destination.DestinationType -import org.opensearch.rest.RestStatus import java.net.MalformedURLException import java.util.stream.Stream diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt index bea8a0f5..8902ae50 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SlackDestinationTests.kt @@ -21,6 +21,7 @@ import org.junit.jupiter.api.assertThrows import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.client.DestinationHttpClient import org.opensearch.notifications.core.transport.DestinationTransportProvider @@ -30,7 +31,6 @@ import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.ChimeDestination import org.opensearch.notifications.spi.model.destination.DestinationType import org.opensearch.notifications.spi.model.destination.SlackDestination -import org.opensearch.rest.RestStatus import java.net.MalformedURLException import java.util.stream.Stream diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SmtpDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SmtpDestinationTests.kt index 4b412c58..94270007 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SmtpDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SmtpDestinationTests.kt @@ -12,7 +12,8 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.mockito.junit.jupiter.MockitoExtension -import org.opensearch.common.settings.SecureString +import org.opensearch.core.common.settings.SecureString +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.client.DestinationSmtpClient import org.opensearch.notifications.core.transport.DestinationTransportProvider @@ -22,7 +23,6 @@ import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.SecureDestinationSettings import org.opensearch.notifications.spi.model.destination.DestinationType import org.opensearch.notifications.spi.model.destination.SmtpDestination -import org.opensearch.rest.RestStatus import javax.mail.MessagingException @ExtendWith(MockitoExtension::class) diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SnsDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SnsDestinationTests.kt index 8902e77e..4daa412d 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SnsDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/SnsDestinationTests.kt @@ -15,6 +15,7 @@ import io.mockk.spyk import org.easymock.EasyMock import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.client.DestinationSnsClient import org.opensearch.notifications.core.credentials.SnsClientFactory @@ -24,7 +25,6 @@ import org.opensearch.notifications.spi.model.DestinationMessageResponse import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.DestinationType import org.opensearch.notifications.spi.model.destination.SnsDestination -import org.opensearch.rest.RestStatus internal class SnsDestinationTests { diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/smtp/SmtpEmailTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/smtp/SmtpEmailTests.kt index b5abcd6a..c3bd0e91 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/smtp/SmtpEmailTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/smtp/SmtpEmailTests.kt @@ -7,13 +7,13 @@ package org.opensearch.notifications.core.smtp import org.junit.After import org.junit.jupiter.api.Test +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.core.NotificationCoreImpl import org.opensearch.notifications.core.transport.DestinationTransportProvider import org.opensearch.notifications.core.transport.SmtpDestinationTransport import org.opensearch.notifications.spi.model.MessageContent import org.opensearch.notifications.spi.model.destination.DestinationType import org.opensearch.notifications.spi.model.destination.SmtpDestination -import org.opensearch.rest.RestStatus import org.springframework.integration.test.mail.TestMailServer import kotlin.test.assertEquals diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/NotificationPlugin.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/NotificationPlugin.kt index 4c75f80f..cefbc43b 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/NotificationPlugin.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/NotificationPlugin.kt @@ -11,7 +11,6 @@ import org.opensearch.client.Client import org.opensearch.cluster.metadata.IndexNameExpressionResolver import org.opensearch.cluster.node.DiscoveryNodes import org.opensearch.cluster.service.ClusterService -import org.opensearch.common.io.stream.NamedWriteableRegistry import org.opensearch.common.settings.ClusterSettings import org.opensearch.common.settings.IndexScopedSettings import org.opensearch.common.settings.Setting @@ -19,6 +18,7 @@ import org.opensearch.common.settings.Settings import org.opensearch.common.settings.SettingsFilter import org.opensearch.commons.notifications.action.NotificationsActions import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.NamedWriteableRegistry import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.env.Environment import org.opensearch.env.NodeEnvironment diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/action/PluginBaseAction.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/action/PluginBaseAction.kt index 7683705e..92987aff 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/action/PluginBaseAction.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/action/PluginBaseAction.kt @@ -16,17 +16,17 @@ import org.opensearch.action.ActionResponse import org.opensearch.action.support.ActionFilters import org.opensearch.action.support.HandledTransportAction import org.opensearch.client.Client -import org.opensearch.common.io.stream.Writeable import org.opensearch.common.util.concurrent.ThreadContext import org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT import org.opensearch.commons.authuser.User import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.Writeable +import org.opensearch.core.rest.RestStatus import org.opensearch.index.IndexNotFoundException import org.opensearch.index.engine.VersionConflictEngineException import org.opensearch.indices.InvalidIndexNameException import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX import org.opensearch.notifications.metrics.Metrics -import org.opensearch.rest.RestStatus import org.opensearch.tasks.Task import org.opensearch.transport.TransportService import java.io.IOException diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigIndexingActions.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigIndexingActions.kt index 8040439f..21242476 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigIndexingActions.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigIndexingActions.kt @@ -32,12 +32,12 @@ import org.opensearch.commons.notifications.model.SmtpAccount import org.opensearch.commons.notifications.model.Sns import org.opensearch.commons.notifications.model.Webhook import org.opensearch.commons.utils.logger +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX import org.opensearch.notifications.metrics.Metrics import org.opensearch.notifications.model.DocMetadata import org.opensearch.notifications.model.NotificationConfigDoc import org.opensearch.notifications.security.UserAccess -import org.opensearch.rest.RestStatus import java.time.Instant /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigOperations.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigOperations.kt index 0244229c..ba44fcef 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigOperations.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigOperations.kt @@ -6,9 +6,9 @@ package org.opensearch.notifications.index import org.opensearch.commons.notifications.action.GetNotificationConfigRequest import org.opensearch.commons.notifications.model.NotificationConfigSearchResult +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.model.NotificationConfigDoc import org.opensearch.notifications.model.NotificationConfigDocInfo -import org.opensearch.rest.RestStatus /** * Interface for config Operations. diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigQueryHelper.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigQueryHelper.kt index 98171118..93049399 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigQueryHelper.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/ConfigQueryHelper.kt @@ -33,12 +33,12 @@ import org.opensearch.commons.notifications.model.ConfigType.SLACK import org.opensearch.commons.notifications.model.ConfigType.SMTP_ACCOUNT import org.opensearch.commons.notifications.model.ConfigType.SNS import org.opensearch.commons.notifications.model.ConfigType.WEBHOOK +import org.opensearch.core.rest.RestStatus import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.QueryBuilder import org.opensearch.index.query.QueryBuilders import org.opensearch.notifications.NotificationPlugin.Companion.TEXT_QUERY_TAG import org.opensearch.notifications.model.DocMetadata.Companion.METADATA_TAG -import org.opensearch.rest.RestStatus /** * Helper class for Get operations. diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/EventQueryHelper.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/EventQueryHelper.kt index adec3bb7..30d784dc 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/EventQueryHelper.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/EventQueryHelper.kt @@ -24,12 +24,12 @@ import org.opensearch.commons.notifications.NotificationConstants.STATUS_TEXT_TA import org.opensearch.commons.notifications.NotificationConstants.TAGS_TAG import org.opensearch.commons.notifications.NotificationConstants.TITLE_TAG import org.opensearch.commons.notifications.NotificationConstants.UPDATED_TIME_TAG +import org.opensearch.core.rest.RestStatus import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.QueryBuilder import org.opensearch.index.query.QueryBuilders import org.opensearch.notifications.NotificationPlugin.Companion.TEXT_QUERY_TAG import org.opensearch.notifications.model.DocMetadata.Companion.METADATA_TAG -import org.opensearch.rest.RestStatus /** * Helper class for Get operations. diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt index fe76dcf6..7051e798 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt @@ -33,6 +33,7 @@ import org.opensearch.commons.notifications.model.NotificationConfigInfo import org.opensearch.commons.notifications.model.NotificationConfigSearchResult import org.opensearch.commons.notifications.model.SearchResults import org.opensearch.commons.utils.logger +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.index.query.BoolQueryBuilder import org.opensearch.index.query.QueryBuilders @@ -46,7 +47,6 @@ import org.opensearch.notifications.model.NotificationConfigDocInfo import org.opensearch.notifications.settings.PluginSettings import org.opensearch.notifications.util.SecureIndexClient import org.opensearch.notifications.util.SuspendUtils.Companion.suspendUntilTimeout -import org.opensearch.rest.RestStatus import org.opensearch.script.Script import org.opensearch.search.SearchHit import org.opensearch.search.builder.SearchSourceBuilder diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/DocMetadata.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/DocMetadata.kt index 13c99037..7b4b95ef 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/DocMetadata.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/DocMetadata.kt @@ -5,7 +5,6 @@ package org.opensearch.notifications.model -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.notifications.NotificationConstants.CREATED_TIME_TAG import org.opensearch.commons.notifications.NotificationConstants.UPDATED_TIME_TAG import org.opensearch.commons.utils.logger @@ -13,6 +12,7 @@ import org.opensearch.commons.utils.stringList import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import java.time.Instant /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/NotificationConfigDoc.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/NotificationConfigDoc.kt index f2162ac2..3a3b7cf7 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/NotificationConfigDoc.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/NotificationConfigDoc.kt @@ -5,13 +5,13 @@ package org.opensearch.notifications.model import org.opensearch.common.xcontent.XContentFactory -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.notifications.NotificationConstants.CONFIG_TAG import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.utils.logger import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import org.opensearch.notifications.model.DocMetadata.Companion.METADATA_TAG import java.io.IOException diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/SendTestNotificationRequest.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/SendTestNotificationRequest.kt index 5619a963..20fb5023 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/SendTestNotificationRequest.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/model/SendTestNotificationRequest.kt @@ -8,16 +8,16 @@ package org.opensearch.notifications.model import org.opensearch.action.ActionRequest import org.opensearch.action.ActionRequestValidationException import org.opensearch.action.ValidateActions -import org.opensearch.common.io.stream.StreamInput -import org.opensearch.common.io.stream.StreamOutput -import org.opensearch.common.io.stream.Writeable -import org.opensearch.common.xcontent.XContentParserUtils import org.opensearch.commons.notifications.NotificationConstants.CONFIG_ID_TAG import org.opensearch.commons.utils.logger +import org.opensearch.core.common.io.stream.StreamInput +import org.opensearch.core.common.io.stream.StreamOutput +import org.opensearch.core.common.io.stream.Writeable import org.opensearch.core.xcontent.ToXContent import org.opensearch.core.xcontent.ToXContentObject import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.core.xcontent.XContentParser +import org.opensearch.core.xcontent.XContentParserUtils import java.io.IOException /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationChannelListRestHandler.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationChannelListRestHandler.kt index 0495bff1..926b61ae 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationChannelListRestHandler.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationChannelListRestHandler.kt @@ -8,6 +8,7 @@ package org.opensearch.notifications.resthandler import org.opensearch.client.node.NodeClient import org.opensearch.commons.notifications.NotificationsPluginInterface import org.opensearch.commons.notifications.action.GetChannelListRequest +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.metrics.Metrics import org.opensearch.rest.BaseRestHandler.RestChannelConsumer @@ -15,7 +16,6 @@ import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestHandler.Route import org.opensearch.rest.RestRequest import org.opensearch.rest.RestRequest.Method.GET -import org.opensearch.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationConfigRestHandler.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationConfigRestHandler.kt index c6756185..de8e4a48 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationConfigRestHandler.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationConfigRestHandler.kt @@ -19,6 +19,7 @@ import org.opensearch.commons.notifications.action.GetNotificationConfigRequest import org.opensearch.commons.notifications.action.UpdateNotificationConfigRequest import org.opensearch.commons.utils.contentParserNextToken import org.opensearch.commons.utils.logger +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.index.ConfigQueryHelper @@ -31,7 +32,6 @@ import org.opensearch.rest.RestRequest.Method.DELETE import org.opensearch.rest.RestRequest.Method.GET import org.opensearch.rest.RestRequest.Method.POST import org.opensearch.rest.RestRequest.Method.PUT -import org.opensearch.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener import org.opensearch.search.sort.SortOrder diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationFeaturesRestHandler.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationFeaturesRestHandler.kt index 8439243e..6364cd2b 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationFeaturesRestHandler.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationFeaturesRestHandler.kt @@ -8,6 +8,7 @@ package org.opensearch.notifications.resthandler import org.opensearch.client.node.NodeClient import org.opensearch.commons.notifications.NotificationsPluginInterface import org.opensearch.commons.notifications.action.GetPluginFeaturesRequest +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.metrics.Metrics import org.opensearch.rest.BaseRestHandler.RestChannelConsumer @@ -15,7 +16,6 @@ import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestHandler.Route import org.opensearch.rest.RestRequest import org.opensearch.rest.RestRequest.Method.GET -import org.opensearch.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationStatsRestHandler.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationStatsRestHandler.kt index 2c599e03..856a928b 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationStatsRestHandler.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/NotificationStatsRestHandler.kt @@ -6,6 +6,7 @@ package org.opensearch.notifications.resthandler import org.opensearch.client.node.NodeClient +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.metrics.Metrics import org.opensearch.rest.BaseRestHandler @@ -14,7 +15,6 @@ import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestHandler.Route import org.opensearch.rest.RestRequest import org.opensearch.rest.RestRequest.Method.GET -import org.opensearch.rest.RestStatus /** * Rest handler for getting notifications backend stats diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/RestResponseToXContentListener.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/RestResponseToXContentListener.kt index ff9f537f..dc165de8 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/RestResponseToXContentListener.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/RestResponseToXContentListener.kt @@ -6,12 +6,12 @@ package org.opensearch.notifications.resthandler import org.opensearch.commons.notifications.action.BaseResponse +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.notifications.metrics.Metrics import org.opensearch.rest.BytesRestResponse import org.opensearch.rest.RestChannel import org.opensearch.rest.RestResponse -import org.opensearch.rest.RestStatus import org.opensearch.rest.action.RestToXContentListener /** diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/SendTestMessageRestHandler.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/SendTestMessageRestHandler.kt index 5963d6b5..d6d30e9b 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/SendTestMessageRestHandler.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/resthandler/SendTestMessageRestHandler.kt @@ -7,6 +7,7 @@ package org.opensearch.notifications.resthandler import org.opensearch.client.node.NodeClient import org.opensearch.commons.notifications.NotificationConstants.CONFIG_ID_TAG +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.action.SendTestNotificationAction import org.opensearch.notifications.metrics.Metrics @@ -17,7 +18,6 @@ import org.opensearch.rest.RestHandler.ReplacedRoute import org.opensearch.rest.RestRequest import org.opensearch.rest.RestRequest.Method.GET import org.opensearch.rest.RestRequest.Method.POST -import org.opensearch.rest.RestStatus /** * Rest handler for getting notification features. diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/security/UserAccessManager.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/security/UserAccessManager.kt index 623ec359..59e6976f 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/security/UserAccessManager.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/security/UserAccessManager.kt @@ -7,8 +7,8 @@ package org.opensearch.notifications.security import org.opensearch.OpenSearchStatusException import org.opensearch.commons.authuser.User +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.settings.PluginSettings -import org.opensearch.rest.RestStatus /** * Class for checking/filtering user access. diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/send/SendMessageActionHelper.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/send/SendMessageActionHelper.kt index 2e1f6f1c..19b0f2f8 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/send/SendMessageActionHelper.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/send/SendMessageActionHelper.kt @@ -36,6 +36,7 @@ import org.opensearch.commons.notifications.model.SmtpAccount import org.opensearch.commons.notifications.model.Sns import org.opensearch.commons.notifications.model.Webhook import org.opensearch.commons.utils.logger +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.ToXContent import org.opensearch.notifications.CoreProvider import org.opensearch.notifications.NotificationPlugin.Companion.LOG_PREFIX @@ -52,7 +53,6 @@ import org.opensearch.notifications.spi.model.destination.SesDestination import org.opensearch.notifications.spi.model.destination.SlackDestination import org.opensearch.notifications.spi.model.destination.SmtpDestination import org.opensearch.notifications.spi.model.destination.SnsDestination -import org.opensearch.rest.RestStatus import java.io.ByteArrayOutputStream /** diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/PluginRestTestCase.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/PluginRestTestCase.kt index 225fe080..458bd69e 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/PluginRestTestCase.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/PluginRestTestCase.kt @@ -21,11 +21,11 @@ import org.opensearch.common.xcontent.XContentType import org.opensearch.commons.ConfigConstants import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.rest.SecureRestClientBuilder +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.DeprecationHandler import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.notifications.NotificationPlugin import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus import org.opensearch.test.rest.OpenSearchRestTestCase import java.io.IOException import java.nio.file.Files diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/SecurityNotificationIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/SecurityNotificationIT.kt index 4342a4d6..313f6480 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/SecurityNotificationIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/SecurityNotificationIT.kt @@ -14,11 +14,11 @@ import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.Slack import org.opensearch.commons.rest.SecureRestClientBuilder +import org.opensearch.core.rest.RestStatus import org.opensearch.notifications.NotificationPlugin import org.opensearch.notifications.verifyChannelIdEquals import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class SecurityNotificationIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/bwc/NotificationsBackwardsCompatibilityIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/bwc/NotificationsBackwardsCompatibilityIT.kt index 76f0e183..5e808c78 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/bwc/NotificationsBackwardsCompatibilityIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/bwc/NotificationsBackwardsCompatibilityIT.kt @@ -6,10 +6,10 @@ package org.opensearch.integtest.bwc import org.opensearch.common.settings.Settings +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class NotificationsBackwardsCompatibilityIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt index f708a6d2..3707bb83 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt @@ -8,11 +8,11 @@ import org.junit.Assert import org.opensearch.commons.notifications.model.Chime import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class ChimeNotificationConfigCrudIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/CreateNotificationConfigIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/CreateNotificationConfigIT.kt index 2d86dfe6..b7797697 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/CreateNotificationConfigIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/CreateNotificationConfigIT.kt @@ -13,11 +13,11 @@ import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.Slack import org.opensearch.commons.notifications.model.SmtpAccount import org.opensearch.commons.notifications.model.Webhook +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class CreateNotificationConfigIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/DeleteNotificationConfigIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/DeleteNotificationConfigIT.kt index 12d84ef4..fcc764f8 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/DeleteNotificationConfigIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/DeleteNotificationConfigIT.kt @@ -6,12 +6,12 @@ package org.opensearch.integtest.config import org.junit.Assert +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifyMultiConfigIdEquals import org.opensearch.notifications.verifySingleConfigIdEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class DeleteNotificationConfigIT : PluginRestTestCase() { private val charPool: List = ('a'..'z') + ('A'..'Z') + ('0'..'9') diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/EmailNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/EmailNotificationConfigCrudIT.kt index fb9b7912..3cd638c2 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/EmailNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/EmailNotificationConfigCrudIT.kt @@ -14,6 +14,7 @@ import org.opensearch.commons.notifications.model.MethodType import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.SesAccount import org.opensearch.commons.notifications.model.SmtpAccount +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifyMultiConfigEquals @@ -21,7 +22,6 @@ import org.opensearch.notifications.verifyMultiConfigIdEquals import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.notifications.verifySingleConfigIdEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class EmailNotificationConfigCrudIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/QueryNotificationConfigIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/QueryNotificationConfigIT.kt index e15bc1b2..a926463d 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/QueryNotificationConfigIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/QueryNotificationConfigIT.kt @@ -9,6 +9,7 @@ import org.junit.Assert import org.opensearch.commons.notifications.model.Chime import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifyMultiConfigIdEquals @@ -16,7 +17,6 @@ import org.opensearch.notifications.verifyOrderedConfigList import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.notifications.verifySingleConfigIdEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus import java.time.Instant class QueryNotificationConfigIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SlackNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SlackNotificationConfigCrudIT.kt index 9fbcdfbb..2b51f39a 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SlackNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SlackNotificationConfigCrudIT.kt @@ -9,11 +9,11 @@ import org.junit.Assert import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.Slack +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class SlackNotificationConfigCrudIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SnsNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SnsNotificationConfigCrudIT.kt index 2300dbcf..10b09f3a 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SnsNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/SnsNotificationConfigCrudIT.kt @@ -9,11 +9,11 @@ import org.junit.Assert import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.Sns +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class SnsNotificationConfigCrudIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/WebhookNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/WebhookNotificationConfigCrudIT.kt index 939a1647..893a64fe 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/WebhookNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/WebhookNotificationConfigCrudIT.kt @@ -9,11 +9,11 @@ import org.junit.Assert import org.opensearch.commons.notifications.model.ConfigType import org.opensearch.commons.notifications.model.NotificationConfig import org.opensearch.commons.notifications.model.Webhook +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifySingleConfigEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class WebhookNotificationConfigCrudIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetNotificationChannelListIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetNotificationChannelListIT.kt index 09324734..339ea038 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetNotificationChannelListIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetNotificationChannelListIT.kt @@ -6,11 +6,11 @@ package org.opensearch.integtest.features import org.opensearch.commons.notifications.model.ConfigType +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.notifications.verifyChannelIdEquals import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class GetNotificationChannelListIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetPluginFeaturesIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetPluginFeaturesIT.kt index ebc09c5d..0a40cf51 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetPluginFeaturesIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/features/GetPluginFeaturesIT.kt @@ -7,10 +7,10 @@ package org.opensearch.integtest.features import org.junit.Assert import org.opensearch.commons.notifications.model.ConfigType +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus class GetPluginFeaturesIT : PluginRestTestCase() { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageRestHandlerIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageRestHandlerIT.kt index bcbde29f..bb1d0949 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageRestHandlerIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageRestHandlerIT.kt @@ -8,10 +8,10 @@ package org.opensearch.integtest.send import org.junit.Assert import org.opensearch.commons.notifications.model.MethodType import org.opensearch.commons.notifications.model.SmtpAccount +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus internal class SendTestMessageRestHandlerIT : PluginRestTestCase() { @Suppress("EmptyFunctionBlock") diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageWithMockServerIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageWithMockServerIT.kt index 4cbb03bd..74ed2d94 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageWithMockServerIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/send/SendTestMessageWithMockServerIT.kt @@ -11,10 +11,10 @@ import com.sun.net.httpserver.HttpServer import org.junit.AfterClass import org.junit.Assert import org.junit.BeforeClass +import org.opensearch.core.rest.RestStatus import org.opensearch.integtest.PluginRestTestCase import org.opensearch.notifications.NotificationPlugin.Companion.PLUGIN_BASE_URI import org.opensearch.rest.RestRequest -import org.opensearch.rest.RestStatus import java.net.InetAddress import java.net.InetSocketAddress diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/notifications/action/PluginActionTests.kt b/notifications/notifications/src/test/kotlin/org/opensearch/notifications/action/PluginActionTests.kt index 8c84741c..03004299 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/notifications/action/PluginActionTests.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/notifications/action/PluginActionTests.kt @@ -43,10 +43,10 @@ import org.opensearch.commons.notifications.model.EventStatus import org.opensearch.commons.notifications.model.NotificationConfigSearchResult import org.opensearch.commons.notifications.model.NotificationEvent import org.opensearch.commons.notifications.model.SeverityType +import org.opensearch.core.rest.RestStatus import org.opensearch.core.xcontent.NamedXContentRegistry import org.opensearch.notifications.index.ConfigIndexingActions import org.opensearch.notifications.send.SendMessageActionHelper -import org.opensearch.rest.RestStatus import org.opensearch.tasks.Task import org.opensearch.transport.TransportService import kotlin.test.assertEquals