From 0e8337ba8ea9a682f0f58425a6cc37afd9d1c46d Mon Sep 17 00:00:00 2001 From: sebastienblanc Date: Thu, 30 Mar 2017 10:51:28 +0200 Subject: [PATCH] KEYCLOAK-4691: Extract iat generator to method --- .../java/org/keycloak/helper/TestsHelper.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/misc/keycloak-test-helper/src/main/java/org/keycloak/helper/TestsHelper.java b/misc/keycloak-test-helper/src/main/java/org/keycloak/helper/TestsHelper.java index 4beb57af41..ce1443fc58 100644 --- a/misc/keycloak-test-helper/src/main/java/org/keycloak/helper/TestsHelper.java +++ b/misc/keycloak-test-helper/src/main/java/org/keycloak/helper/TestsHelper.java @@ -53,6 +53,8 @@ public class TestsHelper { public static String initialAccessCode; public static String appName; + + public static int initialAccessTokenCount = 2; protected static String clientConfiguration; @@ -184,11 +186,7 @@ public class TestsHelper { "admin-cli"); keycloak.realms().create(realmRepresentation); testRealm = realmRepresentation.getRealm(); - ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation(); - rep.setCount(2); - rep.setExpiration(100); - ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep); - initialAccessCode = initialAccess.getToken(); + generateInitialAccessToken(keycloak); return true; } @@ -205,12 +203,16 @@ public class TestsHelper { password, "admin-cli"); keycloak.realms().create(realmRepresentation); + generateInitialAccessToken(keycloak); + return true; + } + + private static void generateInitialAccessToken(Keycloak keycloak) { ClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation(); - rep.setCount(2); + rep.setCount(initialAccessTokenCount); rep.setExpiration(100); ClientInitialAccessPresentation initialAccess = keycloak.realms().realm(testRealm).clientInitialAccess().create(rep); initialAccessCode = initialAccess.getToken(); - return true; } public static boolean deleteRealm(String username, String password, String realmName) throws IOException {