Testsuite PoC - Ability to configure server run-mode within the JUnit5 framework (#31109)
Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
This commit is contained in:
parent
932a92a316
commit
5fdb572f5f
6 changed files with 59 additions and 6 deletions
|
@ -7,7 +7,7 @@ import org.keycloak.test.framework.injection.Registry;
|
|||
import org.keycloak.test.framework.injection.Supplier;
|
||||
import org.keycloak.test.framework.injection.SupplierHelpers;
|
||||
|
||||
public class KeycloakTestServerSupplier implements Supplier<KeycloakTestServer, KeycloakIntegrationTest> {
|
||||
public abstract class AbstractKeycloakTestServerSupplier implements Supplier<KeycloakTestServer, KeycloakIntegrationTest> {
|
||||
|
||||
@Override
|
||||
public Class<KeycloakTestServer> getValueType() {
|
||||
|
@ -23,8 +23,7 @@ public class KeycloakTestServerSupplier implements Supplier<KeycloakTestServer,
|
|||
public InstanceWrapper<KeycloakTestServer, KeycloakIntegrationTest> getValue(Registry registry, KeycloakIntegrationTest annotation) {
|
||||
KeycloakTestServerConfig serverConfig = SupplierHelpers.getInstance(annotation.config());
|
||||
|
||||
// RemoteKeycloakTestServer keycloakTestServer = new RemoteKeycloakTestServer();
|
||||
EmbeddedKeycloakTestServer keycloakTestServer = new EmbeddedKeycloakTestServer();
|
||||
KeycloakTestServer keycloakTestServer = getServer();
|
||||
|
||||
keycloakTestServer.start(serverConfig);
|
||||
|
||||
|
@ -37,8 +36,10 @@ public class KeycloakTestServerSupplier implements Supplier<KeycloakTestServer,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close(KeycloakTestServer remoteKeycloakTestServer) {
|
||||
remoteKeycloakTestServer.stop();
|
||||
public void close(KeycloakTestServer keycloakTestServer) {
|
||||
keycloakTestServer.stop();
|
||||
}
|
||||
|
||||
public abstract KeycloakTestServer getServer();
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.keycloak.test.framework.server;
|
||||
|
||||
public class DistributionKeycloakTestServer implements KeycloakTestServer {
|
||||
|
||||
@Override
|
||||
public void start(KeycloakTestServerConfig serverConfig) {
|
||||
throw new RuntimeException("Method not implemented!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
throw new RuntimeException("Method not implemented!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseUrl() {
|
||||
return "http://localhost:8080";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.keycloak.test.framework.server;
|
||||
|
||||
public class DistributionKeycloakTestServerSupplier extends AbstractKeycloakTestServerSupplier {
|
||||
|
||||
@Override
|
||||
public KeycloakTestServer getServer() {
|
||||
return new DistributionKeycloakTestServer();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.keycloak.test.framework.server;
|
||||
|
||||
public class EmbeddedKeycloakTestServerSupplier extends AbstractKeycloakTestServerSupplier {
|
||||
|
||||
@Override
|
||||
public KeycloakTestServer getServer() {
|
||||
return new EmbeddedKeycloakTestServer();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.keycloak.test.framework.server;
|
||||
|
||||
public class RemoteKeycloakTestServerSupplier extends AbstractKeycloakTestServerSupplier {
|
||||
|
||||
@Override
|
||||
public KeycloakTestServer getServer() {
|
||||
return new RemoteKeycloakTestServer();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
org.keycloak.test.framework.admin.KeycloakAdminClientSupplier
|
||||
org.keycloak.test.framework.realm.ClientSupplier
|
||||
org.keycloak.test.framework.realm.RealmSupplier
|
||||
org.keycloak.test.framework.server.KeycloakTestServerSupplier
|
||||
org.keycloak.test.framework.server.EmbeddedKeycloakTestServerSupplier
|
||||
org.keycloak.test.framework.server.DistributionKeycloakTestServerSupplier
|
||||
org.keycloak.test.framework.server.RemoteKeycloakTestServerSupplier
|
||||
org.keycloak.test.framework.webdriver.ChromeWebDriverSupplier
|
||||
org.keycloak.test.framework.webdriver.FirefoxWebDriverSupplier
|
||||
|
|
Loading…
Reference in a new issue