Testsuite PoC - distribution server run mode. (#31186)

Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
This commit is contained in:
Lukas Hanusovsky 2024-07-15 09:31:50 +02:00 committed by GitHub
parent 17af757662
commit 72fb64f7fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,46 @@
package org.keycloak.test.framework.server;
import org.keycloak.it.utils.RawKeycloakDistribution;
import java.util.LinkedList;
import java.util.List;
public class DistributionKeycloakTestServer implements KeycloakTestServer {
private boolean debug = false;
private boolean manualStop = true;
private boolean enableTls = false;
private boolean reCreate = false;
private boolean removeBuildOptionsAfterBuild = false;
private int requestPort = 8080;
private RawKeycloakDistribution keycloak;
@Override
public void start(KeycloakTestServerConfig serverConfig) {
throw new RuntimeException("Method not implemented!");
keycloak = new RawKeycloakDistribution(debug, manualStop, enableTls, reCreate, removeBuildOptionsAfterBuild, requestPort);
// Set environment variables user and password for Keycloak Admin used by Keycloak instance.
keycloak.setEnvVar("KC_BOOTSTRAP_ADMIN_USERNAME", serverConfig.adminUserName().get());
keycloak.setEnvVar("KC_BOOTSTRAP_ADMIN_PASSWORD", serverConfig.adminUserPassword().get());
List<String> rawOptions = new LinkedList<>();
rawOptions.add("start-dev");
//rawOptions.add("--db=dev-mem"); // TODO With dev-mem there's an issue as the H2 DB isn't stopped when restarting embedded server
rawOptions.add("--cache=local");
if (!serverConfig.features().isEmpty()) {
rawOptions.add("--features=" + String.join(",", serverConfig.features()));
}
serverConfig.options().forEach((key, value) -> rawOptions.add("--" + key + "=" + value));
keycloak.run(rawOptions).assertStartedDevMode();
}
@Override
public void stop() {
throw new RuntimeException("Method not implemented!");
keycloak.stop();
}
@Override