Most create methods in the admin java lib will return a result object. You
need to call close on this to release the underlying http connection. This
could be the cause.
On 6 February 2017 at 08:33, Rodel Talampas <rodel.talampas(a)helixleisure.com
Hi All,
Need help on the following scenario.
Been doing some POC for our keycloak user management project and having
problems passing my unit test as when I create 3 level subgroups, my
Keycloak Server hangs.
Sample Junit Test code:
======================================================
createSubGroups(
keycloak, "REALM1", CASHIER_GROUP,
"CLIENT_1");
createSubGroups(
keycloak, "REALM1", DUTY_MANAGER_GROUP,
"CLIENT_1");
createSubGroups(
keycloak, "REALM1", DUTY_MANAGER_GROUP,
"CLIENT_2");
createSubGroups(
keycloak, "REALM1", CASHIER_GROUP,
"CLIENT_2");
====================================
private static void createSubGroups(Keycloak keycloak, String realmName,
String groupName,
String realmClient){
GroupRepresentation parentSub = null;
boolean found = false;
for (GroupRepresentation group: keycloak.realm(realmName).
groups().groups()){
for (GroupRepresentation sub:
group.getSubGroups()){
if (sub.getName().equals(groupName))
{
parentSub = sub;
found = true;
break;
}
}
if (found) break;
}
GroupResource parentSubResource =
keycloak.realm(realmName).groups().group(parentSub.getId());
GroupRepresentation subGroup1 = new GroupRepresentation();
subGroup1.setName(groupName + "-" + realmClient);
subGroup1.setPath("/Group_1/" + groupName);
parentSubResource.subGroup(subGroup1);
}
========== Target Output Below ======
Groups
Group_1
DUTY_MANAGER
DUTY_MANAGER_Client_1
DUTY_MANAGER_Client_2
CASHIER
CASHIER_Client_1
CASHIER_Client_2
=================================
My code will only work properly for the first 2 calls of the method. On
the 3rd call, it will somehow hang on the loop.
Am not able to debug nor step through in Junit.
It will only produce the following:
Groups
Group_1
DUTY_MANAGER
DUTY_MANAGER_Client_1
CASHIER
CASHIER_Client_1
I also tried of instead using a loop I use the getGroupByPath from the
realmResource but still the same issue.
The only thing left for me is to call the Restful Service directly from my
code.
Any suggestions will be very much appreciated.
Thanks
Rodel
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user