Skip to content
Snippets Groups Projects
Commit 95dc59a9 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6495 addOrUpdateRole also by realm creation

parent 2713b3d2
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ class KeycloakRealmService { ...@@ -55,6 +55,7 @@ class KeycloakRealmService {
keycloakGenericRemoteService.getRealmRepresentation(realmName) keycloakGenericRemoteService.getRealmRepresentation(realmName)
.ifPresentOrElse(existingRealm -> updateRealm(existingRealm, realm), .ifPresentOrElse(existingRealm -> updateRealm(existingRealm, realm),
() -> createRealm(realm, realmName)); () -> createRealm(realm, realmName));
addOrUpdateRealmRoles(realm, realmName);
} }
void updateRealm(RealmRepresentation existingRealm, OzgCloudKeycloakRealmSpec spec) { void updateRealm(RealmRepresentation existingRealm, OzgCloudKeycloakRealmSpec spec) {
...@@ -67,7 +68,6 @@ class KeycloakRealmService { ...@@ -67,7 +68,6 @@ class KeycloakRealmService {
LOG.warn(existingRealm + ": Updating existing realm failed: ", e); LOG.warn(existingRealm + ": Updating existing realm failed: ", e);
throw e; throw e;
} }
addOrUpdateRealmRoles(spec, existingRealm.getRealm());
} }
......
...@@ -92,6 +92,13 @@ class KeycloakRealmServiceTest { ...@@ -92,6 +92,13 @@ class KeycloakRealmServiceTest {
verify(keycloakGenericRemoteService).getRealmRepresentation(REALM_NAME); verify(keycloakGenericRemoteService).getRealmRepresentation(REALM_NAME);
} }
@Test
void shouldCallAddOrUpdateRealmRoles() {
service.createOrUpdateRealm(REALM, REALM_NAME);
verify(service).addOrUpdateRealmRoles(REALM, REALM_NAME);
}
} }
@DisplayName("Update Realm") @DisplayName("Update Realm")
...@@ -118,13 +125,6 @@ class KeycloakRealmServiceTest { ...@@ -118,13 +125,6 @@ class KeycloakRealmServiceTest {
verify(mapper).update(realmRepresentation, REALM); verify(mapper).update(realmRepresentation, REALM);
} }
@Test
void shouldCallAddOrUpdateRealmRoles() {
service.updateRealm(realmRepresentation, REALM);
verify(service).addOrUpdateRealmRoles(REALM, realmRepresentation.getRealm());
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment