package Ġnet . cord a . node Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġcom . google . common . util . concurrent . F utures Ċ import Ġnet . cord a . core . copy To Directory Ċ import Ġnet . cord a . core . create Directories Ċ import Ġnet . cord a . core . div Ċ import Ġnet . cord a . core . flows . Flow Logic Ċ import Ġnet . cord a . core . flows . Initi ated By Ċ import Ġnet . cord a . core . flows . Initi ating Flow Ċ import Ġnet . cord a . core . flows . Start able By RPC Ċ import Ġnet . cord a . core . get OrThrow Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . messaging . start Flow Ċ import Ġnet . cord a . core . utilities . AL ICE Ċ import Ġnet . cord a . core . utilities . BO B Ċ import Ġnet . cord a . core . utilities . unwrap Ċ import Ġnet . cord a . node . driver . driver Ċ import Ġnet . cord a . node . services . start Flow Permission Ċ import Ġnet . cord a . node api . User Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ import Ġjava . nio . file . Paths Ċ Ċ class ĠC ord app Sc anning Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Cor D app Ġjar Ġin Ġplugins Ġdirectory Ġis Ġscanned `() Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠIf Ġthe ĠCor D app Ġjar Ġdoes 't Ġexist Ġthen Ġrun Ġthe Ġintegration Test Classes Ġgradle Ġtask ĊĠĠĠĠĠĠĠ Ġval Ġc ord app Jar Ġ= ĠPaths . get ( java Class . getResource ("/ tr ader - demo . jar "). to URI ()) ĊĠĠĠĠĠĠĠ Ġdriver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġplugins Dir Ġ= Ġ( base Directory ( AL ICE . name ) Ġ/ Ġ" plugins "). create Directories () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġc ord app Jar . copy To Directory ( plugins Dir ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġuser Ġ= ĠUser (" u ", Ġ" p ", Ġempty Set ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġalice Ġ= Ġstart Node ( AL ICE . name , Ġrpc Users Ġ= ĠlistOf ( user )). get OrThrow () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġrpc Ġ= Ġalice . rpc Client To Node (). start ( user . username , Ġuser . password ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠIf Ġthe ĠCor D app Ġwasn 't Ġscanned Ġthen ĠS eller Flow Ġwon 't Ġhave Ġbeen Ġpicked Ġup Ġas Ġan ĠRPC Ġflow ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( rpc . proxy . registered Flows ()). contains (" net . cord a . tr ader demo . flow . S eller Flow ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` empty Ġplugins Ġdirectory `() Ġ{ ĊĠĠĠĠĠĠĠ Ġdriver Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbase Directory Ġ= Ġbase Directory ( AL ICE . name ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( base Directory Ġ/ Ġ" plugins "). create Directories () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstart Node ( AL ICE . name ). get OrThrow () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` sub - cl assed Ġinitiated Ġflow Ġpointing Ġto Ġthe Ġsame Ġiniti ating Ġflow Ġas Ġits Ġsuper - class `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuser Ġ= ĠUser (" u ", Ġ" p ", Ġset Of ( start Flow Permission < Receive Flow > ())) ĊĠĠĠĠĠĠĠ Ġdriver ( system Properties Ġ= Ġmap Of (" net . cord a . node . cord app . scan . package " Ġto Ġ" net . cord a . node ")) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġ( alice , Ġbob ) Ġ= ĠF utures . all As List ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstart Node ( AL ICE . name , Ġrpc Users Ġ= ĠlistOf ( user )), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġstart Node ( BO B . name )). get OrThrow () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġinitiated Flow Class Ġ= Ġalice . rpc Client To Node () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. start ( user . username , Ġuser . password ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. proxy ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. start Flow (:: Receive Flow , Ġbob . node Info . legal Identity ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. returnValue ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( initi ated Flow Class . get OrThrow ()). isEqualTo ( Send Sub Class Flow :: class . java . name ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Start able By RPC ĊĠĠĠ Ġ@ Initi ating Flow ĊĠĠĠ Ġclass ĠReceive Flow ( val Ġother Party : ĠParty ) Ġ: ĠFlow Logic < String >() Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall (): ĠString Ġ= Ġreceive < String >( other Party ). unwrap Ġ{ Ġit Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Initi ated By ( Receive Flow :: class ) ĊĠĠĠ Ġopen Ġclass ĠSend Class Flow ( val Ġother Party : ĠParty ) Ġ: ĠFlow Logic < Unit >() Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ= Ġsend ( other Party , Ġjava Class . name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Initi ated By ( Receive Flow :: class ) ĊĠĠĠ Ġclass ĠSend Sub Class Flow ( other Party : ĠParty ) Ġ: ĠSend Class Flow ( other Party ) Ċ } Ċ