This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interface, bønne og test for AktørIdCacheRepository
- Loading branch information
Showing
4 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/no/nav/fo/veilarbregistrering/aktorIdCache/AktorIdCacheRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package no.nav.fo.veilarbregistrering.aktorIdCache | ||
|
||
import no.nav.fo.veilarbregistrering.bruker.Foedselsnummer | ||
|
||
interface AktorIdCacheRepository { | ||
|
||
fun lagre(aktorIdCache: AktorIdCache) | ||
fun hentAktørId(fnr: Foedselsnummer): AktorIdCache? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...est/kotlin/no/nav/fo/veilarbregistrering/db/GcpAktorIdCacheRepositoryDbIntegrationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package no.nav.fo.veilarbregistrering.db | ||
|
||
import no.nav.fo.veilarbregistrering.aktorIdCache.AktorIdCache | ||
import no.nav.fo.veilarbregistrering.aktorIdCache.AktorIdCacheRepository | ||
import no.nav.fo.veilarbregistrering.bruker.AktorId | ||
import no.nav.fo.veilarbregistrering.bruker.Foedselsnummer | ||
import no.nav.veilarbregistrering.integrasjonstest.db.DbContainerInitializer | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase | ||
import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest | ||
import org.springframework.test.context.ActiveProfiles | ||
import org.springframework.test.context.ContextConfiguration | ||
import java.time.LocalDateTime | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
|
||
@JdbcTest | ||
@AutoConfigureTestDatabase(replace= AutoConfigureTestDatabase.Replace.NONE) | ||
@ContextConfiguration(initializers = [DbContainerInitializer::class], classes = [ RepositoryConfig::class, DatabaseConfig::class ]) | ||
@ActiveProfiles("gcp") | ||
class GcpAktorIdCacheRepositoryDbIntegrationTest( | ||
@Autowired | ||
private val aktorIdCacheRepository: AktorIdCacheRepository | ||
) { | ||
|
||
@Test | ||
fun `skal hente aktørId basert på fødselsnummer`() { | ||
val FOEDSELSNUMMER = Foedselsnummer("01234567890") | ||
val AKTORID = AktorId("1000010000100") | ||
|
||
aktorIdCacheRepository.lagre(AktorIdCache(FOEDSELSNUMMER.foedselsnummer, AKTORID.aktorId, LocalDateTime.now())) | ||
|
||
val aktorIdCache = aktorIdCacheRepository.hentAktørId(FOEDSELSNUMMER) | ||
assertNotNull(aktorIdCache) | ||
assertEquals(AKTORID.aktorId, aktorIdCache.aktorId) | ||
} | ||
} |