fixing Gradle Probleme
This commit is contained in:
+3
-3
@@ -26,7 +26,7 @@ interface AuthenticationService {
|
||||
* @param newPassword Das neue Passwort
|
||||
* @return Das Ergebnis der Passwortänderung
|
||||
*/
|
||||
suspend fun changePassword(userId: Uuid, currentPassword: String, newPassword: String): PasswordChangeResult
|
||||
suspend fun changePassword(userId: Uuid?, currentPassword: String, newPassword: String): PasswordChangeResult
|
||||
|
||||
/**
|
||||
* Mögliche Ergebnisse eines Authentifizierungsversuchs.
|
||||
@@ -81,8 +81,8 @@ interface AuthenticationService {
|
||||
* Represents an authenticated user.
|
||||
*/
|
||||
data class AuthenticatedUser(
|
||||
val userId: Uuid,
|
||||
val personId: Uuid,
|
||||
val userId: Uuid?,
|
||||
val personId: Uuid?,
|
||||
val username: String,
|
||||
val email: String,
|
||||
val permissions: List<BerechtigungE>
|
||||
|
||||
+19
-4
@@ -1,7 +1,9 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class) // <-- HINZUGEFÜGT: Für die neue Kotlin UUID API
|
||||
|
||||
package at.mocode.infrastructure.auth.client
|
||||
|
||||
// import com.benasher44.uuid.uuid4 // <-- ENTFERNT: Alter Import
|
||||
import at.mocode.infrastructure.auth.client.model.BerechtigungE
|
||||
import com.benasher44.uuid.uuid4
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -9,6 +11,7 @@ import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.time.LocalDateTime
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Tests for the AuthenticationService interface using mocks.
|
||||
@@ -17,8 +20,8 @@ import java.time.LocalDateTime
|
||||
class AuthenticationServiceTest {
|
||||
|
||||
private lateinit var authService: AuthenticationService
|
||||
private val testUserId = uuid4()
|
||||
private val testPersonId = uuid4()
|
||||
private val testUserId = Uuid.random() // <-- GEÄNDERT: von uuid4() zu Uuid.random()
|
||||
private val testPersonId = Uuid.random() // <-- GEÄNDERT: von uuid4() zu Uuid.random()
|
||||
|
||||
@BeforeEach
|
||||
fun setUp() {
|
||||
@@ -206,7 +209,7 @@ class AuthenticationServiceTest {
|
||||
@Test
|
||||
fun `changePassword should handle user not found scenario`() = runTest {
|
||||
// Arrange
|
||||
val nonExistentUserId = uuid4()
|
||||
val nonExistentUserId = Uuid.random() // <-- GEÄNDERT: von uuid4() zu Uuid.random()
|
||||
val currentPassword = "password"
|
||||
val newPassword = "newpassword123"
|
||||
|
||||
@@ -282,6 +285,8 @@ class AuthenticationServiceTest {
|
||||
assertNotNull(successResult.token)
|
||||
assertNotNull(successResult.user)
|
||||
}
|
||||
|
||||
else -> fail("Should have been a Success result")
|
||||
}
|
||||
|
||||
// Test Failure result
|
||||
@@ -289,6 +294,8 @@ class AuthenticationServiceTest {
|
||||
is AuthenticationService.AuthResult.Failure -> {
|
||||
assertEquals("Failed", failureResult.reason)
|
||||
}
|
||||
|
||||
else -> fail("Should have been a Failure result")
|
||||
}
|
||||
|
||||
// Test Locked result
|
||||
@@ -296,6 +303,8 @@ class AuthenticationServiceTest {
|
||||
is AuthenticationService.AuthResult.Locked -> {
|
||||
assertNotNull(lockedResult.lockedUntil)
|
||||
}
|
||||
|
||||
else -> fail("Should have been a Locked result")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +321,8 @@ class AuthenticationServiceTest {
|
||||
is AuthenticationService.PasswordChangeResult.Success -> {
|
||||
// Success case verified
|
||||
}
|
||||
|
||||
else -> fail("Should have been a Success result")
|
||||
}
|
||||
|
||||
// Test Failure result
|
||||
@@ -319,6 +330,8 @@ class AuthenticationServiceTest {
|
||||
is AuthenticationService.PasswordChangeResult.Failure -> {
|
||||
assertEquals("Failed", failureResult.reason)
|
||||
}
|
||||
|
||||
else -> fail("Should have been a Failure result")
|
||||
}
|
||||
|
||||
// Test WeakPassword result
|
||||
@@ -326,6 +339,8 @@ class AuthenticationServiceTest {
|
||||
is AuthenticationService.PasswordChangeResult.WeakPassword -> {
|
||||
// WeakPassword case verified
|
||||
}
|
||||
|
||||
else -> fail("Should have been a WeakPassword result")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.infrastructure.eventstore.api
|
||||
|
||||
import at.mocode.core.domain.event.DomainEvent
|
||||
import java.util.UUID
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Schnittstelle für die Serialisierung und Deserialisierung von Domain-Events.
|
||||
@@ -56,7 +58,7 @@ interface EventSerializer {
|
||||
* @param data Die serialisierten Event-Daten
|
||||
* @return Die Aggregat-ID
|
||||
*/
|
||||
fun getAggregateId(data: Map<String, String>): UUID
|
||||
fun getAggregateId(data: Map<String, String>): Uuid
|
||||
|
||||
/**
|
||||
* Ermittelt die Event-ID aus einem serialisierten Event.
|
||||
@@ -64,7 +66,7 @@ interface EventSerializer {
|
||||
* @param data Die serialisierten Event-Daten
|
||||
* @return Die Event-ID
|
||||
*/
|
||||
fun getEventId(data: Map<String, String>): UUID
|
||||
fun getEventId(data: Map<String, String>): Uuid
|
||||
|
||||
/**
|
||||
* Ermittelt die Version aus einem serialisierten Event.
|
||||
|
||||
+8
-6
@@ -1,7 +1,9 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.infrastructure.eventstore.api
|
||||
|
||||
import at.mocode.core.domain.event.DomainEvent
|
||||
import java.util.UUID
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Schnittstelle für einen Event Store, der Domain-Events persistiert.
|
||||
@@ -16,7 +18,7 @@ interface EventStore {
|
||||
* @return Die neue Version des Streams
|
||||
* @throws ConcurrencyException wenn die erwartete Version nicht mit der tatsächlichen Version übereinstimmt
|
||||
*/
|
||||
fun appendToStream(event: DomainEvent, streamId: UUID, expectedVersion: Long): Long
|
||||
fun appendToStream(event: DomainEvent, streamId: Uuid, expectedVersion: Long): Long
|
||||
|
||||
/**
|
||||
* Fügt mehrere Events zum Event Store hinzu.
|
||||
@@ -27,7 +29,7 @@ interface EventStore {
|
||||
* @return Die neue Version des Streams
|
||||
* @throws ConcurrencyException wenn die erwartete Version nicht mit der tatsächlichen Version übereinstimmt
|
||||
*/
|
||||
fun appendToStream(events: List<DomainEvent>, streamId: UUID, expectedVersion: Long): Long
|
||||
fun appendToStream(events: List<DomainEvent>, streamId: Uuid, expectedVersion: Long): Long
|
||||
|
||||
/**
|
||||
* Liest Events aus einem Stream.
|
||||
@@ -37,7 +39,7 @@ interface EventStore {
|
||||
* @param toVersion Die Version, bis zu der gelesen werden soll (inklusive), oder null um alle Events zu lesen
|
||||
* @return Die Events im Stream
|
||||
*/
|
||||
fun readFromStream(streamId: UUID, fromVersion: Long = 0, toVersion: Long? = null): List<DomainEvent>
|
||||
fun readFromStream(streamId: Uuid, fromVersion: Long = 0, toVersion: Long? = null): List<DomainEvent>
|
||||
|
||||
/**
|
||||
* Liest alle Events aus allen Streams.
|
||||
@@ -54,7 +56,7 @@ interface EventStore {
|
||||
* @param streamId Die ID des Event-Streams
|
||||
* @return Die aktuelle Version des Streams, oder -1 wenn der Stream nicht existiert
|
||||
*/
|
||||
fun getStreamVersion(streamId: UUID): Long
|
||||
fun getStreamVersion(streamId: Uuid): Long
|
||||
|
||||
/**
|
||||
* Abonniert Events von einem spezifischen Stream.
|
||||
@@ -64,7 +66,7 @@ interface EventStore {
|
||||
* @param handler Der Handler, der für jedes Event aufgerufen wird
|
||||
* @return Ein Abonnement, das zum Abbestellen verwendet werden kann
|
||||
*/
|
||||
fun subscribeToStream(streamId: UUID, fromVersion: Long = 0, handler: (DomainEvent) -> Unit): Subscription
|
||||
fun subscribeToStream(streamId: Uuid, fromVersion: Long = 0, handler: (DomainEvent) -> Unit): Subscription
|
||||
|
||||
/**
|
||||
* Abonniert alle Events von allen Streams.
|
||||
|
||||
+7
-5
@@ -1,3 +1,5 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.infrastructure.eventstore.redis
|
||||
|
||||
import at.mocode.core.domain.event.DomainEvent
|
||||
@@ -7,8 +9,8 @@ import com.fasterxml.jackson.databind.SerializationFeature
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
|
||||
import com.fasterxml.jackson.module.kotlin.kotlinModule
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Jackson-basierte Implementierung des EventSerializer.
|
||||
@@ -77,16 +79,16 @@ class JacksonEventSerializer : EventSerializer {
|
||||
logger.debug("Registered event type: {} for class: {}", eventType, eventClass.name)
|
||||
}
|
||||
|
||||
override fun getAggregateId(data: Map<String, String>): UUID {
|
||||
override fun getAggregateId(data: Map<String, String>): Uuid {
|
||||
val aggregateIdStr = data[AGGREGATE_ID_FIELD]
|
||||
?: throw IllegalArgumentException("Aggregate ID is missing")
|
||||
return UUID.fromString(aggregateIdStr)
|
||||
return Uuid.parse(aggregateIdStr)
|
||||
}
|
||||
|
||||
override fun getEventId(data: Map<String, String>): UUID {
|
||||
override fun getEventId(data: Map<String, String>): Uuid {
|
||||
val eventIdStr = data[EVENT_ID_FIELD]
|
||||
?: throw IllegalArgumentException("Event ID is missing")
|
||||
return UUID.fromString(eventIdStr)
|
||||
return Uuid.parse(eventIdStr)
|
||||
}
|
||||
|
||||
override fun getVersion(data: Map<String, String>): Long {
|
||||
|
||||
+13
-11
@@ -1,3 +1,5 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.infrastructure.eventstore.redis
|
||||
|
||||
import at.mocode.core.domain.event.DomainEvent
|
||||
@@ -11,8 +13,8 @@ import org.springframework.dao.DataAccessException
|
||||
import org.springframework.data.domain.Range
|
||||
import org.springframework.data.redis.core.SessionCallback
|
||||
import org.springframework.data.redis.core.StringRedisTemplate
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
class RedisEventStore(
|
||||
private val redisTemplate: StringRedisTemplate,
|
||||
@@ -20,10 +22,10 @@ class RedisEventStore(
|
||||
private val properties: RedisEventStoreProperties
|
||||
) : EventStore {
|
||||
private val logger = LoggerFactory.getLogger(RedisEventStore::class.java)
|
||||
private val streamVersionCache = ConcurrentHashMap<UUID, Long>()
|
||||
private val streamVersionCache = ConcurrentHashMap<Uuid, Long>()
|
||||
private val metrics = EventStoreMetrics()
|
||||
|
||||
override fun appendToStream(events: List<DomainEvent>, streamId: UUID, expectedVersion: Long): Long {
|
||||
override fun appendToStream(events: List<DomainEvent>, streamId: Uuid, expectedVersion: Long): Long {
|
||||
val operationId = "batch-append-${System.nanoTime()}"
|
||||
metrics.startOperation(operationId)
|
||||
|
||||
@@ -62,7 +64,7 @@ class RedisEventStore(
|
||||
}
|
||||
}
|
||||
|
||||
override fun appendToStream(event: DomainEvent, streamId: UUID, expectedVersion: Long): Long {
|
||||
override fun appendToStream(event: DomainEvent, streamId: Uuid, expectedVersion: Long): Long {
|
||||
val operationId = "single-append-${System.nanoTime()}"
|
||||
metrics.startOperation(operationId)
|
||||
|
||||
@@ -88,7 +90,7 @@ class RedisEventStore(
|
||||
/**
|
||||
* Validiert die erwartete Version und gibt die aktuelle Version zurück, behandelt Cache-Invalidierung bei Konflikten.
|
||||
*/
|
||||
private fun validateAndGetCurrentVersion(streamId: UUID, expectedVersion: Long): Long {
|
||||
private fun validateAndGetCurrentVersion(streamId: Uuid, expectedVersion: Long): Long {
|
||||
var currentVersion = getStreamVersion(streamId)
|
||||
|
||||
if (currentVersion != expectedVersion) {
|
||||
@@ -107,7 +109,7 @@ class RedisEventStore(
|
||||
/**
|
||||
* Fügt mehrere Events in einer einzigen Redis-Transaktion hinzu für optimale Performance.
|
||||
*/
|
||||
private fun appendEventsInBatch(events: List<DomainEvent>, streamId: UUID, currentVersion: Long): Long {
|
||||
private fun appendEventsInBatch(events: List<DomainEvent>, streamId: Uuid, currentVersion: Long): Long {
|
||||
val streamKey = getStreamKey(streamId)
|
||||
val allEventsStreamKey = getAllEventsStreamKey()
|
||||
|
||||
@@ -152,7 +154,7 @@ class RedisEventStore(
|
||||
}
|
||||
}
|
||||
|
||||
private fun appendToStreamInternal(event: DomainEvent, streamId: UUID, currentVersion: Long): Long {
|
||||
private fun appendToStreamInternal(event: DomainEvent, streamId: Uuid, currentVersion: Long): Long {
|
||||
val newVersion = currentVersion + 1
|
||||
require(event.version.value == newVersion) {
|
||||
"Event version ${event.version.value} does not match expected new version $newVersion for stream $streamId"
|
||||
@@ -188,7 +190,7 @@ class RedisEventStore(
|
||||
}
|
||||
}
|
||||
|
||||
override fun readFromStream(streamId: UUID, fromVersion: Long, toVersion: Long?): List<DomainEvent> {
|
||||
override fun readFromStream(streamId: Uuid, fromVersion: Long, toVersion: Long?): List<DomainEvent> {
|
||||
val operationId = "read-stream-${System.nanoTime()}"
|
||||
metrics.startOperation(operationId)
|
||||
|
||||
@@ -217,7 +219,7 @@ class RedisEventStore(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getStreamVersion(streamId: UUID): Long {
|
||||
override fun getStreamVersion(streamId: Uuid): Long {
|
||||
streamVersionCache[streamId]?.let {
|
||||
metrics.recordCacheHit()
|
||||
return it
|
||||
@@ -230,7 +232,7 @@ class RedisEventStore(
|
||||
return size
|
||||
}
|
||||
|
||||
private fun getStreamKey(streamId: UUID): String {
|
||||
private fun getStreamKey(streamId: Uuid): String {
|
||||
return "${properties.streamPrefix}$streamId"
|
||||
}
|
||||
|
||||
@@ -272,7 +274,7 @@ class RedisEventStore(
|
||||
}
|
||||
}
|
||||
|
||||
override fun subscribeToStream(streamId: UUID, fromVersion: Long, handler: (DomainEvent) -> Unit): Subscription {
|
||||
override fun subscribeToStream(streamId: Uuid, fromVersion: Long, handler: (DomainEvent) -> Unit): Subscription {
|
||||
// Basic implementation - for full functionality, integrate with RedisEventConsumer
|
||||
logger.info("Stream subscription for streamId {} from version {} - basic implementation", streamId, fromVersion)
|
||||
metrics.recordSubscription()
|
||||
|
||||
+5
-2
@@ -10,6 +10,8 @@ import org.junit.jupiter.api.assertThrows
|
||||
import java.util.*
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Instant
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Tests for JacksonEventSerializer - Critical for data integrity.
|
||||
@@ -26,10 +28,11 @@ class JacksonEventSerializerTest {
|
||||
serializer.registerEventType(SimpleTestEvent::class.java, "SimpleTestEvent")
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@Test
|
||||
fun `should serialize and deserialize simple event correctly`() {
|
||||
val aggregateId = UUID.randomUUID()
|
||||
val eventId = UUID.randomUUID()
|
||||
val aggregateId: Uuid = UUID.randomUUID()
|
||||
val eventId: UUID? = UUID.randomUUID()
|
||||
val timestamp = Clock.System.now()
|
||||
|
||||
val event = SimpleTestEvent(
|
||||
|
||||
+5
-4
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
package at.mocode.infrastructure.eventstore.redis
|
||||
|
||||
import at.mocode.core.domain.event.BaseDomainEvent
|
||||
@@ -5,7 +6,6 @@ import at.mocode.core.domain.event.DomainEvent
|
||||
import at.mocode.core.domain.model.*
|
||||
import at.mocode.infrastructure.eventstore.api.EventSerializer
|
||||
import at.mocode.infrastructure.eventstore.api.EventStore
|
||||
import com.benasher44.uuid.uuid4
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
@@ -22,6 +22,7 @@ import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Instant
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
@Testcontainers
|
||||
class RedisEventStoreIntegrationTest {
|
||||
@@ -84,7 +85,7 @@ class RedisEventStoreIntegrationTest {
|
||||
|
||||
@Test
|
||||
fun `event publishing and consuming with consumer groups should work`() {
|
||||
val aggregateId = uuid4()
|
||||
val aggregateId = Uuid.random()
|
||||
val event1 = TestCreatedEvent(aggregateId = AggregateId(aggregateId), version = EventVersion(1L), name = "Test Entity")
|
||||
val event2 = TestUpdatedEvent(aggregateId = AggregateId(aggregateId), version = EventVersion(2L), name = "Updated Test Entity")
|
||||
|
||||
@@ -126,7 +127,7 @@ class RedisEventStoreIntegrationTest {
|
||||
override val version: EventVersion,
|
||||
val name: String,
|
||||
override val eventType: EventType = EventType("TestCreated"),
|
||||
override val eventId: EventId = EventId(uuid4()),
|
||||
override val eventId: EventId = EventId(Uuid.random()),
|
||||
override val timestamp: Instant = Clock.System.now(),
|
||||
override val correlationId: CorrelationId? = null,
|
||||
override val causationId: CausationId? = null
|
||||
@@ -137,7 +138,7 @@ class RedisEventStoreIntegrationTest {
|
||||
override val version: EventVersion,
|
||||
val name: String,
|
||||
override val eventType: EventType = EventType("TestUpdated"),
|
||||
override val eventId: EventId = EventId(uuid4()),
|
||||
override val eventId: EventId = EventId(Uuid.random()),
|
||||
override val timestamp: Instant = Clock.System.now(),
|
||||
override val correlationId: CorrelationId? = null,
|
||||
override val causationId: CausationId? = null
|
||||
|
||||
+5
-4
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
package at.mocode.infrastructure.eventstore.redis
|
||||
|
||||
import at.mocode.core.domain.event.BaseDomainEvent
|
||||
@@ -7,7 +8,6 @@ import at.mocode.core.domain.model.EventType
|
||||
import at.mocode.core.domain.model.EventVersion
|
||||
import at.mocode.infrastructure.eventstore.api.EventSerializer
|
||||
import at.mocode.infrastructure.eventstore.api.EventStore
|
||||
import com.benasher44.uuid.uuid4
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
@@ -21,6 +21,7 @@ import org.testcontainers.containers.GenericContainer
|
||||
import org.testcontainers.junit.jupiter.Container
|
||||
import org.testcontainers.junit.jupiter.Testcontainers
|
||||
import org.testcontainers.utility.DockerImageName
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
@Testcontainers
|
||||
class RedisIntegrationTest {
|
||||
@@ -79,7 +80,7 @@ class RedisIntegrationTest {
|
||||
|
||||
@Test
|
||||
fun `event publishing and consuming should be fast and reliable`() {
|
||||
val aggregateId = uuid4()
|
||||
val aggregateId = Uuid.random()
|
||||
val event1 = TestCreatedEvent(AggregateId(aggregateId), EventVersion(1L), "Test Entity")
|
||||
val event2 = TestUpdatedEvent(AggregateId(aggregateId), EventVersion(2L), "Updated Test Entity")
|
||||
|
||||
@@ -104,14 +105,14 @@ class RedisIntegrationTest {
|
||||
|
||||
@Serializable
|
||||
data class TestCreatedEvent(
|
||||
@Transient override val aggregateId: AggregateId = AggregateId(uuid4()),
|
||||
@Transient override val aggregateId: AggregateId = AggregateId(Uuid.random()),
|
||||
@Transient override val version: EventVersion = EventVersion(0),
|
||||
val name: String
|
||||
) : BaseDomainEvent(aggregateId, EventType("TestCreated"), version)
|
||||
|
||||
@Serializable
|
||||
data class TestUpdatedEvent(
|
||||
@Transient override val aggregateId: AggregateId = AggregateId(uuid4()),
|
||||
@Transient override val aggregateId: AggregateId = AggregateId(Uuid.random()),
|
||||
@Transient override val version: EventVersion = EventVersion(0),
|
||||
val name: String
|
||||
) : BaseDomainEvent(aggregateId, EventType("TestUpdated"), version)
|
||||
|
||||
+4
-2
@@ -1,3 +1,5 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.infrastructure.gateway.config
|
||||
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -10,8 +12,8 @@ import org.springframework.http.server.reactive.ServerHttpResponse
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.web.server.ServerWebExchange
|
||||
import reactor.core.publisher.Mono
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Gateway-Konfiguration für erweiterte Funktionalitäten wie Logging, Rate Limiting und Security.
|
||||
@@ -30,7 +32,7 @@ class CorrelationIdFilter : GlobalFilter, Ordered {
|
||||
override fun filter(exchange: ServerWebExchange, chain: GatewayFilterChain): Mono<Void> {
|
||||
val request = exchange.request
|
||||
val correlationId = request.headers.getFirst(CORRELATION_ID_HEADER)
|
||||
?: UUID.randomUUID().toString()
|
||||
?: Uuid.random().toString()
|
||||
|
||||
val mutatedRequest = request.mutate()
|
||||
.header(CORRELATION_ID_HEADER, correlationId)
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.springframework.context.ApplicationContext
|
||||
* erfolgreich geladen werden kann.
|
||||
*
|
||||
* Mit der Armeria Auto-Configuration Ausschluss-Konfiguration sollte der Context erfolgreich laden.
|
||||
* Verwendet RANDOM_PORT um Konflikte mit bootRun-Tasks zu vermeiden.
|
||||
* Verwendet RANDOM_PORT, um Konflikte mit bootRun-Tasks zu vermeiden.
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
class MonitoringServerApplicationTest {
|
||||
|
||||
Reference in New Issue
Block a user