From 30cef7aa68d1e3d24b69c7d971e73387c34dc5fd Mon Sep 17 00:00:00 2001 From: Michal Hajas Date: Fri, 17 Dec 2021 13:53:00 +0100 Subject: [PATCH] Fix app-server addHttpListener failure --- .../arquillian/AppServerTestEnricher.java | 4 ++-- .../arquillian/ServerTestEnricherUtil.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AppServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AppServerTestEnricher.java index d7b2bb2504..8c735e2309 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AppServerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AppServerTestEnricher.java @@ -58,7 +58,7 @@ import java.util.Set; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; -import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.addHttpsListener; +import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.addHttpsListenerAppServer; import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.reloadOrRestartTimeoutClient; import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.removeHttpsListener; import static org.keycloak.testsuite.util.ServerURLs.getAppServerContextRoot; @@ -250,7 +250,7 @@ public class AppServerTestEnricher { } } else { removeHttpsListener(client, administration); - addHttpsListener(client); + addHttpsListenerAppServer(client); } reloadOrRestartTimeoutClient(administration); diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ServerTestEnricherUtil.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ServerTestEnricherUtil.java index e0d24cac5c..2cb1eceaa9 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ServerTestEnricherUtil.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ServerTestEnricherUtil.java @@ -18,7 +18,9 @@ package org.keycloak.testsuite.arquillian; import org.jboss.logging.Logger; +import org.wildfly.extras.creaper.commands.undertow.AddUndertowListener; import org.wildfly.extras.creaper.commands.undertow.RemoveUndertowListener; +import org.wildfly.extras.creaper.commands.undertow.SslVerifyClient; import org.wildfly.extras.creaper.commands.undertow.UndertowListenerType; import org.wildfly.extras.creaper.core.CommandFailedException; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; @@ -60,6 +62,23 @@ public class ServerTestEnricherUtil { } } + /** + * Add Undertow HTTPS listener for Wildfly 23 + */ + public static boolean addHttpsListenerAppServer(OnlineManagementClient client) { + try { + LOG.debug("Add Undertow HTTPS listener 'https'"); + client.apply(new AddUndertowListener.HttpsBuilder("https", "default-server", "https") + .securityRealm("UndertowRealm") + .verifyClient(SslVerifyClient.REQUESTED) + .build()); + return true; + } catch (CommandFailedException e) { + LOG.warn("Cannot add HTTPS listener 'https'"); + return false; + } + } + /** * Restart client after timeout for reloading */