Skip to content

Commit

Permalink
F - Oppdatering av post for send sed mot eux
Browse files Browse the repository at this point in the history
  • Loading branch information
dskarpas committed Oct 11, 2024
1 parent 2d926e6 commit 0a36c87
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
23 changes: 13 additions & 10 deletions src/main/kotlin/no/nav/eessi/pensjon/eux/klient/EuxKlientLib.kt
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,19 @@ open class EuxKlientLib(private val euxRestTemplate: RestTemplate, override var
}

fun sendSed(euxCaseId: String, dokumentId : String): Boolean {
val path = "/buc/{$euxCaseId}/sed/{$dokumentId}/send?ventePaAksjon=false"
logger.info("Kaller sendSed for buc: $euxCaseId, sed: $dokumentId")
val result =
euxRestTemplate.exchange(
path,
HttpMethod.POST,
HttpEntity("", HttpHeaders().apply { contentType = MediaType.APPLICATION_JSON }),
String::class.java
)
logger.info("SendSed response: ${result.statusCode} ")
val url = "/buc/{$euxCaseId}/sed/{$dokumentId}/send?ventePaAksjon=false"
logger.info("Kaller sendSed for buc: $euxCaseId, sed: $dokumentId, path: $url")

val result: ResponseEntity<String> = euxRestTemplate.postForEntity(
url,
HttpEntity<String>(HttpHeaders().apply {
set("accept", "*/*")
}), String::class.java
)

logger.info("""
| Response Code: ${result.statusCode}}
| Response Body: ${result.body}""".trimMargin())
return result.statusCode == HttpStatus.OK
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ class EuxKlientLibTest {

val mockResponse = ResponseEntity<String>("", HttpStatus.OK)
every {
mockTemplate.exchange(
mockTemplate.postForEntity(
path,
HttpMethod.POST,
any<HttpEntity<String>>(),
String::class.java
)
Expand All @@ -63,6 +62,6 @@ class EuxKlientLibTest {
val result = euxKlientLib.sendSed(euxCaseId, dokumentId)

assertTrue(result)
verify { mockTemplate.exchange(path, HttpMethod.POST, any<HttpEntity<String>>(), String::class.java) }
verify { mockTemplate.postForEntity(path, any<HttpEntity<String>>(), String::class.java) }
}
}

0 comments on commit 0a36c87

Please sign in to comment.