Search in sources :

Example 16 with PersonId

use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.

the class BrukerRepositoryTest method skalIkkeFeileOmIngenPersonIdFinnes.

@Test
public void skalIkkeFeileOmIngenPersonIdFinnes() {
    Fnr fnr = Fnr.ofValidFnr("99999999999");
    Optional<PersonId> result = brukerRepository.retrievePersonidFromFnr(fnr);
    assertTrue(result.isEmpty());
}
Also used : PersonId(no.nav.pto.veilarbportefolje.domene.value.PersonId) TestDataUtils.randomPersonId(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomPersonId) Fnr(no.nav.common.types.identer.Fnr) TestDataUtils.randomFnr(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomFnr) Test(org.junit.Test)

Example 17 with PersonId

use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.

the class BrukerRepositoryTest method skalHentePersonIdFraDatabase.

@Test
public void skalHentePersonIdFraDatabase() {
    Fnr fnr = Fnr.ofValidFnr("12345678900");
    PersonId expectedPersonId = PersonId.of("123456");
    insertOppfolgingsbrukerForPersonIdToFnrMapping(fnr, expectedPersonId);
    Optional<PersonId> result = brukerRepository.retrievePersonidFromFnr(fnr);
    assertTrue(result.isPresent());
    assertEquals(expectedPersonId, result.get());
}
Also used : PersonId(no.nav.pto.veilarbportefolje.domene.value.PersonId) TestDataUtils.randomPersonId(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomPersonId) Fnr(no.nav.common.types.identer.Fnr) TestDataUtils.randomFnr(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomFnr) Test(org.junit.Test)

Example 18 with PersonId

use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.

the class BrukerRepositoryTest method skalHenteFnrForPersonIdFraDatabase.

@Test
public void skalHenteFnrForPersonIdFraDatabase() throws Exception {
    PersonId personId = PersonId.of("123456");
    Fnr expectedFnr = Fnr.ofValidFnr("12345678900");
    insertOppfolgingsbrukerForPersonIdToFnrMapping(expectedFnr, personId);
    Try<Fnr> result = brukerRepository.retrieveFnrFromPersonid(personId);
    assertTrue(result.isSuccess());
    assertEquals(expectedFnr, result.get());
}
Also used : PersonId(no.nav.pto.veilarbportefolje.domene.value.PersonId) TestDataUtils.randomPersonId(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomPersonId) Fnr(no.nav.common.types.identer.Fnr) TestDataUtils.randomFnr(no.nav.pto.veilarbportefolje.util.TestDataUtils.randomFnr) Test(org.junit.Test)

Example 19 with PersonId

use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.

the class BrukerService method getPersonIdFromFnr.

public PersonId getPersonIdFromFnr(AktorId aktoerId) {
    Fnr fnr = aktorClient.hentFnr(aktoerId);
    PersonId nyPersonId = brukerRepository.retrievePersonidFromFnr(fnr).orElseThrow(() -> new NoSuchElementException("Fant ikke personId på aktoer: " + aktoerId));
    AktorId nyAktorIdForPersonId = Try.of(() -> aktorClient.hentAktorId(fnr)).get();
    updateGjeldeFlaggOgInsertAktoeridPaNyttMapping(aktoerId, nyPersonId, nyAktorIdForPersonId);
    return nyPersonId;
}
Also used : PersonId(no.nav.pto.veilarbportefolje.domene.value.PersonId) AktorId(no.nav.common.types.identer.AktorId) Fnr(no.nav.common.types.identer.Fnr) NoSuchElementException(java.util.NoSuchElementException)

Example 20 with PersonId

use of no.nav.pto.veilarbportefolje.domene.value.PersonId in project veilarbportefolje by navikt.

the class BrukerServiceTest method skalFinnePersonIdFraDatabase.

@Test
public void skalFinnePersonIdFraDatabase() {
    when(aktorClient.hentFnr(any(AktorId.class))).thenReturn(Fnr.ofValidFnr(FNR_FRA_SOAP_TJENESTE));
    when(aktorClient.hentAktorId(any(Fnr.class))).thenReturn(AktorId.of(AKTOERID_FRA_SOAP_TJENESTE));
    AktorId aktoerId = AktorId.of("111");
    PersonId personId = PersonId.of("222");
    int updated = insert(db, "AKTOERID_TO_PERSONID").value("PERSONID", personId.toString()).value("AKTOERID", aktoerId.toString()).execute();
    assertTrue(updated > 0);
    Try<PersonId> result = brukerService.hentPersonidFraAktoerid(aktoerId);
    verify(aktorClient, never()).hentFnr(any(AktorId.class));
    verify(opensearchIndexerV2, never()).slettDokumenter(any());
    assertTrue(result.isSuccess());
    assertEquals(personId, result.get());
}
Also used : PersonId(no.nav.pto.veilarbportefolje.domene.value.PersonId) AktorId(no.nav.common.types.identer.AktorId) Fnr(no.nav.common.types.identer.Fnr) Test(org.junit.Test)

Aggregations

PersonId (no.nav.pto.veilarbportefolje.domene.value.PersonId)22 AktorId (no.nav.common.types.identer.AktorId)12 Fnr (no.nav.common.types.identer.Fnr)10 Test (org.junit.Test)7 TestDataUtils.randomFnr (no.nav.pto.veilarbportefolje.util.TestDataUtils.randomFnr)6 TestDataUtils.randomPersonId (no.nav.pto.veilarbportefolje.util.TestDataUtils.randomPersonId)6 Try (io.vavr.control.Try)5 Timestamp (java.sql.Timestamp)5 Set (java.util.Set)5 LocalDate (java.time.LocalDate)4 AktivitetData.aktivitetTyperFraKafka (no.nav.pto.veilarbportefolje.aktiviteter.AktivitetData.aktivitetTyperFraKafka)4 List (java.util.List)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 Collectors.toList (java.util.stream.Collectors.toList)3 Slf4j (lombok.extern.slf4j.Slf4j)3 OppfolgingsBruker (no.nav.pto.veilarbportefolje.opensearch.domene.OppfolgingsBruker)3 BrukerService (no.nav.pto.veilarbportefolje.service.BrukerService)3 DateUtils (no.nav.pto.veilarbportefolje.util.DateUtils)3