/* Ċ Ġ* ĠCopyright Ġ 2 0 1 9 ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . ĠAll ĠRights ĠReserved . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "). Ċ Ġ* ĠYou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠA Ġcopy Ġof Ġthe ĠLicense Ġis Ġlocated Ġat Ċ Ġ* Ċ Ġ* Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* Ġor Ġin Ġthe Ġ" license " Ġfile Ġaccompanying Ġthis Ġfile . ĠThis Ġfile Ġ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 Ġcom . amazon . opend ist ro fore lastic search . index management . index state management Ċ Ċ import Ġcom . amazon . opend ist ro fore lastic search . index management . index state management . model . Managed Index Config Ċ import Ġorg . elasticsearch . common . x content . Logging De precation Handler Ċ import Ġorg . elasticsearch . common . x content . X Content Parser Ċ import Ġorg . elasticsearch . common . x content . X ContentType Ċ import Ġorg . elasticsearch . test . EST est Case Ċ import Ġkotlin . test . assert Fails With Ċ Ċ class ĠManaged Index Config Tests Ġ: ĠEST est Case () Ġ{ ĊĊĠĠĠ Ġfun Ġ` test Ġmanaged Ġindex Ġconfig Ġparsing `() Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġmissing Index Uuid Ġ= Ġ""" {" managed _ index ":{" name ":" ed p NN wd V XG "," enabled ": false ," index ":" D cd VH fm QUI "," schedule ":{" interval ":{" start _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 4 ," period ": 5 ," unit ":" Minutes "} }," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," enabled _ time ": null ," policy _ id ":" K uma J GC W Pi "," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĠĠĠĠĠĠĠ Ġval Ġmissing Index Ġ= Ġ""" {" managed _ index ":{" name ":" ed p NN wd V XG "," enabled ": false ," index _ uuid ":" S dc Nv td y AZ Y yr Vk F Mo Qr "," schedule ":{" interval ":{" start _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 4 ," period ": 5 ," unit ":" Minutes "} }," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," enabled _ time ": null ," policy _ id ":" K uma J GC W Pi "," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĠĠĠĠĠĠĠ Ġval Ġmissing Name Ġ= Ġ""" {" managed _ index ":{" enabled ": false ," index ":" D cd VH fm QUI "," index _ uuid ":" S dc Nv td y AZ Y yr Vk F Mo Qr "," schedule ":{" interval ":{" start _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 4 ," period ": 5 ," unit ":" Minutes "} }," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," enabled _ time ": null ," policy _ id ":" K uma J GC W Pi "," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĠĠĠĠĠĠĠ Ġval Ġmissing Schedule Ġ= Ġ""" {" managed _ index ":{" name ":" ed p NN wd V XG "," enabled ": false ," index ":" D cd VH fm QUI "," index _ uuid ":" S dc Nv td y AZ Y yr Vk F Mo Qr "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," enabled _ time ": null ," policy _ id ":" K uma J GC W Pi "," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĠĠĠĠĠĠĠ Ġval Ġmissing Last Updated Time Ġ= Ġ""" {" managed _ index ":{" name ":" ed p NN wd V XG "," enabled ": false ," index ":" D cd VH fm QUI "," index _ uuid ":" S dc Nv td y AZ Y yr Vk F Mo Qr "," schedule ":{" interval ":{" start _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 4 ," period ": 5 ," unit ":" Minutes "} }," enabled _ time ": null ," policy _ id ":" K uma J GC W Pi "," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĠĠĠĠĠĠĠ Ġval Ġmissing Policy ID Ġ= Ġ""" {" managed _ index ":{" name ":" ed p NN wd V XG "," enabled ": false ," index ":" D cd VH fm QUI "," index _ uuid ":" S dc Nv td y AZ Y yr Vk F Mo Qr "," schedule ":{" interval ":{" start _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 4 ," period ": 5 ," unit ":" Minutes "} }," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," enabled _ time ": null ," policy _ seq _ no ": 5 ," policy _ primary _ term ": 1 7 ," policy ":{" name ":" K uma J GC W Pi "," last _ updated _ time ": 1 5 6 0 4 0 2 7 2 2 6 7 6 ," schema _ version ": 3 4 8 3 9 2 ," error _ notification ": null ," default _ state ":" E pb LV q V ht L "," states ":[{" name ":" E pb LV q V ht L "," action ":[ ]," transitions ": [] },{" name ":" II Jx Q dc enu "," action ":[ ]," transitions ": [] },{" name ":" z SX lb L UB q G "," action ":[ ]," transitions ": [] },{" name ":" n Y RP Bo j B iy "," action ":[ ]," transitions ": [] }] }," change _ policy ":{" policy _ id ":" B tr D pc C Be T "," state ":" ob xA k R uh vq "}} } """ ĊĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġindex Uuid ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Index Uuid )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġindex ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Index )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġname ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Name )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġschedule ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Schedule )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġlast Updated Time ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Last Updated Time )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert Fails With ( IllegalArgumentException :: class , Ġ" Expected ĠIllegalArgumentException Ġfor Ġmissing Ġpolicy ID ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠManaged Index Config . parse WithType ( parser WithType ( missing Policy ID )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġparser WithType ( xc : ĠString ): ĠX Content Parser Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠX ContentType . JSON . x Content (). create Parser ( x Content Registry (), ĠLogging De precation Handler . INSTANCE , Ġxc ) ĊĠĠĠ Ġ} Ċ } Ċ