package Ġde . k lg 7 1 . keycloak migration . change Control . actions . role Ċ Ċ import Ġde . k lg 7 1 . keycloak migration . Abstract IntegrationTest Ċ import Ġde . k lg 7 1 . keycloak migration . change Control . actions . Migration Exception Ċ import Ġde . k lg 7 1 . keycloak migration . change Control . actions . client . Add Simple Client Action Ċ import Ġde . k lg 7 1 . keycloak migration . keycloak api . Key cloak Client Ċ import Ġde . k lg 7 1 . keycloak migration . keycloak api . client Role ByName Ċ import Ġde . k lg 7 1 . keycloak migration . keycloak api . client UUID Ċ import Ġde . k lg 7 1 . keycloak migration . keycloak api . model . Role ListItem Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . assertj . core . api . Assertions . assertThat Thrown By Ċ import Ġorg . junit . Test Ċ import Ġorg . k oin . core . component . inject Ċ import Ġjava . util .* Ċ Ċ class ĠUpdate Role Inte g Test Ġ: ĠAbstract IntegrationTest () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġclient Ġby Ġinject < Key cloak Client >() ĊĠĠĠ Ġprivate Ġval ĠclientId Ġ= Ġ" integration Test " ĊĠĠĠ Ġprivate Ġval Ġrole Name Ġ= Ġ" test Role " ĊĠĠĠ Ġprivate Ġval Ġrole Description Ġ= Ġ" test Role Description " ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Update Realm Role () Ġ{ ĊĠĠĠĠĠĠĠ ĠAdd Role Action ( test Realm , Ġrole Name ). execute It () ĊĊĠĠĠĠĠĠĠ ĠUpdate Role Action ( test Realm , Ġrole Name , Ġdescription Ġ= Ġrole Description , Ġcomposite Ġ= Ġtrue ). execute It () ĊĊĠĠĠĠĠĠĠ ĠRole ListItem ( UUID . randomUUID (), Ġrole Name , Ġrole Description , Ġfalse , Ġfalse , Ġtest Realm ). let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( client . role ByName ( role Name , Ġtest Realm )). isEqualTo Comp aring Only Given Fields ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit , Ġ" name ", Ġ" description ", Ġ" client Role ", Ġ" composite ", Ġ" container Id " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Update Client Role () Ġ{ ĊĠĠĠĠĠĠĠ ĠAdd Simple Client Action ( test Realm , ĠclientId ). execute It () ĊĠĠĠĠĠĠĠ ĠAdd Role Action ( test Realm , Ġrole Name , ĠclientId ). execute It () ĊĊĠĠĠĠĠĠĠ ĠUpdate Role Action ( test Realm , Ġrole Name , ĠclientId , Ġdescription Ġ= Ġrole Description , Ġclient Role Ġ= Ġtrue ). execute It () ĊĊĠĠĠĠĠĠĠ ĠRole ListItem ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUUID . randomUUID (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrole Name , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrole Description , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfalse , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtrue , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclient . client UUID ( clientId , Ġtest Realm ). toString () ĊĠĠĠĠĠĠĠ Ġ). let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( client . client Role ByName ( role Name , ĠclientId , Ġtest Realm )). isEqualTo Comp aring Only Given Fields ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit , Ġ" name ", Ġ" description ", Ġ" client Role ", Ġ" composite ", Ġ" container Id " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Update Role _ realm Role Not Existing () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUpdate Role Action ( test Realm , Ġrole Name , Ġdescription Ġ= Ġrole Description , Ġcomposite Ġ= Ġtrue ). execute It () ĊĠĠĠĠĠĠĠ Ġ}. isInstanceOf ( Migration Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message (" Role Ġwith Ġname : Ġ$ role Name Ġdoes Ġnot Ġexist Ġin Ġrealm : Ġ$ test Realm !") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Update Role _ client Role Not Existing () Ġ{ ĊĠĠĠĠĠĠĠ ĠAdd Simple Client Action ( test Realm , ĠclientId ). execute It () ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUpdate Role Action ( test Realm , Ġrole Name , ĠclientId , Ġdescription Ġ= Ġrole Description , Ġcomposite Ġ= Ġtrue ). execute It () ĊĠĠĠĠĠĠĠ Ġ}. isInstanceOf ( Migration Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message (" Client Role Ġwith Ġname : Ġ$ role Name Ġdoes Ġnot Ġexist Ġin Ġrealm : Ġ$ test Realm !") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Update Role _ client Not Existing () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUpdate Role Action ( test Realm , Ġrole Name , ĠclientId , Ġdescription Ġ= Ġrole Description , Ġcomposite Ġ= Ġtrue ). execute It () ĊĠĠĠĠĠĠĠ Ġ}. isInstanceOf ( Migration Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message (" Client Ġwith Ġid : Ġ$ clientId Ġdoes Ġnot Ġexist Ġin Ġrealm : Ġ$ test Realm !") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Add Composite Roles () Ġ{ ĊĠĠĠĠĠĠĠ ĠAdd Simple Client Action ( test Realm , ĠclientId , Ġtrue ). execute It () ĊĠĠĠĠĠĠĠ ĠAdd Role Action ( test Realm , Ġ" integration Test Child Role 1 "). execute It () ĊĠĠĠĠĠĠĠ ĠAdd Role Action ( test Realm , Ġ" integration Test Child Role 2 ", ĠclientId ). execute It () ĊĠĠĠĠĠĠĠ ĠAdd Role Action ( test Realm , Ġrole Name ). execute It () ĊĠĠĠĠĠĠĠ ĠUpdate Role Action ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtest Realm , Ġrole Name , Ġcomposite Ġ= Ġtrue , Ġcomposite Child Roles Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRole Selector ( name Ġ= Ġ" integration Test Child Role 1 "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRole Selector ( name Ġ= Ġ" integration Test Child Role 2 ", ĠclientId ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ). execute It () ĊĊĠĠĠĠĠĠĠ Ġval Ġrole Ġ= Ġclient . role ByName ( role Name , Ġtest Realm ) ĊĊĠĠĠĠĠĠĠ ĠRole ListItem ( UUID . randomUUID (), Ġrole Name , Ġ"", Ġtrue , Ġfalse , Ġtest Realm ). let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( role ). isEqualTo Comp aring Only Given Fields ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit , Ġ" name ", Ġ" description ", Ġ" client Role ", Ġ" composite ", Ġ" container Id " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠassertThat ( client . get Composite Child Roles ( role . id , Ġtest Realm ). map Ġ{ Ġit . name Ġ}). contains Exactly In Any Order ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" integration Test Child Role 1 ", Ġ" integration Test Child Role 2 " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ