Merge pull request #3585 from abstractj/KEYCLOAK-4011
[KEYCLOAK-4011] - Integrity constraint error when try to delete SSSD Federation Provider
This commit is contained in:
commit
54758b800b
2 changed files with 26 additions and 6 deletions
|
@ -405,6 +405,10 @@ public class JpaUserProvider implements UserProvider, UserCredentialStore {
|
|||
.setParameter("realmId", realm.getId())
|
||||
.setParameter("link", linkId)
|
||||
.executeUpdate();
|
||||
num = em.createNamedQuery("deleteUserGroupMembershipsByRealmAndLink")
|
||||
.setParameter("realmId", realm.getId())
|
||||
.setParameter("link", linkId)
|
||||
.executeUpdate();
|
||||
num = em.createNamedQuery("deleteUsersByRealmAndLink")
|
||||
.setParameter("realmId", realm.getId())
|
||||
.setParameter("link", linkId)
|
||||
|
|
|
@ -2,27 +2,24 @@ package org.keycloak.testsuite.sssd;
|
|||
|
||||
import org.jboss.arquillian.graphene.page.Page;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
import org.keycloak.representations.idm.ComponentRepresentation;
|
||||
import org.keycloak.representations.idm.GroupRepresentation;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.representations.idm.UserFederationProviderFactoryRepresentation;
|
||||
import org.keycloak.representations.idm.UserFederationProviderRepresentation;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.keycloak.storage.UserStorageProvider;
|
||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||
import org.keycloak.testsuite.Assert;
|
||||
import org.keycloak.testsuite.AssertEvents;
|
||||
import org.keycloak.testsuite.admin.ApiUtil;
|
||||
import org.keycloak.testsuite.pages.AccountPasswordPage;
|
||||
import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
|
||||
import org.keycloak.testsuite.pages.LoginPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SSSDTest extends AbstractKeycloakTest {
|
||||
|
||||
|
@ -52,6 +49,8 @@ public class SSSDTest extends AbstractKeycloakTest {
|
|||
@Rule
|
||||
public AssertEvents events = new AssertEvents(this);
|
||||
|
||||
private String SSSDFederationID;
|
||||
|
||||
@Override
|
||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||
RealmRepresentation realm = new RealmRepresentation();
|
||||
|
@ -74,7 +73,9 @@ public class SSSDTest extends AbstractKeycloakTest {
|
|||
userFederation.setProviderType(UserStorageProvider.class.getName());
|
||||
userFederation.setProviderId(PROVIDER_NAME);
|
||||
|
||||
adminClient.realm(REALM_NAME).components().add(userFederation);
|
||||
Response response = adminClient.realm(REALM_NAME).components().add(userFederation);
|
||||
SSSDFederationID = ApiUtil.getCreatedId(response);
|
||||
response.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -120,6 +121,21 @@ public class SSSDTest extends AbstractKeycloakTest {
|
|||
testUserGroups();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSSSDFederationProvider() {
|
||||
log.debug("Testing correct password");
|
||||
|
||||
driver.navigate().to(getAccountUrl());
|
||||
Assert.assertEquals("Browser should be on login page now", "Log in to " + REALM_NAME, driver.getTitle());
|
||||
accountLoginPage.login(USERNAME, PASSWORD);
|
||||
Assert.assertTrue(profilePage.isCurrent());
|
||||
testUserGroups();
|
||||
int componentsListSize = adminClient.realm(REALM_NAME).components().query().size();
|
||||
adminClient.realm(REALM_NAME).components().component(SSSDFederationID).remove();
|
||||
Assert.assertEquals(componentsListSize - 1, adminClient.realm(REALM_NAME).components().query().size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void changeReadOnlyProfile() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in a new issue