-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Laget en konfigurasjon for oppgave tekster
- Loading branch information
Showing
11 changed files
with
156 additions
and
11 deletions.
There are no files selected for viewing
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
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
35 changes: 35 additions & 0 deletions
35
...n/no/nav/paw/arbeidssoekerregisteret/bekreftelse/minsideoppgaver/config/MinSideTekster.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,35 @@ | ||
package no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.config | ||
|
||
import no.nav.paw.config.hoplite.loadNaisOrLocalConfiguration | ||
import java.net.URI | ||
|
||
fun minSideVarselKonfigurasjon(): MinSideVarselKonfigurasjon = loadNaisOrLocalConfiguration("min_side_varsel.yaml") | ||
|
||
data class MinSideVarselKonfigurasjon( | ||
val link: URI, | ||
val standardSpraak: Spraakkode, | ||
val tekster: List<MinSideTekst> | ||
) { | ||
init { | ||
requireNotNull(tekster.find { it.spraak == standardSpraak }) { | ||
"Ingen av tekstene har språk $standardSpraak som er satt som standard språk" | ||
} | ||
} | ||
} | ||
|
||
|
||
data class Spraakkode( | ||
/** | ||
* Språkkode i henhold til ISO-639-1 | ||
*/ | ||
val kode: String | ||
) { | ||
init { | ||
require(kode.length == 2) { "Språkkode må være to bokstaver (ISO-639-1)" } | ||
} | ||
} | ||
|
||
data class MinSideTekst( | ||
val spraak: Spraakkode, | ||
val tekst: String | ||
) |
11 changes: 11 additions & 0 deletions
11
apps/bekreftelse-min-side-oppgaver/src/main/resources/local/min_side_varsel.yaml
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,11 @@ | ||
standardSpraak: | ||
kode: en | ||
link: http://localhost:8080/varsel | ||
tekster: | ||
- spraak: | ||
kode: nb | ||
tekst: Det er påtide å bekrefte arbeidssøkerperioden din i NAV. | ||
- spraak: | ||
kode: en | ||
tekst: It is time to confirm your jobseeker period in NAV. | ||
|
10 changes: 10 additions & 0 deletions
10
apps/bekreftelse-min-side-oppgaver/src/main/resources/nais/min_side_varsel.yaml
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,10 @@ | ||
standardSpraak: | ||
kode: en | ||
link: ${VARSEL_LINK} | ||
tekster: | ||
- spraak: | ||
kode: nb | ||
tekst: Det er påtide å bekrefte arbeidssøkerperioden din i NAV. | ||
- spraak: | ||
kode: en | ||
tekst: It is time to confirm your jobseeker period in NAV. |
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
57 changes: 57 additions & 0 deletions
57
...erregisteret/bekreftelse/minsideoppgaver/applogic/varselbygger/VarselMeldingByggerTest.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,57 @@ | ||
package no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.applogic.varselbygger | ||
|
||
import io.kotest.core.spec.style.FreeSpec | ||
import io.kotest.matchers.should | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.string.shouldContain | ||
import no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.config.MinSideTekst | ||
import no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.config.MinSideVarselKonfigurasjon | ||
import no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.config.Spraakkode | ||
import no.nav.paw.arbeidssoekerregisteret.testdata.bekreftelse.bekreftelseTilgjengelig | ||
import no.nav.paw.config.env.Local | ||
import java.net.URI | ||
import java.net.URL | ||
import java.net.URLStreamHandler | ||
|
||
class VarselMeldingByggerTest : FreeSpec({ | ||
val config = MinSideVarselKonfigurasjon( | ||
link = URI.create("http://localhost:8080"), | ||
standardSpraak = Spraakkode("en"), | ||
tekster = listOf( | ||
MinSideTekst(Spraakkode("nb"), "Hei!"), | ||
MinSideTekst(Spraakkode("en"), "Hello!"), | ||
) | ||
) | ||
val bygger = VarselMeldingBygger( | ||
minSideVarselKonfigurasjon = config, | ||
runtimeEnvironment = Local | ||
) | ||
|
||
"opprettOppgave" { | ||
val hendelse = bekreftelseTilgjengelig() | ||
val identitetsnummer = "12345678909" | ||
val resultat = bygger.opprettOppgave( | ||
identitetsnummer = identitetsnummer, | ||
hendelse = hendelse | ||
) | ||
resultat.varselId shouldBe hendelse.bekreftelseId | ||
resultat.value should { json -> | ||
json shouldContain "\"varselId\":\"${hendelse.bekreftelseId}\"" | ||
json shouldContain "\"ident\":\"$identitetsnummer\"" | ||
json shouldContain "\"sensitivitet\":\"high\"" | ||
json shouldContain "\"type\":\"oppgave\"" | ||
json shouldContain "\"link\":\"${config.link}\"" | ||
json shouldContain config.tekster[0].tekst | ||
json shouldContain config.tekster[1].tekst | ||
} | ||
} | ||
|
||
"avsluttOppgave" { | ||
val bekreftelse = java.util.UUID.randomUUID() | ||
val resultat = bygger.avsluttOppgave(bekreftelse) | ||
resultat.varselId shouldBe bekreftelse | ||
resultat.value should { json -> | ||
json shouldContain "\"varselId\":\"$bekreftelse\"" | ||
} | ||
} | ||
}) |
11 changes: 11 additions & 0 deletions
11
...w/arbeidssoekerregisteret/bekreftelse/minsideoppgaver/config/VerifiserLastingAvTekster.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,11 @@ | ||
package no.nav.paw.arbeidssoekerregisteret.bekreftelse.minsideoppgaver.config | ||
|
||
import io.kotest.core.spec.style.FreeSpec | ||
|
||
class VerifiserLastingAvTekster: FreeSpec({ | ||
//Verifisere av vi kan laste konfig uten exceptions | ||
"Verifiser lasting av tekster" { | ||
val minSideVarselTekster = minSideVarselKonfigurasjon() | ||
println(minSideVarselTekster) | ||
} | ||
}) |