From 91d9b043b6489005c7bf8bac5c160b3c474310f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:58:47 +0000 Subject: [PATCH 1/3] chore(deps): Bump org.springframework.boot from 3.2.5 to 3.3.2 Bumps [org.springframework.boot](https://github.com/spring-projects/spring-boot) from 3.2.5 to 3.3.2. - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.2.5...v3.3.2) --- updated-dependencies: - dependency-name: org.springframework.boot dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e6b7b840d..70fd3d753 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { `kotlin-dsl` // only apply the plugin in the subprojects requiring it because it expects a Spring Boot app // and the shared lib is obviously not one - id("org.springframework.boot") version "3.2.5" apply false + id("org.springframework.boot") version "3.3.2" apply false id("io.spring.dependency-management") version "1.1.6" apply false id("org.graalvm.buildtools.native") version "0.10.2" kotlin("jvm") version "1.9.24" apply false From 91cc0c0a4e7ef90a71b0c213e3b07f36d9135200 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 19 Jul 2024 07:03:22 +0200 Subject: [PATCH 2/3] chore: misc Spring Boot 3.3.x migrations --- build.gradle.kts | 2 +- search-service/build.gradle.kts | 1 + .../com/egm/stellio/shared/model/NgsiLdEntity.kt | 2 +- .../com/egm/stellio/shared/util/JsonUtilsTests.kt | 13 +++---------- subscription-service/build.gradle.kts | 1 + 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 70fd3d753..83044022c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ buildscript { } } -extra["springCloudVersion"] = "2023.0.0" +extra["springCloudVersion"] = "2023.0.3" plugins { // https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#reacting-to-other-plugins.java diff --git a/search-service/build.gradle.kts b/search-service/build.gradle.kts index 83091e31a..9151524f4 100644 --- a/search-service/build.gradle.kts +++ b/search-service/build.gradle.kts @@ -27,6 +27,7 @@ dependencies { developmentOnly("org.springframework.boot:spring-boot-devtools") + runtimeOnly("org.flywaydb:flyway-database-postgresql") runtimeOnly("org.postgresql:postgresql") testImplementation("org.testcontainers:postgresql") diff --git a/shared/src/main/kotlin/com/egm/stellio/shared/model/NgsiLdEntity.kt b/shared/src/main/kotlin/com/egm/stellio/shared/model/NgsiLdEntity.kt index 572d5e146..e99eaeb9a 100644 --- a/shared/src/main/kotlin/com/egm/stellio/shared/model/NgsiLdEntity.kt +++ b/shared/src/main/kotlin/com/egm/stellio/shared/model/NgsiLdEntity.kt @@ -453,7 +453,7 @@ class NgsiLdVocabPropertyInstance private constructor( ensureNotNull(vocab) { BadRequestDataException("VocabProperty $name has an instance without a vocab member") } - ensure(vocab is List<*> && vocab.all { it is Map<*, *> && it.size == 1 && it.containsKey(JSONLD_ID) }) { + ensure(vocab.all { it is Map<*, *> && it.size == 1 && it.containsKey(JSONLD_ID) }) { BadRequestDataException( "VocabProperty $name has a vocab member that is not a string, nor an array of string" ) diff --git a/shared/src/test/kotlin/com/egm/stellio/shared/util/JsonUtilsTests.kt b/shared/src/test/kotlin/com/egm/stellio/shared/util/JsonUtilsTests.kt index 97c90dfd8..c0140be42 100644 --- a/shared/src/test/kotlin/com/egm/stellio/shared/util/JsonUtilsTests.kt +++ b/shared/src/test/kotlin/com/egm/stellio/shared/util/JsonUtilsTests.kt @@ -7,6 +7,7 @@ import com.egm.stellio.shared.util.JsonUtils.deserializeAsMap import com.egm.stellio.shared.util.JsonUtils.serializeObject import com.egm.stellio.shared.web.DEFAULT_TENANT_NAME import kotlinx.coroutines.test.runTest +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -156,15 +157,7 @@ class JsonUtilsTests { val exception = assertThrows { rawEntity.deserializeAsMap() } - Assertions.assertEquals( - """ - Unexpected character (',' (code 44)): was expecting double-quote to start field name - at [Source: (String)"{ - "id": "urn:ngsi-ld:Device:01234",, - "type": "Device" - }"; line: 2, column: 39] - """.trimIndent(), - exception.message - ) + assertThat(exception.message) + .startsWith("Unexpected character (',' (code 44)): was expecting double-quote to start field name") } } diff --git a/subscription-service/build.gradle.kts b/subscription-service/build.gradle.kts index cee56e320..6ee2efde1 100644 --- a/subscription-service/build.gradle.kts +++ b/subscription-service/build.gradle.kts @@ -27,6 +27,7 @@ dependencies { developmentOnly("org.springframework.boot:spring-boot-devtools") + runtimeOnly("org.flywaydb:flyway-database-postgresql") runtimeOnly("org.postgresql:postgresql") testImplementation("org.wiremock:wiremock-standalone:3.3.1") From 16a3fcb526e32593c45e5e91aaf0fb8c669462e7 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 19 Jul 2024 08:45:25 +0200 Subject: [PATCH 3/3] fix: avoid random rounding problems in stddev function --- .../kotlin/com/egm/stellio/search/util/DBAggregationUtils.kt | 2 +- .../egm/stellio/search/service/AggregatedQueryServiceTests.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/search-service/src/main/kotlin/com/egm/stellio/search/util/DBAggregationUtils.kt b/search-service/src/main/kotlin/com/egm/stellio/search/util/DBAggregationUtils.kt index c930c9597..a3bc977da 100644 --- a/search-service/src/main/kotlin/com/egm/stellio/search/util/DBAggregationUtils.kt +++ b/search-service/src/main/kotlin/com/egm/stellio/search/util/DBAggregationUtils.kt @@ -35,7 +35,7 @@ private fun sqlAggregateForJsonNumber(aggregate: TemporalQuery.Aggregate): Strin TemporalQuery.Aggregate.AVG -> "avg(measured_value)" TemporalQuery.Aggregate.MIN -> "min(measured_value)" TemporalQuery.Aggregate.MAX -> "max(measured_value)" - TemporalQuery.Aggregate.STDDEV -> "stddev_samp(measured_value)" + TemporalQuery.Aggregate.STDDEV -> "round(stddev_samp(measured_value)::numeric,10)" TemporalQuery.Aggregate.SUMSQ -> "sum(power(measured_value,2))" } diff --git a/search-service/src/test/kotlin/com/egm/stellio/search/service/AggregatedQueryServiceTests.kt b/search-service/src/test/kotlin/com/egm/stellio/search/service/AggregatedQueryServiceTests.kt index 6e2f1842b..4ff3ef253 100644 --- a/search-service/src/test/kotlin/com/egm/stellio/search/service/AggregatedQueryServiceTests.kt +++ b/search-service/src/test/kotlin/com/egm/stellio/search/service/AggregatedQueryServiceTests.kt @@ -65,7 +65,7 @@ class AggregatedQueryServiceTests : WithTimescaleContainer, WithKafkaContainer { "avg, 5.5", "min, 1.0", "max, 10.0", - "stddev, 3.0276503540974917", + "stddev, 3.0276503541", "sumsq, 385.0" ) fun `it should correctly aggregate on JSON Number values`(aggrMethod: String, expectedValue: String) = runTest {