package Ġuk . gov . just ice . digital . h mp ps . nom is pr isoner deletion service . integration Ċ Ċ import Ġcom . amazonaws . services . sqs . Amazon SQ S Ċ import Ġcom . amazonaws . services . sqs . model . Purge Queue Request Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . boot . test . context . SpringBootTest . Web Environment . RANDOM _ PORT Ċ import Ġorg . springframework . boot . web . server . Local Server Port Ċ import Ġorg . springframework . http . HttpHeaders Ċ import Ġorg . springframework . test . context . Active Profiles Ċ import Ġorg . springframework . test . context . Dynamic Property Registry Ċ import Ġorg . springframework . test . context . Dynamic Property Source Ċ import Ġorg . springframework . test . web . reactive . server . Web Test Client Ċ import Ġuk . gov . just ice . digital . h mp ps . nom is pr isoner deletion service . helper . Jwt Auth Helper Ċ import Ġuk . gov . just ice . digital . h mp ps . nom is pr isoner deletion service . helper . Message Helper Ċ import Ġuk . gov . just ice . digital . h mp ps . nom is pr isoner deletion service . integration . test container . Local Stack Container Ċ import Ġuk . gov . just ice . digital . h mp ps . nom is pr isoner deletion service . integration . test container . Local Stack Container . set Local Stack Properties Ċ import Ġuk . gov . just ice . h mp ps . sqs . H mp ps Queue Ċ import Ġuk . gov . just ice . h mp ps . sqs . H mp ps Queue Service Ċ Ċ @ SpringBootTest ( web Environment Ġ= ĠR AN DOM _ PORT ) Ċ @ Active Profiles (" test ") Ċ abstract Ġclass ĠIntegration TestBase Ġ{ ĊĊĠ Ġ@ Suppress (" Spring Java Injection Points Autow iring Inspection ") ĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġweb Test Client : ĠWeb Test Client ĊĊĠ Ġ@ Autowired ĊĠ Ġprotected Ġlateinit Ġvar Ġjwt Auth Helper : ĠJwt Auth Helper ĊĊĠ Ġ@ Autowired ĊĠ Ġprotected Ġlateinit Ġvar Ġh mp ps Queue Service : ĠH mp ps Queue Service ĊĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġmessage Helper : ĠMessage Helper ĊĊĠ Ġinternal Ġval Ġrequest Queue Ġby Ġlazy Ġ{ Ġh mp ps Queue Service . findBy Queue Id (" datac omp li anc ere quest ") Ġas ĠH mp ps Queue Ġ} ĊĠ Ġinternal Ġval Ġresponse Queue Ġby Ġlazy Ġ{ Ġh mp ps Queue Service . findBy Queue Id (" datac omp li ancer es ponse ") Ġas ĠH mp ps Queue Ġ} ĊĊĠ Ġinternal Ġval Ġrequest Aws S qs Client Ġby Ġlazy Ġ{ Ġrequest Queue . sqs Client Ġ} ĊĠ Ġinternal Ġval Ġrequest Queue Url Ġby Ġlazy Ġ{ Ġrequest Queue . queue Url Ġ} ĊĊĠ Ġinternal Ġval Ġrequest Aws S qs D lq Client Ġby Ġlazy Ġ{ Ġrequest Queue . sqs D lq Client Ġas ĠAmazon SQ S Ġ} ĊĠ Ġinternal Ġval Ġrequest D lq Url Ġby Ġlazy Ġ{ Ġrequest Queue . dl q Url Ġas ĠString Ġ} ĊĊĠ Ġinternal Ġval Ġresponse Aws S qs Client Ġby Ġlazy Ġ{ Ġresponse Queue . sqs Client Ġ} ĊĠ Ġinternal Ġval Ġresponse Queue Url Ġby Ġlazy Ġ{ Ġresponse Queue . queue Url Ġ} ĊĊĠ Ġinternal Ġval Ġresponse Aws S qs D lq Client Ġby Ġlazy Ġ{ Ġresponse Queue . sqs D lq Client Ġas ĠAmazon SQ S Ġ} ĊĠ Ġinternal Ġval Ġresponse D lq Url Ġby Ġlazy Ġ{ Ġresponse Queue . dl q Url Ġas ĠString Ġ} ĊĊĠ Ġ@ Local Server Port ĊĠ Ġprotected Ġvar Ġport : ĠInt Ġ= Ġ 0 ĊĊĠ Ġ@ BeforeEach ĊĠ Ġfun Ġpurge Queues () Ġ{ ĊĠĠĠ Ġresponse Aws S qs Client . purge Queue ( Purge Queue Request ( response Queue Url )) ĊĠĠĠ Ġrequest Aws S qs Client . purge Queue ( Purge Queue Request ( request Queue Url )) ĊĠĠĠ Ġresponse Aws S qs D lq Client . purge Queue ( Purge Queue Request ( response D lq Url )) ĊĠĠĠ Ġrequest Aws S qs D lq Client . purge Queue ( Purge Queue Request ( request D lq Url )) ĊĠĠĠ Ġmessage Helper . clear Messages () ĊĠ Ġ} ĊĊĠ Ġinternal Ġfun Ġset Author isation ( ĊĠĠĠ Ġuser : ĠString Ġ= Ġ" AUTH _ AD M ", ĊĠĠĠ Ġroles : ĠList < String > Ġ= ĠlistOf () ĊĠ Ġ): Ġ( HttpHeaders ) Ġ-> ĠUnit Ġ= Ġjwt Auth Helper . set Author isation ( user , Ġroles ) ĊĊĠ Ġfun Ġget NumberOf Messages Currently On Request Queue (): ĠInt ? Ġ{ ĊĠĠĠ Ġval Ġqueue Attributes Ġ= Ġrequest Aws S qs Client . get Queue Attributes ( request Queue Url , ĠlistOf (" Approx imate NumberOf Messages ")) ĊĠĠĠ Ġreturn Ġqueue Attributes . attributes [" Approx imate NumberOf Messages "] ?. toInt () ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlocal Stack Container Ġ= ĠLocal Stack Container . instance ĊĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġ@ Dynamic Property Source ĊĠĠĠ Ġfun Ġtest containers ( registry : ĠDynamic Property Registry ) Ġ{ ĊĠĠĠĠĠ Ġlocal Stack Container ?. also Ġ{ Ġset Local Stack Properties ( it , Ġregistry ) Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ