diff --git a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/common/PartnerCacheRepository.kt b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/common/PartnerCacheRepository.kt index d8eca7e7..9894b21d 100644 --- a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/common/PartnerCacheRepository.kt +++ b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/common/PartnerCacheRepository.kt @@ -21,10 +21,11 @@ open class PartnerCacheRepository : PartnerRepository { override suspend fun savePartnerUrlForTokenA(tokenA: String, partnerUrl: String): String? = partners .toList() - .firstOrNull { it.tokenA == tokenA } - ?.copy(url = partnerUrl) - ?.also { partners[it.url!!] = it } - ?.url + .indexOfFirst { it.tokenA == tokenA } + .let { index -> + partners[index] = partners[index].copy(url = partnerUrl) + partnerUrl + } override suspend fun saveCredentialsRoles( partnerUrl: String, diff --git a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsReceiver.kt b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsReceiver.kt index fee68f5a..42fd4b24 100644 --- a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsReceiver.kt +++ b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsReceiver.kt @@ -55,7 +55,7 @@ fun main() { serverVersionsUrlProvider = { receiverVersionsUrl }, requiredEndpoints = requiredOtherPartEndpoints ), - receiverVersionsRepository + versionsRepository = receiverVersionsRepository ).registerOn(receiverServer) VersionsServer( service = VersionsService( diff --git a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsSender.kt b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsSender.kt index f5461bd0..5039408c 100644 --- a/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsSender.kt +++ b/ocpi-toolkit-2.2.1/src/test/kotlin/com/izivia/ocpi/toolkit/samples/credentials/CredentialsSender.kt @@ -8,7 +8,10 @@ import com.izivia.ocpi.toolkit.modules.credentials.services.CredentialsClientSer import com.izivia.ocpi.toolkit.modules.credentials.services.RequiredEndpoints import com.izivia.ocpi.toolkit.modules.locations.domain.BusinessDetails import com.izivia.ocpi.toolkit.modules.versions.VersionsServer +import com.izivia.ocpi.toolkit.modules.versions.domain.Endpoint +import com.izivia.ocpi.toolkit.modules.versions.domain.InterfaceRole import com.izivia.ocpi.toolkit.modules.versions.domain.ModuleID +import com.izivia.ocpi.toolkit.modules.versions.domain.VersionNumber import com.izivia.ocpi.toolkit.modules.versions.repositories.InMemoryVersionsRepository import com.izivia.ocpi.toolkit.modules.versions.services.VersionsService import com.izivia.ocpi.toolkit.samples.common.Http4kTransportClientBuilder @@ -38,9 +41,14 @@ fun main() { VersionsServer( service = VersionsService( repository = senderVersionsRepository, - baseUrlProvider = { receiverUrl } + baseUrlProvider = { senderUrl } ) ).registerOn(senderServer) + + senderVersionsRepository.addEndpoint( + VersionNumber.V2_2_1, + Endpoint(ModuleID.credentials, InterfaceRole.SENDER, "$senderUrl/2.2.1/credentials") + ) } senderServer.start()