package Ġprojekt or Ċ Ċ import Ġcom . fasterxml . jackson . databind . Deserialization Feature Ċ import Ġcom . fasterxml . jackson . databind . ObjectMapper Ċ import Ġcom . fasterxml . jackson . databind . Property Naming Strategy Ċ import Ġcom . fasterxml . jackson . databind . Serialization Feature Ċ import Ġcom . fasterxml . jackson . datatype . js r 3 1 0 . Java Time Module Ċ import Ġcom . fasterxml . jackson . module . kotlin . register Kotlin Module Ċ import Ġcom . zaxxer . hikari . Hikari DataSource Ċ import Ġio . ktor . application . Application Ċ import Ġio . ktor . config . Map Application Config Ċ import Ġio . ktor . util . K tor Experimental API Ċ import Ġjava . math . BigDecimal Ċ import Ġkotlin . test . After Test Ċ import Ġkotlinx . coroutines . Obsolete Cor outines Api Ċ import Ġorg . await ility . kotlin . await Ċ import Ġorg . await ility . kotlin . until Ċ import Ġorg . jooq . DSL Context Ċ import Ġorg . k oin . ktor . ext . get Ċ import Ġprojekt or . database . generated . tables . da os .* Ċ import Ġprojekt or . parser . Results Xml Loader Ċ import Ġprojekt or . server . api . Public Id Ċ Ċ @ K tor Experimental API Ċ open Ġclass ĠApplication TestCase Ġ{ ĊĠĠĠ Ġval Ġresults Xml Loader Ġ= ĠResults Xml Loader () ĊĊĠĠĠ Ġval ĠobjectMapper : ĠObjectMapper Ġ= ĠObjectMapper () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. register Kotlin Module () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. register Module ( Java Time Module ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setProperty Naming Strategy ( Property Naming Strategy . S NA KE _ CASE ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. disable ( Serialization Feature . WRITE _ DAT ES _ AS _ TIMESTAMP S ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. configure ( Deserialization Feature . FAIL _ ON _ UNKNOWN _ PROPERTIES , Ġfalse ) ĊĊĠĠĠ Ġlateinit Ġvar ĠdataSource : ĠH ikari DataSource ĊĠĠĠ Ġlateinit Ġvar Ġd sl Context : ĠDSL Context ĊĠĠĠ Ġlateinit Ġvar Ġtest Run Dao : ĠTest Run Dao ĊĠĠĠ Ġlateinit Ġvar Ġtest Suite Group Dao : ĠTest Suite Group Dao ĊĠĠĠ Ġlateinit Ġvar Ġtest Suite Dao : ĠTest Suite Dao ĊĠĠĠ Ġlateinit Ġvar ĠtestCase Dao : ĠTestCase Dao ĊĠĠĠ Ġlateinit Ġvar Ġtest Failure Dao : ĠTest Failure Dao ĊĠĠĠ Ġlateinit Ġvar Ġattachment Dao : ĠTest Run Attachment Dao ĊĠĠĠ Ġlateinit Ġvar Ġtest Run System Attributes Dao : ĠTest Run System Attributes Dao ĊĠĠĠ Ġlateinit Ġvar Ġtest Run DB Generator : ĠTest Run DB Generator ĊĠĠĠ Ġlateinit Ġvar Ġapplication : ĠApplication ĊĊĠĠĠ Ġprotected Ġvar Ġdatabase Schema : ĠString Ġ= Ġ" public " ĊĊĠĠĠ Ġprotected Ġvar Ġpublish Token : ĠString ? Ġ= Ġnull ĊĊĠĠĠ Ġprotected Ġvar Ġattachments Enabled : ĠBoolean ? Ġ= Ġnull ĊĠĠĠ Ġprotected Ġvar Ġattachments MaxSize MB : ĠBigDecimal ? Ġ= Ġnull ĊĊĠĠĠ Ġprotected Ġvar Ġcleanup Max Age Days : ĠInt ? Ġ= Ġnull ĊĊĠĠĠ Ġ@ Obsolete Cor outines Api ĊĠĠĠ Ġfun Ġcreate Test Application ( application : ĠApplication ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġschema Ġ= Ġdatabase Schema ĊĊĠĠĠĠĠĠĠ Ġ( application . environment . config Ġas ĠMap Application Config ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠSet Ġhere Ġthe Ġproperties ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . datasource . username ", ĠSystem . getenv (" DB _ USERNAME ") Ġ?: Ġ" test user ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . datasource . password ", ĠSystem . getenv (" DB _ PASSWORD ") Ġ?: Ġ" test pass ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . datasource . jdbc Url ", ĠSystem . getenv (" DB _ URL ") Ġ?: Ġ" jdbc : postgresql :// localhost : 5 4 3 3 / pro jekt ord b ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . datasource . schema ", Ġschema ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġpublish Token ?. let Ġ{ Ġput (" ktor . auth . publish Token ", Ġit ) Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġattachments Enabled ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . attachment . url ", Ġ" http :// localhost : 9 0 0 0 ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . attachment . bucketName ", Ġ" attachment st esting ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . attachment . auto Create Bucket ", Ġ" true ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . attachment . access Key ", Ġ" min io _ access _ key ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . attachment . secret Key ", Ġ" min io _ secret _ key ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġattachments MaxSize MB ?. let Ġ{ Ġput (" ktor . attachment . maxSize MB ", Ġit . toString ()) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcleanup Max Age Days ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput (" ktor . cleanup . max Report Age Days ", Ġit . toString ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġapplication . main () ĊĊĠĠĠĠĠĠĠ ĠdataSource Ġ= Ġapplication . get () ĊĠĠĠĠĠĠĠ Ġd sl Context Ġ= Ġapplication . get () ĊĠĠĠĠĠĠĠ Ġtest Run Dao Ġ= ĠTest Run Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġtest Suite Group Dao Ġ= ĠTest Suite Group Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġtest Suite Dao Ġ= ĠTest Suite Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ ĠtestCase Dao Ġ= ĠTestCase Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġtest Failure Dao Ġ= ĠTest Failure Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġattachment Dao Ġ= ĠTest Run Attachment Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġtest Run System Attributes Dao Ġ= ĠTest Run System Attributes Dao ( dsl Context . configuration ()) ĊĠĠĠĠĠĠĠ Ġtest Run DB Generator Ġ= ĠTest Run DB Generator ( test Run Dao , Ġtest Suite Group Dao , Ġtest Suite Dao , ĠtestCase Dao , Ġtest Failure Dao ) ĊĊĠĠĠĠĠĠĠ Ġthis . application Ġ= Ġapplication ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġwait Until Test Run Has Attachments ( public Id : ĠPublic Id , Ġattachment Count : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġawait Ġuntil Ġ{ Ġattachment Dao . fetch By Test Run Public Id ( public Id . id ). size Ġ== Ġattachment Count Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After Test ĊĠĠĠ Ġfun Ġclose DataSource () Ġ{ ĊĠĠĠĠĠĠĠ ĠdataSource . close () ĊĠĠĠ Ġ} Ċ } Ċ