Skip to content

Commit

Permalink
KEYCLOAK-2898 Fix GroupMappersTest on wildfly. Clearing AssertEvents …
Browse files Browse the repository at this point in the history
…events queue before test instead of after
  • Loading branch information
mposolda committed Apr 26, 2016
1 parent 4433a05 commit 225523f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Expand Up @@ -133,7 +133,7 @@ public void beforeAbstractKeycloakTest() throws Exception {
MASTER, ADMIN, ADMIN, Constants.ADMIN_CLI_CLIENT_ID);
deleteMeOAuthClient = new DeleteMeOAuthClient(AuthServerTestEnricher.getAuthServerContextRoot() + "/auth");

testingClient = KeycloakTestingClient.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + "/auth");
getTestingClient();

adminUser = createAdminUserRepresentation();

Expand Down Expand Up @@ -188,6 +188,13 @@ public void setDefaultPageUriParameters() {
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() {
Expand Down
Expand Up @@ -63,12 +63,9 @@ public Statement apply(final Statement base, org.junit.runner.Description descri
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
base.evaluate();
} finally {
// TODO Test should fail if there are leftover events
context.testingClient.testing().clearQueue();
}
context.getTestingClient().testing().clearQueue();
base.evaluate();
// TODO Test should fail if there are leftover events
}
};
}
Expand Down
Expand Up @@ -109,7 +109,6 @@ private ClientRepresentation getClientByAlias(RealmRepresentation testRealmRep,
@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);
Expand Down

0 comments on commit 225523f

Please sign in to comment.