Skip to content

Commit

Permalink
PI-1630 added feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-britton-moj committed Nov 7, 2023
1 parent 4f5082a commit 6e2ef33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import uk.gov.justice.digital.hmpps.integrations.delius.PersonManagerRepository
import uk.gov.justice.digital.hmpps.integrations.delius.contact.entity.ContactRepository
import uk.gov.justice.digital.hmpps.integrations.delius.contact.entity.ContactType
import uk.gov.justice.digital.hmpps.integrations.delius.getByCrn
import uk.gov.justice.digital.hmpps.messaging.FeatureFlag
import uk.gov.justice.digital.hmpps.messaging.HmppsChannelManager
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService

Expand Down Expand Up @@ -62,7 +63,7 @@ internal class OpdIntegrationTest {
@Order(1)
@Test
fun `process opd assessment`() {
whenever(featureFlags.enabled("opd.assessment.processing")).thenReturn(true)
whenever(featureFlags.enabled(FeatureFlag)).thenReturn(true)
val message = prepMessage("opd-assessment-new", wireMockServer.port())

channelManager.getChannel(queueName).publishAndWait(message)
Expand Down Expand Up @@ -106,7 +107,7 @@ internal class OpdIntegrationTest {
@Order(2)
@Test
fun `process update to opd assessment`() {
whenever(featureFlags.enabled("opd.assessment.processing")).thenReturn(true)
whenever(featureFlags.enabled(FeatureFlag)).thenReturn(true)
val message = prepMessage("opd-assessment-update", wireMockServer.port())

channelManager.getChannel(queueName).publishAndWait(message)
Expand All @@ -132,7 +133,7 @@ internal class OpdIntegrationTest {

@Test
fun `does not process opd assessment when feature flagged`() {
whenever(featureFlags.enabled("opd.assessment.processing")).thenReturn(false)
whenever(featureFlags.enabled(FeatureFlag)).thenReturn(false)

val message = prepMessage("opd-assessment-new", wireMockServer.port())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import uk.gov.justice.digital.hmpps.service.OpdService
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService
import java.time.ZonedDateTime

const val FeatureFlag = "opd-assessment-processing"

@Component
class Handler(
override val converter: NotificationConverter<HmppsDomainEvent>,
Expand All @@ -20,7 +22,7 @@ class Handler(
) : NotificationHandler<HmppsDomainEvent> {
override fun handle(notification: Notification<HmppsDomainEvent>) {
val opdAssessment = notification.message.opdAssessment()
if (!featureFlags.enabled("opd.assessment.processing")) {
if (!featureFlags.enabled(FeatureFlag)) {
telemetryService.trackEvent("OpdAssessmentIgnored", opdAssessment.telemetryProperties())
return
}
Expand Down

0 comments on commit 6e2ef33

Please sign in to comment.