diff --git a/README.md b/README.md index 06577387..5847e4af 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# th2 common library (Java) (5.11.1) +# th2 common library (Java) (5.12.0) ## Usage @@ -511,6 +511,10 @@ dependencies { ## Release notes +### 5.12.0-dev + ++ Updated kubernetes-client: `6.12.1` + ### 5.11.1-dev + Add `remove` and `clear` operations to `MapBuilder` diff --git a/build.gradle b/build.gradle index 0154af4c..223bc05c 100644 --- a/build.gradle +++ b/build.gradle @@ -138,17 +138,17 @@ dependencies { implementation 'io.prometheus:simpleclient_httpserver' implementation 'io.prometheus:simpleclient_log4j2' - implementation("com.squareup.okio:okio:3.8.0") { + implementation("com.squareup.okio:okio:3.4.0") { because('fix vulnerability in transitive dependency ') } - implementation("com.squareup.okhttp3:okhttp:4.12.0") { + implementation("com.squareup.okhttp3:okhttp:4.11.0") { because('fix vulnerability in transitive dependency ') } - implementation('com.squareup.okhttp3:logging-interceptor:4.12.0') { + implementation('com.squareup.okhttp3:logging-interceptor:4.11.0') { because('fix vulnerability in transitive dependency ') } - implementation("io.fabric8:kubernetes-client:6.10.0") { + implementation("io.fabric8:kubernetes-client:6.12.1") { exclude group: 'com.fasterxml.jackson.dataformat', module: 'jackson-dataformat-yaml' } diff --git a/src/test/kotlin/com/exactpro/th2/common/util/TestMultiMapDeserializer.kt b/src/test/kotlin/com/exactpro/th2/common/util/TestMultiMapDeserializer.kt index c949fdc6..809ecc13 100644 --- a/src/test/kotlin/com/exactpro/th2/common/util/TestMultiMapDeserializer.kt +++ b/src/test/kotlin/com/exactpro/th2/common/util/TestMultiMapDeserializer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 Exactpro (Exactpro Systems Limited) + * Copyright 2020-2024 Exactpro (Exactpro Systems Limited) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,10 +20,12 @@ import com.exactpro.th2.common.schema.strategy.route.json.RoutingStrategyModule import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.exc.MismatchedInputException +import com.fasterxml.jackson.module.kotlin.KotlinFeature import com.fasterxml.jackson.module.kotlin.KotlinModule import org.apache.commons.collections4.MultiValuedMap import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import kotlin.test.assertFailsWith class TestMultiMapDeserializer { @@ -32,7 +34,16 @@ class TestMultiMapDeserializer { private val OBJECT_MAPPER: ObjectMapper = ObjectMapper() init { - OBJECT_MAPPER.registerModule(KotlinModule()) + OBJECT_MAPPER.registerModule( + KotlinModule.Builder() + .withReflectionCacheSize(512) + .configure(KotlinFeature.NullToEmptyCollection, false) + .configure(KotlinFeature.NullToEmptyMap, false) + .configure(KotlinFeature.NullIsSameAsDefault, false) + .configure(KotlinFeature.SingletonSupport, false) + .configure(KotlinFeature.StrictNullChecks, false) + .build() + ) OBJECT_MAPPER.registerModule(RoutingStrategyModule(OBJECT_MAPPER)) } @@ -40,15 +51,21 @@ class TestMultiMapDeserializer { @Test fun `test negate deserialize`() { - try { - OBJECT_MAPPER.readValue("""{"multimap":"string"}""", TestBeanClass::class.java) - assert(false) - } catch (e: MismatchedInputException) {} + assertFailsWith( + MismatchedInputException::class, + ) { + OBJECT_MAPPER.readValue("""{"multimap":"string"}""", TestBeanClass::class.java) + }.also { e -> + assertEquals(""" + Unexpected token (null), expected START_ARRAY: Can not deserialize MultiValuedMap. Field is not array or object. + at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 13] (through reference chain: com.exactpro.th2.common.util.TestMultiMapDeserializer${"$"}TestBeanClass["multimap"]) + """.trimIndent(), e.message) + } } @Test fun `test positive deserialize`() { - val bean = OBJECT_MAPPER.readValue("""{"multimap":[{"fieldName":"test", "value":"value", "operation":"EQUAL"},{"fieldName":"test", "value":"value123", "operation":"EQUAL"}]}""", TestBeanClass::class.java) + val bean = OBJECT_MAPPER.readValue("""{"multimap":[{"fieldName":"test", "value":"value", "operation":"EQUAL"},{"fieldName":"test", "value":"value123", "operation":"EQUAL"}]}""", TestBeanClass::class.java) val filters = bean.multimap["test"].toList() @@ -57,6 +74,6 @@ class TestMultiMapDeserializer { assertEquals(filters[1].expectedValue,"value123") } - private data class TestBeanClass(@JsonDeserialize(using = MultiMapFiltersDeserializer::class) val multimap: MultiValuedMap) {} + private data class TestBeanClass(@JsonDeserialize(using = MultiMapFiltersDeserializer::class) val multimap: MultiValuedMap) } \ No newline at end of file