Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statisk data forvalter fjernet direkte tilgang mot kodeverk-api #3692

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/kodeverk-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
- application: testnav-pdl-forvalter
- application: testnav-pdl-forvalter-dev
- application: testnav-levende-arbeidsforhold-ansettelse
- application: testnorge-statisk-data-forvalter
outbound:
external:
- host: kodeverk-api.nav.no
Expand Down
3 changes: 2 additions & 1 deletion apps/testnorge-statisk-data-forvalter/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ spec:
- application: krr-stub
- application: synthdata-aareg
cluster: dev-fss
- application: kodeverk
- application: testnav-kodeverk-service
cluster: dev-gcp
- application: testnav-aareg-proxy
cluster: dev-fss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Consumers {

private ServerProperties testnavAaregProxy;
private ServerProperties genererNavnService;
private ServerProperties kodeverkApi;
private ServerProperties testnavKodeverkService;
private ServerProperties testnavOrganisasjonFasteDataService;
private ServerProperties testnavOrganisasjonService;
private ServerProperties testnavPersonFasteDataService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public KodeverkConsumer(
.maxInMemorySize(16 * 1024 * 1024))
.build())
.baseUrl(consumers
.getKodeverkApi()
.getTestnavKodeverkService()
.getUrl())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import no.nav.registre.sdforvalter.domain.KrrListe;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ consumers:
url: https://testnav-bruker-service-dev.intern.dev.nav.no
synthdata-aareg:
url: https://nais-synthdata-aareg.dev.intern.nav.no
testnav-kodeverk-service:
url: https://testnav-kodeverk-service.intern.dev.nav.no

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spring:
aad:
issuer-uri: ${AAD_ISSUER_URI}/v2.0
jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys
accepted-audience: ${AZURE_APP_CLIENT_ID}, api:// ${AZURE_APP_CLIENT_ID}
accepted-audience: ${AZURE_APP_CLIENT_ID}, api:// ${AZURE_APP_CLIENT_ID}

springdoc:
swagger-ui:
Expand Down Expand Up @@ -59,11 +59,11 @@ consumers:
url: https://krr-stub-%s.dev.intern.nav.no/api
synthdata-aareg:
url: http://nais-synthdata-aareg.dolly.svc.nais.local
kodeverk-api:
name: kodeverk-api
namespace: team-rocket
url: https://kodeverk-api.nav.no
cluster: prod-gcp
testnav-kodeverk-service:
name: testnav-kodeverk-service
namespace: dolly
url: http://testnav-kodeverk-service.dolly.svc.cluster.local
cluster: dev-gcp
testnav-aareg-proxy:
name: testnav-aareg-proxy
namespace: dolly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,41 @@
@AutoConfigureMockMvc
class OrkestreringControllerAaregIntegrationTest {

private static final String FNR = "01010101010";
private static final String ORGNR = "999999999";
private static final String MILJOE = "test";
private static String syntString;
private final KodeverkResponse kodeverkResponse = new KodeverkResponse(Collections.singletonList("yrke"));
private final TypeReference<List<RsAaregSyntetiseringsRequest>> syntResponse = new TypeReference<>() {
};
@Autowired
private MockMvc mvc;

@MockBean
private TokenExchange tokenExchange;

@Autowired
private AaregRepository aaregRepository;

@Autowired
private ObjectMapper objectMapper;

private static final String FNR = "01010101010";
private static final String ORGNR = "999999999";
private static final String MILJOE = "test";

private final KodeverkResponse kodeverkResponse = new KodeverkResponse(Collections.singletonList("yrke"));
private static String syntString;
private final TypeReference<List<RsAaregSyntetiseringsRequest>> syntResponse = new TypeReference<>() {
};
@AfterEach
public void cleanUp() {
reset();
aaregRepository.deleteAll();
}

@BeforeAll
public static void setup() {
syntString = getResourceFileContent("files/enkel_arbeidsforholdmelding.json");
}

@Disabled("Fix verify GET on (.*)/kodeverk-api/api/v1/kodeverk/Yrker/koder")
private AaregModel createAaregModel() {
AaregModel model = new AaregModel();
model.setFnr(FNR);
model.setOrgId(ORGNR);
return model;
}

@Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
@Test
void shouldInitiateAaregFromDatabase() throws Exception {
final AaregModel aaregModel = createAaregModel();
Expand Down Expand Up @@ -127,7 +135,7 @@ void shouldInitiateAaregFromDatabase() throws Exception {

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/kodeverk-api/api/v1/kodeverk/Yrker/koder")
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.verifyGet();

Expand Down Expand Up @@ -167,7 +175,7 @@ void shouldNotOppretteAaregWhenAlreadyExists() throws Exception {

}

@Disabled("Fix verify GET on (.*)/kodeverk-api/api/v1/kodeverk/Yrker/koder")
@Disabled("Fix verify GET on (.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
@Test
void shouldNotOppretteAaregIfSyntError() throws Exception {
final AaregModel aaregModel = createAaregModel();
Expand All @@ -190,7 +198,7 @@ void shouldNotOppretteAaregIfSyntError() throws Exception {

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/kodeverk-api/api/v1/kodeverk/Yrker/koder")
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.stubGet();

Expand All @@ -213,22 +221,9 @@ void shouldNotOppretteAaregIfSyntError() throws Exception {

JsonWiremockHelper
.builder(objectMapper)
.withUrlPathMatching("(.*)/kodeverk-api/api/v1/kodeverk/Yrker/koder")
.withUrlPathMatching("(.*)/testnav-kodeverk-service/api/v1/kodeverk/Yrker/koder")
.withResponseBody(kodeverkResponse)
.verifyGet();
}

private AaregModel createAaregModel() {
AaregModel model = new AaregModel();
model.setFnr(FNR);
model.setOrgId(ORGNR);
return model;
}

@AfterEach
public void cleanUp() {
reset();
aaregRepository.deleteAll();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ consumers:
url: http://localhost:${wiremock.server.port:0}/krr-stub/api
synthdata-aareg:
url: http://localhost:${wiremock.server.port:0}/synt-aareg
kodeverk:
url: http://localhost:${wiremock.server.port:0}/kodeverk-api
name: kodeverk-api
namespace: team-rocket
testnav-kodeverk-service:
url: http://localhost:${wiremock.server.port:0}/testnav-kodeverk-service
name: testnav-kodeverk-service
namespace: dolly
cluster: dummy
testnav-aareg-proxy:
url: http://localhost:${wiremock.server.port:0}/aareg
Expand Down
Loading