package Ġorg . on ap . cc sdk . cds . blueprint spro cess or . self service . api . utils Ċ Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Flags Ċ import Ġorg . on ap . cc sdk . cds . controller blueprint s . common . api . Action Identifiers Ċ import Ġorg . on ap . cc sdk . cds . controller blueprint s . common . api . Common Header Ċ import Ġorg . on ap . cc sdk . cds . controller blueprint s . common . api . EventType Ċ import Ġorg . on ap . cc sdk . cds . controller blueprint s . common . api . Flag Ċ import Ġorg . springframework . test . context . junit 4 . Spring Runner Ċ import Ġjava . text . SimpleDateFormat Ċ Ċ @ RunWith ( Spring Runner :: class ) Ċ class ĠBlue Print Mappings Test Ġ{ ĊĊĠĠĠ Ġval Ġformatter Ġ= ĠSimpleDateFormat (" yyyy - MM - dd ' T ' HH : mm : ss . SS S ' Z '") ĊĠĠĠ Ġval Ġdate String Ġ= Ġ" 2 0 1 9 - 0 1 - 1 6 T 1 8 : 2 5 : 4 3 . 5 1 1 Z " ĊĠĠĠ Ġval Ġdate For Test Ġ= Ġformatter . parse ( date String ) ĊĊĠĠĠ Ġval Ġflag Ġ= ĠFlag . newBuilder (). setIs Force ( false ). set T tl ( 1 ). build () ĊĊĠĠĠ Ġfun Ġcreate Flag (): ĠFlags Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġflag Ġ= ĠFlags () ĊĠĠĠĠĠĠĠ Ġflag . is Force Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġflag . ttl Ġ= Ġ 1 ĊĠĠĠĠĠĠĠ Ġreturn Ġflag ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġflag To Java Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġflag 2 Ġ= Ġflag . to Java () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( flag . is Force , Ġflag 2 . is Force ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( flag . ttl , Ġflag 2 . ttl ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġflag To Proto Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġflag Ġ= Ġcreate Flag () ĊĠĠĠĠĠĠĠ Ġval Ġflag 2 Ġ= Ġflag . to Proto () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( flag . is Force , Ġflag 2 . is Force ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( flag . ttl , Ġflag 2 . ttl ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Status (): Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Status Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstatus Ġ= Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Status () ĊĠĠĠĠĠĠĠ Ġstatus . code Ġ= Ġ 4 0 0 ĊĠĠĠĠĠĠĠ Ġstatus . errorMessage Ġ= Ġ" Concurrent Ġmodification Ġexception " ĊĠĠĠĠĠĠĠ Ġstatus . eventType Ġ= ĠEventType . EVENT _ COMPONENT _ PROCESS ING . name ĊĠĠĠĠĠĠĠ Ġstatus . message Ġ= Ġ" Error Ġuploading Ġdata " ĊĠĠĠĠĠĠĠ Ġstatus . timestamp Ġ= Ġdate For Test ĊĠĠĠĠĠĠĠ Ġreturn Ġstatus ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġstatus To Proto Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstatus Ġ= Ġcreate Status () ĊĠĠĠĠĠĠĠ Ġval Ġstatus 2 Ġ= Ġstatus . to Proto () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( status . code , Ġstatus 2 . code ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( status . errorMessage , Ġstatus 2 . errorMessage ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( status . eventType , Ġstatus 2 . eventType . name ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( status . message , Ġstatus 2 . message ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( status . timestamp . toString (), Ġstatus 2 . timestamp ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcommon Header To Java Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġflag Ġ= ĠFlag . newBuilder (). setIs Force ( true ). set T tl ( 2 ). build () ĊĊĠĠĠĠĠĠĠ Ġval Ġcommon Header Ġ= ĠCommon Header . newBuilder (). set Origin ator Id (" Origin "). set RequestId (" request ID "). set Sub RequestId (" sub Request ID "). set Timestamp ( date String ). set Flag ( flag ). build () ĊĠĠĠĠĠĠĠ Ġval Ġcommon Header 2 Ġ= Ġcommon Header . to Java () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . origin ator Id , Ġcommon Header 2 . origin ator Id ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . requestId , Ġcommon Header 2 . requestId ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . sub RequestId , Ġcommon Header 2 . sub RequestId ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . timestamp , Ġformatter . format ( common Header 2 . timestamp )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Common Header (): Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Common Header Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Header Ġ= Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Common Header () ĊĠĠĠĠĠĠĠ Ġcommon Header . flags Ġ= Ġcreate Flag () ĊĠĠĠĠĠĠĠ Ġcommon Header . origin ator Id Ġ= Ġ" 1 2 3 4 " ĊĠĠĠĠĠĠĠ Ġcommon Header . requestId Ġ= Ġ" 2 3 4 5 " ĊĠĠĠĠĠĠĠ Ġcommon Header . sub RequestId Ġ= Ġ" 0 1 2 3 " ĊĠĠĠĠĠĠĠ Ġcommon Header . timestamp Ġ= Ġdate For Test ĊĠĠĠĠĠĠĠ Ġreturn Ġcommon Header ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcommon Header To Proto Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Header Ġ= Ġcreate Common Header () ĊĠĠĠĠĠĠĠ Ġval Ġcommon Header 2 Ġ= Ġcommon Header . to Proto () ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . origin ator Id , Ġcommon Header 2 . origin ator Id ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . requestId , Ġcommon Header 2 . requestId ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . sub RequestId , Ġcommon Header 2 . sub RequestId ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( common Header . timestamp . toString (), Ġcommon Header 2 . timestamp ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġaction Identifier To Java Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġaction Identifiers Ġ= ĠAction Identifiers . newBuilder (). setAction Name (" Process ĠAction "). set Blueprint Name (" Blueprint Name "). set Blueprint Version (" 3 . 0 "). set Mode (" Execution "). build () ĊĠĠĠĠĠĠĠ Ġval Ġaction Identifiers 2 Ġ= Ġaction Identifiers . to Java () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . action Name , Ġaction Identifiers 2 . action Name ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . blueprint Name , Ġaction Identifiers 2 . blueprint Name ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . blueprint Version , Ġaction Identifiers 2 . blueprint Version ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . mode , Ġaction Identifiers 2 . mode ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcreate Action Identifier (): Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Action Identifiers Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġac Ġ= Ġorg . on ap . cc sdk . cds . blueprint spro cess or . core . api . data . Action Identifiers () ĊĠĠĠĠĠĠĠ Ġac . mode Ġ= Ġ" mode " ĊĠĠĠĠĠĠĠ Ġac . blueprint Version Ġ= Ġ" version " ĊĠĠĠĠĠĠĠ Ġac . blueprint Name Ġ= Ġ" name " ĊĠĠĠĠĠĠĠ Ġac . action Name Ġ= Ġ" action " ĊĠĠĠĠĠĠĠ Ġreturn Ġac ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġaction Identifier To Proto Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġaction Identifiers Ġ= Ġcreate Action Identifier () ĊĠĠĠĠĠĠĠ Ġval Ġaction Identifiers 2 Ġ= Ġaction Identifiers . to Proto () ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . action Name , Ġaction Identifiers 2 . action Name ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . blueprint Name , Ġaction Identifiers 2 . blueprint Name ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . blueprint Version , Ġaction Identifiers 2 . blueprint Version ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( action Identifiers . mode , Ġaction Identifiers 2 . mode ) ĊĠĠĠ Ġ} Ċ }