Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add options from org.keycloak.test.framework.server.KeycloakTestServerConfig#options now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pedroigor It is copied from the EmbeddedServer setup, so not necessary to have it right now, but will be used in the future.


//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
Expand Down