Задание НУ из ui
This commit is contained in:
+35
@@ -389,6 +389,41 @@ class CatalogControllerTest {
|
||||
assertEquals(42L, requestCaptor.value.ic.orbPoint.revolution)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `satellite pdcm current initial conditions endpoint proxies request to ballistics`() {
|
||||
val response = SatelliteICDTO(
|
||||
satelliteId = 501L,
|
||||
movementModel = MovementModel.KONDOR,
|
||||
ic = InitialConditionsDTO(
|
||||
orbPoint = OrbPointDTO(
|
||||
time = LocalDateTime.of(2026, 4, 24, 10, 15, 30, 123_000_000),
|
||||
revolution = 42L,
|
||||
vx = 1.0,
|
||||
vy = 2.0,
|
||||
vz = 3.0,
|
||||
x = 4.0,
|
||||
y = 5.0,
|
||||
z = 6.0
|
||||
),
|
||||
sBall = 0.07,
|
||||
f81 = 145.2
|
||||
)
|
||||
)
|
||||
doReturn(response).`when`(ballisticsService).currentInitialConditions(501L)
|
||||
|
||||
val actual = WebClient.create("http://localhost:$port")
|
||||
.get()
|
||||
.uri("/api/catalog/satellites/pdcm/501/initial-conditions")
|
||||
.retrieve()
|
||||
.bodyToMono(SatelliteICDTO::class.java)
|
||||
.block()!!
|
||||
|
||||
assertEquals(501L, actual.satelliteId)
|
||||
assertEquals(MovementModel.KONDOR, actual.movementModel)
|
||||
assertEquals(42L, actual.ic.orbPoint.revolution)
|
||||
verify(ballisticsService).currentInitialConditions(501L)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `satellite create endpoint proxies request`() {
|
||||
val request = SatelliteCreateDTO(
|
||||
|
||||
+32
-1
@@ -59,6 +59,7 @@ class BallisticsServiceTest {
|
||||
)
|
||||
)
|
||||
)
|
||||
val currentInitialConditions = service.currentInitialConditions(101L)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
@@ -67,7 +68,8 @@ class BallisticsServiceTest {
|
||||
"/api/satellites/101/orbit",
|
||||
"/api/satellites/orbit/availability",
|
||||
"/api/satellites/101/extract-time",
|
||||
"/api/satellites/receive-rv"
|
||||
"/api/satellites/receive-rv",
|
||||
"/api/satellites/101/initial-conditions/current"
|
||||
),
|
||||
requests.map { it.path }
|
||||
)
|
||||
@@ -78,6 +80,7 @@ class BallisticsServiceTest {
|
||||
"time_start=2026-04-21T10:00&time_stop=2026-04-21T12:00",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
),
|
||||
requests.map { it.query }
|
||||
@@ -87,6 +90,8 @@ class BallisticsServiceTest {
|
||||
assertNotNull(exactPoint)
|
||||
assertEquals(timeStart, exactPoint.time)
|
||||
assertEquals(true, requestBodies.single().contains(""""movementModel":"KONDOR""""))
|
||||
assertNotNull(currentInitialConditions)
|
||||
assertEquals(101L, currentInitialConditions.satelliteId)
|
||||
}
|
||||
|
||||
private fun createService(serverUrl: String): BallisticsService {
|
||||
@@ -133,6 +138,32 @@ class BallisticsServiceTest {
|
||||
requestBodies.add(exchange.requestBody.bufferedReader().use { it.readText() })
|
||||
respond(exchange, "")
|
||||
}
|
||||
startedServer.createContext("/api/satellites/101/initial-conditions/current") { exchange ->
|
||||
requests.add(exchange.requestURI)
|
||||
respond(
|
||||
exchange,
|
||||
"""
|
||||
{
|
||||
"satelliteId": 101,
|
||||
"movementModel": "KONDOR",
|
||||
"ic": {
|
||||
"orbPoint": {
|
||||
"time": "2026-04-21T10:00:00",
|
||||
"revolution": 7,
|
||||
"vx": 1.0,
|
||||
"vy": 2.0,
|
||||
"vz": 3.0,
|
||||
"x": 4.0,
|
||||
"y": 5.0,
|
||||
"z": 6.0
|
||||
},
|
||||
"sBall": 0.0,
|
||||
"f81": 147.8
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
startedServer.start()
|
||||
server = startedServer
|
||||
return "http://localhost:${startedServer.address.port}"
|
||||
|
||||
Reference in New Issue
Block a user