diff --git a/.env b/.env
index 5e5dc00f2..12cdb7593 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,3 @@
# Used in docker-compose
# shellcheck disable=SC2034
-KEYCLOAK_VERSION=22.0.4
+KEYCLOAK_VERSION=23.0.1
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index c6e8d8a91..3962d46bd 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -33,6 +33,7 @@ jobs:
- KEYCLOAK_VERSION: 20.0.5
- KEYCLOAK_VERSION: 21.1.1
- KEYCLOAK_VERSION: 22.0.4
+ - KEYCLOAK_VERSION: 23.0.1
steps:
- uses: actions/checkout@v3
with:
@@ -50,6 +51,11 @@ jobs:
key: ${{ runner.os }}-maven-${{ matrix.env.KEYCLOAK_VERSION }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-${{ matrix.env.KEYCLOAK_VERSION }}
+ - name: Adapt sources for Keycloak versions < 23.0.0 (UPConfig -> String)
+ if: ${{ matrix.env.KEYCLOAK_VERSION < '23.0.0' }}
+ run: |
+ echo "JAVAX_PROFILE=-Ppre-keycloak23" >> $GITHUB_ENV
+
- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
@@ -159,6 +165,11 @@ jobs:
key: ${{ runner.os }}-${{ matrix.java }}-maven-build-pom-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ matrix.java }}-maven-build-pom
+ - name: Adapt sources for Keycloak versions < 23.0.0 (UPConfig -> String)
+ if: ${{ matrix.env.KEYCLOAK_VERSION < '23.0.0' }}
+ run: |
+ echo "JAVAX_PROFILE=-Ppre-keycloak23" >> $GITHUB_ENV
+
- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
@@ -192,6 +203,11 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-keycloak-legacy
+ - name: Adapt sources for Keycloak versions < 23.0.0 (UPConfig -> String)
+ if: ${{ matrix.env.KEYCLOAK_VERSION < '23.0.0' }}
+ run: |
+ echo "JAVAX_PROFILE=-Ppre-keycloak23" >> $GITHUB_ENV
+
- name: Adapt sources for Keycloak versions < 22.0.0 (jakarta -> javax)
if: ${{ matrix.env.KEYCLOAK_VERSION < '22.0.0' }}
run: |
diff --git a/Dockerfile b/Dockerfile
index 848c3f18b..be02aac5e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@ FROM ${BUILDER_IMAGE} AS BUILDER
WORKDIR /app/
-ARG KEYCLOAK_VERSION=22.0.4
+ARG KEYCLOAK_VERSION=23.0.1
ARG MAVEN_CLI_OPTS="-ntp -B"
COPY .mvn .mvn
diff --git a/README.md b/README.md
index b188bef0b..76c9ad924 100644
--- a/README.md
+++ b/README.md
@@ -156,7 +156,7 @@ Additionally, the tag `maven` contains the source code and compile keycloak-conf
Keycloak versions, that not official supported., e.g.:
```bash
-docker run --rm -ti -v $PWD:/config/ -eKEYCLOAK_VERSION=22.0.4 -eMAVEN_CLI_OPTS="-B -ntp -q" adorsys/keycloak-config-cli:edge-build
+docker run --rm -ti -v $PWD:/config/ -eKEYCLOAK_VERSION=23.0.1 -eMAVEN_CLI_OPTS="-B -ntp -q" adorsys/keycloak-config-cli:edge-build
```
### Docker run
diff --git a/pom.xml b/pom.xml
index dee390cf6..65ae22e1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,7 @@
UTF-8
UTF-8
- 22.0.4
+ 23.0.1
3.2.0
10.0
@@ -727,6 +727,61 @@
import jakarta
import javax
+
+ import org.keycloak.representations.userprofile.config.UPConfig;
+ ;
+
+
+ return JsonUtil.toJson\(userProfileResource.getConfiguration\(\)\);
+ return userProfileResource.getConfiguration();
+
+
+ userProfileResource.update\(JsonUtil.readValue\(newUserProfileConfiguration, UPConfig.class\)\);
+ userProfileResource.update(newUserProfileConfiguration);
+
+
+
+
+
+
+
+
+ pre-keycloak23
+
+
+
+ com.google.code.maven-replacer-plugin
+ replacer
+ ${maven-replacer.version}
+
+
+ replace-upconfig-with-string
+ generate-sources
+
+ replace
+
+
+
+
+
+ ${project.basedir}/src
+
+
+ main/java/de/adorsys/keycloak/config/repository/UserProfileRepository.java
+
+
+
+ import org.keycloak.representations.userprofile.config.UPConfig;
+ ;
+
+
+ return JsonUtil.toJson\(userProfileResource.getConfiguration\(\)\);
+ return userProfileResource.getConfiguration();
+
+
+ userProfileResource.update\(JsonUtil.readValue\(newUserProfileConfiguration, UPConfig.class\)\);
+ userProfileResource.update(newUserProfileConfiguration);
+
diff --git a/src/main/java/de/adorsys/keycloak/config/repository/GroupRepository.java b/src/main/java/de/adorsys/keycloak/config/repository/GroupRepository.java
index 7ce265ee1..32eaf0490 100644
--- a/src/main/java/de/adorsys/keycloak/config/repository/GroupRepository.java
+++ b/src/main/java/de/adorsys/keycloak/config/repository/GroupRepository.java
@@ -111,13 +111,12 @@ public void addSubGroup(String realmName, String parentGroupId, GroupRepresentat
}
public GroupRepresentation getSubGroupByName(String realmName, String parentGroupId, String name) {
- GroupRepresentation existingGroup = getResourceById(realmName, parentGroupId).toRepresentation();
-
- return existingGroup.getSubGroups()
+ GroupRepresentation subGroup = getSubGroups(realmName, parentGroupId)
.stream()
.filter(subgroup -> Objects.equals(subgroup.getName(), name))
.findFirst()
.orElse(null);
+ return subGroup;
}
public void addRealmRoles(String realmName, String groupId, List roleNames) {
@@ -239,4 +238,12 @@ private GroupResource getResourceById(String realmName, String groupId) {
.groups()
.group(groupId);
}
+
+ public List getSubGroups(String realmName, String parentGroupId) {
+ // TODO make max size configurable
+ // note this is currently the only way to populate the subgroup information
+ // The meaning of the briefRepresentation was apprently inverted by mistake in Keycloak 23.0.0
+ // see: https://github.com/keycloak/keycloak/issues/25096
+ return getResourceById(realmName, parentGroupId).getSubGroups(0, 100, true);
+ }
}
diff --git a/src/main/java/de/adorsys/keycloak/config/repository/UserProfileRepository.java b/src/main/java/de/adorsys/keycloak/config/repository/UserProfileRepository.java
index 1e16a64ce..7685ff0c9 100644
--- a/src/main/java/de/adorsys/keycloak/config/repository/UserProfileRepository.java
+++ b/src/main/java/de/adorsys/keycloak/config/repository/UserProfileRepository.java
@@ -23,16 +23,13 @@
import de.adorsys.keycloak.config.exception.KeycloakRepositoryException;
import de.adorsys.keycloak.config.util.JsonUtil;
import org.keycloak.admin.client.resource.UserProfileResource;
+import org.keycloak.representations.userprofile.config.UPConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
-import java.util.Optional;
-
-import jakarta.ws.rs.core.Response;
-
@Component
public class UserProfileRepository {
@@ -57,35 +54,36 @@ public void updateUserProfile(String realm, boolean newUserProfileEnabled, Strin
if (!newUserProfileEnabled) {
logger.trace("UserProfile is explicitly disabled, removing configuration.");
- try (var response = userProfileResource.update(null)) {
- logger.trace("UserProfile configuration removed.");
- }
- return;
+ userProfileResource.update(null);
+ logger.trace("UserProfile configuration removed.");
}
var realmAttributes = realmRepository.get(realm).getAttributesOrEmpty();
- var currentUserProfileConfiguration = Optional.ofNullable(userProfileResource.getConfiguration()).orElse("");
+ var currentUserProfileConfiguration = getUserProfileConfiguration(userProfileResource);
if (!StringUtils.hasText(currentUserProfileConfiguration)) {
logger.warn("UserProfile is enabled, but no configuration string provided.");
return;
}
- var currentUserProfileEnabled = Boolean.parseBoolean(realmAttributes.getOrDefault(REALM_ATTRIBUTES_USER_PROFILE_ENABLED_STRING, "false"));
+ var currentUserProfileEnabled =
+ Boolean.parseBoolean(realmAttributes.getOrDefault(REALM_ATTRIBUTES_USER_PROFILE_ENABLED_STRING, "false"));
+
if (!currentUserProfileEnabled) {
logger.warn("UserProfile enabled attribute in realm differs from configuration. "
+ "This is strange, because the attribute import should have done that already.");
}
var userProfileConfigChanged = hasUserProfileConfigurationChanged(newUserProfileConfiguration, currentUserProfileConfiguration);
+
if (!userProfileConfigChanged) {
logger.trace("UserProfile did not change, skipping update.");
return;
}
- try (var updateUserProfileResponse = userProfileResource.update(newUserProfileConfiguration)) {
- if (!updateUserProfileResponse.getStatusInfo().equals(Response.Status.OK)) {
- throw new KeycloakRepositoryException("Could not update UserProfile Definition");
- }
+ try {
+ resolveUserProfileUpdate(userProfileResource, newUserProfileConfiguration);
+ } catch (Exception ex) {
+ throw new KeycloakRepositoryException("Could not update UserProfile Definition", ex);
}
logger.trace("UserProfile updated.");
@@ -97,6 +95,14 @@ private boolean hasUserProfileConfigurationChanged(String newUserProfileConfigur
return !currentValue.equals(newValue);
}
+ private String getUserProfileConfiguration(UserProfileResource userProfileResource) {
+ return JsonUtil.toJson(userProfileResource.getConfiguration());
+ }
+
+ private void resolveUserProfileUpdate(UserProfileResource userProfileResource, String newUserProfileConfiguration) {
+ userProfileResource.update(JsonUtil.readValue(newUserProfileConfiguration, UPConfig.class));
+ }
+
private UserProfileResource getResource(String realmName) {
return this.realmRepository.getResource(realmName).users().userProfile();
}
diff --git a/src/main/java/de/adorsys/keycloak/config/service/GroupImportService.java b/src/main/java/de/adorsys/keycloak/config/service/GroupImportService.java
index c8334e8f8..5045a3b73 100644
--- a/src/main/java/de/adorsys/keycloak/config/service/GroupImportService.java
+++ b/src/main/java/de/adorsys/keycloak/config/service/GroupImportService.java
@@ -29,6 +29,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.Consumer;
@@ -77,18 +78,44 @@ private void deleteGroupsMissingInImport(
List importedGroups,
List existingGroups
) {
- Set importedGroupNames = importedGroups.stream()
- .map(GroupRepresentation::getName)
- .collect(Collectors.toSet());
+ Map groupPathMap = new HashMap<>();
+ for (GroupRepresentation groupRep : importedGroups) {
+ buildGroupPathLookupMap(groupPathMap, groupRep, "/");
+ }
for (GroupRepresentation existingGroup : existingGroups) {
- if (importedGroupNames.contains(existingGroup.getName())) continue;
+ if (groupPathMap.containsKey("/" + existingGroup.getName())) {
+ if (existingGroup.getSubGroupCount() > 0) {
+ tryRecursivelyDeletingDanglingSubGroups(groupPathMap, realmName, existingGroup.getId());
+ }
+ continue;
+ }
logger.debug("Delete group '{}' in realm '{}'", existingGroup.getName(), realmName);
groupRepository.deleteGroup(realmName, existingGroup.getId());
}
}
+ private void tryRecursivelyDeletingDanglingSubGroups(Map groupPathMap, String realmName, String parentGroupId) {
+ List subGroups = groupRepository.getSubGroups(realmName, parentGroupId);
+ for (GroupRepresentation subGroup : subGroups) {
+ String path = subGroup.getPath();
+ if (!groupPathMap.containsKey(path)) {
+ groupRepository.deleteGroup(realmName, subGroup.getId());
+ } else {
+ tryRecursivelyDeletingDanglingSubGroups(groupPathMap, realmName, subGroup.getId());
+ }
+ }
+ }
+
+ private void buildGroupPathLookupMap(Map map, GroupRepresentation currentGroup, String prefix) {
+ String groupPath = prefix + currentGroup.getName();
+ map.put(groupPath, currentGroup);
+ for (GroupRepresentation subGroup : currentGroup.getSubGroups()) {
+ buildGroupPathLookupMap(map, subGroup, groupPath + "/");
+ }
+ }
+
private void createOrUpdateRealmGroup(String realmName, GroupRepresentation group) {
String groupName = group.getName();
@@ -114,6 +141,10 @@ private void createGroup(String realmName, GroupRepresentation group) {
}
private void addRealmRoles(String realmName, GroupRepresentation existingGroup) {
+ if (existingGroup == null) {
+ return;
+ }
+
List realmRoles = existingGroup.getRealmRoles();
if (realmRoles != null && !realmRoles.isEmpty()) {
@@ -122,6 +153,10 @@ private void addRealmRoles(String realmName, GroupRepresentation existingGroup)
}
private void addClientRoles(String realmName, GroupRepresentation existingGroup) {
+ if (existingGroup == null) {
+ return;
+ }
+
Map> existingClientRoles = existingGroup.getClientRoles();
String groupId = existingGroup.getId();
@@ -136,6 +171,10 @@ private void addClientRoles(String realmName, GroupRepresentation existingGroup)
}
private void addSubGroups(String realmName, GroupRepresentation existingGroup) {
+ if (existingGroup == null) {
+ return;
+ }
+
List subGroups = existingGroup.getSubGroups();
String groupId = existingGroup.getId();
@@ -243,26 +282,32 @@ private void updateGroupRealmRoles(String realmName, String groupId, List estimateRealmRolesToRemove(List realmRoles, List existingRealmRolesNames) {
- List realmRoleNamesToRemove = new ArrayList<>();
+ if (existingRealmRolesNames == null) {
+ return Collections.emptyList();
+ }
+
+ List realmRoleNamesToRemove = new ArrayList<>();
for (String existingRealmRolesName : existingRealmRolesNames) {
if (!realmRoles.contains(existingRealmRolesName)) {
realmRoleNamesToRemove.add(existingRealmRolesName);
}
}
-
return realmRoleNamesToRemove;
}
private List estimateRealmRolesToAdd(List realmRoles, List existingRealmRolesNames) {
- List realmRoleNamesToAdd = new ArrayList<>();
+ if (existingRealmRolesNames == null) {
+ return realmRoles;
+ }
+
+ List realmRoleNamesToAdd = new ArrayList<>();
for (String realmRoleName : realmRoles) {
if (!existingRealmRolesNames.contains(realmRoleName)) {
realmRoleNamesToAdd.add(realmRoleName);
}
}
-
return realmRoleNamesToAdd;
}
@@ -285,10 +330,17 @@ private void updateClientRoles(
String clientId = clientRole.getKey();
List clientRoleNames = clientRole.getValue();
- List existingClientRoleNamesForClient = existingClientRoleNames.get(clientId);
+ List clientRoleNamesToAdd;
+ List clientRoleNamesToRemove;
- List clientRoleNamesToAdd = estimateClientRolesToAdd(existingClientRoleNamesForClient, clientRoleNames);
- List clientRoleNamesToRemove = estimateClientRolesToRemove(existingClientRoleNamesForClient, clientRoleNames);
+ if (existingClientRoleNames != null) {
+ List existingClientRoleNamesForClient = existingClientRoleNames.get(clientId);
+ clientRoleNamesToAdd = estimateClientRolesToAdd(existingClientRoleNamesForClient, clientRoleNames);
+ clientRoleNamesToRemove = estimateClientRolesToRemove(existingClientRoleNamesForClient, clientRoleNames);
+ } else {
+ clientRoleNamesToAdd = clientRoleNames;
+ clientRoleNamesToRemove = Collections.emptyList();
+ }
groupRepository.addClientRoles(realmName, groupId, clientId, clientRoleNamesToAdd);
groupRepository.removeClientRoles(realmName, groupId, clientId, clientRoleNamesToRemove);
@@ -301,6 +353,11 @@ private void deleteClientRolesMissingInImport(
Map> existingClientRoleNames,
Map> groupClientRoles
) {
+
+ if (CollectionUtils.isEmpty(existingClientRoleNames)) {
+ return;
+ }
+
for (Map.Entry> existingClientRoleNamesEntry : existingClientRoleNames.entrySet()) {
String clientId = existingClientRoleNamesEntry.getKey();
List clientRoleNames = existingClientRoleNamesEntry.getValue();
@@ -312,34 +369,37 @@ private void deleteClientRolesMissingInImport(
}
private List estimateClientRolesToRemove(List existingClientRoleNamesForClient, List clientRoleNamesFromImport) {
- List clientRoleNamesToRemove = new ArrayList<>();
- if (existingClientRoleNamesForClient != null) {
- for (String existingClientRoleNameForClient : existingClientRoleNamesForClient) {
- if (!clientRoleNamesFromImport.contains(existingClientRoleNameForClient)) {
- clientRoleNamesToRemove.add(existingClientRoleNameForClient);
- }
- }
+ if (CollectionUtils.isEmpty(existingClientRoleNamesForClient)) {
+ return Collections.emptyList();
}
+ List clientRoleNamesToRemove = new ArrayList<>();
+ for (String existingClientRoleNameForClient : existingClientRoleNamesForClient) {
+ if (!clientRoleNamesFromImport.contains(existingClientRoleNameForClient)) {
+ clientRoleNamesToRemove.add(existingClientRoleNameForClient);
+ }
+ }
return clientRoleNamesToRemove;
}
private List estimateClientRolesToAdd(List existingClientRoleNamesForClient, List clientRoleNamesFromImport) {
- List clientRoleNamesToAdd = new ArrayList<>();
+ if (CollectionUtils.isEmpty(existingClientRoleNamesForClient)) {
+ return clientRoleNamesFromImport;
+ }
+
+ List clientRoleNamesToAdd = new ArrayList<>();
for (String clientRoleName : clientRoleNamesFromImport) {
- if (existingClientRoleNamesForClient == null || !existingClientRoleNamesForClient.contains(clientRoleName)) {
+ if (!existingClientRoleNamesForClient.contains(clientRoleName)) {
clientRoleNamesToAdd.add(clientRoleName);
}
}
-
return clientRoleNamesToAdd;
}
private void updateSubGroups(String realmName, String parentGroupId, List subGroups) {
- GroupRepresentation existingGroup = groupRepository.getGroupById(realmName, parentGroupId);
- List existingSubGroups = existingGroup.getSubGroups();
+ List existingSubGroups = groupRepository.getSubGroups(realmName, parentGroupId);
deleteAllSubGroupsMissingInImport(realmName, subGroups, existingSubGroups);
diff --git a/src/main/java/de/adorsys/keycloak/config/util/JsonUtil.java b/src/main/java/de/adorsys/keycloak/config/util/JsonUtil.java
index fd3087189..f7d289e93 100644
--- a/src/main/java/de/adorsys/keycloak/config/util/JsonUtil.java
+++ b/src/main/java/de/adorsys/keycloak/config/util/JsonUtil.java
@@ -70,4 +70,12 @@ private static JsonNode fromJsonAsNode(String value) {
throw new ImportProcessingException(e);
}
}
+
+ public static T readValue(String value, Class type) {
+ try {
+ return value == null ? null : objectMapper.readValue(value, type);
+ } catch (JsonProcessingException e) {
+ throw new ImportProcessingException(e);
+ }
+ }
}
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index f88d18cf8..0e9250bfe 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -1,5 +1,13 @@
spring.output.ansi.enabled=ALWAYS
spring.config.import=classpath:application-debug.properties
-keycloak.url=http://localhost:8080/
-keycloak.password=admin123
-import.files.locations=contrib/example-config/moped.json
+keycloak.url=https://localhost:8444/auth
+#keycloak.url=http://localhost:8321/auth
+#keycloak.url=https://barmerid-local.id.clone.bconnect.barmer.de/auth
+keycloak.user=keycloak
+keycloak.password=Start123!
+#keycloak.password=y7c3XXTH8xYkK5ZAazsy
+#keycloak.password=DA4MV?x&x2
+#keycloak.user=keycloak-barmer
+#keycloak.password=5wWZ2ebvBujnYxA7zGjt
+#keycloak.password=r37Hj6h5XmqQS6uvP28x
+import.files.locations=/Users/jonas/IdeaProjects/bestands-idp/_realmdefinition/barmerid-local.bconnect.barmer.de.json
diff --git a/src/main/resources/application2.properties b/src/main/resources/application2.properties
new file mode 100644
index 000000000..88da78db7
--- /dev/null
+++ b/src/main/resources/application2.properties
@@ -0,0 +1,56 @@
+spring.cache.type=NONE
+spring.main.web-application-type=NONE
+spring.main.log-startup-info=true
+spring.main.banner-mode=off
+spring.main.lazy-initialization=true
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration
+
+keycloak.version=@keycloak.version@
+keycloak.login-realm=master
+keycloak.user=admin
+keycloak.client-secret=
+keycloak.grant-type=password
+keycloak.client-id=admin-cli
+keycloak.ssl-verify=false
+keycloak.connect-timeout=10s
+keycloak.read-timeout=10s
+keycloak.availability-check.enabled=false
+keycloak.availability-check.timeout=120s
+keycloak.availability-check.retry-delay=2s
+import.validate=true
+import.parallel=false
+import.files.excludes=""
+import.files.include-hidden-files=false
+import.cache.enabled=true
+import.cache.key=default
+import.var-substitution.enabled=true
+import.var-substitution.nested=true
+import.var-substitution.undefined-is-error=true
+import.var-substitution.prefix=$(
+import.var-substitution.suffix=)
+import.remote-state.enabled=false
+# For security reasons, change this value if you want to encrypt the state
+import.remote-state.encryption-salt=2B521C795FBE2F2425DB150CD3700BA9
+import.behaviors.remove-default-role-from-user=false
+import.behaviors.skip-attributes-for-federated-user=false
+import.behaviors.sync-user-federation=false
+import.managed.authentication-flow=full
+import.managed.group=full
+import.managed.required-action=full
+import.managed.client-scope=full
+import.managed.scope-mapping=full
+import.managed.client-scope-mapping=full
+import.managed.component=full
+import.managed.sub-component=full
+import.managed.identity-provider=full
+import.managed.identity-provider-mapper=full
+import.managed.role=full
+import.managed.client=full
+import.managed.client-authorization-resources=full
+import.managed.client-authorization-policies=full
+import.managed.client-authorization-scopes=full
+
+logging.group.http=org.apache.http.wire
+logging.group.realm-config=de.adorsys.keycloak.config.provider.KeycloakImportProvider
+logging.group.keycloak-config-cli=de.adorsys.keycloak.config.service,de.adorsys.keycloak.config.KeycloakConfigRunner,de.adorsys.keycloak.config.provider.KeycloakProvider
+logging.group.kcc=de.adorsys.keycloak.config.service,de.adorsys.keycloak.config.KeycloakConfigRunner,de.adorsys.keycloak.config.provider.KeycloakProvider
diff --git a/src/test/java/de/adorsys/keycloak/config/service/ImportGroupsIT.java b/src/test/java/de/adorsys/keycloak/config/service/ImportGroupsIT.java
index d6172a62d..456e07ea6 100644
--- a/src/test/java/de/adorsys/keycloak/config/service/ImportGroupsIT.java
+++ b/src/test/java/de/adorsys/keycloak/config/service/ImportGroupsIT.java
@@ -22,15 +22,19 @@
import de.adorsys.keycloak.config.AbstractImportIT;
import de.adorsys.keycloak.config.exception.KeycloakRepositoryException;
+import de.adorsys.keycloak.config.util.VersionUtil;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
+import org.keycloak.admin.client.resource.GroupResource;
import org.keycloak.admin.client.resource.GroupsResource;
import org.keycloak.representations.idm.GroupRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -60,12 +64,36 @@ void shouldCreateRealmWithGroups() throws IOException {
assertThat("name not equal", createdGroup.getName(), is("My Group"));
assertThat("path not equal", createdGroup.getPath(), is("/My Group"));
- assertThat("attributes is null", createdGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", createdGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles not null", createdGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(createdGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(createdGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(createdGroup.getClientRoles());
assertThat("subgroups not empty", createdGroup.getSubGroups(), hasSize(0));
}
+ private void assertThatGroupAttributesAreEmpty(Map> attributes) {
+ if (VersionUtil.gt(KEYCLOAK_VERSION, "22")) {
+ assertThat("attributes is null", attributes, is(nullValue()));
+ } else {
+ assertThat("attributes is null", attributes, aMapWithSize(0));
+ }
+ }
+
+ private void assertThatGroupRealmRolesAreEmpty(List realmRoles) {
+ if (VersionUtil.gt(KEYCLOAK_VERSION, "22")) {
+ assertThat("realm roles is null", realmRoles, is(nullValue()));
+ } else {
+ assertThat("realm roles is null", realmRoles, hasSize(0));
+ }
+ }
+
+ private void assertThatGroupClientRolesAreEmpty(Map> clientRoles) {
+ if (VersionUtil.gt(KEYCLOAK_VERSION, "22")) {
+ assertThat("client roles not null", clientRoles, is(nullValue()));
+ } else {
+ assertThat("client roles not null", clientRoles, aMapWithSize(0));
+ }
+ }
+
@Test
@Order(1)
void shouldUpdateRealmAddGroup() throws IOException {
@@ -79,18 +107,18 @@ void shouldUpdateRealmAddGroup() throws IOException {
assertThat("name not equal", existingGroup.getName(), is("My Group"));
assertThat("path not equal", existingGroup.getPath(), is("/My Group"));
- assertThat("attributes is null", existingGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", existingGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", existingGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(existingGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(existingGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(existingGroup.getClientRoles());
assertThat("subgroups is null", existingGroup.getSubGroups(), hasSize(0));
GroupRepresentation addedGroup = loadGroup("/My Added Group");
assertThat("name not equal", addedGroup.getName(), is("My Added Group"));
assertThat("path not equal", addedGroup.getPath(), is("/My Added Group"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), hasSize(0));
}
@@ -111,8 +139,8 @@ void shouldUpdateRealmAddGroupWithAttribute() throws IOException {
assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes is null", addedGroup.getAttributes(), hasEntry(is("my attribute"), containsInAnyOrder("my attribute value")));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), hasSize(0));
}
@@ -129,9 +157,9 @@ void shouldUpdateRealmAddGroupWithRealmRole() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with realm role"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with realm role"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
assertThat("realm roles is null", addedGroup.getRealmRoles(), contains("my_realm_role"));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), hasSize(0));
}
@@ -148,8 +176,8 @@ void shouldUpdateRealmAddGroupWithClientRole() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with client role"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with client role"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", addedGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role")));
@@ -170,9 +198,9 @@ void shouldUpdateRealmAddGroupWithSubGroup() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with subgroup"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with subgroup"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), notNullValue());
assertThat("subgroups is empty", addedGroup.getSubGroups(), hasSize(1));
@@ -180,9 +208,9 @@ void shouldUpdateRealmAddGroupWithSubGroup() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/Group with subgroup/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -199,9 +227,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithRealmRole() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with subgroup with realm role"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with subgroup with realm role"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), notNullValue());
assertThat("subgroups is empty", addedGroup.getSubGroups(), hasSize(1));
@@ -209,9 +237,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithRealmRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/Group with subgroup with realm role/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), contains("my_second_realm_role"));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -228,9 +256,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithClientRole() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with subgroup with client role"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with subgroup with client role"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
assertThat("subgroups is null", addedGroup.getSubGroups(), notNullValue());
assertThat("subgroups is empty", addedGroup.getSubGroups(), hasSize(1));
@@ -238,8 +266,8 @@ void shouldUpdateRealmAddGroupWithSubGroupWithClientRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/Group with subgroup with client role/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(1));
assertThat("subgroup's client roles is null", subGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_second_client_role")));
@@ -260,9 +288,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithSubGroup() throws IOException {
assertThat("name not equal", addedGroup.getName(), is("Group with subgroup with subgroup"));
assertThat("path not equal", addedGroup.getPath(), is("/Group with subgroup with subgroup"));
- assertThat("attributes is null", addedGroup.getAttributes(), aMapWithSize(0));
- assertThat("realm roles is null", addedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", addedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(addedGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(addedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(addedGroup.getClientRoles());
List subGroups = addedGroup.getSubGroups();
assertThat("subgroups is null", subGroups, notNullValue());
@@ -272,9 +300,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithSubGroup() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/Group with subgroup with subgroup/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
List innerSubGroups = subGroup.getSubGroups();
assertThat("subgroup's subgroups is null", innerSubGroups, hasSize(1));
@@ -283,9 +311,9 @@ void shouldUpdateRealmAddGroupWithSubGroupWithSubGroup() throws IOException {
assertThat("subgroup is null", innerSubGroup, notNullValue());
assertThat("subgroup's name not equal", innerSubGroup.getName(), is("My Inner SubGroup"));
assertThat("subgroup's path not equal", innerSubGroup.getPath(), is("/Group with subgroup with subgroup/My SubGroup/My Inner SubGroup"));
- assertThat("subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
}
@Test
@@ -304,8 +332,8 @@ void shouldUpdateRealmUpdateGroupAddAttribute() throws IOException {
assertThat("attributes is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes is null", updatedGroup.getAttributes(), hasEntry(is("my added attribute"), containsInAnyOrder("my added attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
- assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(updatedGroup.getClientRoles());
assertThat("subgroups not empty", updatedGroup.getSubGroups(), hasSize(0));
}
@@ -326,7 +354,7 @@ void shouldUpdateRealmUpdateGroupAddRealmRole() throws IOException {
assertThat("attributes is null", updatedGroup.getAttributes(), hasEntry(is("my added attribute"), containsInAnyOrder("my added attribute value")));
assertThat("realm roles is null", updatedGroup.getRealmRoles(), contains("my_realm_role"));
- assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(updatedGroup.getClientRoles());
assertThat("subgroups not empty", updatedGroup.getSubGroups(), hasSize(0));
}
@@ -377,9 +405,9 @@ void shouldUpdateRealmUpdateGroupAddSubgroup() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -411,9 +439,9 @@ void shouldUpdateRealmUpdateGroupAddSecondSubgroup() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
GroupRepresentation sub2ndGroup = subGroups.stream()
@@ -423,9 +451,9 @@ void shouldUpdateRealmUpdateGroupAddSecondSubgroup() throws IOException {
assertThat("subgroup is null", sub2ndGroup, notNullValue());
assertThat("subgroup's name not equal", sub2ndGroup.getName(), is("My 2nd SubGroup"));
assertThat("subgroup's path not equal", sub2ndGroup.getPath(), is("/My Group/My 2nd SubGroup"));
- assertThat("subgroup's attributes is null", sub2ndGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", sub2ndGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", sub2ndGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(sub2ndGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(sub2ndGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(sub2ndGroup.getClientRoles());
assertThat("subgroup's subgroups is null", sub2ndGroup.getSubGroups(), hasSize(0));
}
@@ -457,9 +485,9 @@ void shouldUpdateRealmUpdateGroupRemoveAndAddSecondSubgroup() throws IOException
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
GroupRepresentation sub2ndGroup = subGroups.stream()
@@ -469,9 +497,9 @@ void shouldUpdateRealmUpdateGroupRemoveAndAddSecondSubgroup() throws IOException
assertThat("subgroup is null", sub2ndGroup, notNullValue());
assertThat("subgroup's name not equal", sub2ndGroup.getName(), is("My other 2nd SubGroup"));
assertThat("subgroup's path not equal", sub2ndGroup.getPath(), is("/My Group/My other 2nd SubGroup"));
- assertThat("subgroup's attributes is null", sub2ndGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", sub2ndGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", sub2ndGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(sub2ndGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(sub2ndGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(sub2ndGroup.getClientRoles());
assertThat("subgroup's subgroups is null", sub2ndGroup.getSubGroups(), hasSize(0));
}
@@ -501,9 +529,9 @@ void shouldUpdateRealmUpdateGroupAddSecondAttributeValue() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -534,9 +562,9 @@ void shouldUpdateRealmUpdateGroupAddSecondAttribute() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -567,9 +595,9 @@ void shouldUpdateRealmUpdateGroupChangeAttributeValue() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -601,9 +629,9 @@ void shouldUpdateRealmUpdateGroupChangeAttributeKey() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -634,9 +662,9 @@ void shouldUpdateRealmUpdateGroupDeleteAttribute() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -667,9 +695,9 @@ void shouldUpdateRealmUpdateGroupDeleteAttributeValue() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -699,9 +727,9 @@ void shouldUpdateRealmUpdateGroupAddSecondRealmRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -732,9 +760,9 @@ void shouldUpdateRealmUpdateGroupDeleteRealmRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -752,7 +780,7 @@ void shouldUpdateRealmUpdateGroupDeleteLastRealmRole() throws IOException {
assertThat("path not equal", updatedGroup.getPath(), is("/My Group"));
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(), hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role")));
@@ -763,9 +791,9 @@ void shouldUpdateRealmUpdateGroupDeleteLastRealmRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -785,7 +813,7 @@ void shouldUpdateRealmUpdateGroupAddSecondClientRole() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_client_role", "my_second_client_role")));
@@ -797,9 +825,9 @@ void shouldUpdateRealmUpdateGroupAddSecondClientRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -819,7 +847,7 @@ void shouldUpdateRealmUpdateGroupRemoveClientRole() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_second_client_role")));
@@ -830,9 +858,9 @@ void shouldUpdateRealmUpdateGroupRemoveClientRole() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -852,7 +880,7 @@ void shouldUpdateRealmUpdateGroupAddClientRolesFromSecondClient() throws IOExcep
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(2));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("moped-client"), containsInAnyOrder("my_second_client_role")));
@@ -865,9 +893,9 @@ void shouldUpdateRealmUpdateGroupAddClientRolesFromSecondClient() throws IOExcep
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -887,7 +915,7 @@ void shouldUpdateRealmUpdateGroupRemoveClient() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -899,9 +927,9 @@ void shouldUpdateRealmUpdateGroupRemoveClient() throws IOException {
assertThat("subgroup is null", subGroup, notNullValue());
assertThat("subgroup's name not equal", subGroup.getName(), is("My SubGroup"));
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
- assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(subGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -921,7 +949,7 @@ void shouldUpdateRealmUpdateGroupAddAttributeToSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -938,8 +966,8 @@ void shouldUpdateRealmUpdateGroupAddAttributeToSubGroup() throws IOException {
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(1));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my subgroup attribute"), containsInAnyOrder("my subgroup attribute value")));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -959,7 +987,7 @@ void shouldUpdateRealmUpdateGroupAddAttributeValueToSubGroup() throws IOExceptio
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -972,8 +1000,8 @@ void shouldUpdateRealmUpdateGroupAddAttributeValueToSubGroup() throws IOExceptio
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(1));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my subgroup attribute"), containsInAnyOrder("my subgroup attribute value", "my subgroup attribute second value")));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -993,7 +1021,7 @@ void shouldUpdateRealmUpdateGroupAddSecondAttributeToSubGroup() throws IOExcepti
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1009,8 +1037,8 @@ void shouldUpdateRealmUpdateGroupAddSecondAttributeToSubGroup() throws IOExcepti
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my subgroup attribute"), containsInAnyOrder("my subgroup attribute value", "my subgroup attribute second value")));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my second subgroup attribute"), containsInAnyOrder("my second subgroup attribute value", "my second subgroup attribute second value")));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1029,7 +1057,7 @@ void shouldUpdateRealmUpdateGroupRemoveAttributeValueFromSubGroup() throws IOExc
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1043,8 +1071,8 @@ void shouldUpdateRealmUpdateGroupRemoveAttributeValueFromSubGroup() throws IOExc
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(2));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my subgroup attribute"), containsInAnyOrder("my subgroup attribute second value")));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my second subgroup attribute"), containsInAnyOrder("my second subgroup attribute value", "my second subgroup attribute second value")));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1064,7 +1092,7 @@ void shouldUpdateRealmUpdateGroupRemoveAttributeFromSubGroup() throws IOExceptio
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1077,8 +1105,8 @@ void shouldUpdateRealmUpdateGroupRemoveAttributeFromSubGroup() throws IOExceptio
assertThat("subgroup's path not equal", subGroup.getPath(), is("/My Group/My SubGroup"));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(1));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my second subgroup attribute"), containsInAnyOrder("my second subgroup attribute value", "my second subgroup attribute second value")));
- assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupRealmRolesAreEmpty(subGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1098,7 +1126,7 @@ void shouldUpdateRealmUpdateGroupAddRealmRoleToSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1117,7 +1145,7 @@ void shouldUpdateRealmUpdateGroupAddRealmRoleToSubGroup() throws IOException {
assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), contains("my_realm_role"));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1137,7 +1165,7 @@ void shouldUpdateRealmUpdateGroupAddSecondRealmRoleToSubGroup() throws IOExcepti
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1151,7 +1179,7 @@ void shouldUpdateRealmUpdateGroupAddSecondRealmRoleToSubGroup() throws IOExcepti
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(1));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my second subgroup attribute"), containsInAnyOrder("my second subgroup attribute value", "my second subgroup attribute second value")));
assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), containsInAnyOrder("my_realm_role", "my_second_realm_role"));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1171,7 +1199,7 @@ void shouldUpdateRealmUpdateGroupRemoveRealmRoleFromSubGroup() throws IOExceptio
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1185,7 +1213,7 @@ void shouldUpdateRealmUpdateGroupRemoveRealmRoleFromSubGroup() throws IOExceptio
assertThat("subgroup's attributes is null", subGroup.getAttributes(), aMapWithSize(1));
assertThat("subgroup's attributes is null", subGroup.getAttributes(), hasEntry(is("my second subgroup attribute"), containsInAnyOrder("my second subgroup attribute value", "my second subgroup attribute second value")));
assertThat("subgroup's realm roles is null", subGroup.getRealmRoles(), contains("my_second_realm_role"));
- assertThat("subgroup's client roles is null", subGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupClientRolesAreEmpty(subGroup.getClientRoles());
assertThat("subgroup's subgroups is null", subGroup.getSubGroups(), hasSize(0));
}
@@ -1205,7 +1233,7 @@ void shouldUpdateRealmUpdateGroupAddClientRoleToSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1240,7 +1268,7 @@ void shouldUpdateRealmUpdateGroupAddSecondClientRoleToSubGroup() throws IOExcept
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1275,7 +1303,7 @@ void shouldUpdateRealmUpdateGroupAddSecondClientRolesToSubGroup() throws IOExcep
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1311,7 +1339,7 @@ void shouldUpdateRealmUpdateGroupRemoveClientRoleFromSubGroup() throws IOExcepti
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1347,7 +1375,7 @@ void shouldUpdateRealmUpdateGroupRemoveClientRolesFromSubGroup() throws IOExcept
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1382,7 +1410,7 @@ void shouldUpdateRealmUpdateGroupAddSubGroupToSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1406,9 +1434,9 @@ void shouldUpdateRealmUpdateGroupAddSubGroupToSubGroup() throws IOException {
assertThat("inner subgroup is null", innerSubGroup, notNullValue());
assertThat("subgroup's name not equal", innerSubGroup.getName(), is("My inner SubGroup"));
assertThat("subgroup's path not equal", innerSubGroup.getPath(), is("/My Group/My SubGroup/My inner SubGroup"));
- assertThat("subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
}
@Test
@@ -1427,7 +1455,7 @@ void shouldUpdateRealmUpdateGroupAddSecondSubGroupToSubGroup() throws IOExceptio
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1455,9 +1483,9 @@ void shouldUpdateRealmUpdateGroupAddSecondSubGroupToSubGroup() throws IOExceptio
assertThat("inner subgroup is null", innerSubGroup, notNullValue());
assertThat("inner subgroup's name not equal", innerSubGroup.getName(), is("My inner SubGroup"));
assertThat("inner subgroup's path not equal", innerSubGroup.getPath(), is("/My Group/My SubGroup/My inner SubGroup"));
- assertThat("inner subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("inner subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("inner subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
assertThat("inner subgroup's subgroups is null", innerSubGroup.getSubGroups(), hasSize(0));
innerSubGroup = innerSubGroups.stream()
@@ -1467,9 +1495,9 @@ void shouldUpdateRealmUpdateGroupAddSecondSubGroupToSubGroup() throws IOExceptio
assertThat("inner subgroup is null", innerSubGroup, notNullValue());
assertThat("inner subgroup's name not equal", innerSubGroup.getName(), is("My second inner SubGroup"));
assertThat("inner subgroup's path not equal", innerSubGroup.getPath(), is("/My Group/My SubGroup/My second inner SubGroup"));
- assertThat("inner subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("inner subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("inner subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
assertThat("inner subgroup's subgroups is null", innerSubGroup.getSubGroups(), hasSize(0));
}
@@ -1489,7 +1517,7 @@ void shouldUpdateRealmUpdateGroupUpdateSubGroupInSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1529,10 +1557,9 @@ void shouldUpdateRealmUpdateGroupUpdateSubGroupInSubGroup() throws IOException {
assertThat("inner inner subgroup is null", innerInnerSubGroup, notNullValue());
assertThat("inner inner subgroup's name not equal", innerInnerSubGroup.getName(), is("My inner inner SubGroup"));
assertThat("inner inner subgroup's path not equal", innerInnerSubGroup.getPath(), is("/My Group/My SubGroup/My inner SubGroup/My inner inner SubGroup"));
- assertThat("inner inner subgroup's attributes is null", innerInnerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("inner inner subgroup's realm roles is null", innerInnerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("inner inner subgroup's client roles is null", innerInnerSubGroup.getClientRoles(), aMapWithSize(0));
-
+ assertThatGroupAttributesAreEmpty(innerInnerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerInnerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerInnerSubGroup.getClientRoles());
innerSubGroup = innerSubGroups.stream()
.filter(s -> Objects.equals(s.getName(), "My second inner SubGroup"))
@@ -1541,9 +1568,9 @@ void shouldUpdateRealmUpdateGroupUpdateSubGroupInSubGroup() throws IOException {
assertThat("inner subgroup is null", innerSubGroup, notNullValue());
assertThat("inner subgroup's name not equal", innerSubGroup.getName(), is("My second inner SubGroup"));
assertThat("inner subgroup's path not equal", innerSubGroup.getPath(), is("/My Group/My SubGroup/My second inner SubGroup"));
- assertThat("inner subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("inner subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("inner subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
assertThat("inner subgroup's subgroups is null", innerSubGroup.getSubGroups(), hasSize(0));
}
@@ -1563,7 +1590,7 @@ void shouldUpdateRealmUpdateGroupDeleteSubGroupInSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1591,9 +1618,9 @@ void shouldUpdateRealmUpdateGroupDeleteSubGroupInSubGroup() throws IOException {
assertThat("inner subgroup is null", innerSubGroup, notNullValue());
assertThat("inner subgroup's name not equal", innerSubGroup.getName(), is("My second inner SubGroup"));
assertThat("inner subgroup's path not equal", innerSubGroup.getPath(), is("/My Group/My SubGroup/My second inner SubGroup"));
- assertThat("inner subgroup's attributes is null", innerSubGroup.getAttributes(), aMapWithSize(0));
- assertThat("inner subgroup's realm roles is null", innerSubGroup.getRealmRoles(), hasSize(0));
- assertThat("inner subgroup's client roles is null", innerSubGroup.getClientRoles(), aMapWithSize(0));
+ assertThatGroupAttributesAreEmpty(innerSubGroup.getAttributes());
+ assertThatGroupRealmRolesAreEmpty(innerSubGroup.getRealmRoles());
+ assertThatGroupClientRolesAreEmpty(innerSubGroup.getClientRoles());
assertThat("inner subgroup's subgroups is null", innerSubGroup.getSubGroups(), hasSize(0));
}
@@ -1613,7 +1640,7 @@ void shouldUpdateRealmUpdateGroupDeleteSubGroup() throws IOException {
assertThat("attributes roles is null", updatedGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", updatedGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", updatedGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(updatedGroup.getRealmRoles());
assertThat("client roles is null", updatedGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", updatedGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1637,7 +1664,7 @@ void shouldUpdateRealmAddGroupWithSubstringOfExistingGroupName() throws IOExcept
assertThat("attributes roles is null", existingGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", existingGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", existingGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(existingGroup.getRealmRoles());
assertThat("client roles is null", existingGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", existingGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1668,7 +1695,7 @@ void shouldUpdateRealmUpdateGroupWithSubstringOfExistingGroupName() throws IOExc
assertThat("attributes roles is null", existingGroup.getAttributes(), aMapWithSize(1));
assertThat("attributes roles is null", existingGroup.getAttributes(),
hasEntry(is("my changed attribute"), containsInAnyOrder("my changed attribute value")));
- assertThat("realm roles is null", existingGroup.getRealmRoles(), hasSize(0));
+ assertThatGroupRealmRolesAreEmpty(existingGroup.getRealmRoles());
assertThat("client roles is null", existingGroup.getClientRoles(), aMapWithSize(1));
assertThat("client roles is null", existingGroup.getClientRoles(), hasEntry(is("second-moped-client"), containsInAnyOrder("my_client_role_of_second-moped-client", "my_second_client_role_of_second-moped-client")));
@@ -1715,6 +1742,10 @@ void shouldUpdateRealmDeleteAllGroups() throws IOException {
}
private GroupRepresentation loadGroup(String groupPath) {
+ return loadGroup(groupPath, true);
+ }
+
+ private GroupRepresentation loadGroup(String groupPath, boolean fetchSubGroupsRecursively) {
GroupsResource groupsResource = keycloakProvider.getInstance()
.realm(REALM_NAME)
.groups();
@@ -1726,9 +1757,24 @@ private GroupRepresentation loadGroup(String groupPath) {
.findFirst()
.orElseThrow(() -> new KeycloakRepositoryException("Can't find group '%s'.", groupPath));
- return groupsResource
- .group(groupRepresentation.getId())
+ GroupResource groupResource = groupsResource
+ .group(groupRepresentation.getId());
+ GroupRepresentation group = groupResource
.toRepresentation();
+
+ if (fetchSubGroupsRecursively) {
+ tryToFetchSubGroups(groupsResource, group);
+ }
+
+ return group;
+ }
+
+ private void tryToFetchSubGroups(GroupsResource groupsResource, GroupRepresentation currentGroup) {
+ if (currentGroup.getSubGroupCount() > 0) {
+ List subGroups = new ArrayList<>(groupsResource.group(currentGroup.getId()).getSubGroups(0, 100, true));
+ subGroups.forEach(subGroupRep -> tryToFetchSubGroups(groupsResource, subGroupRep));
+ currentGroup.setSubGroups(subGroups);
+ }
}
private Optional tryToLoadGroup(String groupPath) {
diff --git a/src/test/java/de/adorsys/keycloak/config/service/ImportUserProfileIT.java b/src/test/java/de/adorsys/keycloak/config/service/ImportUserProfileIT.java
index d7c0a407b..ff1475011 100644
--- a/src/test/java/de/adorsys/keycloak/config/service/ImportUserProfileIT.java
+++ b/src/test/java/de/adorsys/keycloak/config/service/ImportUserProfileIT.java
@@ -20,7 +20,10 @@
package de.adorsys.keycloak.config.service;
import de.adorsys.keycloak.config.AbstractImportIT;
+import de.adorsys.keycloak.config.util.JsonUtil;
+import de.adorsys.keycloak.config.util.VersionUtil;
import org.hamcrest.Matcher;
+import org.junit.Assume;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
@@ -46,6 +49,9 @@ public class ImportUserProfileIT extends AbstractImportIT {
@Order(0)
@DisabledIfSystemProperty(named = "keycloak.version", matches = "16.1.1", disabledReason = "Not working")
void shouldCreateRealmButNoUserProfileEnabled() throws IOException {
+
+ Assume.assumeTrue(VersionUtil.le(KEYCLOAK_VERSION, "23")); // this behaviour changed in Keycloak 23
+
doImport("00_ignore_realm_with_user_profile.json");
assertRealm(false);
@@ -108,6 +114,9 @@ void shouldNotUpdateRealmByRemoveProfileWhenNothingSet() throws IOException {
@Order(4)
@DisabledIfSystemProperty(named = "keycloak.version", matches = "16.1.1", disabledReason = "Not working")
void shouldUpdateRealmByRemoveProfileWhenSwitchedOff() throws IOException {
+
+ Assume.assumeTrue(VersionUtil.le(KEYCLOAK_VERSION, "23")); // this behaviour changed in Keycloak 23
+
doImport("04_update_realm_with_user_profile_switched_off.json");
assertRealm(false);
@@ -129,7 +138,7 @@ private String assertRealmHasUserProfileConfigurationStringWith(Matcher