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>
|
<artifactId>keycloak-model-tests</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>${mysql.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -363,7 +363,7 @@ public class ExportImportTest {
|
||||||
private void pushProperty(String name, String value) {
|
private void pushProperty(String name, String value) {
|
||||||
String currentValue = System.getProperty(name);
|
String currentValue = System.getProperty(name);
|
||||||
if (currentValue != null) {
|
if (currentValue != null) {
|
||||||
previousValues.put(name, value);
|
previousValues.put(name, currentValue);
|
||||||
}
|
}
|
||||||
System.setProperty(name, value);
|
System.setProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,9 @@ public abstract class AbstractKeycloakRule extends ExternalResource {
|
||||||
try {
|
try {
|
||||||
RealmModel realmByName = session.realms().getRealmByName(realm);
|
RealmModel realmByName = session.realms().getRealmByName(realm);
|
||||||
UserModel user = session.users().getUserByUsername(name, realmByName);
|
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 {
|
} finally {
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +58,9 @@ public abstract class AbstractKeycloakRule extends ExternalResource {
|
||||||
session.getTransaction().begin();
|
session.getTransaction().begin();
|
||||||
try {
|
try {
|
||||||
RealmModel realmByName = session.realms().getRealmByName(realm);
|
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 {
|
} finally {
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue