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

Log offender-event notifications to Telemetry #4397

Merged
merged 1 commit into from
Nov 6, 2024
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
@@ -1,5 +1,7 @@
package uk.gov.justice.digital.hmpps

import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.hasItems
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
Expand All @@ -16,8 +18,6 @@ import uk.gov.justice.digital.hmpps.integrations.delius.offender.OffenderDeltaRe
import uk.gov.justice.digital.hmpps.integrations.delius.offender.OffenderDeltaService
import uk.gov.justice.digital.hmpps.messaging.HmppsChannelManager
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService
import java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME
import java.time.temporal.ChronoUnit

@SpringBootTest
internal class IntegrationTest {
Expand Down Expand Up @@ -48,7 +48,7 @@ internal class IntegrationTest {
expected.forEach {
verify(telemetryService, timeout(30000)).trackEvent(
eq("OffenderEventPublished"),
eq(it + ("occurredAt" to ISO_ZONED_DATE_TIME.format(delta.dateChanged.truncatedTo(ChronoUnit.SECONDS)))),
check { properties -> assertThat(properties.entries, hasItems(*it.entries.toTypedArray())) },
any()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class OffenderDeltaService(
mapOf(
"crn" to it.message.crn,
"eventType" to it.eventType!!,
"occurredAt" to ISO_ZONED_DATE_TIME.format(it.message.eventDatetime)
"occurredAt" to ISO_ZONED_DATE_TIME.format(it.message.eventDatetime),
"notification" to it.toString(),
)
)
}
Expand Down
Loading