Fix persist config values for custom components (#31862)

Closes #31858

Signed-off-by: Stephan Schrader <stephan.schrader@wallis.de>
Signed-off-by: Stephan Schrader <zstephanz@gmail.com>
Co-authored-by: Stephan Schrader <stephan.schrader@wallis.de>
This commit is contained in:
StephanSchrader 2024-08-07 14:40:30 +02:00 committed by GitHub
parent acbbfde4ab
commit 4d64092119
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -1058,7 +1058,7 @@ public class RepresentationToModel {
Set<String> keys = new HashSet<>(rep.getConfig().keySet());
for (String k : keys) {
if (!internal && !providerConfiguration.containsKey(k)) {
break;
continue;
}
List<String> values = rep.getConfig().get(k);

View file

@ -93,7 +93,7 @@ public class ComponentsTest extends AbstractAdminTest {
public void testConcurrencyWithoutChildren() throws InterruptedException {
testConcurrency((s, i) -> s.submit(new CreateAndDeleteComponent(s, i)));
// Data consistency is not guaranteed with concurrent access to entities in map store.
// Data consistency is not guaranteed with concurrent access to entities in map store.
// For details see https://issues.redhat.com/browse/KEYCLOAK-17586
// The reason that this test remains here is to test whether it finishes in time (we need to test whether there is no slowness).
// assertThat(realm.components().query(realm.toRepresentation().getId(), TestProvider.class.getName()), Matchers.hasSize(0));
@ -103,7 +103,7 @@ public class ComponentsTest extends AbstractAdminTest {
public void testConcurrencyWithChildren() throws InterruptedException {
testConcurrency((s, i) -> s.submit(new CreateAndDeleteComponentWithFlatChildren(s, i)));
// Data consistency is not guaranteed with concurrent access to entities in map store.
// Data consistency is not guaranteed with concurrent access to entities in map store.
// For details see https://issues.redhat.com/browse/KEYCLOAK-17586
// The reason that this test remains here is to test whether it finishes in time (we need to test whether there is no slowness).
// assertThat(realm.components().query(realm.toRepresentation().getId(), TestProvider.class.getName()), Matchers.hasSize(0));
@ -229,6 +229,9 @@ public class ComponentsTest extends AbstractAdminTest {
// Check value updated
returned.getConfig().putSingle("val1", "one-updated");
// send a key / value which not contained in the original component config
returned.getConfig().putSingle("not-a-config-key", "ten");
// Check null deletes property
returned.getConfig().putSingle("val2", null);
@ -442,7 +445,7 @@ public class ComponentsTest extends AbstractAdminTest {
ComponentRepresentation rep = createComponentRepresentation("test-" + i);
rep.getConfig().putSingle("required", "required-value");
rep.setParentId(this.realm.toRepresentation().getId());
String id = createComponent(this.realm, rep);
assertThat(id, Matchers.notNullValue());