use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.
the class CvServiceTest method skal_ikke_behandle_meldinger_som_har_meldingstype_arbeidsgiver_generell.
@Test
void skal_ikke_behandle_meldinger_som_har_meldingstype_arbeidsgiver_generell() {
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.ARBEIDSGIVER_GENERELL);
cvService.behandleCVHjemmelMelding(cvMelding);
GetResponse getResponse = opensearchTestClient.fetchDocument(aktoerId);
assertThat(getResponse.isExists()).isTrue();
boolean harDeltCv = (boolean) getResponse.getSourceAsMap().get("har_delt_cv");
assertThat(harDeltCv).isFalse();
}
use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.
the class CvServiceKafkaConsumerTest method populateCVEksistereKafkaTopic.
private void populateCVEksistereKafkaTopic(AktorId... aktoerIds) throws ExecutionException, InterruptedException {
for (AktorId aktoerId : aktoerIds) {
Melding cvMelding = new Melding();
cvMelding.setAktoerId(aktoerId.toString());
cvMelding.setMeldingstype(Meldingstype.ENDRE);
cvService.behandleKafkaMeldingLogikk(cvMelding);
}
}
use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.
the class CVService method behandleKafkaMeldingCVHjemmel.
public void behandleKafkaMeldingCVHjemmel(ConsumerRecord<String, CVMelding> kafkaMelding) {
log.info("Behandler kafka-melding med key {} og offset {} på topic {}", kafkaMelding.key(), kafkaMelding.offset(), kafkaMelding.topic());
CVMelding cvMelding = kafkaMelding.value();
behandleCVHjemmelMelding(cvMelding);
}
use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.
the class CvServiceTest method skal_ikke_behandle_meldinger_som_har_meldingstype_cv_generell.
@Test
void skal_ikke_behandle_meldinger_som_har_meldingstype_cv_generell() {
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_GENERELL);
cvService.behandleCVHjemmelMelding(cvMelding);
GetResponse getResponse = opensearchTestClient.fetchDocument(aktoerId);
assertThat(getResponse.isExists()).isTrue();
boolean harDeltCv = (boolean) getResponse.getSourceAsMap().get("har_delt_cv");
assertThat(harDeltCv).isFalse();
}
use of no.nav.pto.veilarbportefolje.cv.dto.CVMelding in project veilarbportefolje by navikt.
the class CvServiceTest method skal_oppdatere_dokumentet_i_db_og_opensearch.
@Test
void skal_oppdatere_dokumentet_i_db_og_opensearch() {
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);
Boolean harDeltCvDb = cvRepository.harDeltCv(aktoerId);
assertThat(harDeltCvDb).isTrue();
GetResponse getResponse = opensearchTestClient.fetchDocument(aktoerId);
assertThat(getResponse.isExists()).isTrue();
boolean harDeltCv = (boolean) getResponse.getSourceAsMap().get("har_delt_cv");
assertThat(harDeltCv).isTrue();
}
Aggregations