chore(gateway, ping-service, security): streamline configurations, remove redundancies, and improve resilience
- Removed `MdcCorrelationFilter` and simplified correlation ID management using Micrometer Tracing. - Updated `SecurityConfig` in `gateway` with enhanced role-based access and standardized JWT validation. - Added new `@Profile` annotations in `ping-service` to exclude certain components during testing. - Refactored and removed legacy `application-keycloak.yaml` and consolidated settings into the primary `application.yaml`. - Adjusted Gradle scripts to clean up dependency declarations and improve modularity. - Simplified CORS and Gateway route configurations for better maintainability.
This commit is contained in:
+8
@@ -39,4 +39,12 @@ class PingApiClient(
|
||||
override suspend fun healthCheck(): HealthResponse {
|
||||
return client.get("$baseUrl/api/ping/health").body()
|
||||
}
|
||||
|
||||
override suspend fun publicPing(): PingResponse {
|
||||
return client.get("$baseUrl/api/ping/public").body()
|
||||
}
|
||||
|
||||
override suspend fun securePing(): PingResponse {
|
||||
return client.get("$baseUrl/api/ping/secure").body()
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -26,4 +26,12 @@ class PingApiKoinClient(private val client: HttpClient) : PingApi {
|
||||
override suspend fun healthCheck(): HealthResponse {
|
||||
return client.get("/api/ping/health").body()
|
||||
}
|
||||
|
||||
override suspend fun publicPing(): PingResponse {
|
||||
return client.get("/api/ping/public").body()
|
||||
}
|
||||
|
||||
override suspend fun securePing(): PingResponse {
|
||||
return client.get("/api/ping/secure").body()
|
||||
}
|
||||
}
|
||||
|
||||
+37
-14
@@ -21,30 +21,21 @@ class TestPingApiClient : PingApi {
|
||||
var simplePingResponse: PingResponse? = null
|
||||
var enhancedPingResponse: EnhancedPingResponse? = null
|
||||
var healthResponse: HealthResponse? = null
|
||||
var publicPingResponse: PingResponse? = null
|
||||
var securePingResponse: PingResponse? = null
|
||||
|
||||
// Call tracking
|
||||
var simplePingCalled = false
|
||||
var enhancedPingCalledWith: Boolean? = null
|
||||
var healthCheckCalled = false
|
||||
var publicPingCalled = false
|
||||
var securePingCalled = false
|
||||
var callCount = 0
|
||||
|
||||
override suspend fun simplePing(): PingResponse {
|
||||
simplePingCalled = true
|
||||
callCount++
|
||||
|
||||
if (simulateDelay) {
|
||||
kotlinx.coroutines.delay(delayMs)
|
||||
}
|
||||
|
||||
if (shouldThrowException) {
|
||||
throw Exception(exceptionMessage)
|
||||
}
|
||||
|
||||
return simplePingResponse ?: PingResponse(
|
||||
status = "OK",
|
||||
timestamp = "2025-09-27T21:27:00Z",
|
||||
service = "test-ping-service"
|
||||
)
|
||||
return handleRequest(simplePingResponse)
|
||||
}
|
||||
|
||||
override suspend fun enhancedPing(simulate: Boolean): EnhancedPingResponse {
|
||||
@@ -88,6 +79,34 @@ class TestPingApiClient : PingApi {
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun publicPing(): PingResponse {
|
||||
publicPingCalled = true
|
||||
callCount++
|
||||
return handleRequest(publicPingResponse)
|
||||
}
|
||||
|
||||
override suspend fun securePing(): PingResponse {
|
||||
securePingCalled = true
|
||||
callCount++
|
||||
return handleRequest(securePingResponse)
|
||||
}
|
||||
|
||||
private suspend fun handleRequest(response: PingResponse?): PingResponse {
|
||||
if (simulateDelay) {
|
||||
kotlinx.coroutines.delay(delayMs)
|
||||
}
|
||||
|
||||
if (shouldThrowException) {
|
||||
throw Exception(exceptionMessage)
|
||||
}
|
||||
|
||||
return response ?: PingResponse(
|
||||
status = "OK",
|
||||
timestamp = "2025-09-27T21:27:00Z",
|
||||
service = "test-ping-service"
|
||||
)
|
||||
}
|
||||
|
||||
// Test utilities
|
||||
fun reset() {
|
||||
shouldThrowException = false
|
||||
@@ -97,9 +116,13 @@ class TestPingApiClient : PingApi {
|
||||
simplePingResponse = null
|
||||
enhancedPingResponse = null
|
||||
healthResponse = null
|
||||
publicPingResponse = null
|
||||
securePingResponse = null
|
||||
simplePingCalled = false
|
||||
enhancedPingCalledWith = null
|
||||
healthCheckCalled = false
|
||||
publicPingCalled = false
|
||||
securePingCalled = false
|
||||
callCount = 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user