/* Ċ Ġ* Ġ============ LICENSE _ START ================================================ ======= Ċ Ġ* Ġd cae gen 2 - collect ors - ves hv Ċ Ġ* Ġ================================================================= =============== Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 ĠN OK IA Ċ Ġ* Ġ================================================================= =============== Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ġ============ LICENSE _ END ================================================ ========= Ċ Ġ*/ Ċ package Ġorg . on ap . dca e . collect ors . ves hv . sim ulators . x nf . impl . config Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Return Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġorg . apache . commons . cli . CommandLine Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . jetbrains . spe k . api . Spe k Ċ import Ġorg . jetbrains . spe k . api . dsl . describe Ċ import Ġorg . jetbrains . spe k . api . dsl . it Ċ import Ġorg . jetbrains . spe k . api . dsl . on Ċ import Ġorg . on ap . dca e . collect ors . ves hv . command line . CommandLine Option Ċ import Ġorg . on ap . dca e . collect ors . ves hv . command line . has Option Ċ import Ġorg . on ap . dca e . collect ors . ves hv . command line . stringValue Ċ import Ġjava . nio . file . Paths ĊĊ Ċ internal Ġobject ĠS sl UtilsTest Ġ: ĠSpe k ({ ĊĊĠĠĠ Ġdescribe (" creating Ġse cur ty Ġconfiguration Ġprovider ") Ġ{ ĊĊĠĠĠĠĠĠĠ Ġon (" command Ġline Ġwithout Ġssl Ġdisable ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpassword File Ġ= Ġresource Path AsString ("/ ssl / password ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcommand Line : ĠCommandLine Ġ= Ġmock () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( command Line . has Option ( CommandLine Option . SSL _ DISABLE )). do Return ( false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( command Line . stringValue ( CommandLine Option . TR UST _ STORE _ PASSWORD _ FILE , ĠTR UST _ STORE _ PASSWORD _ FILE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. do Return ( password File ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( command Line . stringValue ( CommandLine Option . KEY _ STORE _ PASSWORD _ FILE , ĠKEY _ STORE _ PASSWORD _ FILE )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. do Return ( password File ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġit (" should Ġcreate Ġconfiguration Ġwith Ġsome Ġkeys ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġconfiguration Ġ= Ġcreate Security Configuration Provider ( command Line ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġverify ( command Line ). has Option ( CommandLine Option . SSL _ DISABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( configuration . is Success ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġconfiguration . map Ġ{ ĠassertThat ( it (). keys . isDefined ()). isTrue () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġon (" command Ġline Ġwith Ġssl Ġdisabled ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcommand Line : ĠCommandLine Ġ= Ġmock () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( command Line . has Option ( CommandLine Option . SSL _ DISABLE )). do Return ( true ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġit (" should Ġcreate Ġconfiguration Ġwithout Ġkeys ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġconfiguration Ġ= Ġcreate Security Configuration Provider ( command Line ) ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġverify ( command Line ). has Option ( CommandLine Option . SSL _ DISABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( configuration . is Success ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġconfiguration . map Ġ{ ĠassertThat ( it (). keys . isEmpty ()). isTrue () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }) Ċ Ċ private Ġfun Ġresource Path AsString ( resource : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ ĠPaths . get ( Ssl UtilsTest :: class . java . getResource ( resource ). to URI ()). toString () Ċ