From d9b95e0240b5f4e48ce2a4168e96e34cd4e063cd Mon Sep 17 00:00:00 2001 From: Lukas Hanusovsky Date: Wed, 10 May 2023 09:43:07 +0200 Subject: [PATCH] Testsuite with Undertow and OpenJDK17 - Nashorn library support. GH Actions failures - refactoring. --- .../java/org/keycloak/testsuite/AbstractKeycloakTest.java | 1 - .../custom/AbstractCustomAccountManagementTest.java | 1 + .../testsuite/account/custom/CustomAuthFlowOTPTest.java | 7 ------- .../testsuite/adapter/servlet/DemoServletsAdapterTest.java | 1 + .../org/keycloak/testsuite/admin/client/SessionTest.java | 2 ++ .../org/keycloak/testsuite/broker/SocialLoginTest.java | 1 + .../java/org/keycloak/testsuite/cookies/CookieTest.java | 6 ++++++ .../testsuite/federation/storage/UserStorageTest.java | 1 + testsuite/integration-arquillian/tests/pom.xml | 7 +++++++ 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java index dfa380e315..be240da89c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java @@ -196,7 +196,6 @@ public abstract class AbstractKeycloakTest { } oauth.init(driver); - createAppClientInRealm("test"); } public void reconnectAdminClient() throws Exception { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/AbstractCustomAccountManagementTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/AbstractCustomAccountManagementTest.java index c2dee52940..1bf6e826ba 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/AbstractCustomAccountManagementTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/AbstractCustomAccountManagementTest.java @@ -40,6 +40,7 @@ public abstract class AbstractCustomAccountManagementTest extends AbstractAccoun @Before public void beforeTest() { authMgmtResource = testRealmResource().flows(); + createAppClientInRealm(testRealmResource().toRepresentation().getRealm()); } protected AuthenticationManagementResource getAuthMgmtResource() { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/CustomAuthFlowOTPTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/CustomAuthFlowOTPTest.java index 27455f558c..14d5ff810a 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/CustomAuthFlowOTPTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/custom/CustomAuthFlowOTPTest.java @@ -17,7 +17,6 @@ package org.keycloak.testsuite.account.custom; import org.jboss.arquillian.graphene.page.Page; -import org.junit.Before; import org.junit.Test; import org.keycloak.models.AuthenticationExecutionModel.Requirement; import org.keycloak.models.utils.DefaultAuthenticationFlows; @@ -86,12 +85,6 @@ public class CustomAuthFlowOTPTest extends AbstractCustomAccountManagementTest { super.setDefaultPageUriParameters(); testLoginOneTimeCodePage.setAuthRealm(testRealmPage); } - - @Before - @Override - public void beforeTest() { - super.beforeTest(); - } private void configureRequiredActions() { //set configure TOTP as required action to test user diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/DemoServletsAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/DemoServletsAdapterTest.java index 6d50b1e610..b85c9a0ffc 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/DemoServletsAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/DemoServletsAdapterTest.java @@ -309,6 +309,7 @@ public class DemoServletsAdapterTest extends AbstractServletsAdapterTest { // set demo realm name for all tests oauth.realm(testRealmResource().toRepresentation().getRealm()); + createAppClientInRealm(testRealmResource().toRepresentation().getRealm()); } @After diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/SessionTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/SessionTest.java index 3dd1552991..0360a5103a 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/SessionTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/SessionTest.java @@ -50,6 +50,8 @@ public class SessionTest extends AbstractClientTest { assertAdminEvents.assertEvent(getRealmId(), OperationType.CREATE, AdminEventPaths.userResourcePath(testUser.getId()), ResourceType.USER); assertAdminEvents.assertEvent(getRealmId(), OperationType.ACTION, AdminEventPaths.userResetPasswordPath(testUser.getId()), ResourceType.USER); + + createAppClientInRealm(testRealmResource().toRepresentation().getRealm()); } @Override diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java index f1f3cbec72..f95d66602c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java @@ -175,6 +175,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { @Before public void beforeSocialLoginTest() { oauth.realm(REALM); + createAppClientInRealm(REALM); } @After diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java index 508541bcf1..b8fd096ce9 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cookies/CookieTest.java @@ -29,6 +29,7 @@ import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; import org.jboss.arquillian.graphene.page.Page; +import org.junit.Before; import org.junit.Test; import org.keycloak.models.Constants; import org.keycloak.representations.idm.RealmRepresentation; @@ -76,6 +77,11 @@ public class CookieTest extends AbstractKeycloakTest { @Page protected AppPage appPage; + @Before + public void beforeCookieTest() { + createAppClientInRealm("test"); + } + @Override public void addTestRealms(List testRealms) { RealmRepresentation realmRepresentation = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java index 38bdf87abb..0d95ca09e3 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java @@ -159,6 +159,7 @@ public class UserStorageTest extends AbstractAuthTest { propProviderRWId = addComponent(newPropProviderRW()); + createAppClientInRealm(testRealmResource().toRepresentation().getRealm()); } @After diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 6c25f685bb..332c4a705b 100644 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -1844,6 +1844,13 @@ compile + + + org.openjdk.nashorn + nashorn-core + ${nashorn.version} + +