From c4cabd04051477d7030cb48f6c1263ee0f160ff6 Mon Sep 17 00:00:00 2001 From: Amardeep Chimber Date: Fri, 14 Jun 2024 16:20:37 +0100 Subject: [PATCH] PI-2257 update test Signed-off-by: Amardeep Chimber --- .../uk/gov/justice/digital/hmpps/data/DataLoader.kt | 4 ++-- .../digital/hmpps/data/generator/PersonGenerator.kt | 8 ++++---- .../dev/resources/messages/recommendation-deleted.json | 2 +- .../digital/hmpps/RecommendationIntegrationTest.kt | 2 -- .../delius/recommendation/person/PersonRepository.kt | 2 +- .../delius/recommendation/person/entity/Person.kt | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/DataLoader.kt b/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/DataLoader.kt index 236616976e..511d954165 100644 --- a/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/DataLoader.kt +++ b/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/DataLoader.kt @@ -35,8 +35,8 @@ class DataLoader( persist(PersonGenerator.RECOMMENDATION_DELETED) persist(PersonGenerator.RECOMMENDATION_DELETED_INACTIVE_STAFF) persist(PersonGenerator.RECOMMENDATION_MERGED_FROM) - persist(PersonGenerator.X000010_ADDITIONAL_IDENTIFIER.type) - persist(PersonGenerator.X000010_ADDITIONAL_IDENTIFIER) + persist(PersonGenerator.X000077_ADDITIONAL_IDENTIFIER.mergeDetail) + persist(PersonGenerator.X000077_ADDITIONAL_IDENTIFIER) persist(PersonGenerator.DEFAULT_PROVIDER) persist(PersonGenerator.DEFAULT_LAU) diff --git a/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/PersonGenerator.kt b/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/PersonGenerator.kt index 444db7015b..10be905733 100644 --- a/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/PersonGenerator.kt +++ b/projects/make-recall-decisions-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/PersonGenerator.kt @@ -29,13 +29,13 @@ object PersonGenerator { val NO_ACCESS_LIMITATIONS = generateUserAccess("X000007") val RECOMMENDATION_DELETED = generate("X000008") val RECOMMENDATION_DELETED_INACTIVE_STAFF = generate("X000009") - val RECOMMENDATION_MERGED_FROM = generate("X000010", softDeleted = true) - val X000010_ADDITIONAL_IDENTIFIER = + val RECOMMENDATION_MERGED_FROM = generate("X000077", softDeleted = true) + val X000077_ADDITIONAL_IDENTIFIER = AdditionalIdentifier( IdGenerator.getAndIncrement(), - RECOMMENDATION_DELETED.crn, + RECOMMENDATION_MERGED_FROM.crn, false, - RECOMMENDATION_MERGED_FROM, + RECOMMENDATION_DELETED, ReferenceData(IdGenerator.getAndIncrement(), "MFCRN", "Merged From CRN") ) diff --git a/projects/make-recall-decisions-and-delius/src/dev/resources/messages/recommendation-deleted.json b/projects/make-recall-decisions-and-delius/src/dev/resources/messages/recommendation-deleted.json index e389b6cbcf..81ab4c4af7 100644 --- a/projects/make-recall-decisions-and-delius/src/dev/resources/messages/recommendation-deleted.json +++ b/projects/make-recall-decisions-and-delius/src/dev/resources/messages/recommendation-deleted.json @@ -14,7 +14,7 @@ "identifiers": [ { "type": "CRN", - "value": "X000008" + "value": "X000077" } ] } diff --git a/projects/make-recall-decisions-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/RecommendationIntegrationTest.kt b/projects/make-recall-decisions-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/RecommendationIntegrationTest.kt index 9b3662e855..87dd7a0eb3 100644 --- a/projects/make-recall-decisions-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/RecommendationIntegrationTest.kt +++ b/projects/make-recall-decisions-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/RecommendationIntegrationTest.kt @@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.mock.mockito.MockBean -import org.springframework.test.context.TestPropertySource import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator import uk.gov.justice.digital.hmpps.data.generator.UserGenerator import uk.gov.justice.digital.hmpps.integrations.delius.recommendation.contact.entity.Contact @@ -21,7 +20,6 @@ import uk.gov.justice.digital.hmpps.telemetry.TelemetryService import uk.gov.justice.digital.hmpps.telemetry.notificationReceived @SpringBootTest -@TestPropertySource(properties = ["logging.level.org.hibernate.SQL=DEBUG", "logging.level.org.hibernate.orm.jdbc.bind=TRACE"]) internal class RecommendationIntegrationTest { @Value("\${messaging.consumer.queue}") lateinit var queueName: String diff --git a/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/PersonRepository.kt b/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/PersonRepository.kt index 8923271bd0..4c5aedf87a 100644 --- a/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/PersonRepository.kt +++ b/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/PersonRepository.kt @@ -20,7 +20,7 @@ interface PersonRepository : JpaRepository { WHERE ai.crn = :crn AND p.softDeleted = false AND p.manager.active = true - AND ai.type.code IN ('DOFF', 'MFCRN', 'MTCRN', 'PCRN') + AND ai.mergeDetail.code IN ('DOFF', 'MFCRN', 'MTCRN', 'PCRN') """ ) fun findByCrn(crn: String): Person? diff --git a/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/entity/Person.kt b/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/entity/Person.kt index ed82701fae..1d76b243b9 100644 --- a/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/entity/Person.kt +++ b/projects/make-recall-decisions-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/recommendation/person/entity/Person.kt @@ -76,5 +76,5 @@ class AdditionalIdentifier( @ManyToOne @JoinColumn(name = "identifier_name_id") - val type: ReferenceData + val mergeDetail: ReferenceData )