package Ġnet . cord a . node . services Ċ Ċ import Ġnet . cord a . core . contracts . Always Accept Attachment Constraint Ċ import Ġnet . cord a . core . flows . Not ary Flow Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . transactions . Transaction Builder Ċ import Ġnet . cord a . core . utilities . get OrThrow Ċ import Ġnet . cord a . node . internal . Started Node Ċ import Ġnet . cord a . node . services . B FT Not ary Service Tests . Companion . start B ft Cluster And Node Ċ import Ġnet . cord a . node . services . transactions . min Cluster Size Ċ import Ġnet . cord a . testing . contracts . Dummy Contract Ċ import Ġnet . cord a . testing . core . dummy Command Ċ import Ġnet . cord a . testing . core . single Identity Ċ import Ġnet . cord a . testing . node . internal . Internal Mock Network Ċ import Ġnet . cord a . testing . node . internal . Internal Mock Network . Mock Node Ċ import Ġnet . cord a . testing . node . internal . start Flow Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠB FT SM a Rt Tests Ġ{ ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġmock Net : ĠInternal Mock Network ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġbefore () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Net Ġ= ĠInternal Mock Network ( listOf (" net . cord a . testing . contracts ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġstop Nodes () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Net . stop Nodes () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĠFailure Ġmode Ġis Ġthe Ġredundant Ġreplica Ġgets Ġstuck Ġin Ġstartup , Ġso Ġwe Ġcan 't Ġdispose Ġit Ġclean ly Ġat Ġthe Ġend . Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` all Ġreplicas Ġstart Ġeven Ġif Ġthere Ġis Ġa Ġnew Ġconsensus Ġduring Ġstartup `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcluster Size Ġ= Ġmin Cluster Size ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġ( not ary , Ġnode ) Ġ= Ġstart B ft Cluster And Node ( cluster Size , Ġmock Net , Ġexpose R aces Ġ= Ġtrue ) Ġ// ĠThis Ġtrue Ġadds Ġa Ġsleep Ġto Ġexpose Ġthe Ġrace . ĊĠĠĠĠĠĠĠ Ġval Ġf Ġ= Ġnode . run Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtrivial Tx Ġ= Ġsign Initial Transaction ( not ary ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd Output State ( Dummy Contract . Single Owner State ( owner Ġ= Ġinfo . single Identity ()), ĠDummy Contract . PROGRAM _ ID , ĠAlways Accept Attachment Constraint ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠCreate Ġa Ġnew Ġconsensus Ġwhile Ġthe Ġredundant Ġreplica Ġis Ġsleep ing : ĊĠĠĠĠĠĠĠĠĠĠĠ Ġservices . start Flow ( Not ary Flow . Client ( trivial Tx )). result Future ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġmock Net . run Network () ĊĠĠĠĠĠĠĠ Ġf . get OrThrow () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠStarted Node < Mock Node >. sign Initial Transaction ( not ary : ĠParty , Ġblock : ĠTransaction Builder . () Ġ-> ĠAny ?): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġservices . sign Initial Transaction ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTransaction Builder ( not ary ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd Command ( dummy Command ( services . my Info . single Identity (). own ing Key )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġblock () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ