Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IS-1736: Svar moteinnkalling ikke til Arena #222

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ class SendDialogmeldingArenaCronjob(
val unpublishedArenaMeldinger = database.getUnpublishedArenaMeldinger()
unpublishedArenaMeldinger.forEach { (dialogmeldingId, fellesformat, msgId) ->
try {
val sendToArena = !arenaDialogmeldingService.isMeldingStoredInBehandlerdialog(msgId)
val fellesformatXml = safeUnmarshal(fellesformat)
val receivedDialogmelding = ReceivedDialogmelding.create(
dialogmeldingId = dialogmeldingId,
fellesformat = fellesformatXml,
inputMessageText = fellesformat,
)
val sendToArena = !arenaDialogmeldingService.isMeldingStoredInBehandlerdialog(msgId) &&
receivedDialogmelding.dialogmelding.innkallingMoterespons == null
if (sendToArena) {
val fellesformatXml = safeUnmarshal(fellesformat)
val receivedDialogmelding = ReceivedDialogmelding.create(
dialogmeldingId = dialogmeldingId,
fellesformat = fellesformatXml,
inputMessageText = fellesformat,
)
arenaDialogmeldingService.sendArenaDialogmeldingToMQ(
receivedDialogmelding = receivedDialogmelding,
fellesformatXml = fellesformatXml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,31 @@ class SendDialogmeldingArenaCronjobSpek : Spek({
}
verify(exactly = 0) { mqSender.sendArena(any()) }
}
it("Does not send when melding is svar på dialogmøteinnkalling") {
val fellesformatMeldingSvarMoteinnkalling =
getFileAsString("src/test/resources/dialogmelding_dialog_svar_innkalling_dialogmote.xml")
val fellesformatXmlMeldingInBehandlerdialog = safeUnmarshal(fellesformatMeldingSvarMoteinnkalling)
val receivedDialogmeldingInBehandlerdialog = ReceivedDialogmelding.create(
dialogmeldingId = UUID.randomUUID().toString(),
fellesformat = fellesformatXmlMeldingInBehandlerdialog,
inputMessageText = fellesformatMeldingSvarMoteinnkalling,
)
val dialogmeldingId = createDialogmeldingOpplysning(receivedDialogmeldingInBehandlerdialog)
database.lagreSendtKafka(dialogmeldingId)
database.lagreSendtApprec(dialogmeldingId)
database.updateSendtApprec(
dialogmeldingId = dialogmeldingId,
timestamp = Timestamp.valueOf(LocalDateTime.now().minusMinutes(11)),
)

runBlocking {
val result = sendDialogmeldingArenaCronjob.runJob()

result.updated shouldBeEqualTo 1
result.failed shouldBeEqualTo 0
}
verify(exactly = 0) { mqSender.sendArena(any()) }
}

it("Does not process dialogmelding when already checked whether it should be sent to arena") {
val fellesformatMeldingInBehandlerdialog =
Expand Down