Fix MySQL and PostgreSQL testsuite (was caused by uncommited transaction)
This commit is contained in:
parent
b3b46339a4
commit
3514d5cd78
3 changed files with 7 additions and 10 deletions
|
@ -402,13 +402,6 @@
|
|||
<artifactId>keycloak-model-tests</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -363,7 +363,7 @@ public class ExportImportTest {
|
|||
private void pushProperty(String name, String value) {
|
||||
String currentValue = System.getProperty(name);
|
||||
if (currentValue != null) {
|
||||
previousValues.put(name, value);
|
||||
previousValues.put(name, currentValue);
|
||||
}
|
||||
System.setProperty(name, value);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ public abstract class AbstractKeycloakRule extends ExternalResource {
|
|||
try {
|
||||
RealmModel realmByName = session.realms().getRealmByName(realm);
|
||||
UserModel user = session.users().getUserByUsername(name, realmByName);
|
||||
return user != null ? ModelToRepresentation.toRepresentation(user) : null;
|
||||
UserRepresentation userRep = user != null ? ModelToRepresentation.toRepresentation(user) : null;
|
||||
session.getTransaction().commit();
|
||||
return userRep;
|
||||
} finally {
|
||||
session.close();
|
||||
}
|
||||
|
@ -56,7 +58,9 @@ public abstract class AbstractKeycloakRule extends ExternalResource {
|
|||
session.getTransaction().begin();
|
||||
try {
|
||||
RealmModel realmByName = session.realms().getRealmByName(realm);
|
||||
return ModelToRepresentation.toRepresentation(session.users().getUserById(id, realmByName));
|
||||
UserRepresentation userRep = ModelToRepresentation.toRepresentation(session.users().getUserById(id, realmByName));
|
||||
session.getTransaction().commit();
|
||||
return userRep;
|
||||
} finally {
|
||||
session.close();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue