Search in sources :

Example 6 with CVMelding

use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.

the class CvServiceTest method skal_hente_fnr_fra_aktoertjenesten_om_fnr_mangler_i_melding.

@Test
void skal_hente_fnr_fra_aktoertjenesten_om_fnr_mangler_i_melding() {
    String document = new JSONObject().put("aktoer_id", aktoerId.toString()).put("har_delt_cv", false).toString();
    IndexResponse indexResponse = opensearchTestClient.createDocument(aktoerId, document);
    assertThat(indexResponse.status().getStatus()).isEqualTo(201);
    CVMelding cvMelding = new CVMelding();
    cvMelding.setAktoerId(aktoerId);
    cvMelding.setRessurs(Ressurs.CV_HJEMMEL);
    cvService.behandleCVHjemmelMelding(cvMelding);
    GetResponse getResponse = opensearchTestClient.fetchDocument(aktoerId);
    assertThat(getResponse.isExists()).isTrue();
    boolean harDeltCv = (boolean) getResponse.getSourceAsMap().get("har_delt_cv");
    assertThat(harDeltCv).isTrue();
}
Also used : JSONObject(org.json.JSONObject) IndexResponse(org.opensearch.action.index.IndexResponse) CVMelding(no.nav.pto.veilarbportefolje.cv.dto.CVMelding) GetResponse(org.opensearch.action.get.GetResponse) EndToEndTest(no.nav.pto.veilarbportefolje.util.EndToEndTest) Test(org.junit.jupiter.api.Test)

Example 7 with CVMelding

use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.

the class CvServiceTest method skal_ignorere_tilfeller_hvor_dokumentet_ikke_finnes_i_opensearch.

@Test
void skal_ignorere_tilfeller_hvor_dokumentet_ikke_finnes_i_opensearch() {
    CVMelding cvMelding = new CVMelding();
    cvMelding.setAktoerId(aktoerId);
    cvMelding.setRessurs(Ressurs.CV_HJEMMEL);
    cvService.behandleCVHjemmelMelding(cvMelding);
    GetResponse getResponse = opensearchTestClient.fetchDocument(aktoerId);
    assertThat(getResponse.isExists()).isFalse();
}
Also used : CVMelding(no.nav.pto.veilarbportefolje.cv.dto.CVMelding) GetResponse(org.opensearch.action.get.GetResponse) EndToEndTest(no.nav.pto.veilarbportefolje.util.EndToEndTest) Test(org.junit.jupiter.api.Test)

Example 8 with CVMelding

use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.

the class CvServiceKafkaConsumerTest method populateCVHjemmelKafkaTopic.

private void populateCVHjemmelKafkaTopic(AktorId... aktoerIds) throws ExecutionException, InterruptedException {
    for (AktorId aktoerId : aktoerIds) {
        CVMelding cvMelding = new CVMelding();
        cvMelding.setAktoerId(aktoerId);
        cvMelding.setRessurs(Ressurs.CV_HJEMMEL);
        cvService.behandleCVHjemmelMelding(cvMelding);
    }
}
Also used : CVMelding(no.nav.pto.veilarbportefolje.cv.dto.CVMelding) AktorId(no.nav.common.types.identer.AktorId)

Aggregations

CVMelding (no.nav.pto.veilarbportefolje.cv.dto.CVMelding)8 EndToEndTest (no.nav.pto.veilarbportefolje.util.EndToEndTest)5 Test (org.junit.jupiter.api.Test)5 GetResponse (org.opensearch.action.get.GetResponse)5 JSONObject (org.json.JSONObject)4 IndexResponse (org.opensearch.action.index.IndexResponse)4 AktorId (no.nav.common.types.identer.AktorId)2 Melding (no.nav.arbeid.cv.avro.Melding)1