/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 6 . ĠSun gh you k ĠB ae Ġ< sun gh you k . bae @ gmail . com > Ċ Ġ* Ġ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 . Ċ Ġ* Ċ Ġ*/ Ċ Ċ package Ġdeb op 4 k . redis son . kotlin . config Ċ Ċ import Ġdeb op 4 k . core . logger Of Ċ import Ġdeb op 4 k . core . un initialized Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . redis son . api . Redis son Client Ċ import Ġorg . redis son . api . Redis son Reactive Client Ċ import Ġorg . redis son . client . Redis Client Ċ import Ġorg . redis son . client . protocol . Redis Commands Ċ import Ġorg . redis son . client . protocol . Redis Strict Command Ċ import Ġorg . redis son . client . protocol . decoder . String Map Data Decoder Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . test . context . junit 4 . Spring Runner Ċ import Ġjavax . inject . Inject Ċ Ċ @ RunWith ( Spring Runner :: class ) Ċ @ SpringBootTest ( classes Ġ= ĠarrayOf ( Redis son Kotlin Config ration :: class )) Ċ class ĠRedis son Kotlin Configuration Test Ġ{ ĊĊĠ Ġprivate Ġval Ġlog Ġ= Ġlogger Of ( java Class ) ĊĊĠ Ġ@ Inject Ġval Ġredis son : ĠRedis son Client Ġ= Ġun initialized () ĊĠ Ġ@ Inject Ġval Ġredis son Reactive : ĠRedis son Reactive Client Ġ= Ġun initialized () ĊĠ Ġ@ Inject Ġval Ġredis : ĠRedis Client Ġ= Ġun initialized () ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Injection () Ġ{ ĊĠĠĠ ĠassertThat ( redis son ). isNotNull () ĊĠĠĠ ĠassertThat ( redis son Reactive ). isNotNull () ĊĠĠĠ ĠassertThat ( redis ). isNotNull () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Redis Connection () Ġ{ ĊĠĠĠ Ġval Ġconn Ġ= Ġredis . connect () ĊĠĠĠ ĠassertThat ( conn . sync ( Redis Commands . PING )). isEqualTo (" P ONG ") ĊĊĠĠĠ Ġval ĠINFO _ ALL Ġ= ĠRedis Strict Command (" INFO ", Ġnull , ĠString Map Data Decoder ()) ĊĠĠĠ Ġval Ġinfos Ġ= Ġconn . sync ( INFO _ ALL ) ĊĠĠĠ Ġfor Ġ(( key , Ġvalue ) Ġin Ġinfos ) Ġ{ ĊĠĠĠĠĠ Ġprintln (" redis Ġkey =$ key , Ġvalue =$ value ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġfuture Ġ= Ġconn . close Async () ĊĠĠĠ Ġfuture . sync () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Bucket () Ġ{ ĊĠĠĠ Ġredis son . keys . flush db () ĊĊĠĠĠ Ġval Ġbucket Ġ= Ġredis son . get Bucket < String >(" a ") ĊĠĠĠ Ġbucket . delete () ĊĠĠĠ ĠassertThat ( bucket . try Set (" b ")). isTrue () ĊĠĠĠ ĠassertThat ( bucket . delete ()). isTrue () ĊĠĠĠ ĠassertThat ( redis son . get Bucket < Any >(" a "). delete ()). isFalse () ĊĠ Ġ} Ċ }