diff --git a/nais-dev-gcp.yaml b/nais-dev-gcp.yaml index 9c167aa9..26168b8f 100644 --- a/nais-dev-gcp.yaml +++ b/nais-dev-gcp.yaml @@ -65,10 +65,6 @@ spec: namespace: team-rocket - application: poao-tilgang namespace: poao - - application: veilarbregistrering - namespace: paw - - application: aia-backend - namespace: paw - application: paw-arbeidssoekerregisteret-api-oppslag namespace: paw - application: skjermede-personer-pip @@ -121,18 +117,10 @@ spec: value: api://dev-gcp.poao.veilarboppfolging/.default - name: VEILARBOPPFOLGING_URL value: http://veilarboppfolging.poao/veilarboppfolging - - name: VEILARBREGISTRERING_SCOPE - value: api://dev-gcp.paw.veilarbregistrering/.default - - name: VEILARBREGISTRERING_URL - value: http://veilarbregistrering.paw - name: KONTOREGISTER_PERSON_V1_SCOPE value: api://dev-gcp.okonomi.sokos-kontoregister-person/.default - name: KONTOREGISTER_PERSON_V1_URL value: http://sokos-kontoregister-person.okonomi - - name: AIA_BACKEND_URL - value: http://aia-backend.paw/aia-backend - - name: AIA_BACKEND_SCOPE - value: api://dev-gcp.paw.paw-arbeidssoker-besvarelse/.default - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_URL value: http://paw-arbeidssoekerregisteret-api-oppslag.paw - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE diff --git a/nais-prod-gcp.yaml b/nais-prod-gcp.yaml index e1bd4351..545d67ff 100644 --- a/nais-prod-gcp.yaml +++ b/nais-prod-gcp.yaml @@ -64,10 +64,6 @@ spec: namespace: team-rocket - application: poao-tilgang namespace: poao - - application: veilarbregistrering - namespace: paw - - application: aia-backend - namespace: paw - application: paw-arbeidssoekerregisteret-api-oppslag namespace: paw - application: skjermede-personer-pip @@ -121,18 +117,10 @@ spec: value: api://prod-gcp.poao.veilarboppfolging/.default - name: VEILARBOPPFOLGING_URL value: http://veilarboppfolging.poao/veilarboppfolging - - name: VEILARBREGISTRERING_SCOPE - value: api://prod-gcp.paw.veilarbregistrering/.default - - name: VEILARBREGISTRERING_URL - value: http://veilarbregistrering.paw - name: KONTOREGISTER_PERSON_V1_SCOPE value: api://prod-gcp.okonomi.sokos-kontoregister-person/.default - name: KONTOREGISTER_PERSON_V1_URL value: http://sokos-kontoregister-person.okonomi - - name: AIA_BACKEND_URL - value: http://aia-backend.paw/aia-backend - - name: AIA_BACKEND_SCOPE - value: api://prod-gcp.paw.paw-arbeidssoker-besvarelse/.default - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_URL value: http://paw-arbeidssoekerregisteret-api-oppslag.paw - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE diff --git a/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClient.kt b/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClient.kt deleted file mode 100644 index 07d67fcf..00000000 --- a/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClient.kt +++ /dev/null @@ -1,8 +0,0 @@ -package no.nav.veilarbperson.client.aiabackend - -import no.nav.common.health.HealthCheck -import okhttp3.Response - -interface AiaBackendClient : HealthCheck { - fun hentEndringIRegistreringsdata(endringIRegistreringsdataRequestDTO: EndringIRegistreringsdataRequestDTO) : Response -} diff --git a/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClientImpl.kt b/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClientImpl.kt deleted file mode 100644 index b40c0eda..00000000 --- a/src/main/java/no/nav/veilarbperson/client/aiabackend/AiaBackendClientImpl.kt +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.veilarbperson.client.aiabackend - -import lombok.SneakyThrows -import no.nav.common.health.HealthCheckResult -import no.nav.common.health.HealthCheckUtils -import no.nav.common.rest.client.RestClient -import no.nav.common.rest.client.RestUtils -import no.nav.common.utils.UrlUtils.joinPaths -import org.springframework.http.HttpHeaders.ACCEPT -import org.springframework.http.MediaType.APPLICATION_JSON_VALUE -import no.nav.veilarbperson.utils.toJson -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.Response -import org.springframework.http.HttpHeaders -import java.util.function.Supplier - -class AiaBackendClientImpl(private val aiaBackendUrl: String, private val userTokenSupplier: Supplier) : AiaBackendClient { - private val client: OkHttpClient = RestClient.baseClient() - - @SneakyThrows - override fun hentEndringIRegistreringsdata(endringIRegistreringsdataRequestDTO: EndringIRegistreringsdataRequestDTO) : Response { - val request = Request.Builder() - .url(joinPaths(aiaBackendUrl, "/veileder/besvarelse")) - .header(HttpHeaders.AUTHORIZATION, userTokenSupplier.get()) - .header(ACCEPT, APPLICATION_JSON_VALUE) - .post(endringIRegistreringsdataRequestDTO.toJson().toRequestBody(RestUtils.MEDIA_TYPE_JSON)) - .build() - - return client.newCall(request).execute() - } - - override fun checkHealth(): HealthCheckResult { - return HealthCheckUtils.pingUrl(joinPaths(aiaBackendUrl, "/internal/isReady"), client) - } -} diff --git a/src/main/java/no/nav/veilarbperson/client/aiabackend/EndringIRegistreringsdataRequestDTO.kt b/src/main/java/no/nav/veilarbperson/client/aiabackend/EndringIRegistreringsdataRequestDTO.kt deleted file mode 100644 index 591698ba..00000000 --- a/src/main/java/no/nav/veilarbperson/client/aiabackend/EndringIRegistreringsdataRequestDTO.kt +++ /dev/null @@ -1,5 +0,0 @@ -package no.nav.veilarbperson.client.aiabackend - -data class EndringIRegistreringsdataRequestDTO( - val foedselsnummer: String -) diff --git a/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClient.java b/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClient.java deleted file mode 100644 index 6d876b63..00000000 --- a/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClient.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.veilarbperson.client.veilarbregistrering; - -import no.nav.common.health.HealthCheck; -import no.nav.common.types.identer.Fnr; -import okhttp3.Response; - -public interface VeilarbregistreringClient extends HealthCheck { - - Response hentRegistrering(Fnr fnr); -} diff --git a/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClientImpl.java b/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClientImpl.java deleted file mode 100644 index 30ff8ec9..00000000 --- a/src/main/java/no/nav/veilarbperson/client/veilarbregistrering/VeilarbregistreringClientImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package no.nav.veilarbperson.client.veilarbregistrering; - -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import no.nav.common.health.HealthCheckResult; -import no.nav.common.health.HealthCheckUtils; -import no.nav.common.rest.client.RestClient; -import no.nav.common.types.identer.Fnr; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import org.springframework.http.HttpHeaders; - -import java.util.function.Supplier; - -import static no.nav.common.utils.UrlUtils.joinPaths; -import static org.springframework.http.HttpHeaders.ACCEPT; -import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; - -@RequiredArgsConstructor -public class VeilarbregistreringClientImpl implements VeilarbregistreringClient { - - private final OkHttpClient client; - - private final String veilarbregistreringUrl; - - private final Supplier serviceTokenSupplier; - - @Override - @SneakyThrows - public Response hentRegistrering(Fnr fnr) { - Request request = new Request.Builder() - .url(joinPaths(veilarbregistreringUrl, "/veilarbregistrering/api/registrering?fnr=" + fnr)) - .header(ACCEPT, APPLICATION_JSON_VALUE) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + serviceTokenSupplier.get()) - .build(); - - return RestClient.baseClient().newCall(request).execute(); - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckUtils.pingUrl(joinPaths(veilarbregistreringUrl, "/veilarbregistrering/internal/isReady"), client); - } -} diff --git a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java index 296c6b6c..fe810f3e 100644 --- a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java @@ -10,14 +10,11 @@ import no.nav.common.client.norg2.NorgHttp2Client; import no.nav.common.metrics.InfluxClient; import no.nav.common.metrics.MetricsClient; -import no.nav.common.rest.client.RestClient; import no.nav.common.token_client.builder.AzureAdTokenClientBuilder; import no.nav.common.token_client.client.AzureAdMachineToMachineTokenClient; import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient; import no.nav.common.token_client.client.MachineToMachineTokenClient; import no.nav.poao_tilgang.client.PoaoTilgangClient; -import no.nav.veilarbperson.client.aiabackend.AiaBackendClient; -import no.nav.veilarbperson.client.aiabackend.AiaBackendClientImpl; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirClientImpl; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; @@ -36,8 +33,6 @@ import no.nav.veilarbperson.client.representasjon.RepresentasjonClientImpl; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClientImpl; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClientImpl; import no.nav.veilarbperson.service.AuthService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -65,13 +60,6 @@ public VeilarboppfolgingClient veilarboppfolgingClient(EnvironmentProperties pro () -> authService.getAadOboTokenForTjeneste(properties.getVeilarboppfolgingScope())); } - @Bean - public AiaBackendClient aiaBackendClient(EnvironmentProperties environmentProperties, AuthService authService) { - return new AiaBackendClientImpl( - environmentProperties.getAiaBackendUrl(), - () -> authService.getAadOboTokenForTjeneste(environmentProperties.getAiaBackendScope())); - } - @Bean public DigdirClient digdirClient(EnvironmentProperties properties, MachineToMachineTokenClient tokenClient) { return new DigdirClientImpl(properties.getKrrUrl(), @@ -115,13 +103,6 @@ public RepresentasjonClient representasjonClient(EnvironmentProperties propertie () -> authService.getAadOboTokenForTjeneste(properties.getReprApiScope())); } - @Bean - public VeilarbregistreringClient veilarbregistreringClient(EnvironmentProperties properties, AzureAdMachineToMachineTokenClient aadMachineToMachineTokenClient) { - return new VeilarbregistreringClientImpl(RestClient.baseClient(), - properties.getVeilarbregistreringUrl(), - () -> aadMachineToMachineTokenClient.createMachineToMachineToken(properties.getVeilarbregistreringScope())); - } - @Bean public OppslagArbeidssoekerregisteretClient oppslagArbeidssoekerregisteretClient( EnvironmentProperties properties, diff --git a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java index 75b80a15..c13e8a92 100644 --- a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java +++ b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java @@ -31,12 +31,8 @@ public class EnvironmentProperties { private String skjermedePersonerPipUrl; private String veilarboppfolgingScope; private String veilarboppfolgingUrl; - private String veilarbregistreringScope; - private String veilarbregistreringUrl; private String kontoregisterScope; private String kontoregisterUrl; - private String aiaBackendUrl; - private String aiaBackendScope; private String oppslagArbeidssoekerregisteretUrl; private String oppslagArbeidssoekerregisteretScope; } diff --git a/src/main/java/no/nav/veilarbperson/config/SelftTestConfig.java b/src/main/java/no/nav/veilarbperson/config/SelftTestConfig.java index 17c29efa..8eeb1107 100644 --- a/src/main/java/no/nav/veilarbperson/config/SelftTestConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/SelftTestConfig.java @@ -10,7 +10,6 @@ import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.regoppslag.RegoppslagClient; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -27,7 +26,6 @@ public SelfTestChecks selfTestChecks( SkjermetClient skjermetClient, Norg2Client norg2Client, PdlClient pdlClient, - VeilarbregistreringClient veilarbregistreringClient, RegoppslagClient regoppslagClient ) { return new SelfTestChecks(List.of( @@ -37,7 +35,6 @@ public SelfTestChecks selfTestChecks( new SelfTestCheck("Norg2", false, norg2Client), new SelfTestCheck("PDL", true, pdlClient), new SelfTestCheck("skjermede-personer", true, skjermetClient), - new SelfTestCheck("Veilarbregistrering", false, veilarbregistreringClient), new SelfTestCheck("Regoppslag", false, regoppslagClient) )); } diff --git a/src/main/java/no/nav/veilarbperson/controller/v1/PersonController.java b/src/main/java/no/nav/veilarbperson/controller/v1/PersonController.java index b02b51b6..f1030249 100644 --- a/src/main/java/no/nav/veilarbperson/controller/v1/PersonController.java +++ b/src/main/java/no/nav/veilarbperson/controller/v1/PersonController.java @@ -8,7 +8,6 @@ import no.nav.veilarbperson.service.AuthService; import no.nav.veilarbperson.service.CvJobbprofilService; import no.nav.veilarbperson.service.PersonV2Service; -import no.nav.veilarbperson.service.RegistreringService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -24,8 +23,6 @@ public class PersonController { private final CvJobbprofilService cvJobbprofilService; - private final RegistreringService registreringService; - @Deprecated @GetMapping("/aktorid") public AktoerId aktorid(@RequestParam("fnr") Fnr fnr) { @@ -79,23 +76,6 @@ public ResponseEntity cvOgJobbprofil(@RequestParam(value = "fnr", requir return cvJobbprofilService.hentCvJobbprofilJson(fnr); } - @Deprecated - @GetMapping("/registrering") - public ResponseEntity registrering(@RequestParam(value = "fnr") Fnr fnr) { - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(fnr); - return registreringService.hentRegistrering(fnr); - } - - @Deprecated - @PostMapping("/registrering/endringer") - public ResponseEntity endringIRegistreringdata(@RequestBody PersonRequestBody personRequestBody) { - Fnr fnr = Fnr.of(personRequestBody.fodselsnummer()); - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(fnr); - return registreringService.hentEndringIRegistreringsdata(fnr); - } - // TODO: Det er hårete å måtte skille på ekstern og intern // Lag istedenfor en egen controller for interne operasjoner og en annen for eksterne private Fnr hentIdentForEksternEllerIntern(Fnr queryParamFnr) { diff --git a/src/main/java/no/nav/veilarbperson/controller/v3/PersonV3Controller.java b/src/main/java/no/nav/veilarbperson/controller/v3/PersonV3Controller.java index fd5f09cb..56e8031c 100644 --- a/src/main/java/no/nav/veilarbperson/controller/v3/PersonV3Controller.java +++ b/src/main/java/no/nav/veilarbperson/controller/v3/PersonV3Controller.java @@ -15,10 +15,6 @@ import org.springframework.web.server.ResponseStatusException; import java.io.IOException; -import java.util.List; - -import static no.nav.veilarbperson.utils.SecureLog.secureLog; - @Slf4j @RestController @@ -32,8 +28,6 @@ public class PersonV3Controller { private final CvJobbprofilService cvJobbprofilService; - private final RegistreringService registreringService; - private final OppslagArbeidssoekerregisteretService oppslagArbeidssoekerregisteretService; @PostMapping("/hent-person") @@ -72,22 +66,6 @@ public ResponseEntity cvOgJobbprofil(@RequestBody PersonRequest personRe return cvJobbprofilService.hentCvJobbprofilJson(personRequest.getFnr()); } - @PostMapping("/person/hent-registrering") - @Operation(summary = "Henter registreringen til person") - public ResponseEntity registrering(@RequestBody PersonRequest personRequest) { - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(personRequest.getFnr()); - return registreringService.hentRegistrering(personRequest.getFnr()); - } - - @PostMapping("/person/registrering/hent-endringer") - @Operation(summary = "Henter endringer på registreringen til person") - public ResponseEntity endringIRegistreringdata(@RequestBody PersonRequest personRequest) { - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(personRequest.getFnr()); - return registreringService.hentEndringIRegistreringsdata(personRequest.getFnr()); - } - @PostMapping("/person/hent-malform") @Operation(summary = "Henter malform fra DIGDIR tjeneste") public Malform malform(@RequestBody PersonRequest personRequest) { diff --git a/src/main/java/no/nav/veilarbperson/service/RegistreringService.java b/src/main/java/no/nav/veilarbperson/service/RegistreringService.java deleted file mode 100644 index fcebf9b7..00000000 --- a/src/main/java/no/nav/veilarbperson/service/RegistreringService.java +++ /dev/null @@ -1,54 +0,0 @@ -package no.nav.veilarbperson.service; - -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.aiabackend.AiaBackendClient; -import no.nav.veilarbperson.client.aiabackend.EndringIRegistreringsdataRequestDTO; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; - -@RequiredArgsConstructor -@Service -public class RegistreringService { - - private final VeilarbregistreringClient client; - private final AiaBackendClient aiaBackendClient; - - @SneakyThrows - public ResponseEntity hentRegistrering(Fnr fnr) { - try (Response response = client.hentRegistrering(fnr); - ResponseBody responseBody = response.body()) { - - String bodyString = null; - - if (responseBody != null) { - bodyString = responseBody.string(); - } - - return ResponseEntity - .status(response.code()) - .body(bodyString); - } - } - - @SneakyThrows - public ResponseEntity hentEndringIRegistreringsdata(Fnr fnr) { - try (Response response = aiaBackendClient.hentEndringIRegistreringsdata(new EndringIRegistreringsdataRequestDTO(fnr.get())); - ResponseBody responseBody = response.body()) { - - String bodyString = null; - - if (responseBody != null) { - bodyString = responseBody.string(); - } - - return ResponseEntity - .status(response.code()) - .body(bodyString); - } - } -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index eebb49db..60ac7acb 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -31,12 +31,8 @@ app.env.skjermedePersonerPipScope=${SKJERMEDE_PERSONER_PIP_SCOPE} app.env.skjermedePersonerPipUrl=${SKJERMEDE_PERSONER_PIP_URL} app.env.veilarboppfolgingScope=${VEILARBOPPFOLGING_SCOPE} app.env.veilarboppfolgingUrl=${VEILARBOPPFOLGING_URL} -app.env.veilarbregistreringScope=${VEILARBREGISTRERING_SCOPE} -app.env.veilarbregistreringUrl=${VEILARBREGISTRERING_URL} app.env.kontoregisterScope=${KONTOREGISTER_PERSON_V1_SCOPE} app.env.kontoregisterUrl=${KONTOREGISTER_PERSON_V1_URL} -app.env.aiaBackendUrl=${AIA_BACKEND_URL} -app.env.aiaBackendScope=${AIA_BACKEND_SCOPE} app.env.oppslagArbeidssoekerregisteretScope=${OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE} app.env.oppslagArbeidssoekerregisteretUrl=${OPPSLAG_ARBEIDSSOEKERREGISTERET_URL} diff --git a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java index 2456c635..708bedb5 100644 --- a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java @@ -7,13 +7,10 @@ import no.nav.common.health.HealthCheckResult; import no.nav.common.health.selftest.SelfTestChecks; import no.nav.common.metrics.MetricsClient; -import no.nav.common.rest.client.RestClient; import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient; import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.EksternBrukerId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.aiabackend.AiaBackendClient; -import no.nav.veilarbperson.client.aiabackend.EndringIRegistreringsdataRequestDTO; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; @@ -28,11 +25,8 @@ import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.PdlRequest; import no.nav.veilarbperson.client.representasjon.RepresentasjonClient; -import no.nav.veilarbperson.client.representasjon.RepresentasjonClientImpl; import no.nav.veilarbperson.client.veilarboppfolging.UnderOppfolging; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClient; -import no.nav.veilarbperson.client.veilarbregistrering.VeilarbregistreringClientImpl; import okhttp3.Response; import org.jetbrains.annotations.NotNull; import org.mockito.Mockito; @@ -198,22 +192,6 @@ public HealthCheckResult checkHealth() { }; } - @Bean - public AiaBackendClient aiaBackendClient() { - return new AiaBackendClient() { - @NotNull - @Override - public Response hentEndringIRegistreringsdata(@NotNull EndringIRegistreringsdataRequestDTO endringIRegistreringsdataRequestDTO) { - return null; - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckResult.healthy(); - } - }; - } - @Bean public PdlClient pdlClient() { return new PdlClient() { @@ -279,12 +257,6 @@ public SelfTestChecks selfTestChecks() { return mock(SelfTestChecks.class); } - @Bean - public VeilarbregistreringClient veilarbregistreringClient() { - return new VeilarbregistreringClientImpl( - RestClient.baseClient(), "http://localhost:" + WIREMOCK_PORT, () -> ""); - } - @Bean public OppslagArbeidssoekerregisteretClient oppslagArbeidssoekerregisteretClient() { return new OppslagArbeidssoekerregisteretClientImpl( diff --git a/src/test/java/no/nav/veilarbperson/config/ServiceTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ServiceTestConfig.java index c0fbff53..d771e72f 100644 --- a/src/test/java/no/nav/veilarbperson/config/ServiceTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ServiceTestConfig.java @@ -11,7 +11,6 @@ KodeverkService.class, PersonV2Service.class, CvJobbprofilService.class, - RegistreringService.class, OppslagArbeidssoekerregisteretService.class }) public class ServiceTestConfig {} diff --git a/src/test/java/no/nav/veilarbperson/controller/PersonControllerTest.java b/src/test/java/no/nav/veilarbperson/controller/PersonControllerTest.java deleted file mode 100644 index 49a7d83e..00000000 --- a/src/test/java/no/nav/veilarbperson/controller/PersonControllerTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package no.nav.veilarbperson.controller; - -import com.github.tomakehurst.wiremock.client.WireMock; -import no.nav.poao_tilgang.poao_tilgang_test_core.NavAnsatt; -import no.nav.poao_tilgang.poao_tilgang_test_core.NavContext; -import no.nav.poao_tilgang.poao_tilgang_test_core.PrivatBruker; -import no.nav.veilarbperson.config.ApplicationTestConfig; -import no.nav.veilarbperson.controller.v1.PersonController; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.web.servlet.MockMvc; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@WebMvcTest(controllers = PersonController.class) -@Import({ApplicationTestConfig.class}) -@DirtiesContext -public class PersonControllerTest { - - @Autowired - private MockMvc mockMvc; - - @Autowired - private NavContext navContext; - - @Test - public void returnerer_registrering_for_registrert_bruker() throws Exception { - PrivatBruker ny = navContext.getPrivatBrukere().ny(); - NavAnsatt navAnsatt = navContext.getNavAnsatt().nyFor(ny); - - - String expectedJson = "{}"; - String fnr = ny.getNorskIdent(); - - stubFor(WireMock.get(urlEqualTo("/veilarbregistrering/api/registrering?fnr=" + fnr)) - .willReturn(ok() - .withHeader("Content-Type", "application/json") - .withBody(expectedJson))); - - - mockMvc - .perform( - get("/api/person/registrering") - .queryParam("fnr", fnr) - .header("test_ident", navAnsatt.getNavIdent()) - .header("test_ident_type", "INTERN") - ) - .andExpect(content().json(expectedJson)) - .andExpect(status().is(200)); - } - - @Test - public void returnerer_ikke_registrering_for_bruker_som_ikke_er_registrert() throws Exception { - PrivatBruker ny = navContext.getPrivatBrukere().ny(); - NavAnsatt navAnsatt = navContext.getNavAnsatt().nyFor(ny); - - String fnr = ny.getNorskIdent(); - - stubFor(WireMock.get(urlEqualTo("/veilarbregistrering/api/registrering?fnr=" + fnr)) - .willReturn( - notFound() - .withHeader("Content-Type", "application/json"))); - - - mockMvc - .perform( - get("/api/person/registrering") - .queryParam("fnr", fnr) - .header("test_ident", navAnsatt.getNavIdent()) - .header("test_ident_type", "INTERN") - ) - .andExpect(status().is(404)); - } -} - diff --git a/src/test/java/no/nav/veilarbperson/controller/PersonV3ControllerTest.java b/src/test/java/no/nav/veilarbperson/controller/PersonV3ControllerTest.java index 0cd158ed..bc7e5955 100644 --- a/src/test/java/no/nav/veilarbperson/controller/PersonV3ControllerTest.java +++ b/src/test/java/no/nav/veilarbperson/controller/PersonV3ControllerTest.java @@ -47,55 +47,6 @@ public class PersonV3ControllerTest { @MockBean private PersonV2Service personV2Service; - @Test - public void returnerer_registrering_for_registrert_bruker() throws Exception { - PrivatBruker ny = navContext.getPrivatBrukere().ny(); - NavAnsatt navAnsatt = navContext.getNavAnsatt().nyFor(ny); - - String expectedJson = "{}"; - String fnr = ny.getNorskIdent(); - - stubFor(WireMock.get(urlEqualTo("/veilarbregistrering/api/registrering?fnr=" + fnr)) - .willReturn(ok() - .withHeader("Content-Type", "application/json") - .withBody(expectedJson))); - - - mockMvc - .perform( - post("/api/v3/person/hent-registrering") - .contentType(APPLICATION_JSON) - .content("{\"fnr\":\"" + fnr + "\"}") - .header("test_ident", navAnsatt.getNavIdent()) - .header("test_ident_type", "INTERN") - ) - .andExpect(content().json(expectedJson)) - .andExpect(status().is(200)); - } - - @Test - public void returnerer_ikke_registrering_for_bruker_som_ikke_er_registrert() throws Exception { - PrivatBruker ny = navContext.getPrivatBrukere().ny(); - NavAnsatt navAnsatt = navContext.getNavAnsatt().nyFor(ny); - String fnr = ny.getNorskIdent(); - - stubFor(WireMock.get(urlEqualTo("/veilarbregistrering/api/registrering?fnr=" + fnr)) - .willReturn( - notFound() - .withHeader("Content-Type", "application/json"))); - - - mockMvc - .perform( - post("/api/v3/person/hent-registrering") - .contentType(APPLICATION_JSON) - .content("{\"fnr\":\"" + fnr + "\"}") - .header("test_ident", navAnsatt.getNavIdent()) - .header("test_ident_type", "INTERN") - ) - .andExpect(status().is(404)); - } - @Test public void returnerer_person_uten_behandlingsnummer_hent_person() throws Exception { PrivatBruker ny = navContext.getPrivatBrukere().ny();