Fix app-server addHttpListener failure

This commit is contained in:
Michal Hajas 2021-12-17 13:53:00 +01:00 committed by Stian Thorgersen
parent 4dd58ebde7
commit 30cef7aa68
2 changed files with 21 additions and 2 deletions

View file

@ -58,7 +58,7 @@ import java.util.Set;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors; 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.reloadOrRestartTimeoutClient;
import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.removeHttpsListener; import static org.keycloak.testsuite.arquillian.ServerTestEnricherUtil.removeHttpsListener;
import static org.keycloak.testsuite.util.ServerURLs.getAppServerContextRoot; import static org.keycloak.testsuite.util.ServerURLs.getAppServerContextRoot;
@ -250,7 +250,7 @@ public class AppServerTestEnricher {
} }
} else { } else {
removeHttpsListener(client, administration); removeHttpsListener(client, administration);
addHttpsListener(client); addHttpsListenerAppServer(client);
} }
reloadOrRestartTimeoutClient(administration); reloadOrRestartTimeoutClient(administration);

View file

@ -18,7 +18,9 @@
package org.keycloak.testsuite.arquillian; package org.keycloak.testsuite.arquillian;
import org.jboss.logging.Logger; 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.RemoveUndertowListener;
import org.wildfly.extras.creaper.commands.undertow.SslVerifyClient;
import org.wildfly.extras.creaper.commands.undertow.UndertowListenerType; import org.wildfly.extras.creaper.commands.undertow.UndertowListenerType;
import org.wildfly.extras.creaper.core.CommandFailedException; import org.wildfly.extras.creaper.core.CommandFailedException;
import org.wildfly.extras.creaper.core.online.OnlineManagementClient; 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 * Restart client after timeout for reloading
*/ */