KEYCLOAK-13070 UserConsentWithUserStorageModelTest failing with ModelDuplicateException
This commit is contained in:
parent
aecfe251e4
commit
695fb92241
1 changed files with 172 additions and 169 deletions
|
@ -60,6 +60,7 @@ public class ConcurrentTransactionsTest extends AbstractTestRealmKeycloakTest {
|
||||||
AtomicReference<String> clientDBIdAtomic = new AtomicReference<>();
|
AtomicReference<String> clientDBIdAtomic = new AtomicReference<>();
|
||||||
AtomicReference<Exception> exceptionHolder = new AtomicReference<>();
|
AtomicReference<Exception> exceptionHolder = new AtomicReference<>();
|
||||||
|
|
||||||
|
try {
|
||||||
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionSetup) -> {
|
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionSetup) -> {
|
||||||
|
|
||||||
RealmModel realm = sessionSetup.realms().getRealm("test");
|
RealmModel realm = sessionSetup.realms().getRealm("test");
|
||||||
|
@ -178,8 +179,10 @@ public class ConcurrentTransactionsTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
session2.sessions().removeUserSessions(realm);
|
session2.sessions().removeUserSessions(realm);
|
||||||
|
|
||||||
tearDownRealm(session2, "user1", "user2");
|
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
tearDownRealm(session, "user1", "user2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,6 +191,7 @@ public class ConcurrentTransactionsTest extends AbstractTestRealmKeycloakTest {
|
||||||
@ModelTest
|
@ModelTest
|
||||||
public void removeUserAttribute(KeycloakSession session) throws Exception {
|
public void removeUserAttribute(KeycloakSession session) throws Exception {
|
||||||
|
|
||||||
|
try {
|
||||||
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionSet) -> {
|
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionSet) -> {
|
||||||
|
|
||||||
RealmModel realm = sessionSet.realms().createRealm("original");
|
RealmModel realm = sessionSet.realms().createRealm("original");
|
||||||
|
@ -258,10 +262,9 @@ public class ConcurrentTransactionsTest extends AbstractTestRealmKeycloakTest {
|
||||||
Assert.fail("Exception happened in some of threads. Details: " + reference.get().getMessage());
|
Assert.fail("Exception happened in some of threads. Details: " + reference.get().getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionTearDown) -> {
|
tearDownRealm(session, "john", "john2");
|
||||||
tearDownRealm(sessionTearDown, "john", "john2");
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tearDownRealm(KeycloakSession session, String user1, String user2) {
|
private void tearDownRealm(KeycloakSession session, String user1, String user2) {
|
||||||
|
|
Loading…
Reference in a new issue