diff --git a/api-gateway/src/main/resources/application.yml b/api-gateway/src/main/resources/application.yml index 080d75ae6..ba2d1d7df 100644 --- a/api-gateway/src/main/resources/application.yml +++ b/api-gateway/src/main/resources/application.yml @@ -33,15 +33,16 @@ application: management: endpoints: - enabled-by-default: false web: exposure: include: health,info + access: + default: none endpoint: info: - enabled: false + access: none health: - enabled: true + access: read_only logbook: format.style: http diff --git a/build.gradle.kts b/build.gradle.kts index 7877ab0ac..263642913 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,8 +22,8 @@ plugins { id("org.springframework.boot") version "3.4.0" apply false id("io.spring.dependency-management") version "1.1.6" apply false id("org.graalvm.buildtools.native") version "0.10.3" - kotlin("jvm") version "2.0.21" apply false - kotlin("plugin.spring") version "2.0.21" apply false + kotlin("jvm") version "2.1.0" apply false + kotlin("plugin.spring") version "2.1.0" apply false id("com.google.cloud.tools.jib") version "3.4.4" apply false id("io.gitlab.arturbosch.detekt") version "1.23.7" apply false id("org.sonarqube") version "6.0.1.5171" @@ -86,7 +86,8 @@ subprojects { kotlin { compilerOptions { - freeCompilerArgs.add("-Xjsr305=strict") + // https://kotlinlang.org/docs/whatsnew2020.html#data-class-copy-function-to-have-the-same-visibility-as-constructor + freeCompilerArgs.addAll("-Xjsr305=strict", "-Xconsistent-data-class-copy-visibility") apiVersion.set(KotlinVersion.KOTLIN_2_0) jvmTarget.set(JvmTarget.JVM_21) } diff --git a/search-service/config/detekt/baseline.xml b/search-service/config/detekt/baseline.xml index a0949b0b7..4ccc60237 100644 --- a/search-service/config/detekt/baseline.xml +++ b/search-service/config/detekt/baseline.xml @@ -19,6 +19,7 @@ LongMethod:V0_29__JsonLd_migration.kt$V0_29__JsonLd_migration$override fun migrate(context: Context) LongParameterList:AttributeInstance.kt$AttributeInstance.Companion$( attributeUuid: UUID, instanceId: URI = generateRandomInstanceId(), timeAndProperty: Pair<ZonedDateTime, TemporalProperty>, value: Triple<String?, Double?, WKTCoordinates?>, payload: ExpandedAttributeInstance, sub: String? ) LongParameterList:AttributeInstance.kt$AttributeInstance.Companion$( attributeUuid: UUID, instanceId: URI = generateRandomInstanceId(), timeProperty: TemporalProperty? = TemporalProperty.OBSERVED_AT, modifiedAt: ZonedDateTime? = null, attributeMetadata: AttributeMetadata, payload: ExpandedAttributeInstance, time: ZonedDateTime, sub: String? = null ) + LongParameterList:BusinessObjectsFactory.kt$( attributeUuid: UUID, timeProperty: AttributeInstance.TemporalProperty = AttributeInstance.TemporalProperty.OBSERVED_AT, measuredValue: Double? = Random.nextDouble(), value: String? = null, time: ZonedDateTime = ngsiLdDateTime(), sub: Sub? = null ) LongParameterList:EntitiesQuery.kt$EntitiesQuery$( open val q: String?, open val scopeQ: String?, open val paginationQuery: PaginationQuery, open val attrs: Set<ExpandedTerm>, open val datasetId: Set<String>, open val geoQuery: GeoQuery?, open val linkedEntityQuery: LinkedEntityQuery?, open val contexts: List<String> ) LongParameterList:EntityAttributeService.kt$EntityAttributeService$( attribute: Attribute, attributeName: ExpandedTerm, attributeMetadata: AttributeMetadata, mergedAt: ZonedDateTime, observedAt: ZonedDateTime?, attributePayload: ExpandedAttributeInstance, sub: Sub? ) LongParameterList:EntityAttributeService.kt$EntityAttributeService$( attribute: Attribute, ngsiLdAttribute: NgsiLdAttribute, attributeMetadata: AttributeMetadata, createdAt: ZonedDateTime, attributePayload: ExpandedAttributeInstance, sub: Sub? ) diff --git a/search-service/src/main/kotlin/com/egm/stellio/search/csr/model/NGSILDWarning.kt b/search-service/src/main/kotlin/com/egm/stellio/search/csr/model/NGSILDWarning.kt index 2372b651e..b25c00ea2 100644 --- a/search-service/src/main/kotlin/com/egm/stellio/search/csr/model/NGSILDWarning.kt +++ b/search-service/src/main/kotlin/com/egm/stellio/search/csr/model/NGSILDWarning.kt @@ -47,12 +47,13 @@ data class MiscellaneousPersistentWarning( override val csr: ContextSourceRegistration ) : NGSILDWarning(MISCELLANEOUS_PERSISTENT_WARNING_CODE, message, csr) -fun ResponseEntity<*>.addWarnings(warnings: List?): ResponseEntity<*> { - val headers = HttpHeaders.writableHttpHeaders(this.headers) - if (!warnings.isNullOrEmpty()) - headers.addAll(NGSILDWarning.HEADER_NAME, warnings.map { it.getHeaderMessage() }) - - return ResponseEntity.status(this.statusCode) - .headers(headers) - .body(this.body) -} +fun ResponseEntity<*>.addWarnings(warnings: List?): ResponseEntity<*> = + if (!warnings.isNullOrEmpty()) { + val headers = HttpHeaders(this.headers).apply { + addAll(NGSILDWarning.HEADER_NAME, warnings.map { it.getHeaderMessage() }) + } + + ResponseEntity.status(this.statusCode) + .headers(headers) + .body(this.body) + } else this diff --git a/search-service/src/test/kotlin/com/egm/stellio/search/support/BusinessObjectsFactory.kt b/search-service/src/test/kotlin/com/egm/stellio/search/support/BusinessObjectsFactory.kt index c5e55fd73..17748681a 100644 --- a/search-service/src/test/kotlin/com/egm/stellio/search/support/BusinessObjectsFactory.kt +++ b/search-service/src/test/kotlin/com/egm/stellio/search/support/BusinessObjectsFactory.kt @@ -14,10 +14,12 @@ import com.egm.stellio.shared.model.getSingleEntry import com.egm.stellio.shared.util.APIC_COMPOUND_CONTEXTS import com.egm.stellio.shared.util.BEEHIVE_TYPE import com.egm.stellio.shared.util.JsonLdUtils +import com.egm.stellio.shared.util.Sub import com.egm.stellio.shared.util.ngsiLdDateTime import com.egm.stellio.shared.util.toUri import io.r2dbc.postgresql.codec.Json import java.net.URI +import java.time.ZonedDateTime import java.util.UUID import kotlin.random.Random @@ -42,16 +44,20 @@ fun gimmeEntityPayload( fun gimmeNumericPropertyAttributeInstance( attributeUuid: UUID, - timeProperty: AttributeInstance.TemporalProperty = AttributeInstance.TemporalProperty.OBSERVED_AT + timeProperty: AttributeInstance.TemporalProperty = AttributeInstance.TemporalProperty.OBSERVED_AT, + measuredValue: Double? = Random.nextDouble(), + value: String? = null, + time: ZonedDateTime = ngsiLdDateTime(), + sub: Sub? = null ): AttributeInstance { val attributeMetadata = AttributeMetadata( - measuredValue = Random.nextDouble(), - value = null, + measuredValue = measuredValue, + value = value, geoValue = null, valueType = Attribute.AttributeValueType.NUMBER, datasetId = null, type = Attribute.AttributeType.Property, - observedAt = ngsiLdDateTime() + observedAt = time ) val payload = JsonLdUtils.buildExpandedPropertyValue(attributeMetadata.measuredValue!!) .addNonReifiedTemporalProperty(JsonLdUtils.NGSILD_OBSERVED_AT_PROPERTY, attributeMetadata.observedAt!!) @@ -62,7 +68,8 @@ fun gimmeNumericPropertyAttributeInstance( time = attributeMetadata.observedAt, attributeMetadata = attributeMetadata, timeProperty = timeProperty, - payload = payload + payload = payload, + sub = sub ) } diff --git a/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AggregatedTemporalQueryServiceTests.kt b/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AggregatedTemporalQueryServiceTests.kt index 2233517a3..775715ee5 100644 --- a/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AggregatedTemporalQueryServiceTests.kt +++ b/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AggregatedTemporalQueryServiceTests.kt @@ -97,8 +97,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on JSON Number values`(aggrMethod: String, expectedValue: String) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.NUMBER) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(measuredValue = i.toDouble()) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + measuredValue = i.toDouble() + ) attributeInstanceService.create(attributeInstance) } @@ -126,8 +128,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on JSON String values`(aggrMethod: String, expectedValue: String?) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.STRING) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(measuredValue = null, value = "a$i") + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = "a$i" + ) attributeInstanceService.create(attributeInstance) } @@ -155,15 +159,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on JSON Object values`(aggrMethod: String, expectedValue: String?) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.OBJECT) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = """ - { - "a": $i - } - """.trimIndent() - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = """{ "a": $i }""" + ) attributeInstanceService.create(attributeInstance) } @@ -191,13 +190,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on JSON Array values`(aggrMethod: String, expectedValue: String?) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.ARRAY) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = """ - [ $i ] - """.trimIndent() - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = """[ $i ]""" + ) attributeInstanceService.create(attributeInstance) } @@ -225,11 +221,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on JSON Boolean values`(aggrMethod: String, expectedValue: String?) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.BOOLEAN) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = if (i % 2 == 0) "true" else "false" - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = if (i % 2 == 0) "true" else "false" + ) attributeInstanceService.create(attributeInstance) } @@ -258,11 +253,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon val attribute = createAttribute(Attribute.AttributeValueType.DATETIME) val baseDateTime = ZonedDateTime.parse("2023-03-05T00:01:01Z") (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = baseDateTime.plusHours(i.toLong()).toString() - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = baseDateTime.plusHours(i.toLong()).toString() + ) attributeInstanceService.create(attributeInstance) } @@ -291,11 +285,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon val attribute = createAttribute(Attribute.AttributeValueType.DATE) val baseDateTime = LocalDate.parse("2023-03-05") (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = baseDateTime.plusDays(i.toLong()).toString() - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = baseDateTime.plusDays(i.toLong()).toString() + ) attributeInstanceService.create(attributeInstance) } @@ -324,11 +317,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon val attribute = createAttribute(Attribute.AttributeValueType.TIME) val baseDateTime = OffsetTime.parse("00:00:01Z") (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = baseDateTime.plusHours(i.toLong()).toString() - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = baseDateTime.plusHours(i.toLong()).toString() + ) attributeInstanceService.create(attributeInstance) } @@ -356,11 +348,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should correctly aggregate on URI values`(aggrMethod: String, expectedValue: String?) = runTest { val attribute = createAttribute(Attribute.AttributeValueType.URI) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - measuredValue = null, - value = "urn:ngsi-ld:Entity:$i" - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = "urn:ngsi-ld:Entity:$i" + ) attributeInstanceService.create(attributeInstance) } @@ -378,8 +369,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should aggregate on the whole time range if no aggrPeriodDuration is given`() = runTest { val attribute = createAttribute(Attribute.AttributeValueType.NUMBER) (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(measuredValue = i.toDouble()) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + measuredValue = i.toDouble() + ) attributeInstanceService.create(attributeInstance) } @@ -415,8 +408,10 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon val attribute = createAttribute(Attribute.AttributeValueType.NUMBER) val startTimestamp = ZonedDateTime.parse("2023-12-28T12:00:00Z") (1..10).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(time = startTimestamp.plusDays(i.toLong())) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + time = startTimestamp.plusDays(i.toLong()) + ) attributeInstanceService.create(attributeInstance) } @@ -437,11 +432,15 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon fun `it should handle aggregates for an attribute having different types of values in history`() = runTest { val attribute = createAttribute(Attribute.AttributeValueType.ARRAY) (1..10).forEach { i -> - val attributeInstanceWithArrayValue = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(measuredValue = null, value = "[ $i ]") + val attributeInstanceWithArrayValue = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = "[ $i ]" + ) attributeInstanceService.create(attributeInstanceWithArrayValue) - val attributeInstanceWithStringValue = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy(measuredValue = null, value = "$i") + val attributeInstanceWithStringValue = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + value = "$i" + ) attributeInstanceService.create(attributeInstanceWithStringValue) } @@ -461,11 +460,11 @@ class AggregatedTemporalQueryServiceTests : WithTimescaleContainer, WithKafkaCon val attribute = createAttribute(Attribute.AttributeValueType.NUMBER) val startTimestamp = ZonedDateTime.parse("2023-12-31T23:00:00Z") (0..9).forEach { i -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(attributeUuid) - .copy( - time = startTimestamp.plusHours(i.toLong()), - measuredValue = 1.0 - ) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = attributeUuid, + measuredValue = 1.0, + time = startTimestamp.plusHours(i.toLong()) + ) attributeInstanceService.create(attributeInstance) } diff --git a/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AttributeInstanceServiceTests.kt b/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AttributeInstanceServiceTests.kt index 3945f9aa7..a05fc17f5 100644 --- a/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AttributeInstanceServiceTests.kt +++ b/search-service/src/test/kotlin/com/egm/stellio/search/temporal/service/AttributeInstanceServiceTests.kt @@ -188,9 +188,10 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should retrieve a full instance if temporalValues are not asked for`() = runTest { - val observation = gimmeNumericPropertyAttributeInstance(incomingAttribute.id).copy( - time = now, - measuredValue = 12.4 + val observation = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = 12.4, + time = now ) attributeInstanceService.create(observation) @@ -210,7 +211,8 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should retrieve an instance having the corresponding time property value`() = runTest { - val observation = gimmeNumericPropertyAttributeInstance(incomingAttribute.id).copy( + val observation = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, timeProperty = AttributeInstance.TemporalProperty.CREATED_AT, time = now, measuredValue = 12.4 @@ -233,7 +235,8 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should retrieve an instance with audit info if time property is not observedAt`() = runTest { - val observation = gimmeNumericPropertyAttributeInstance(incomingAttribute.id).copy( + val observation = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, timeProperty = AttributeInstance.TemporalProperty.CREATED_AT, time = now, measuredValue = 12.4, @@ -258,7 +261,8 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should not retrieve an instance not having the corresponding time property value`() = runTest { - val observation = gimmeNumericPropertyAttributeInstance(incomingAttribute.id).copy( + val observation = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, timeProperty = AttributeInstance.TemporalProperty.CREATED_AT, time = now, measuredValue = 12.4 @@ -365,11 +369,11 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer fun `it should set the start time to the oldest value if asking for no timerel`() = runTest { (1..9).forEachIndexed { index, _ -> val attributeInstance = - gimmeNumericPropertyAttributeInstance(incomingAttribute.id) - .copy( - measuredValue = index.toDouble(), - time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") - ) + gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = index.toDouble(), + time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") + ) attributeInstanceService.create(attributeInstance) } val temporalEntitiesQuery = gimmeTemporalEntitiesQuery( @@ -393,11 +397,11 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer fun `it should include lower bound of interval with after timerel`() = runTest { (1..5).forEachIndexed { index, _ -> val attributeInstance = - gimmeNumericPropertyAttributeInstance(incomingAttribute.id) - .copy( - measuredValue = index.toDouble(), - time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") - ) + gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = index.toDouble(), + time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") + ) attributeInstanceService.create(attributeInstance) } val temporalEntitiesQuery = gimmeTemporalEntitiesQuery( @@ -418,11 +422,11 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer fun `it should exclude upper bound of interval with between timerel`() = runTest { (1..5).forEachIndexed { index, _ -> val attributeInstance = - gimmeNumericPropertyAttributeInstance(incomingAttribute.id) - .copy( - measuredValue = index.toDouble(), - time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") - ) + gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = index.toDouble(), + time = ZonedDateTime.parse("2022-07-0${index + 1}T00:00:00Z") + ) attributeInstanceService.create(attributeInstance) } val temporalEntitiesQuery = gimmeTemporalEntitiesQuery( @@ -446,8 +450,10 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should only return the limited instances asked in the temporal query`() = runTest { (1..10).forEach { _ -> - val attributeInstance = gimmeNumericPropertyAttributeInstance(incomingAttribute.id) - .copy(measuredValue = 1.0) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = 1.0 + ) attributeInstanceService.create(attributeInstance) } val temporalEntitiesQuery = gimmeTemporalEntitiesQuery( @@ -470,11 +476,11 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer val now = ngsiLdDateTime() (1..10).forEachIndexed { index, _ -> val attributeInstance = - gimmeNumericPropertyAttributeInstance(incomingAttribute.id) - .copy( - measuredValue = 1.0, - time = now.minusSeconds(index.toLong()) - ) + gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + measuredValue = 1.0, + time = now.minusSeconds(index.toLong()) + ) attributeInstanceService.create(attributeInstance) } @@ -572,11 +578,20 @@ class AttributeInstanceServiceTests : WithTimescaleContainer, WithKafkaContainer @Test fun `it should update an existing attribute instance with same observation date`() = runTest { - val attributeInstance = gimmeNumericPropertyAttributeInstance(incomingAttribute.id) + val attributeInstance = gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + time = now + ) attributeInstanceService.create(attributeInstance) - val createResult = attributeInstanceService.create(attributeInstance.copy(measuredValue = 100.0)) + val createResult = attributeInstanceService.create( + gimmeNumericPropertyAttributeInstance( + attributeUuid = incomingAttribute.id, + time = now, + measuredValue = 100.0 + ) + ) assertThat(createResult.isRight()) attributeInstanceService.search( diff --git a/shared/config/detekt/baseline.xml b/shared/config/detekt/baseline.xml index 3e5ba7324..c359f0fb8 100644 --- a/shared/config/detekt/baseline.xml +++ b/shared/config/detekt/baseline.xml @@ -2,7 +2,6 @@ - CyclomaticComplexMethod:ExceptionHandler.kt$ExceptionHandler$@ExceptionHandler fun transformErrorResponse(throwable: Throwable): ResponseEntity<ProblemDetail> LongMethod:CompactedEntityLinkedTests.kt$CompactedEntityLinkedTests$@Test fun `it should inline two entities with their respective relationhips`() LongMethod:CompactedEntityLinkedTests.kt$CompactedEntityLinkedTests$@Test fun `it should simplify relationships for inlined entities`() LongMethod:QueryUtils.kt$private fun transformQQueryToSqlJsonPath( mainAttributePath: List<ExpandedTerm>, trailingAttributePath: List<ExpandedTerm>, operator: String, value: String ) diff --git a/shared/src/main/resources/shared.properties b/shared/src/main/resources/shared.properties index bda56c3bb..576c2666d 100644 --- a/shared/src/main/resources/shared.properties +++ b/shared/src/main/resources/shared.properties @@ -29,8 +29,8 @@ server.error.include-stacktrace = always server.shutdown = graceful server.http2.enabled = true -management.endpoints.enabled-by-default = false -management.endpoint.health.enabled = true +management.endpoints.access.default = none +management.endpoint.health.access = read_only # Default values for sending log data to a Gelf compatible endpoint # Log data is sent only if the 'gelflogs' Spring profile is active diff --git a/subscription-service/src/test/kotlin/com/egm/stellio/subscription/support/WithKafkaContainer.kt b/subscription-service/src/test/kotlin/com/egm/stellio/subscription/support/WithKafkaContainer.kt index 591a67cb2..cbe761176 100644 --- a/subscription-service/src/test/kotlin/com/egm/stellio/subscription/support/WithKafkaContainer.kt +++ b/subscription-service/src/test/kotlin/com/egm/stellio/subscription/support/WithKafkaContainer.kt @@ -2,7 +2,7 @@ package com.egm.stellio.subscription.support import org.springframework.test.context.DynamicPropertyRegistry import org.springframework.test.context.DynamicPropertySource -import org.testcontainers.containers.KafkaContainer +import org.testcontainers.kafka.ConfluentKafkaContainer import org.testcontainers.utility.DockerImageName interface WithKafkaContainer { @@ -12,7 +12,7 @@ interface WithKafkaContainer { private val kafkaImage: DockerImageName = DockerImageName.parse("confluentinc/cp-kafka:7.6.0") - private val kafkaContainer = KafkaContainer(kafkaImage).apply { + private val kafkaContainer = ConfluentKafkaContainer(kafkaImage).apply { withReuse(true) }