Skip to content

Commit

Permalink
Bruk egen event for fullført journalføring (#747)
Browse files Browse the repository at this point in the history
* Bruk egen event for fullført journalføring

* Oppdater integrasjonstest

* Oppdater integrasjonstest (igjen)
  • Loading branch information
bjerga authored Nov 5, 2024
1 parent 8b26176 commit eb40b71
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Inntektsmelding
import no.nav.helsearbeidsgiver.felles.BehovType
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.json.krev
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.json.toJson
Expand Down Expand Up @@ -52,18 +53,13 @@ class DistribusjonRiver(
) {
null
} else {
val eventName = Key.EVENT_NAME.les(EventName.serializer(), json)
if (eventName !in setOf(EventName.INNTEKTSMELDING_JOURNALFOERT, EventName.INNTEKTSMELDING_JOURNALPOST_ID_LAGRET)) {
null
} else {
Melding(
eventName = eventName,
transaksjonId = Key.UUID.les(UuidSerializer, json),
inntektsmelding = Key.INNTEKTSMELDING.les(Inntektsmelding.serializer(), json),
bestemmendeFravaersdag = Key.BESTEMMENDE_FRAVAERSDAG.lesOrNull(LocalDateSerializer, json),
journalpostId = Key.JOURNALPOST_ID.les(String.serializer(), json),
)
}
Melding(
eventName = Key.EVENT_NAME.krev(EventName.INNTEKTSMELDING_JOURNALPOST_ID_LAGRET, EventName.serializer(), json),
transaksjonId = Key.UUID.les(UuidSerializer, json),
inntektsmelding = Key.INNTEKTSMELDING.les(Inntektsmelding.serializer(), json),
bestemmendeFravaersdag = Key.BESTEMMENDE_FRAVAERSDAG.lesOrNull(LocalDateSerializer, json),
journalpostId = Key.JOURNALPOST_ID.les(String.serializer(), json),
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ class InnsendingIT : EndToEndTest() {
}

messages
.filter(EventName.INNTEKTSMELDING_MOTTATT)
.filter(EventName.INNTEKTSMELDING_JOURNALFOERT)
.filter(BehovType.LAGRE_JOURNALPOST_ID)
.firstAsMap()
.also {
// Journalført i dokarkiv
it shouldContainKey Key.INNTEKTSMELDING
it[Key.JOURNALPOST_ID]?.fromJson(String.serializer()) shouldBe Mock.JOURNALPOST_ID
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class LagreSelvbestemtIT : EndToEndTest() {
.shouldBeEqualToInntektsmelding(nyInntektsmelding)

messages
.filter(EventName.SELVBESTEMT_IM_LAGRET)
.filter(EventName.INNTEKTSMELDING_JOURNALFOERT)
.filter(BehovType.LAGRE_JOURNALPOST_ID)
.firstAsMap()
.shouldContainNokTilJournalfoeringOgDistribusjon(transaksjonId, nyInntektsmelding, compareType = false)
Expand Down Expand Up @@ -244,7 +244,7 @@ class LagreSelvbestemtIT : EndToEndTest() {
.shouldBeEqualToInntektsmelding(Mock.inntektsmelding, compareType = true)

messages
.filter(EventName.SELVBESTEMT_IM_LAGRET)
.filter(EventName.INNTEKTSMELDING_JOURNALFOERT)
.filter(BehovType.LAGRE_JOURNALPOST_ID)
.firstAsMap()
.shouldContainNokTilJournalfoeringOgDistribusjon(transaksjonId, Mock.inntektsmelding, compareType = true)
Expand Down Expand Up @@ -318,7 +318,7 @@ class LagreSelvbestemtIT : EndToEndTest() {
.shouldBeEmpty()

messages
.filter(EventName.SELVBESTEMT_IM_LAGRET)
.filter(EventName.INNTEKTSMELDING_JOURNALFOERT)
.filter(BehovType.LAGRE_JOURNALPOST_ID)
.all()
.shouldBeEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class JournalfoerImRiver(
val journalpostId = opprettOgFerdigstillJournalpost(transaksjonId, inntektsmelding, bestemmendeFravaersdag)

return mapOf(
Key.EVENT_NAME to eventName.toJson(),
Key.EVENT_NAME to EventName.INNTEKTSMELDING_JOURNALFOERT.toJson(),
Key.BEHOV to BehovType.LAGRE_JOURNALPOST_ID.toJson(),
Key.UUID to transaksjonId.toJson(),
Key.JOURNALPOST_ID to journalpostId.toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class JournalfoerImRiverTest :

testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.EVENT_NAME to EventName.INNTEKTSMELDING_JOURNALFOERT.toJson(),
Key.BEHOV to BehovType.LAGRE_JOURNALPOST_ID.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Key.JOURNALPOST_ID to journalpostId.toJson(),
Expand Down Expand Up @@ -122,7 +122,7 @@ class JournalfoerImRiverTest :

testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.EVENT_NAME to EventName.INNTEKTSMELDING_JOURNALFOERT.toJson(),
Key.BEHOV to BehovType.LAGRE_JOURNALPOST_ID.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Key.JOURNALPOST_ID to journalpostId.toJson(),
Expand Down Expand Up @@ -174,7 +174,7 @@ class JournalfoerImRiverTest :

testRapid.firstMessage().toMap() shouldContainExactly
mapOf(
Key.EVENT_NAME to innkommendeMelding.eventName.toJson(),
Key.EVENT_NAME to EventName.INNTEKTSMELDING_JOURNALFOERT.toJson(),
Key.BEHOV to BehovType.LAGRE_JOURNALPOST_ID.toJson(),
Key.UUID to innkommendeMelding.transaksjonId.toJson(),
Key.JOURNALPOST_ID to journalpostId.toJson(),
Expand Down

0 comments on commit eb40b71

Please sign in to comment.