Skip to content

Commit

Permalink
Upgrade kotlin to 1.16.10 (#356)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <[email protected]>
  • Loading branch information
lezzago authored Mar 21, 2022
1 parent b2aef1d commit 120f7c4
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class AcknowledgeAlertAction private constructor() : ActionType<AcknowledgeAlertResponse>(NAME, ::AcknowledgeAlertResponse) {
companion object {
val INSTANCE = AcknowledgeAlertAction()
val NAME = "cluster:admin/opendistro/alerting/alerts/ack"
const val NAME = "cluster:admin/opendistro/alerting/alerts/ack"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import org.opensearch.action.delete.DeleteResponse
class DeleteDestinationAction private constructor() : ActionType<DeleteResponse>(NAME, ::DeleteResponse) {
companion object {
val INSTANCE = DeleteDestinationAction()
val NAME = "cluster:admin/opendistro/alerting/destination/delete"
const val NAME = "cluster:admin/opendistro/alerting/destination/delete"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import org.opensearch.action.delete.DeleteResponse
class DeleteMonitorAction private constructor() : ActionType<DeleteResponse>(NAME, ::DeleteResponse) {
companion object {
val INSTANCE = DeleteMonitorAction()
val NAME = "cluster:admin/opendistro/alerting/monitor/delete"
const val NAME = "cluster:admin/opendistro/alerting/monitor/delete"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class ExecuteMonitorAction private constructor() : ActionType<ExecuteMonitorResponse>(NAME, ::ExecuteMonitorResponse) {
companion object {
val INSTANCE = ExecuteMonitorAction()
val NAME = "cluster:admin/opendistro/alerting/monitor/execute"
const val NAME = "cluster:admin/opendistro/alerting/monitor/execute"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class GetAlertsAction private constructor() : ActionType<GetAlertsResponse>(NAME, ::GetAlertsResponse) {
companion object {
val INSTANCE = GetAlertsAction()
val NAME = "cluster:admin/opendistro/alerting/alerts/get"
const val NAME = "cluster:admin/opendistro/alerting/alerts/get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class GetDestinationsAction private constructor() : ActionType<GetDestinationsResponse>(NAME, ::GetDestinationsResponse) {
companion object {
val INSTANCE = GetDestinationsAction()
val NAME = "cluster:admin/opendistro/alerting/destination/get"
const val NAME = "cluster:admin/opendistro/alerting/destination/get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class GetEmailAccountAction private constructor() : ActionType<GetEmailAccountResponse>(NAME, ::GetEmailAccountResponse) {
companion object {
val INSTANCE = GetEmailAccountAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_account/get"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class GetEmailGroupAction private constructor() : ActionType<GetEmailGroupResponse>(NAME, ::GetEmailGroupResponse) {
companion object {
val INSTANCE = GetEmailGroupAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_group/get"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class GetMonitorAction private constructor() : ActionType<GetMonitorResponse>(NAME, ::GetMonitorResponse) {
companion object {
val INSTANCE = GetMonitorAction()
val NAME = "cluster:admin/opendistro/alerting/monitor/get"
const val NAME = "cluster:admin/opendistro/alerting/monitor/get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class IndexDestinationAction private constructor() : ActionType<IndexDestinationResponse>(NAME, ::IndexDestinationResponse) {
companion object {
val INSTANCE = IndexDestinationAction()
val NAME = "cluster:admin/opendistro/alerting/destination/write"
const val NAME = "cluster:admin/opendistro/alerting/destination/write"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class IndexEmailAccountAction private constructor() : ActionType<IndexEmailAccountResponse>(NAME, ::IndexEmailAccountResponse) {
companion object {
val INSTANCE = IndexEmailAccountAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_account/write"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/write"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class IndexEmailGroupAction private constructor() : ActionType<IndexEmailGroupResponse>(NAME, ::IndexEmailGroupResponse) {
companion object {
val INSTANCE = IndexEmailGroupAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_group/write"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/write"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import org.opensearch.action.ActionType
class IndexMonitorAction private constructor() : ActionType<IndexMonitorResponse>(NAME, ::IndexMonitorResponse) {
companion object {
val INSTANCE = IndexMonitorAction()
val NAME = "cluster:admin/opendistro/alerting/monitor/write"
const val NAME = "cluster:admin/opendistro/alerting/monitor/write"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse
class SearchEmailAccountAction private constructor() : ActionType<SearchResponse>(NAME, ::SearchResponse) {
companion object {
val INSTANCE = SearchEmailAccountAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_account/search"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_account/search"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse
class SearchEmailGroupAction private constructor() : ActionType<SearchResponse>(NAME, ::SearchResponse) {
companion object {
val INSTANCE = SearchEmailGroupAction()
val NAME = "cluster:admin/opendistro/alerting/destination/email_group/search"
const val NAME = "cluster:admin/opendistro/alerting/destination/email_group/search"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import org.opensearch.action.search.SearchResponse
class SearchMonitorAction private constructor() : ActionType<SearchResponse>(NAME, ::SearchResponse) {
companion object {
val INSTANCE = SearchMonitorAction()
val NAME = "cluster:admin/opendistro/alerting/monitor/search"
const val NAME = "cluster:admin/opendistro/alerting/monitor/search"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class SupportedClusterMetricsSettings {

@Suppress("UNCHECKED_CAST")
if (supportedJsonPayloads != null)
supportedApiList = XContentHelper.convertToMap(JsonXContent.jsonXContent, supportedJsonPayloads.readText(), false) as HashMap<String, Map<String, ArrayList<String>>>
supportedApiList = XContentHelper.convertToMap(JsonXContent.jsonXContent, supportedJsonPayloads.readText(), false)
as HashMap<String, Map<String, ArrayList<String>>>
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,51 @@ class SupportedClusterMetricsSettingsExtensionsTests : OpenSearchTestCase() {
fun `test redactFieldsFromResponse with non-empty supportedJsonPayload`() {
// GIVEN
mappedResponse = hashMapOf(
("pathRoot1" to hashMapOf(("pathRoot1_subPath1" to 11), ("pathRoot1_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath1" to 121), ("pathRoot1_subPath2_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath2_subPath1" to 1221))))))),
(
"pathRoot1" to hashMapOf(
("pathRoot1_subPath1" to 11),
(
"pathRoot1_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath1" to 121),
(
"pathRoot1_subPath2_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath2_subPath1" to 1221)
)
)
)
)
)
),
("pathRoot2" to hashMapOf(("pathRoot2_subPath1" to 21), ("pathRoot2_subPath2" to setOf(221, 222, "223string")))),
("pathRoot3" to hashMapOf(("pathRoot3_subPath1" to 31), ("pathRoot3_subPath2" to setOf(321, 322, "323string"))))
)

supportedJsonPayload = hashMapOf(
("pathRoot1" to arrayListOf("pathRoot1_subPath1", "pathRoot1_subPath2.pathRoot1_subPath2_subPath2.pathRoot1_subPath2_subPath2_subPath1")),
(
"pathRoot1" to arrayListOf(
"pathRoot1_subPath1",
"pathRoot1_subPath2.pathRoot1_subPath2_subPath2.pathRoot1_subPath2_subPath2_subPath1"
)
),
("pathRoot2" to arrayListOf("pathRoot2_subPath2")),
("pathRoot3" to arrayListOf())
)

expectedResponse = hashMapOf(
("pathRoot1" to hashMapOf(("pathRoot1_subPath1" to 11), ("pathRoot1_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath2_subPath1" to 1221))))))),
(
"pathRoot1" to hashMapOf(
("pathRoot1_subPath1" to 11),
(
"pathRoot1_subPath2" to hashMapOf(
(
"pathRoot1_subPath2_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath2_subPath1" to 1221)
)
)
)
)
)
),
("pathRoot2" to hashMapOf(("pathRoot2_subPath2" to setOf(221, 222, "223string")))),
("pathRoot3" to hashMapOf(("pathRoot3_subPath1" to 31), ("pathRoot3_subPath2" to setOf(321, 322, "323string"))))
)
Expand All @@ -42,13 +74,41 @@ class SupportedClusterMetricsSettingsExtensionsTests : OpenSearchTestCase() {
fun `test redactFieldsFromResponse with empty supportedJsonPayload`() {
// GIVEN
mappedResponse = hashMapOf(
("pathRoot1" to hashMapOf(("pathRoot1_subPath1" to 11), ("pathRoot1_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath1" to 121), ("pathRoot1_subPath2_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath2_subPath1" to 1221))))))),
(
"pathRoot1" to hashMapOf(
("pathRoot1_subPath1" to 11),
(
"pathRoot1_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath1" to 121),
(
"pathRoot1_subPath2_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath2_subPath1" to 1221)
)
)
)
)
)
),
("pathRoot2" to hashMapOf(("pathRoot2_subPath1" to 21), ("pathRoot2_subPath2" to setOf(221, 222, "223string")))),
("pathRoot3" to 3)
)

expectedResponse = hashMapOf(
("pathRoot1" to hashMapOf(("pathRoot1_subPath1" to 11), ("pathRoot1_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath1" to 121), ("pathRoot1_subPath2_subPath2" to hashMapOf(("pathRoot1_subPath2_subPath2_subPath1" to 1221))))))),
(
"pathRoot1" to hashMapOf(
("pathRoot1_subPath1" to 11),
(
"pathRoot1_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath1" to 121),
(
"pathRoot1_subPath2_subPath2" to hashMapOf(
("pathRoot1_subPath2_subPath2_subPath1" to 1221)
)
)
)
)
)
),
("pathRoot2" to hashMapOf(("pathRoot2_subPath1" to 21), ("pathRoot2_subPath2" to setOf(221, 222, "223string")))),
("pathRoot3" to 3)
)
Expand Down
2 changes: 1 addition & 1 deletion build-tools/merged-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

allprojects {
plugins.withId('jacoco') {
jacoco.toolVersion = '0.8.5'
jacoco.toolVersion = '0.8.7'
// For some reason this dependency isn't getting setup automatically by the jacoco plugin
tasks.withType(JacocoReport) {
dependsOn tasks.withType(Test)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
// 1.0.0 -> 1.0.0.0, and 1.0.0-SNAPSHOT -> 1.0.0.0-SNAPSHOT
opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2')
common_utils_version = System.getProperty("common_utils.version", opensearch_build)
kotlin_version = '1.3.72'
kotlin_version = '1.6.10'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ data class ClusterMetricsInput(
pathParams = pathParams.trim('/')
ILLEGAL_PATH_PARAMETER_CHARACTERS.forEach { character ->
if (pathParams.contains(character))
throw IllegalArgumentException("The provided path parameters contain invalid characters or spaces. Please omit: ${ILLEGAL_PATH_PARAMETER_CHARACTERS.joinToString(" ")}")
throw IllegalArgumentException(
"The provided path parameters contain invalid characters or spaces. Please omit: " +
"${ILLEGAL_PATH_PARAMETER_CHARACTERS.joinToString(" ")}"
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class ClusterMetricsInputTests {

// WHEN + THEN
assertFailsWith<IllegalArgumentException>(
"The provided path parameters contain invalid characters or spaces. Please omit: ${ILLEGAL_PATH_PARAMETER_CHARACTERS.joinToString(" ")}"
"The provided path parameters contain invalid characters or spaces. Please omit: " +
"${ILLEGAL_PATH_PARAMETER_CHARACTERS.joinToString(" ")}"
) {
clusterMetricsInput.parsePathParams()
}
Expand Down

0 comments on commit 120f7c4

Please sign in to comment.