generated from ministryofjustice/template-repository
-
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.
Browse files
Browse the repository at this point in the history
…3890) * PI-2258 replicate transaction rollback error Signed-off-by: Amardeep Chimber <[email protected]> * PI-2258 move transaction annotation to handler and update tests Signed-off-by: Amardeep Chimber <[email protected]> * PI-2258 undo change to dev queue timeout value Signed-off-by: Amardeep Chimber <[email protected]> * PI-2258 move transaction rollback test in a separate file Signed-off-by: Amardeep Chimber <[email protected]> * Formatting changes * Empty-Commit * PI-2258 refactor test attribute names Signed-off-by: Amardeep Chimber <[email protected]> --------- Signed-off-by: Amardeep Chimber <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0323be3
commit 4d7d0b2
Showing
11 changed files
with
123 additions
and
9 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
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
17 changes: 17 additions & 0 deletions
17
...prison-custody-status-to-delius/src/dev/resources/messages/prisoner-matched-with-pom.json
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,17 @@ | ||
{ | ||
"Type": "Notification", | ||
"MessageId": "b11f8b6c-a7bc-4a3e-af9c-3e4870924eaa", | ||
"TopicArn": "", | ||
"Message": "{\"eventType\":\"probation-case.prison-identifier.added\",\"version\":1,\"occurredAt\":\"2023-07-31T09:26:39+01:00\",\"publishedAt\":\"2023-07-31T09:26:39.362Z+01:00\",\"description\":\"A prisoner identifier has been added\",\"personReference\":{\"identifiers\":[{\"type\":\"NOMS\",\"value\":\"B5295DZ\"}]}}", | ||
"Timestamp": "2023-07-31T09:26:39.362Z", | ||
"SignatureVersion": "1", | ||
"Signature": "", | ||
"SigningCertURL": "", | ||
"UnsubscribeURL": "", | ||
"MessageAttributes": { | ||
"eventType": { | ||
"Type": "String", | ||
"Value": "probation-case.prison-identifier.added" | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...rationTest/kotlin/uk/gov/justice/digital/hmpps/PcstdIntegrationTransactionRollbackTest.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,39 @@ | ||
package uk.gov.justice.digital.hmpps | ||
|
||
import org.hamcrest.MatcherAssert.assertThat | ||
import org.hamcrest.Matchers.equalTo | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.test.context.TestPropertySource | ||
import uk.gov.justice.digital.hmpps.data.generator.BookingGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.InstitutionGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.NotificationGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator | ||
|
||
@TestPropertySource(properties = ["logging.level.org.springframework.transaction=DEBUG", "logging.level.org.hibernate.engine.transaction.internal.TransactionImpl=DEBUG"]) | ||
class PcstdIntegrationTransactionRollbackTest : PcstdIntegrationTestBase() { | ||
private val releaseOnLicence = "Released on Licence" | ||
|
||
@Test | ||
fun `when a prisoner is matched with more than one pom`() { | ||
|
||
val notification = NotificationGenerator.PRISONER_MATCHED_WITH_POM | ||
val person = PersonGenerator.MATCHABLE_WITH_POM | ||
withBooking( | ||
BookingGenerator.MATCHED_WITH_POM, | ||
BookingGenerator.MATCHED_WITH_POM.lastMovement(notification.message.occurredAt) | ||
) | ||
val before = getCustody(person.nomsNumber) | ||
assertThat(before.institution?.code, equalTo(InstitutionGenerator.DEFAULT.code)) | ||
|
||
channelManager.getChannel(queueName).publishAndWait(notification) | ||
|
||
val custody = getCustody(person.nomsNumber) | ||
assertTrue(custody.isInCustody()) | ||
assertThat(custody.institution?.code, equalTo(InstitutionGenerator.DEFAULT.code)) | ||
|
||
verifyCustodyHistory( | ||
custody | ||
) | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
...tatus-to-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/messaging/ActionProcessor.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
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