Skip to content

Commit

Permalink
tar inn proxiedWebClient-endringer fra #339
Browse files Browse the repository at this point in the history
  • Loading branch information
martintveter committed Mar 16, 2021
1 parent b218d4a commit 386e05a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
Expand Up @@ -12,14 +12,14 @@ import org.springframework.web.reactive.function.client.WebClient
@Profile("!mock")
@Configuration
class KommuneInfoClientConfig(
private val proxiedWebClient: WebClient,
private val proxiedWebClientBuilder: WebClient.Builder,
private val clientProperties: ClientProperties
) {

@Bean
fun kommuneInfoClient(): KommuneInfoClient {
return KommuneInfoClientImpl(
proxiedWebClient,
proxiedWebClientBuilder.build(),
fiksProperties()
)
}
Expand Down
Expand Up @@ -12,7 +12,7 @@ import org.springframework.web.reactive.function.client.WebClient
@Profile("!mock")
@Configuration
class IdPortenClientConfig(
private val proxiedWebClient: WebClient,
private val proxiedWebClientBuilder: WebClient.Builder,
@Value("\${no.nav.sosialhjelp.idporten.token_url}") private val tokenUrl: String,
@Value("\${no.nav.sosialhjelp.idporten.client_id}") private val clientId: String,
@Value("\${no.nav.sosialhjelp.idporten.scope}") private val scope: String,
Expand All @@ -24,7 +24,7 @@ class IdPortenClientConfig(
@Bean
fun idPortenClient(): IdPortenClient {
return IdPortenClient(
webClient = proxiedWebClient,
webClient = proxiedWebClientBuilder.build(),
idPortenProperties = idPortenProperties()
)
}
Expand Down
Expand Up @@ -11,31 +11,25 @@ import reactor.netty.http.client.HttpClient

@Profile("!(mock|mock-alt|local)")
@Configuration
class ProxiedWebClientConfig(
private val webClientBuilder: WebClient.Builder
) {
class ProxiedWebClientConfig {

@Value("\${HTTPS_PROXY}")
private lateinit var proxyUrl: String

@Bean
fun proxiedWebClient(): WebClient =
webClientBuilder
fun proxiedWebClientBuilder(): WebClient.Builder =
WebClient.builder()
.clientConnector(getReactorClientHttpConnector(proxyUrl))
.build()

}

@Profile("mock|mock-alt|local")
@Configuration
class MockProxiedWebClientConfig(
private val webClientBuilder: WebClient.Builder
) {
class MockProxiedWebClientConfig {

@Bean
fun proxiedWebClient(): WebClient =
webClientBuilder
fun proxiedWebClientBuilder(): WebClient.Builder =
WebClient.builder()
.clientConnector(ReactorClientHttpConnector(HttpClient.newConnection()))
.build()

}
1 change: 1 addition & 0 deletions src/main/resources/logback-spring.xml
Expand Up @@ -24,6 +24,7 @@
</appender>

<logger name="no.nav.sosialhjelp.innsyn" level="DEBUG"/>
<logger name="no.nav.sosialhjelp.idporten" level="DEBUG"/>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.security" level="INFO"/>
<logger name="org.springframework.web" level="INFO"/>
Expand Down
Expand Up @@ -16,8 +16,8 @@ class ApplicationContextTest {
@MockkBean
private lateinit var idPortenClient: IdPortenClient

@MockkBean(name = "proxiedWebClient")
private lateinit var proxiedWebClient: WebClient
@MockkBean(name = "proxiedWebClientBuilder", relaxed = true)
private lateinit var proxiedWebClientBuilder: WebClient.Builder

@MockkBean
private lateinit var proxiedWebClientConfig: ProxiedWebClientConfig
Expand Down

0 comments on commit 386e05a

Please sign in to comment.