chore: remove deprecated horses, clubs, officials, and persons services

- Deleted obsolete modules related to horses, clubs, officials, and persons services, including their configurations, build files, and database provisioning scripts.
- Cleaned up associated references in the project structure (e.g., `settings.gradle.kts`).
- Removed unused database tables and Spring beans related to these domains.

Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
2026-03-28 16:50:49 +01:00
parent 2cb3f0b125
commit c806660685
181 changed files with 4121 additions and 8694 deletions
@@ -19,123 +19,123 @@ import kotlin.uuid.Uuid
@OptIn(ExperimentalUuidApi::class)
class PingServiceTest {
private val repository: PingRepository = mockk()
private lateinit var service: PingService
private val repository: PingRepository = mockk()
private lateinit var service: PingService
@BeforeEach
fun setUp() {
service = PingService(repository)
}
@BeforeEach
fun setUp() {
service = PingService(repository)
}
@Test
fun `executePing should persist and return ping with given message`() {
// Given
every { repository.save(any()) } answers { firstArg() }
@Test
fun `executePing should persist and return ping with given message`() {
// Given
every { repository.save(any()) } answers { firstArg() }
// When
val result = service.executePing("Hello")
// When
val result = service.executePing("Hello")
// Then
assertThat(result.message).isEqualTo("Hello")
verify { repository.save(any()) }
}
// Then
assertThat(result.message).isEqualTo("Hello")
verify { repository.save(any()) }
}
@Test
fun `executePing should generate a new UUID for each ping`() {
// Given
every { repository.save(any()) } answers { firstArg() }
@Test
fun `executePing should generate a new UUID for each ping`() {
// Given
every { repository.save(any()) } answers { firstArg() }
// When
val result1 = service.executePing("Ping 1")
val result2 = service.executePing("Ping 2")
// When
val result1 = service.executePing("Ping 1")
val result2 = service.executePing("Ping 2")
// Then
assertThat(result1.id).isNotEqualTo(result2.id)
}
// Then
assertThat(result1.id).isNotEqualTo(result2.id)
}
@Test
fun `getPingHistory should delegate to repository and return all pings`() {
// Given
val pings = listOf(
Ping(message = "Ping A"),
Ping(message = "Ping B")
)
every { repository.findAll() } returns pings
@Test
fun `getPingHistory should delegate to repository and return all pings`() {
// Given
val pings = listOf(
Ping(message = "Ping A"),
Ping(message = "Ping B")
)
every { repository.findAll() } returns pings
// When
val result = service.getPingHistory()
// When
val result = service.getPingHistory()
// Then
assertThat(result).hasSize(2)
assertThat(result.map { it.message }).containsExactly("Ping A", "Ping B")
verify { repository.findAll() }
}
// Then
assertThat(result).hasSize(2)
assertThat(result.map { it.message }).containsExactly("Ping A", "Ping B")
verify { repository.findAll() }
}
@Test
fun `getPingHistory should return empty list when no pings exist`() {
// Given
every { repository.findAll() } returns emptyList()
@Test
fun `getPingHistory should return empty list when no pings exist`() {
// Given
every { repository.findAll() } returns emptyList()
// When
val result = service.getPingHistory()
// When
val result = service.getPingHistory()
// Then
assertThat(result).isEmpty()
}
// Then
assertThat(result).isEmpty()
}
@Test
fun `getPing should return ping by id`() {
// Given
val id = Uuid.generateV7()
val ping = Ping(id = id, message = "Find me")
every { repository.findById(id) } returns ping
@Test
fun `getPing should return ping by id`() {
// Given
val id = Uuid.generateV7()
val ping = Ping(id = id, message = "Find me")
every { repository.findById(id) } returns ping
// When
val result = service.getPing(id)
// When
val result = service.getPing(id)
// Then
assertThat(result).isEqualTo(ping)
verify { repository.findById(id) }
}
// Then
assertThat(result).isEqualTo(ping)
verify { repository.findById(id) }
}
@Test
fun `getPing should return null when ping not found`() {
// Given
val id = Uuid.generateV7()
every { repository.findById(id) } returns null
@Test
fun `getPing should return null when ping not found`() {
// Given
val id = Uuid.generateV7()
every { repository.findById(id) } returns null
// When
val result = service.getPing(id)
// When
val result = service.getPing(id)
// Then
assertThat(result).isNull()
}
// Then
assertThat(result).isNull()
}
@Test
fun `getPingsSince should return pings after given timestamp`() {
// Given
val timestamp = Instant.parse("2024-01-01T00:00:00Z").toEpochMilli()
val ping = Ping(message = "Recent Ping", timestamp = Instant.parse("2024-06-01T00:00:00Z"))
every { repository.findByTimestampAfter(any()) } returns listOf(ping)
@Test
fun `getPingsSince should return pings after given timestamp`() {
// Given
val timestamp = Instant.parse("2024-01-01T00:00:00Z").toEpochMilli()
val ping = Ping(message = "Recent Ping", timestamp = Instant.parse("2024-06-01T00:00:00Z"))
every { repository.findByTimestampAfter(any()) } returns listOf(ping)
// When
val result = service.getPingsSince(timestamp)
// When
val result = service.getPingsSince(timestamp)
// Then
assertThat(result).hasSize(1)
assertThat(result[0].message).isEqualTo("Recent Ping")
verify { repository.findByTimestampAfter(Instant.ofEpochMilli(timestamp)) }
}
// Then
assertThat(result).hasSize(1)
assertThat(result[0].message).isEqualTo("Recent Ping")
verify { repository.findByTimestampAfter(Instant.ofEpochMilli(timestamp)) }
}
@Test
fun `getPingsSince should return empty list when no pings after timestamp`() {
// Given
every { repository.findByTimestampAfter(any()) } returns emptyList()
@Test
fun `getPingsSince should return empty list when no pings after timestamp`() {
// Given
every { repository.findByTimestampAfter(any()) } returns emptyList()
// When
val result = service.getPingsSince(System.currentTimeMillis())
// When
val result = service.getPingsSince(System.currentTimeMillis())
// Then
assertThat(result).isEmpty()
}
// Then
assertThat(result).isEmpty()
}
}
@@ -35,54 +35,54 @@ import kotlin.uuid.toJavaUuid
@OptIn(ExperimentalUuidApi::class)
class PingRepositoryTest {
@Autowired
private lateinit var repositoryAdapter: PingRepositoryAdapter
@Autowired
private lateinit var repositoryAdapter: PingRepositoryAdapter
// Wir nutzen das Repository direkt, um zu prüfen, ob JPA funktioniert
@Autowired
private lateinit var springDataRepository: SpringDataPingRepository
// Wir nutzen das Repository direkt, um zu prüfen, ob JPA funktioniert
@Autowired
private lateinit var springDataRepository: SpringDataPingRepository
companion object {
@Container
val postgres = PostgreSQLContainer("postgres:16-alpine")
.withDatabaseName("testdb")
.withUsername("test")
.withPassword("test")
companion object {
@Container
val postgres = PostgreSQLContainer("postgres:16-alpine")
.withDatabaseName("testdb")
.withUsername("test")
.withPassword("test")
@JvmStatic
@DynamicPropertySource
fun registerPgProperties(registry: DynamicPropertyRegistry) {
registry.add("spring.datasource.url", postgres::getJdbcUrl)
registry.add("spring.datasource.username", postgres::getUsername)
registry.add("spring.datasource.password", postgres::getPassword)
// Wichtig: Flyway muss laufen, um Tabellen zu erstellen
registry.add("spring.flyway.enabled") { "true" }
}
@JvmStatic
@DynamicPropertySource
fun registerPgProperties(registry: DynamicPropertyRegistry) {
registry.add("spring.datasource.url", postgres::getJdbcUrl)
registry.add("spring.datasource.username", postgres::getUsername)
registry.add("spring.datasource.password", postgres::getPassword)
// Wichtig: Flyway muss laufen, um Tabellen zu erstellen
registry.add("spring.flyway.enabled") { "true" }
}
}
@Test
fun `should save and load ping entity`() {
// Given
val pingId = Uuid.generateV7()
val ping = Ping(
id = pingId,
message = "Integration Test Ping",
timestamp = Instant.now()
)
@Test
fun `should save and load ping entity`() {
// Given
val pingId = Uuid.generateV7()
val ping = Ping(
id = pingId,
message = "Integration Test Ping",
timestamp = Instant.now()
)
// When
repositoryAdapter.save(ping)
// When
repositoryAdapter.save(ping)
// Then (via Adapter)
val loadedPing = repositoryAdapter.findById(pingId)
assertThat(loadedPing).isNotNull
assertThat(loadedPing?.message).isEqualTo("Integration Test Ping")
assertThat(loadedPing?.id).isEqualTo(pingId)
// Then (via Adapter)
val loadedPing = repositoryAdapter.findById(pingId)
assertThat(loadedPing).isNotNull
assertThat(loadedPing?.message).isEqualTo("Integration Test Ping")
assertThat(loadedPing?.id).isEqualTo(pingId)
// Then (Direct DB Check via Spring Data)
// Fix: Use toJavaUuid() instead of UUID.fromString(pingId.toString())
val entity = springDataRepository.findById(pingId.toJavaUuid())
assertThat(entity).isPresent
assertThat(entity.get().message).isEqualTo("Integration Test Ping")
}
// Then (Direct DB Check via Spring Data)
// Fix: Use toJavaUuid() instead of UUID.fromString(pingId.toString())
val entity = springDataRepository.findById(pingId.toJavaUuid())
assertThat(entity).isPresent
assertThat(entity.get().message).isEqualTo("Integration Test Ping")
}
}
@@ -37,8 +37,8 @@ import kotlin.uuid.ExperimentalUuidApi
* Nutzt @WebMvcTest für einen isolierten MVC-Slice ohne echte Services oder DB.
*/
@WebMvcTest(
controllers = [PingController::class],
properties = ["spring.aop.proxy-target-class=true"]
controllers = [PingController::class],
properties = ["spring.aop.proxy-target-class=true"]
)
@ContextConfiguration(classes = [TestPingServiceApplication::class])
@ActiveProfiles("test")
@@ -47,153 +47,153 @@ import kotlin.uuid.ExperimentalUuidApi
@OptIn(ExperimentalUuidApi::class)
class PingControllerTest {
@Autowired
private lateinit var mockMvc: MockMvc
@Autowired
private lateinit var mockMvc: MockMvc
@Autowired
@Qualifier("pingUseCaseMock")
private lateinit var pingUseCase: PingUseCase
@Autowired
@Qualifier("pingUseCaseMock")
private lateinit var pingUseCase: PingUseCase
@Autowired
private lateinit var properties: PingProperties
@Autowired
private lateinit var properties: PingProperties
@Autowired
private lateinit var objectMapper: ObjectMapper
@Autowired
private lateinit var objectMapper: ObjectMapper
@TestConfiguration
class PingControllerTestConfig {
@Bean("pingUseCaseMock")
@Primary
fun pingUseCase(): PingUseCase = mockk(relaxed = true)
@TestConfiguration
class PingControllerTestConfig {
@Bean("pingUseCaseMock")
@Primary
fun pingUseCase(): PingUseCase = mockk(relaxed = true)
@Bean
@Primary
fun pingRepositoryAdapter(): PingRepositoryAdapter = mockk(relaxed = true)
@Bean
@Primary
fun pingRepositoryAdapter(): PingRepositoryAdapter = mockk(relaxed = true)
@Bean
@Primary
fun pingProperties(): PingProperties = mockk(relaxed = true)
}
@Bean
@Primary
fun pingProperties(): PingProperties = mockk(relaxed = true)
}
@BeforeEach
fun setUp() {
clearMocks(pingUseCase, properties)
every { properties.serviceName } returns "ping-service"
every { properties.serviceNameFallback } returns "ping-service-fallback"
}
@BeforeEach
fun setUp() {
clearMocks(pingUseCase, properties)
every { properties.serviceName } returns "ping-service"
every { properties.serviceNameFallback } returns "ping-service-fallback"
}
@Test
fun `should return simple ping response`() {
// Given
every { pingUseCase.executePing(any()) } returns Ping(
message = "Simple Ping",
timestamp = Instant.parse("2023-10-01T10:00:00Z")
)
@Test
fun `should return simple ping response`() {
// Given
every { pingUseCase.executePing(any()) } returns Ping(
message = "Simple Ping",
timestamp = Instant.parse("2023-10-01T10:00:00Z")
)
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/simple"))
.andExpect(request().asyncStarted())
.andReturn()
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/simple"))
.andExpect(request().asyncStarted())
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("pong")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
verify { pingUseCase.executePing("Simple Ping") }
}
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("pong")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
verify { pingUseCase.executePing("Simple Ping") }
}
@Test
fun `should return enhanced ping response`() {
// Given
every { pingUseCase.executePing(any()) } returns Ping(
message = "Enhanced Ping",
timestamp = Instant.parse("2023-10-01T10:00:00Z")
)
@Test
fun `should return enhanced ping response`() {
// Given
every { pingUseCase.executePing(any()) } returns Ping(
message = "Enhanced Ping",
timestamp = Instant.parse("2023-10-01T10:00:00Z")
)
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/enhanced"))
.andExpect(request().asyncStarted())
.andReturn()
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/enhanced"))
.andExpect(request().asyncStarted())
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("pong")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
verify { pingUseCase.executePing("Enhanced Ping") }
}
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("pong")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
verify { pingUseCase.executePing("Enhanced Ping") }
}
@Test
fun `should return health check response with status up`() {
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/health"))
.andExpect(request().asyncStarted())
.andReturn()
@Test
fun `should return health check response with status up`() {
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/health"))
.andExpect(request().asyncStarted())
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("up")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
}
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json["status"].asText()).isEqualTo("up")
assertThat(json["service"].asText()).isEqualTo(properties.serviceName)
}
@Test
fun `should return sync pings as list`() {
// Given
val timestamp = 1696154400000L
every { pingUseCase.getPingsSince(timestamp) } returns listOf(
Ping(
message = "Sync Ping",
timestamp = Instant.ofEpochMilli(timestamp + 1000)
)
)
@Test
fun `should return sync pings as list`() {
// Given
val timestamp = 1696154400000L
every { pingUseCase.getPingsSince(timestamp) } returns listOf(
Ping(
message = "Sync Ping",
timestamp = Instant.ofEpochMilli(timestamp + 1000)
)
)
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/sync").param("since", timestamp.toString()))
.andExpect(request().asyncStarted())
.andReturn()
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/sync").param("since", timestamp.toString()))
.andExpect(request().asyncStarted())
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json.isArray).isTrue
assertThat(json.size()).isEqualTo(1)
assertThat(json[0]["message"].asText()).isEqualTo("Sync Ping")
assertThat(json[0]["lastModified"].asLong()).isEqualTo(timestamp + 1000)
verify { pingUseCase.getPingsSince(timestamp) }
}
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json.isArray).isTrue
assertThat(json.size()).isEqualTo(1)
assertThat(json[0]["message"].asText()).isEqualTo("Sync Ping")
assertThat(json[0]["lastModified"].asLong()).isEqualTo(timestamp + 1000)
verify { pingUseCase.getPingsSince(timestamp) }
}
@Test
fun `should return empty list when no pings since timestamp`() {
// Given
val timestamp = System.currentTimeMillis()
every { pingUseCase.getPingsSince(timestamp) } returns emptyList()
@Test
fun `should return empty list when no pings since timestamp`() {
// Given
val timestamp = System.currentTimeMillis()
every { pingUseCase.getPingsSince(timestamp) } returns emptyList()
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/sync").param("since", timestamp.toString()))
.andExpect(request().asyncStarted())
.andReturn()
// When
val mvcResult: MvcResult = mockMvc.perform(get("/ping/sync").param("since", timestamp.toString()))
.andExpect(request().asyncStarted())
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
val result = mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk)
.andReturn()
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json.isArray).isTrue
assertThat(json.size()).isEqualTo(0)
}
// Then
val json = objectMapper.readTree(result.response.contentAsString)
assertThat(json.isArray).isTrue
assertThat(json.size()).isEqualTo(0)
}
}
@@ -20,7 +20,7 @@ import org.springframework.context.annotation.Import
*/
@SpringBootApplication
@ComponentScan(
basePackages = ["at.mocode.infrastructure.security"]
basePackages = ["at.mocode.infrastructure.security"]
)
@Import(PingController::class, PingProperties::class)
@EnableAspectJAutoProxy(proxyTargetClass = true) // Erzwingt CGLIB Proxies für Controller