feat(Tracer Bullet)

This commit is contained in:
2025-08-11 23:47:05 +02:00
parent 582678e226
commit a50b1b3822
43 changed files with 1665 additions and 292 deletions
@@ -0,0 +1,13 @@
package at.mocode.temp.pingservice
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@RestController
class PingController {
@GetMapping("/ping")
fun ping(): Map<String, String> {
return mapOf("status" to "pong")
}
}
@@ -0,0 +1,11 @@
package at.mocode.temp.pingservice
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
class PingServiceApplication
fun main(args: Array<String>) {
runApplication<PingServiceApplication>(*args)
}
@@ -0,0 +1,23 @@
spring:
application:
name: ping-service
cloud:
consul:
host: localhost
port: 8500
discovery:
register: true
health-check-path: /actuator/health
health-check-interval: 10s
server:
port: 8082
management:
endpoints:
web:
exposure:
include: health,info
endpoint:
health:
show-details: always
@@ -0,0 +1,23 @@
package at.mocode.temp.pingservice
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.*
@WebMvcTest(PingController::class)
class PingControllerTest {
@Autowired
private lateinit var mockMvc: MockMvc
@Test
fun `ping endpoint should return pong status`() {
mockMvc.perform(get("/ping"))
.andExpect(status().isOk)
.andExpect(content().contentType("application/json"))
.andExpect(jsonPath("$.status").value("pong"))
}
}