Skip to content

Commit

Permalink
Sørg for at PortName alltid får postfix
Browse files Browse the repository at this point in the history
  • Loading branch information
androa committed Jul 5, 2024
1 parent 48fd7fc commit 2dc72cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inline fun <reified T> createSoapClient(block: Config.() -> Unit): T =
val annotations = T::class.java.getAnnotation(WebService::class.java)
val namespace = annotations.targetNamespace + "/Binding"
val svcName = svcName ?: annotations.name
val portName = portName ?: svcName + "Port"
val portName = (portName ?: svcName) + "Port"

JaxWsProxyFactoryBean()
.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,33 @@ internal class SoapPortTest {
fun `kan overstyre svcName og PortName for å lage klient`() {
val stsClient = mockk<STSClient>()

val e: ServiceConstructionException =
assertThrows<ServiceConstructionException> {
createSoapClient<YtelseskontraktV3> {
sts = stsClient
stsAllowInsecure = true
endpoint = "foo"
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
svcName = "Blupr"
portName = "Blarp"
}
assertThrows<ServiceConstructionException> {
createSoapClient<YtelseskontraktV3> {
sts = stsClient
stsAllowInsecure = true
endpoint = "foo"
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
svcName = "Blupr"
}
assertEquals(
"Could not find definition for service {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}Blupr.",
e.message,
)
}.also {
assertEquals(
"Could not find definition for service {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}Blupr.",
it.message,
)
}
assertThrows<ServiceConstructionException> {
createSoapClient<YtelseskontraktV3> {
sts = stsClient
stsAllowInsecure = true
endpoint = "foo"
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
portName = "Blarp"
}
}.also {
assertEquals(
"Could not find definition for port {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}BlarpPort.",
it.message,
)
}
}
}

0 comments on commit 2dc72cf

Please # to comment.