From 3514d5cd782e9c32ec22c9ae2cac773a23fbf342 Mon Sep 17 00:00:00 2001 From: mposolda Date: Tue, 22 Jul 2014 07:52:51 +0200 Subject: [PATCH] Fix MySQL and PostgreSQL testsuite (was caused by uncommited transaction) --- testsuite/integration/pom.xml | 7 ------- .../keycloak/testsuite/exportimport/ExportImportTest.java | 2 +- .../org/keycloak/testsuite/rule/AbstractKeycloakRule.java | 8 ++++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/testsuite/integration/pom.xml b/testsuite/integration/pom.xml index 753d9d3c40..8d7c37b290 100755 --- a/testsuite/integration/pom.xml +++ b/testsuite/integration/pom.xml @@ -402,13 +402,6 @@ keycloak-model-tests ${project.version} - - - mysql - mysql-connector-java - ${mysql.version} - - diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java index bd8a985377..c20eb76ef5 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/exportimport/ExportImportTest.java @@ -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); } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/AbstractKeycloakRule.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/AbstractKeycloakRule.java index 149a6388c6..70e3694ab6 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/AbstractKeycloakRule.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/AbstractKeycloakRule.java @@ -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(); }