diff --git a/pom.xml b/pom.xml index ea943f35..a189f992 100644 --- a/pom.xml +++ b/pom.xml @@ -37,8 +37,8 @@ 3.1.1 3.0_20240215101759_cea211f 2.0_20240131125409_e3d0f6d - 2.20240123084817_35f03aa - 3.2.0 + 3.20240227112118_e55c4be + 4.1.3 4.9.1 2.35.1 1.13.9 diff --git a/src/main/kotlin/no/nav/familie/ef/personhendelse/configuration/ApplicationConfig.kt b/src/main/kotlin/no/nav/familie/ef/personhendelse/configuration/ApplicationConfig.kt index 7ea7dc30..07018d04 100644 --- a/src/main/kotlin/no/nav/familie/ef/personhendelse/configuration/ApplicationConfig.kt +++ b/src/main/kotlin/no/nav/familie/ef/personhendelse/configuration/ApplicationConfig.kt @@ -1,13 +1,13 @@ package no.nav.familie.ef.personhendelse.configuration import com.fasterxml.jackson.module.kotlin.KotlinModule +import no.nav.familie.http.client.RetryOAuth2HttpClient import no.nav.familie.http.config.RestTemplateAzure import no.nav.familie.kafka.KafkaErrorHandler import no.nav.familie.kontrakter.felles.objectMapper import no.nav.familie.log.filter.LogFilter import no.nav.familie.log.filter.RequestTimeFilter import no.nav.security.token.support.client.core.http.OAuth2HttpClient -import no.nav.security.token.support.client.spring.oauth2.DefaultOAuth2HttpClient import no.nav.security.token.support.client.spring.oauth2.EnableOAuth2Client import no.nav.security.token.support.spring.api.EnableJwtTokenValidation import org.slf4j.LoggerFactory @@ -20,6 +20,7 @@ import org.springframework.context.annotation.Import import org.springframework.context.annotation.Primary import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter import org.springframework.scheduling.annotation.EnableScheduling +import org.springframework.web.client.RestClient import org.springframework.web.client.RestTemplate import java.time.Duration import java.time.temporal.ChronoUnit @@ -80,13 +81,15 @@ class ApplicationConfig { * pga .setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE) * og [OAuth2AccessTokenResponse] som burde settes med setters, då feltnavn heter noe annet enn feltet i json */ - @Bean @Primary + @Bean fun oAuth2HttpClient(): OAuth2HttpClient { - return DefaultOAuth2HttpClient( - RestTemplateBuilder() - .setConnectTimeout(Duration.of(2, ChronoUnit.SECONDS)) - .setReadTimeout(Duration.of(4, ChronoUnit.SECONDS)), + return RetryOAuth2HttpClient( + RestClient.create( + RestTemplateBuilder() + .setConnectTimeout(Duration.of(2, ChronoUnit.SECONDS)) + .setReadTimeout(Duration.of(4, ChronoUnit.SECONDS)).build(), + ), ) } } diff --git "a/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListener.kt" "b/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListener.kt" index 66cad94f..8aa52bbc 100644 --- "a/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListener.kt" +++ "b/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListener.kt" @@ -29,7 +29,7 @@ class KontantstøtteVedtakListener(val kontantstøtteVedtakService: Kontantstøt try { logger.info("Leser vedtak for kontantstøtte med behandlingId: ${vedtakhendelse.behandlingsId}") if (erAlleredeHåndtert(vedtakhendelse)) { - logger.info("Har allerede håndtert kontantstøttevedtak med behandlingId=${vedtakhendelse.behandlingsId}") + logger.info("Har allerede håndtert kontantstøttevedtak med behandlingId=${vedtakhendelse.behandlingsId}") } else { opprettOppgaveHvisPersonHarLøpendeBarnetilsyn(vedtakhendelse.person.personIdent, vedtakhendelse.behandlingsId) } diff --git "a/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakService.kt" "b/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakService.kt" index 9252f6f0..221a0008 100644 --- "a/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakService.kt" +++ "b/src/main/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakService.kt" @@ -32,7 +32,7 @@ class KontantstøtteVedtakService( fun lagreKontantstøttehendelse(behandlingId: String) { kontantstøtteVedtakRepository.lagreKontantstøttevedtak(behandlingId) } - + fun erAlleredeHåndtert(behandlingId: String): Boolean { return kontantstøtteVedtakRepository.harAlleredeProsessertKontantstøttevedtak(behandlingId) } diff --git a/src/test/kotlin/no/nav/familie/ef/personhendelse/IntegrasjonstestConfig.kt b/src/test/kotlin/no/nav/familie/ef/personhendelse/IntegrasjonstestConfig.kt index 8681f246..009cb3e1 100644 --- a/src/test/kotlin/no/nav/familie/ef/personhendelse/IntegrasjonstestConfig.kt +++ b/src/test/kotlin/no/nav/familie/ef/personhendelse/IntegrasjonstestConfig.kt @@ -18,7 +18,7 @@ class IntegrasjonstestConfig { fun oAuth2AccessTokenServiceMock(): OAuth2AccessTokenService { val tokenMockService = mockk() every { tokenMockService.getAccessToken(any()) } - .returns(OAuth2AccessTokenResponse("Mock-token-response", 60, 60, null)) + .returns(OAuth2AccessTokenResponse("Mock-token-response", 60, 60, emptyMap())) return tokenMockService } } diff --git "a/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListenerTest.kt" "b/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListenerTest.kt" index 93fea157..21ad6d71 100644 --- "a/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListenerTest.kt" +++ "b/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakListenerTest.kt" @@ -5,7 +5,6 @@ import io.mockk.every import io.mockk.just import io.mockk.mockk import io.mockk.verify -import java.time.ZonedDateTime import no.nav.familie.eksterne.kontrakter.BehandlingType import no.nav.familie.eksterne.kontrakter.BehandlingÅrsak import no.nav.familie.eksterne.kontrakter.Kategori @@ -16,6 +15,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecord import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.springframework.kafka.support.Acknowledgment +import java.time.ZonedDateTime class KontantstøtteVedtakListenerTest { private val kontantstøtteVedtakServiceMock = mockk() @@ -32,7 +32,7 @@ class KontantstøtteVedtakListenerTest { kompetanseperioder = listOf(), funksjonellId = "veri", behandlingÅrsak = BehandlingÅrsak.SØKNAD, - vilkårResultater = listOf() + vilkårResultater = listOf(), ) val vedtakDvhAsJson = objectMapper.writeValueAsString(vedtakDvh) @@ -69,4 +69,4 @@ class KontantstøtteVedtakListenerTest { verify(exactly = 1) { kontantstøtteVedtakServiceMock.erAlleredeHåndtert(vedtakDvh.behandlingsId) } verify(exactly = 1) { kontantstøtteVedtakServiceMock.opprettVurderKonsekvensOppgaveForBarnetilsyn(any(), any()) } } -} \ No newline at end of file +} diff --git "a/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakRepositoryTest.kt" "b/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakRepositoryTest.kt" index 555e833d..8a73afcd 100644 --- "a/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakRepositoryTest.kt" +++ "b/src/test/kotlin/no/nav/familie/ef/personhendelse/kontantst\303\270tte/vedtak/Kontantst\303\270tteVedtakRepositoryTest.kt" @@ -1,10 +1,10 @@ package no.nav.familie.ef.personhendelse.kontantstøtte.vedtak -import java.util.UUID import no.nav.familie.ef.personhendelse.IntegrasjonSpringRunnerTest import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired +import java.util.UUID class KontantstøtteVedtakRepositoryTest : IntegrasjonSpringRunnerTest() { @@ -19,12 +19,12 @@ class KontantstøtteVedtakRepositoryTest : IntegrasjonSpringRunnerTest() { assertThat( kontantstøtteVedtakRepository.harAlleredeProsessertKontantstøttevedtak( - behandlingAlleredeHåndtert - ) + behandlingAlleredeHåndtert, + ), ).isTrue() assertThat( - kontantstøtteVedtakRepository.harAlleredeProsessertKontantstøttevedtak(behandlingIkkeHåndtert) + kontantstøtteVedtakRepository.harAlleredeProsessertKontantstøttevedtak(behandlingIkkeHåndtert), ).isFalse() } -} \ No newline at end of file +} diff --git a/src/test/resources/application-integrasjonstest.yml b/src/test/resources/application-integrasjonstest.yml index 45396a39..0468ffce 100644 --- a/src/test/resources/application-integrasjonstest.yml +++ b/src/test/resources/application-integrasjonstest.yml @@ -2,7 +2,6 @@ no.nav.security.jwt: issuer.azuread: discoveryurl: http://localhost:${mock-oauth2-server.port}/azuread/.well-known/openid-configuration accepted_audience: aud-localhost - cookie_name: localhost-idtoken spring: kafka: bootstrap-servers: http://localhost:9092