Merge pull request #3430 from stianst/KEYCLOAK-3819
KEYCLOAK-3819 Add support to change name of components
This commit is contained in:
commit
21459d0f43
2 changed files with 22 additions and 0 deletions
|
@ -1746,6 +1746,10 @@ public class RepresentationToModel {
|
|||
}
|
||||
|
||||
public static void updateComponent(KeycloakSession session, ComponentRepresentation rep, ComponentModel component, boolean internal) {
|
||||
if (rep.getName() != null) {
|
||||
component.setName(rep.getName());
|
||||
}
|
||||
|
||||
if (rep.getParentId() != null) {
|
||||
component.setParentId(rep.getParentId());
|
||||
}
|
||||
|
|
|
@ -144,6 +144,24 @@ public class ComponentsTest extends AbstractAdminTest {
|
|||
assertEquals(1, returned.getConfig().size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRename() {
|
||||
ComponentRepresentation rep = createComponentRepresentation("mycomponent");
|
||||
rep.getConfig().addFirst("required", "foo");
|
||||
|
||||
String id = createComponent(rep);
|
||||
ComponentRepresentation returned = components.component(id).toRepresentation();
|
||||
assertEquals("mycomponent", returned.getName());
|
||||
|
||||
rep.setName("myupdatedcomponent");
|
||||
|
||||
components.component(id).update(rep);
|
||||
|
||||
returned = components.component(id).toRepresentation();
|
||||
assertEquals("myupdatedcomponent", returned.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecretConfig() throws Exception {
|
||||
ComponentRepresentation rep = createComponentRepresentation("mycomponent");
|
||||
|
|
Loading…
Reference in a new issue