Merge pull request #2745 from mposolda/master

KEYCLOAK-2898 Fix GroupMappersTest on wildfly. Clearing AssertEvents …
This commit is contained in:
Marek Posolda 2016-04-26 18:01:25 +02:00
commit ce58f00caa
3 changed files with 11 additions and 8 deletions

View file

@ -133,7 +133,7 @@ public abstract class AbstractKeycloakTest {
MASTER, ADMIN, ADMIN, Constants.ADMIN_CLI_CLIENT_ID);
deleteMeOAuthClient = new DeleteMeOAuthClient(AuthServerTestEnricher.getAuthServerContextRoot() + "/auth");
testingClient = KeycloakTestingClient.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + "/auth");
getTestingClient();
adminUser = createAdminUserRepresentation();
@ -188,6 +188,13 @@ public abstract class AbstractKeycloakTest {
loginPage.setAuthRealm(MASTER);
}
protected KeycloakTestingClient getTestingClient() {
if (testingClient == null) {
testingClient = KeycloakTestingClient.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + "/auth");
}
return testingClient;
}
public abstract void addTestRealms(List<RealmRepresentation> testRealms);
private void addTestRealms() {

View file

@ -63,12 +63,9 @@ public class AssertEvents implements TestRule {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
context.getTestingClient().testing().clearQueue();
base.evaluate();
} finally {
// TODO Test should fail if there are leftover events
context.testingClient.testing().clearQueue();
}
}
};
}

View file

@ -109,7 +109,6 @@ public class GroupMappersTest extends AbstractGroupTest {
@Test
@SuppressWarnings("unchecked")
public void testGroupMappers() throws Exception {
events.clear();
RealmResource realm = adminClient.realms().realm("test");
{
UserRepresentation user = realm.users().search("topGroupUser", -1, -1).get(0);