Skip to content

Commit 2dc72cf

Browse files
committed
Sørg for at PortName alltid får postfix
1 parent 48fd7fc commit 2dc72cf

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

soap-client/src/main/kotlin/no/nav/dagpenger/soap/client/SoapPort.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ inline fun <reified T> createSoapClient(block: Config.() -> Unit): T =
2525
val annotations = T::class.java.getAnnotation(WebService::class.java)
2626
val namespace = annotations.targetNamespace + "/Binding"
2727
val svcName = svcName ?: annotations.name
28-
val portName = portName ?: svcName + "Port"
28+
val portName = (portName ?: svcName) + "Port"
2929

3030
JaxWsProxyFactoryBean()
3131
.apply {

soap-client/src/test/kotlin/no/nav/dagpenger/soap/client/SoapPortTest.kt

+27-14
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,33 @@ internal class SoapPortTest {
5959
fun `kan overstyre svcName og PortName for å lage klient`() {
6060
val stsClient = mockk<STSClient>()
6161

62-
val e: ServiceConstructionException =
63-
assertThrows<ServiceConstructionException> {
64-
createSoapClient<YtelseskontraktV3> {
65-
sts = stsClient
66-
stsAllowInsecure = true
67-
endpoint = "foo"
68-
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
69-
svcName = "Blupr"
70-
portName = "Blarp"
71-
}
62+
assertThrows<ServiceConstructionException> {
63+
createSoapClient<YtelseskontraktV3> {
64+
sts = stsClient
65+
stsAllowInsecure = true
66+
endpoint = "foo"
67+
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
68+
svcName = "Blupr"
7269
}
73-
assertEquals(
74-
"Could not find definition for service {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}Blupr.",
75-
e.message,
76-
)
70+
}.also {
71+
assertEquals(
72+
"Could not find definition for service {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}Blupr.",
73+
it.message,
74+
)
75+
}
76+
assertThrows<ServiceConstructionException> {
77+
createSoapClient<YtelseskontraktV3> {
78+
sts = stsClient
79+
stsAllowInsecure = true
80+
endpoint = "foo"
81+
wsdl = "wsdl/tjenestespesifikasjon/no/nav/tjeneste/virksomhet/ytelseskontrakt/v3/Binding.wsdl"
82+
portName = "Blarp"
83+
}
84+
}.also {
85+
assertEquals(
86+
"Could not find definition for port {http://nav.no/tjeneste/virksomhet/ytelseskontrakt/v3/Binding}BlarpPort.",
87+
it.message,
88+
)
89+
}
7790
}
7891
}

0 commit comments

Comments
 (0)