diff --git a/.github/actions/conditional/action.yml b/.github/actions/conditional/action.yml
index b185d68397..63b2913880 100644
--- a/.github/actions/conditional/action.yml
+++ b/.github/actions/conditional/action.yml
@@ -22,9 +22,6 @@ outputs:
ci-webauthn:
description: Should "ci.yml" execute (WebAuthn)
value: ${{ steps.changes.outputs.ci-webauthn }}
- ci-test-poc:
- description: Should "ci.yml" execute (Test PoC)
- value: ${{ steps.changes.outputs.ci-test-poc }}
operator:
description: Should "operator-ci.yml" execute
value: ${{ steps.changes.outputs.operator }}
diff --git a/.github/actions/conditional/conditions b/.github/actions/conditional/conditions
index 70c8f91eae..8ff1d0260c 100644
--- a/.github/actions/conditional/conditions
+++ b/.github/actions/conditional/conditions
@@ -60,5 +60,3 @@ js/libs/keycloak-js/ ci ci-quarkus
*.tsx codeql-typescript
testsuite::database-suite ci-store
-
-test-poc/ ci ci-test-poc
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 64bfb232fb..7468012884 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,6 @@ jobs:
ci-store: ${{ steps.conditional.outputs.ci-store }}
ci-sssd: ${{ steps.conditional.outputs.ci-sssd }}
ci-webauthn: ${{ steps.conditional.outputs.ci-webauthn }}
- ci-test-poc: ${{ steps.conditional.outputs.ci-test-poc }}
ci-aurora: ${{ steps.auroradb-tests.outputs.run-aurora-tests }}
steps:
@@ -84,7 +83,7 @@ jobs:
run: |
SEP=""
PROJECTS=""
- for i in `find -name '*Test.java' -type f | egrep -v './(testsuite|quarkus|docs|test-poc|test-framework)/' | sed 's|/src/test/java/.*||' | sort | uniq | sed 's|./||'`; do
+ for i in `find -name '*Test.java' -type f | egrep -v './(testsuite|quarkus|docs|tests|test-framework)/' | sed 's|/src/test/java/.*||' | sort | uniq | sed 's|./||'`; do
PROJECTS="$PROJECTS$SEP$i"
SEP=","
done
@@ -958,7 +957,7 @@ jobs:
job-id: migration-tests-${{ matrix.old-version }}-${{ matrix.database }}
test-framework:
- name: Keycloak Test Framework
+ name: Test Framework
runs-on: ubuntu-latest
needs: build
timeout-minutes: 30
@@ -972,12 +971,10 @@ jobs:
- name: Run tests
run: ./mvnw test -f test-framework/pom.xml
- test-poc:
- name: Test PoC
+ base-new-integration-tests:
+ name: Base IT (new)
runs-on: ubuntu-latest
- if: needs.conditional.outputs.ci-test-poc == 'true'
needs:
- - conditional
- build
timeout-minutes: 30
steps:
@@ -988,9 +985,7 @@ jobs:
uses: ./.github/actions/integration-test-setup
- name: Run tests
- env:
- KC_TEST_BROWSER: chrome-headless
- run: ./mvnw clean install -f test-poc/pom.xml
+ run: ./mvnw test -f tests/pom.xml
check:
name: Status Check - Keycloak CI
@@ -1015,7 +1010,8 @@ jobs:
- sssd-unit-tests
- migration-tests
- external-infinispan-tests
- - test-poc
+ - test-framework
+ - base-new-integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
diff --git a/pom.xml b/pom.xml
index 969697295a..8b9333aeae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -307,6 +307,7 @@
authz
js
test-framework
+ tests
quarkus
@@ -1587,13 +1588,6 @@
-
- test-poc
-
- test-poc
-
-
-
eap8-adapters
diff --git a/test-framework/core/pom.xml b/test-framework/core/pom.xml
new file mode 100755
index 0000000000..6e5f42e977
--- /dev/null
+++ b/test-framework/core/pom.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+ keycloak-test-framework-parent
+ org.keycloak.test
+ 999.0.0-SNAPSHOT
+ ../pom.xml
+
+ 4.0.0
+
+ keycloak-test-framework-core
+ Keycloak Test Framework
+ jar
+ Preview Keycloak testing framework based on JUnit 5
+
+
+
+ org.keycloak
+ keycloak-admin-client-tests
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+
+
+ org.keycloak
+ keycloak-junit5
+
+
+ org.testcontainers
+ junit-jupiter
+
+
+ org.testcontainers
+ postgresql
+
+
+ org.testcontainers
+ mariadb
+
+
+ org.testcontainers
+ mysql
+
+
+ org.testcontainers
+ mssqlserver
+
+
+ org.testcontainers
+ oracle-free
+
+
+
+ com.nimbusds
+ oauth2-oidc-sdk
+ 11.13
+
+
+
diff --git a/test-framework/src/main/java/org/junit/rules/TestRule.java b/test-framework/core/src/main/java/org/junit/rules/TestRule.java
similarity index 100%
rename from test-framework/src/main/java/org/junit/rules/TestRule.java
rename to test-framework/core/src/main/java/org/junit/rules/TestRule.java
diff --git a/test-framework/src/main/java/org/junit/runners/model/Statement.java b/test-framework/core/src/main/java/org/junit/runners/model/Statement.java
similarity index 100%
rename from test-framework/src/main/java/org/junit/runners/model/Statement.java
rename to test-framework/core/src/main/java/org/junit/runners/model/Statement.java
diff --git a/test-framework/core/src/main/java/org/keycloak/test/framework/CoreTestFrameworkExtension.java b/test-framework/core/src/main/java/org/keycloak/test/framework/CoreTestFrameworkExtension.java
new file mode 100644
index 0000000000..859723dba5
--- /dev/null
+++ b/test-framework/core/src/main/java/org/keycloak/test/framework/CoreTestFrameworkExtension.java
@@ -0,0 +1,60 @@
+package org.keycloak.test.framework;
+
+import org.keycloak.test.framework.admin.KeycloakAdminClientSupplier;
+import org.keycloak.test.framework.database.DevFileDatabaseSupplier;
+import org.keycloak.test.framework.database.DevMemDatabaseSupplier;
+import org.keycloak.test.framework.database.MSSQLServerDatabaseSupplier;
+import org.keycloak.test.framework.database.MariaDBDatabaseSupplier;
+import org.keycloak.test.framework.database.MySQLDatabaseSupplier;
+import org.keycloak.test.framework.database.OracleDatabaseSupplier;
+import org.keycloak.test.framework.database.PostgresDatabaseSupplier;
+import org.keycloak.test.framework.database.TestDatabase;
+import org.keycloak.test.framework.events.EventsSupplier;
+import org.keycloak.test.framework.events.SysLogServerSupplier;
+import org.keycloak.test.framework.injection.Supplier;
+import org.keycloak.test.framework.oauth.OAuthClientSupplier;
+import org.keycloak.test.framework.realm.ClientSupplier;
+import org.keycloak.test.framework.realm.RealmSupplier;
+import org.keycloak.test.framework.realm.UserSupplier;
+import org.keycloak.test.framework.server.DistributionKeycloakTestServerSupplier;
+import org.keycloak.test.framework.server.EmbeddedKeycloakTestServerSupplier;
+import org.keycloak.test.framework.server.KeycloakTestServer;
+import org.keycloak.test.framework.server.RemoteKeycloakTestServerSupplier;
+
+import java.util.List;
+import java.util.Map;
+
+public class CoreTestFrameworkExtension implements TestFrameworkExtension {
+
+ @Override
+ public List> suppliers() {
+ return List.of(
+ new KeycloakAdminClientSupplier(),
+ new ClientSupplier(),
+ new RealmSupplier(),
+ new UserSupplier(),
+ new DistributionKeycloakTestServerSupplier(),
+ new EmbeddedKeycloakTestServerSupplier(),
+ new RemoteKeycloakTestServerSupplier(),
+ new DevMemDatabaseSupplier(),
+ new DevFileDatabaseSupplier(),
+ new MySQLDatabaseSupplier(),
+ new PostgresDatabaseSupplier(),
+ new MariaDBDatabaseSupplier(),
+ new MSSQLServerDatabaseSupplier(),
+ new OracleDatabaseSupplier(),
+ new OAuthClientSupplier(),
+ new SysLogServerSupplier(),
+ new EventsSupplier()
+ );
+ }
+
+ @Override
+ public Map, String> valueTypeAliases() {
+ return Map.of(
+ KeycloakTestServer.class, "server",
+ TestDatabase.class, "database"
+ );
+ }
+
+}
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/KeycloakIntegrationTestExtension.java b/test-framework/core/src/main/java/org/keycloak/test/framework/KeycloakIntegrationTestExtension.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/KeycloakIntegrationTestExtension.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/KeycloakIntegrationTestExtension.java
diff --git a/test-framework/core/src/main/java/org/keycloak/test/framework/TestFrameworkExtension.java b/test-framework/core/src/main/java/org/keycloak/test/framework/TestFrameworkExtension.java
new file mode 100644
index 0000000000..dfaaf98fdc
--- /dev/null
+++ b/test-framework/core/src/main/java/org/keycloak/test/framework/TestFrameworkExtension.java
@@ -0,0 +1,17 @@
+package org.keycloak.test.framework;
+
+import org.keycloak.test.framework.injection.Supplier;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public interface TestFrameworkExtension {
+
+ List> suppliers();
+
+ default Map, String> valueTypeAliases() {
+ return Collections.emptyMap();
+ }
+
+}
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/admin/KeycloakAdminClientSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/admin/KeycloakAdminClientSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/admin/KeycloakAdminClientSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/admin/KeycloakAdminClientSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectAdminClient.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectAdminClient.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectAdminClient.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectAdminClient.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectClient.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectClient.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectClient.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectClient.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectEvents.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectEvents.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectEvents.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectEvents.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectOAuthClient.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectOAuthClient.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectOAuthClient.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectOAuthClient.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectRealm.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectRealm.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectRealm.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectRealm.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectSysLogServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectSysLogServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectSysLogServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectSysLogServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectTestDatabase.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectTestDatabase.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectTestDatabase.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectTestDatabase.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectUser.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectUser.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectUser.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/InjectUser.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/KeycloakIntegrationTest.java b/test-framework/core/src/main/java/org/keycloak/test/framework/annotations/KeycloakIntegrationTest.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/KeycloakIntegrationTest.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/annotations/KeycloakIntegrationTest.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/config/Config.java b/test-framework/core/src/main/java/org/keycloak/test/framework/config/Config.java
similarity index 90%
rename from test-framework/src/main/java/org/keycloak/test/framework/config/Config.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/config/Config.java
index 6d0e8f08e3..67b1d6a067 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/config/Config.java
+++ b/test-framework/core/src/main/java/org/keycloak/test/framework/config/Config.java
@@ -13,8 +13,8 @@ public class Config {
private static final SmallRyeConfig config = initConfig();
- public static String getSelectedSupplier(Class> valueType) {
- return config.getOptionalValue("kc.test." + ValueTypeAlias.getAlias(valueType), String.class).orElse(null);
+ public static String getSelectedSupplier(Class> valueType, ValueTypeAlias valueTypeAlias) {
+ return config.getOptionalValue("kc.test." + valueTypeAlias.getAlias(valueType), String.class).orElse(null);
}
public static String getAdminClientId() {
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/AbstractDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/AbstractDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/AbstractDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/AbstractDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/DatabaseConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/DatabaseConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/DatabaseConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/DatabaseConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/DevFileDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/DevFileDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/DevFileDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/DevFileDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/DevMemDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/DevMemDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/DevMemDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/DevMemDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/MSSQLServerDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/MSSQLServerDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/MSSQLServerDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/MSSQLServerDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/MariaDBDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/MariaDBDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/MariaDBDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/MariaDBDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/MySQLDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/MySQLDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/MySQLDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/MySQLDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/OracleDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/OracleDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/OracleDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/OracleDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/PostgresDatabaseSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/PostgresDatabaseSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/PostgresDatabaseSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/PostgresDatabaseSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/database/TestDatabase.java b/test-framework/core/src/main/java/org/keycloak/test/framework/database/TestDatabase.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/database/TestDatabase.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/database/TestDatabase.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/EventParser.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/EventParser.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/EventParser.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/EventParser.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/Events.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/Events.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/Events.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/Events.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/EventsSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/EventsSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/EventsSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/EventsSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/SysLog.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLog.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/SysLog.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLog.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/SysLogListener.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogListener.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/SysLogListener.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogListener.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/SysLogServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/SysLogServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/events/SysLogServerSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogServerSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/events/SysLogServerSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/events/SysLogServerSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/AnnotationFields.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/AnnotationFields.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/AnnotationFields.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/AnnotationFields.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/DefaultAnnotationProxy.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/DefaultAnnotationProxy.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/DefaultAnnotationProxy.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/DefaultAnnotationProxy.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/InstanceContext.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/InstanceContext.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/InstanceContext.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/InstanceContext.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/LifeCycle.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/LifeCycle.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/LifeCycle.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/LifeCycle.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/Registry.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/Registry.java
similarity index 95%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/Registry.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/Registry.java
index f14556346d..e71a083611 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/injection/Registry.java
+++ b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/Registry.java
@@ -2,9 +2,8 @@ package org.keycloak.test.framework.injection;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.extension.ExtensionContext;
+import org.keycloak.test.framework.TestFrameworkExtension;
import org.keycloak.test.framework.config.Config;
-import org.keycloak.test.framework.realm.DefaultRealmConfig;
-import org.keycloak.test.framework.realm.ManagedRealm;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -288,17 +287,24 @@ public class Registry implements ExtensionContext.Store.CloseableResource {
}
private void loadSuppliers() {
- Iterator supplierIterator = ServiceLoader.load(Supplier.class).iterator();
+ Iterator extensions = ServiceLoader.load(TestFrameworkExtension.class).iterator();
+ ValueTypeAlias valueTypeAlias = new ValueTypeAlias();
+ List tmp = new LinkedList<>();
+ while (extensions.hasNext()) {
+ TestFrameworkExtension extension = extensions.next();
+ tmp.addAll(extension.suppliers());
+ valueTypeAlias.addAll(extension.valueTypeAliases());
+ }
+
Set loadedValueTypes = new HashSet<>();
Set skippedSuppliers = new HashSet<>();
- while (supplierIterator.hasNext()) {
- Supplier supplier = supplierIterator.next();
+ for (Supplier supplier : tmp) {
boolean shouldAdd = false;
Class supplierValueType = supplier.getValueType();
if (!loadedValueTypes.contains(supplierValueType)) {
- String requestedSupplier = Config.getSelectedSupplier(supplierValueType);
+ String requestedSupplier = Config.getSelectedSupplier(supplierValueType, valueTypeAlias);
if (requestedSupplier != null) {
if (requestedSupplier.equals(supplier.getAlias())) {
shouldAdd = true;
@@ -320,14 +326,14 @@ public class Registry implements ExtensionContext.Store.CloseableResource {
StringBuilder loaded = new StringBuilder();
loaded.append("Loaded suppliers:");
for (Supplier s : suppliers) {
- loaded.append("\n - " + ValueTypeAlias.getAlias(s.getValueType()) + " --> " + s.getAlias());
+ loaded.append("\n - " + valueTypeAlias.getAlias(s.getValueType()) + " --> " + s.getAlias());
}
LOGGER.trace(loaded.toString());
StringBuilder skipped = new StringBuilder();
skipped.append("Skipped suppliers:");
for (Supplier s : skippedSuppliers) {
- skipped.append("\n - " + ValueTypeAlias.getAlias(s.getValueType()) + " --> " + s.getAlias());
+ skipped.append("\n - " + valueTypeAlias.getAlias(s.getValueType()) + " --> " + s.getAlias());
}
LOGGER.trace(skipped.toString());
}
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/RequestedInstance.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/RequestedInstance.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/RequestedInstance.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/RequestedInstance.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/StringUtil.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/StringUtil.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/StringUtil.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/StringUtil.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/Supplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/Supplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/Supplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/Supplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/SupplierHelpers.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/SupplierHelpers.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/injection/SupplierHelpers.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/injection/SupplierHelpers.java
diff --git a/test-framework/core/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java
new file mode 100644
index 0000000000..20a345813b
--- /dev/null
+++ b/test-framework/core/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java
@@ -0,0 +1,22 @@
+package org.keycloak.test.framework.injection;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ValueTypeAlias {
+
+ private final Map, String> aliases = new HashMap<>();
+
+ public void addAll(Map, String> aliases) {
+ this.aliases.putAll(aliases);
+ }
+
+ public String getAlias(Class> clazz) {
+ String alias = aliases.get(clazz);
+ if (alias == null) {
+ alias = clazz.getSimpleName();
+ }
+ return alias;
+ }
+
+}
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/oauth/DefaultOAuthClientConfiguration.java b/test-framework/core/src/main/java/org/keycloak/test/framework/oauth/DefaultOAuthClientConfiguration.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/oauth/DefaultOAuthClientConfiguration.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/oauth/DefaultOAuthClientConfiguration.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthCallbackServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthCallbackServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthCallbackServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthCallbackServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthClient.java b/test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthClient.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthClient.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthClient.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthClientSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthClientSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/oauth/OAuthClientSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/oauth/OAuthClientSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ClientConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ClientConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ClientConfigBuilder.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientConfigBuilder.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ClientConfigBuilder.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientConfigBuilder.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ClientSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ClientSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ClientSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/Collections.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/Collections.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/Collections.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/Collections.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultClientConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultClientConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultClientConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultClientConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultRealmConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultRealmConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultRealmConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultRealmConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultUserConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultUserConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/DefaultUserConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/DefaultUserConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedClient.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedClient.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedClient.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedClient.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedRealm.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedRealm.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedRealm.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedRealm.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedUser.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedUser.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/ManagedUser.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/ManagedUser.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/RealmConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/RealmConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/RealmConfigBuilder.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmConfigBuilder.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/RealmConfigBuilder.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmConfigBuilder.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/RealmSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/RealmSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/RealmSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/Representations.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/Representations.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/Representations.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/Representations.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/UserConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/UserConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/UserConfigBuilder.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserConfigBuilder.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/UserConfigBuilder.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserConfigBuilder.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/realm/UserSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/realm/UserSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/realm/UserSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/AbstractKeycloakTestServerSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/AbstractKeycloakTestServerSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/AbstractKeycloakTestServerSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/AbstractKeycloakTestServerSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/DefaultKeycloakTestServerConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/DefaultKeycloakTestServerConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/DefaultKeycloakTestServerConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/DefaultKeycloakTestServerConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServerSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServerSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServerSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/DistributionKeycloakTestServerSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServerSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServerSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServerSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/EmbeddedKeycloakTestServerSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/KeycloakTestServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/KeycloakTestServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/KeycloakTestServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/KeycloakTestServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/KeycloakTestServerConfig.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/KeycloakTestServerConfig.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/KeycloakTestServerConfig.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/KeycloakTestServerConfig.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServer.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServer.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServer.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServer.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServerSupplier.java b/test-framework/core/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServerSupplier.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServerSupplier.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServerSupplier.java
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/util/ApiUtil.java b/test-framework/core/src/main/java/org/keycloak/test/framework/util/ApiUtil.java
similarity index 100%
rename from test-framework/src/main/java/org/keycloak/test/framework/util/ApiUtil.java
rename to test-framework/core/src/main/java/org/keycloak/test/framework/util/ApiUtil.java
diff --git a/test-framework/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/test-framework/core/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension
similarity index 100%
rename from test-framework/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension
rename to test-framework/core/src/main/resources/META-INF/services/org.junit.jupiter.api.extension.Extension
diff --git a/test-framework/core/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension b/test-framework/core/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
new file mode 100644
index 0000000000..ba5e5bee7d
--- /dev/null
+++ b/test-framework/core/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
@@ -0,0 +1 @@
+org.keycloak.test.framework.CoreTestFrameworkExtension
\ No newline at end of file
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/events/EventParserTest.java b/test-framework/core/src/test/java/org/keycloak/test/framework/events/EventParserTest.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/events/EventParserTest.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/events/EventParserTest.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/events/SysLogTest.java b/test-framework/core/src/test/java/org/keycloak/test/framework/events/SysLogTest.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/events/SysLogTest.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/events/SysLogTest.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/DefaultAnnotationProxyTest.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/DefaultAnnotationProxyTest.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/DefaultAnnotationProxyTest.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/DefaultAnnotationProxyTest.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/RegistryTest.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/RegistryTest.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/RegistryTest.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/RegistryTest.java
diff --git a/test-framework/core/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java
new file mode 100644
index 0000000000..72b98fc90d
--- /dev/null
+++ b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java
@@ -0,0 +1,24 @@
+package org.keycloak.test.framework.injection;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.keycloak.admin.client.Keycloak;
+import org.keycloak.test.framework.server.KeycloakTestServer;
+
+import java.util.Map;
+
+public class ValueTypeAliasTest {
+
+ @Test
+ public void withAlias() {
+ ValueTypeAlias valueTypeAlias = new ValueTypeAlias();
+ valueTypeAlias.addAll(Map.of(KeycloakTestServer.class, "server"));
+ Assertions.assertEquals("server", valueTypeAlias.getAlias(KeycloakTestServer.class));
+ }
+
+ @Test
+ public void withoutAlias() {
+ Assertions.assertEquals("Keycloak", new ValueTypeAlias().getAlias(Keycloak.class));
+ }
+
+}
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildAnnotation.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildAnnotation.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildAnnotation.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildAnnotation.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildSupplier.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildSupplier.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildSupplier.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildSupplier.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildValue.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildValue.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildValue.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockChildValue.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockInstances.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockInstances.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockInstances.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockInstances.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParent2Supplier.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParent2Supplier.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParent2Supplier.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParent2Supplier.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentAnnotation.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentAnnotation.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentAnnotation.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentAnnotation.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentSupplier.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentSupplier.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentSupplier.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentSupplier.java
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentValue.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentValue.java
similarity index 100%
rename from test-framework/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentValue.java
rename to test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockParentValue.java
diff --git a/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockTestFrameworkExtension.java b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockTestFrameworkExtension.java
new file mode 100644
index 0000000000..2db3346b2f
--- /dev/null
+++ b/test-framework/core/src/test/java/org/keycloak/test/framework/injection/mocks/MockTestFrameworkExtension.java
@@ -0,0 +1,19 @@
+package org.keycloak.test.framework.injection.mocks;
+
+import org.keycloak.test.framework.TestFrameworkExtension;
+import org.keycloak.test.framework.injection.Supplier;
+
+import java.util.List;
+
+public class MockTestFrameworkExtension implements TestFrameworkExtension {
+
+ @Override
+ public List> suppliers() {
+ return List.of(
+ new MockParentSupplier(),
+ new MockParent2Supplier(),
+ new MockChildSupplier()
+ );
+ }
+
+}
diff --git a/test-framework/core/src/test/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension b/test-framework/core/src/test/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
new file mode 100644
index 0000000000..e5d29558b7
--- /dev/null
+++ b/test-framework/core/src/test/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
@@ -0,0 +1 @@
+org.keycloak.test.framework.injection.mocks.MockTestFrameworkExtension
\ No newline at end of file
diff --git a/test-framework/src/test/resources/logging.properties b/test-framework/core/src/test/resources/logging.properties
similarity index 100%
rename from test-framework/src/test/resources/logging.properties
rename to test-framework/core/src/test/resources/logging.properties
diff --git a/test-poc/showcase/pom.xml b/test-framework/examples/pom.xml
similarity index 69%
rename from test-poc/showcase/pom.xml
rename to test-framework/examples/pom.xml
index 3d8be32e00..c7d0fb29c1 100755
--- a/test-poc/showcase/pom.xml
+++ b/test-framework/examples/pom.xml
@@ -19,23 +19,29 @@
- keycloak-test-parent
+ keycloak-test-framework-parent
org.keycloak.test
999.0.0-SNAPSHOT
../pom.xml
4.0.0
- keycloak-test-framework-showcase
- Keycloak Test Framework Showcase
+ keycloak-test-framework-examples
+ Keycloak Test Framework Examples
jar
- Showcase of new tests demonstrating the new testing framework usability
+ Example tests to demonstrate the new testing framework
- org.keycloak
- keycloak-test-framework
- 999.0.0-SNAPSHOT
+ org.keycloak.test
+ keycloak-test-framework-core
+ ${project.version}
+ test
+
+
+ org.keycloak.test
+ keycloak-test-framework-ui
+ ${project.version}
test
@@ -53,6 +59,10 @@
com.microsoft.sqlserver
mssql-jdbc
+
+ com.oracle.database.jdbc
+ ojdbc11
+
@@ -66,6 +76,13 @@
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/CustomConfigTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/CustomConfigTest.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/CustomConfigTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/CustomConfigTest.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/DefaultConfig1Test.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/DefaultConfig1Test.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/DefaultConfig1Test.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/DefaultConfig1Test.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/DefaultConfig2Test.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/DefaultConfig2Test.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/DefaultConfig2Test.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/DefaultConfig2Test.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/EventsTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/EventsTest.java
similarity index 90%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/EventsTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/EventsTest.java
index a12b94f85a..295cd53439 100644
--- a/test-poc/examples/src/test/java/org/keycloak/test/examples/EventsTest.java
+++ b/test-framework/examples/src/test/java/org/keycloak/test/examples/EventsTest.java
@@ -6,12 +6,12 @@ import org.junit.jupiter.api.Test;
import org.keycloak.events.EventType;
import org.keycloak.test.framework.annotations.InjectEvents;
import org.keycloak.test.framework.annotations.InjectOAuthClient;
-import org.keycloak.test.framework.annotations.InjectPage;
-import org.keycloak.test.framework.annotations.InjectWebDriver;
+import org.keycloak.test.framework.ui.annotations.InjectPage;
+import org.keycloak.test.framework.ui.annotations.InjectWebDriver;
import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.events.Events;
import org.keycloak.test.framework.oauth.OAuthClient;
-import org.keycloak.test.framework.page.LoginPage;
+import org.keycloak.test.framework.ui.page.LoginPage;
import org.keycloak.test.framework.server.KeycloakTestServerConfig;
import org.openqa.selenium.WebDriver;
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/FancyRealmTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/FancyRealmTest.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/FancyRealmTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/FancyRealmTest.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/GlobalManagedResourcesTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/GlobalManagedResourcesTest.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/GlobalManagedResourcesTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/GlobalManagedResourcesTest.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/ManagedResources2Test.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/ManagedResources2Test.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/ManagedResources2Test.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/ManagedResources2Test.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/ManagedResourcesTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/ManagedResourcesTest.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/ManagedResourcesTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/ManagedResourcesTest.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/MultipleInstancesTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/MultipleInstancesTest.java
similarity index 100%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/MultipleInstancesTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/MultipleInstancesTest.java
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java
similarity index 93%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java
index d7c103db3a..dbf4fd3780 100644
--- a/test-poc/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java
+++ b/test-framework/examples/src/test/java/org/keycloak/test/examples/OAuthClientTest.java
@@ -9,14 +9,12 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.test.framework.annotations.InjectOAuthClient;
-import org.keycloak.test.framework.annotations.InjectPage;
-import org.keycloak.test.framework.annotations.InjectRealm;
+import org.keycloak.test.framework.ui.annotations.InjectPage;
import org.keycloak.test.framework.annotations.InjectUser;
-import org.keycloak.test.framework.annotations.InjectWebDriver;
+import org.keycloak.test.framework.ui.annotations.InjectWebDriver;
import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.oauth.OAuthClient;
-import org.keycloak.test.framework.page.LoginPage;
-import org.keycloak.test.framework.realm.ManagedRealm;
+import org.keycloak.test.framework.ui.page.LoginPage;
import org.keycloak.test.framework.realm.ManagedUser;
import org.openqa.selenium.WebDriver;
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/PagesTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/PagesTest.java
similarity index 72%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/PagesTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/PagesTest.java
index 688dd9c863..23a15c06e6 100644
--- a/test-poc/examples/src/test/java/org/keycloak/test/examples/PagesTest.java
+++ b/test-framework/examples/src/test/java/org/keycloak/test/examples/PagesTest.java
@@ -1,10 +1,10 @@
package org.keycloak.test.examples;
import org.junit.jupiter.api.Test;
-import org.keycloak.test.framework.annotations.InjectPage;
+import org.keycloak.test.framework.ui.annotations.InjectPage;
import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
-import org.keycloak.test.framework.page.LoginPage;
-import org.keycloak.test.framework.page.WelcomePage;
+import org.keycloak.test.framework.ui.page.LoginPage;
+import org.keycloak.test.framework.ui.page.WelcomePage;
@KeycloakIntegrationTest
public class PagesTest {
diff --git a/test-poc/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java b/test-framework/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java
similarity index 89%
rename from test-poc/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java
rename to test-framework/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java
index f9359427b6..a1586cdbae 100644
--- a/test-poc/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java
+++ b/test-framework/examples/src/test/java/org/keycloak/test/examples/WelcomePageTest.java
@@ -5,9 +5,9 @@ import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.test.framework.annotations.InjectAdminClient;
-import org.keycloak.test.framework.annotations.InjectWebDriver;
+import org.keycloak.test.framework.ui.annotations.InjectWebDriver;
import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
-import org.keycloak.test.framework.page.WelcomePage;
+import org.keycloak.test.framework.ui.page.WelcomePage;
import org.openqa.selenium.WebDriver;
import java.util.List;
diff --git a/test-poc/examples/src/test/resources/container-license-acceptance.txt b/test-framework/examples/src/test/resources/container-license-acceptance.txt
similarity index 100%
rename from test-poc/examples/src/test/resources/container-license-acceptance.txt
rename to test-framework/examples/src/test/resources/container-license-acceptance.txt
diff --git a/test-poc/showcase/src/test/resources/logging.properties b/test-framework/examples/src/test/resources/logging.properties
similarity index 85%
rename from test-poc/showcase/src/test/resources/logging.properties
rename to test-framework/examples/src/test/resources/logging.properties
index 19448548bd..e5237d9487 100644
--- a/test-poc/showcase/src/test/resources/logging.properties
+++ b/test-framework/examples/src/test/resources/logging.properties
@@ -1,5 +1,5 @@
-loggers=org.keycloak.test
-logger.org.keycloak.test.level=TRACE
+loggers=org.keycloak.test.framework
+#logger.org.keycloak.test.level=TRACE
logger.handlers=CONSOLE
diff --git a/test-framework/pom.xml b/test-framework/pom.xml
index 80a5b894c7..8fda850c97 100755
--- a/test-framework/pom.xml
+++ b/test-framework/pom.xml
@@ -1,20 +1,20 @@
+~ Copyright 2016 Red Hat, Inc. and/or its affiliates
+~ and other contributors as indicated by the @author tags.
+~
+~ Licensed under the Apache License, Version 2.0 (the "License");
+~ you may not use this file except in compliance with the License.
+~ You may obtain a copy of the License at
+~
+~ http://www.apache.org/licenses/LICENSE-2.0
+~
+~ Unless required by applicable law or agreed to in writing, software
+~ distributed under the License is distributed on an "AS IS" BASIS,
+~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~ See the License for the specific language governing permissions and
+~ limitations under the License.
+-->
@@ -26,81 +26,16 @@
4.0.0
- keycloak-test-framework
- Keycloak Test Framework
- jar
- Preview Keycloak testing framework based on JUnit 5
+ keycloak-test-framework-parent
+ org.keycloak.test
+ pom
+ Keycloak Test Framework Parent
+ Keycloak Test Framework Parent
-
- 4.23.1
- 4.23.0
-
+
+ core
+ ui
+ examples
+
-
-
- org.keycloak
- keycloak-admin-client-tests
-
-
- org.junit.jupiter
- junit-jupiter-engine
-
-
- org.keycloak
- keycloak-junit5
-
-
- org.seleniumhq.selenium
- selenium-java
- ${selenium.version}
- pom
-
-
- org.seleniumhq.selenium
- selenium-firefox-driver
- ${selenium.version}
- pom
-
-
- org.seleniumhq.selenium
- selenium-chrome-driver
- ${selenium.version}
- pom
-
-
- org.seleniumhq.selenium
- htmlunit3-driver
- ${selenium.html.unit.version}
-
-
- org.testcontainers
- junit-jupiter
-
-
- org.testcontainers
- postgresql
-
-
- org.testcontainers
- mariadb
-
-
- org.testcontainers
- mysql
-
-
- org.testcontainers
- mssqlserver
-
-
- org.testcontainers
- oracle-free
-
-
-
- com.nimbusds
- oauth2-oidc-sdk
- 11.13
-
-
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java b/test-framework/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java
deleted file mode 100644
index 166d8ec56c..0000000000
--- a/test-framework/src/main/java/org/keycloak/test/framework/injection/ValueTypeAlias.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.keycloak.test.framework.injection;
-
-import org.keycloak.test.framework.database.TestDatabase;
-import org.keycloak.test.framework.server.KeycloakTestServer;
-import org.openqa.selenium.WebDriver;
-
-import java.util.Map;
-
-public class ValueTypeAlias {
-
- private static final Map aliases = Map.of(
- WebDriver.class, "browser",
- KeycloakTestServer.class, "server",
- TestDatabase.class, "database"
- );
-
- public static String getAlias(Class> clazz) {
- String alias = aliases.get(clazz);
- if (alias == null) {
- alias = clazz.getSimpleName();
- }
- return alias;
- }
-
-}
diff --git a/test-framework/src/main/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier b/test-framework/src/main/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier
deleted file mode 100644
index 9d15dd1da2..0000000000
--- a/test-framework/src/main/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier
+++ /dev/null
@@ -1,23 +0,0 @@
-org.keycloak.test.framework.admin.KeycloakAdminClientSupplier
-org.keycloak.test.framework.realm.ClientSupplier
-org.keycloak.test.framework.realm.RealmSupplier
-org.keycloak.test.framework.realm.UserSupplier
-org.keycloak.test.framework.server.DistributionKeycloakTestServerSupplier
-org.keycloak.test.framework.server.EmbeddedKeycloakTestServerSupplier
-org.keycloak.test.framework.server.RemoteKeycloakTestServerSupplier
-org.keycloak.test.framework.webdriver.HtmlUnitWebDriverSupplier
-org.keycloak.test.framework.webdriver.ChromeHeadlessWebDriverSupplier
-org.keycloak.test.framework.webdriver.ChromeWebDriverSupplier
-org.keycloak.test.framework.webdriver.FirefoxHeadlessWebDriverSupplier
-org.keycloak.test.framework.webdriver.FirefoxWebDriverSupplier
-org.keycloak.test.framework.database.DevMemDatabaseSupplier
-org.keycloak.test.framework.database.DevFileDatabaseSupplier
-org.keycloak.test.framework.database.MySQLDatabaseSupplier
-org.keycloak.test.framework.database.PostgresDatabaseSupplier
-org.keycloak.test.framework.database.MariaDBDatabaseSupplier
-org.keycloak.test.framework.database.MSSQLServerDatabaseSupplier
-org.keycloak.test.framework.database.OracleDatabaseSupplier
-org.keycloak.test.framework.page.PageSupplier
-org.keycloak.test.framework.oauth.OAuthClientSupplier
-org.keycloak.test.framework.events.SysLogServerSupplier
-org.keycloak.test.framework.events.EventsSupplier
\ No newline at end of file
diff --git a/test-framework/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java b/test-framework/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java
deleted file mode 100644
index 55a8c585ef..0000000000
--- a/test-framework/src/test/java/org/keycloak/test/framework/injection/ValueTypeAliasTest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.keycloak.test.framework.injection;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.keycloak.admin.client.Keycloak;
-import org.openqa.selenium.WebDriver;
-
-public class ValueTypeAliasTest {
-
- @Test
- public void withAlias() {
- Assertions.assertEquals("browser", ValueTypeAlias.getAlias(WebDriver.class));
- }
-
- @Test
- public void withoutAlias() {
- Assertions.assertEquals("Keycloak", ValueTypeAlias.getAlias(Keycloak.class));
- }
-
-}
diff --git a/test-framework/src/test/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier b/test-framework/src/test/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier
deleted file mode 100644
index ff17ebaa5f..0000000000
--- a/test-framework/src/test/resources/META-INF/services/org.keycloak.test.framework.injection.Supplier
+++ /dev/null
@@ -1,3 +0,0 @@
-org.keycloak.test.framework.injection.mocks.MockParentSupplier
-org.keycloak.test.framework.injection.mocks.MockParent2Supplier
-org.keycloak.test.framework.injection.mocks.MockChildSupplier
\ No newline at end of file
diff --git a/test-framework/ui/pom.xml b/test-framework/ui/pom.xml
new file mode 100755
index 0000000000..e1542c8b5f
--- /dev/null
+++ b/test-framework/ui/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+ keycloak-test-framework-parent
+ org.keycloak.test
+ 999.0.0-SNAPSHOT
+ ../pom.xml
+
+ 4.0.0
+
+ keycloak-test-framework-ui
+ Keycloak Test Framework
+ jar
+ UI extension for Keycloak Test Framework
+
+
+ 4.23.1
+ 4.23.0
+
+
+
+
+ org.keycloak.test
+ keycloak-test-framework-core
+ ${project.version}
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ ${selenium.version}
+ pom
+
+
+ org.seleniumhq.selenium
+ selenium-firefox-driver
+ ${selenium.version}
+ pom
+
+
+ org.seleniumhq.selenium
+ selenium-chrome-driver
+ ${selenium.version}
+ pom
+
+
+ org.seleniumhq.selenium
+ htmlunit3-driver
+ ${selenium.html.unit.version}
+
+
+
diff --git a/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/UITestFrameworkExtension.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/UITestFrameworkExtension.java
new file mode 100644
index 0000000000..dec873d9b4
--- /dev/null
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/UITestFrameworkExtension.java
@@ -0,0 +1,37 @@
+package org.keycloak.test.framework.ui;
+
+import org.keycloak.test.framework.TestFrameworkExtension;
+import org.keycloak.test.framework.injection.Supplier;
+import org.keycloak.test.framework.ui.page.PageSupplier;
+import org.keycloak.test.framework.ui.webdriver.ChromeHeadlessWebDriverSupplier;
+import org.keycloak.test.framework.ui.webdriver.ChromeWebDriverSupplier;
+import org.keycloak.test.framework.ui.webdriver.FirefoxHeadlessWebDriverSupplier;
+import org.keycloak.test.framework.ui.webdriver.FirefoxWebDriverSupplier;
+import org.keycloak.test.framework.ui.webdriver.HtmlUnitWebDriverSupplier;
+import org.openqa.selenium.WebDriver;
+
+import java.util.List;
+import java.util.Map;
+
+public class UITestFrameworkExtension implements TestFrameworkExtension {
+
+ @Override
+ public List> suppliers() {
+ return List.of(
+ new HtmlUnitWebDriverSupplier(),
+ new ChromeHeadlessWebDriverSupplier(),
+ new ChromeWebDriverSupplier(),
+ new FirefoxHeadlessWebDriverSupplier(),
+ new FirefoxWebDriverSupplier(),
+ new PageSupplier()
+ );
+ }
+
+ @Override
+ public Map, String> valueTypeAliases() {
+ return Map.of(
+ WebDriver.class, "browser"
+ );
+ }
+
+}
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectPage.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectPage.java
similarity index 83%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectPage.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectPage.java
index 5b1d520de8..5232746a33 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectPage.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectPage.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.annotations;
+package org.keycloak.test.framework.ui.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectWebDriver.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectWebDriver.java
similarity index 83%
rename from test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectWebDriver.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectWebDriver.java
index 1ca5e9aa06..80bd0454e2 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/annotations/InjectWebDriver.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/annotations/InjectWebDriver.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.annotations;
+package org.keycloak.test.framework.ui.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/page/AbstractPage.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/AbstractPage.java
similarity index 86%
rename from test-framework/src/main/java/org/keycloak/test/framework/page/AbstractPage.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/AbstractPage.java
index db5bbaeb37..49902a7d75 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/page/AbstractPage.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/AbstractPage.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.page;
+package org.keycloak.test.framework.ui.page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/page/LoginPage.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/LoginPage.java
similarity index 93%
rename from test-framework/src/main/java/org/keycloak/test/framework/page/LoginPage.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/LoginPage.java
index d1128d57fe..15f14c3216 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/page/LoginPage.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/LoginPage.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.page;
+package org.keycloak.test.framework.ui.page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/page/PageSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/PageSupplier.java
similarity index 92%
rename from test-framework/src/main/java/org/keycloak/test/framework/page/PageSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/PageSupplier.java
index 92e7efb5f7..2f6428a817 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/page/PageSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/PageSupplier.java
@@ -1,6 +1,6 @@
-package org.keycloak.test.framework.page;
+package org.keycloak.test.framework.ui.page;
-import org.keycloak.test.framework.annotations.InjectPage;
+import org.keycloak.test.framework.ui.annotations.InjectPage;
import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.RequestedInstance;
import org.keycloak.test.framework.injection.Supplier;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/page/WelcomePage.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/WelcomePage.java
similarity index 92%
rename from test-framework/src/main/java/org/keycloak/test/framework/page/WelcomePage.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/WelcomePage.java
index a07ba8b025..f8477ffdee 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/page/WelcomePage.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/page/WelcomePage.java
@@ -1,10 +1,9 @@
-package org.keycloak.test.framework.page;
+package org.keycloak.test.framework.ui.page;
import org.junit.jupiter.api.Assertions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
-import org.openqa.selenium.support.PageFactory;
public class WelcomePage extends AbstractPage {
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/AbstractWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/AbstractWebDriverSupplier.java
similarity index 93%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/AbstractWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/AbstractWebDriverSupplier.java
index 91c804a2c8..13f2c89f0c 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/AbstractWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/AbstractWebDriverSupplier.java
@@ -1,6 +1,6 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
-import org.keycloak.test.framework.annotations.InjectWebDriver;
+import org.keycloak.test.framework.ui.annotations.InjectWebDriver;
import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeHeadlessWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeHeadlessWebDriverSupplier.java
similarity index 93%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeHeadlessWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeHeadlessWebDriverSupplier.java
index fd2063c8a7..ad641f37c7 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeHeadlessWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeHeadlessWebDriverSupplier.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeWebDriverSupplier.java
similarity index 90%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeWebDriverSupplier.java
index 35e5fe22de..561bbebdcd 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/ChromeWebDriverSupplier.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxHeadlessWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxHeadlessWebDriverSupplier.java
similarity index 91%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxHeadlessWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxHeadlessWebDriverSupplier.java
index 70bcae1ba7..0da296f7aa 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxHeadlessWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxHeadlessWebDriverSupplier.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxWebDriverSupplier.java
similarity index 90%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxWebDriverSupplier.java
index 17ded412b5..3ec5858058 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/FirefoxWebDriverSupplier.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
diff --git a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/HtmlUnitWebDriverSupplier.java b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/HtmlUnitWebDriverSupplier.java
similarity index 94%
rename from test-framework/src/main/java/org/keycloak/test/framework/webdriver/HtmlUnitWebDriverSupplier.java
rename to test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/HtmlUnitWebDriverSupplier.java
index 582ba7cfa5..317ea5d2a2 100644
--- a/test-framework/src/main/java/org/keycloak/test/framework/webdriver/HtmlUnitWebDriverSupplier.java
+++ b/test-framework/ui/src/main/java/org/keycloak/test/framework/ui/webdriver/HtmlUnitWebDriverSupplier.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.framework.webdriver;
+package org.keycloak.test.framework.ui.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
diff --git a/test-framework/ui/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension b/test-framework/ui/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
new file mode 100644
index 0000000000..1bc124eef1
--- /dev/null
+++ b/test-framework/ui/src/main/resources/META-INF/services/org.keycloak.test.framework.TestFrameworkExtension
@@ -0,0 +1 @@
+org.keycloak.test.framework.ui.UITestFrameworkExtension
\ No newline at end of file
diff --git a/test-poc/showcase/src/test/java/org/keycloak/test/showcase/UserTest.java b/test-poc/showcase/src/test/java/org/keycloak/test/showcase/UserTest.java
deleted file mode 100644
index c2d480b53b..0000000000
--- a/test-poc/showcase/src/test/java/org/keycloak/test/showcase/UserTest.java
+++ /dev/null
@@ -1,441 +0,0 @@
-package org.keycloak.test.showcase;
-
-import jakarta.ws.rs.core.Response;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.keycloak.common.util.Base64;
-import org.keycloak.models.UserModel;
-import org.keycloak.models.credential.PasswordCredentialModel;
-import org.keycloak.models.utils.ModelToRepresentation;
-import org.keycloak.models.utils.StripSecretsUtils;
-import org.keycloak.representations.idm.CredentialRepresentation;
-import org.keycloak.representations.idm.ErrorRepresentation;
-import org.keycloak.representations.idm.RealmRepresentation;
-import org.keycloak.representations.idm.UserRepresentation;
-import org.keycloak.test.framework.annotations.InjectOAuthClient;
-import org.keycloak.test.framework.annotations.InjectPage;
-import org.keycloak.test.framework.annotations.InjectRealm;
-import org.keycloak.test.framework.annotations.InjectWebDriver;
-import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
-import org.keycloak.test.framework.oauth.OAuthClient;
-import org.keycloak.test.framework.page.LoginPage;
-import org.keycloak.test.framework.realm.ManagedRealm;
-import org.keycloak.test.framework.util.ApiUtil;
-import org.keycloak.util.JsonSerialization;
-import org.openqa.selenium.WebDriver;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-@KeycloakIntegrationTest
-public class UserTest {
-
- @InjectRealm
- ManagedRealm realm;
-
- @InjectOAuthClient
- OAuthClient oAuthClient;
-
- @InjectWebDriver
- WebDriver webDriver;
-
- @InjectPage
- LoginPage loginPage;
-
- @AfterEach
- public void afterEach() {
- realm.admin().identityProviders().findAll()
- .forEach(ip -> realm.admin().identityProviders().get(ip.getAlias()).remove());
- realm.admin().groups().groups()
- .forEach(g -> realm.admin().groups().group(g.getId()).remove());
- realm.admin().users().list()
- .forEach(u -> realm.admin().users().delete(u.getId()));
- }
-
- public String createUser() {
- return createUser("user1", "user1@localhost");
- }
-
- public String createUser(String username, String email) {
- UserRepresentation user = new UserRepresentation();
- user.setUsername(username);
- user.setEmail(email);
- user.setRequiredActions(Collections.emptyList());
- user.setEnabled(true);
-
- return createUser(user);
- }
-
- private String createUser(UserRepresentation userRep) {
- return createUser(userRep, true);
- }
-
- private String createUser(UserRepresentation userRep, boolean assertAdminEvent) {
- final String createdId;
- try (Response response = realm.admin().users().create(userRep)) {
- createdId = ApiUtil.handleCreatedResponse(response);
- Assertions.assertNotNull(createdId);
- }
-
- StripSecretsUtils.stripSecrets(null, userRep);
-
- // TODO
-/* if (assertAdminEvent) {
- assertAdminEvents.assertEvent(realmId, OperationType.CREATE, AdminEventPaths.userResourcePath(createdId), userRep,
- ResourceType.USER);
- }
-
- getCleanup().addUserId(createdId);*/
-
- return createdId;
- }
-
- @Test
- public void verifyCreateUser() {
- createUser();
- }
-
- @Test
- public void createUserWithTemporaryPasswordWithAdditionalPasswordUpdateShouldRemoveUpdatePasswordRequiredAction() {
-
- String userId = createUser();
-
- CredentialRepresentation credTmp = new CredentialRepresentation();
- credTmp.setType(CredentialRepresentation.PASSWORD);
- credTmp.setValue("temp");
- credTmp.setTemporary(Boolean.TRUE);
-
- realm.admin().users().get(userId).resetPassword(credTmp);
-
- CredentialRepresentation credPerm = new CredentialRepresentation();
- credPerm.setType(CredentialRepresentation.PASSWORD);
- credPerm.setValue("perm");
- credPerm.setTemporary(null);
-
- realm.admin().users().get(userId).resetPassword(credPerm);
-
- UserRepresentation userRep = realm.admin().users().get(userId).toRepresentation();
-
- Assertions.assertFalse(userRep.getRequiredActions().contains(UserModel.RequiredAction.UPDATE_PASSWORD.name()));
- }
-
- @Test
- public void createDuplicatedUser1() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user1");
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
-
- // Just to show how to retrieve underlying error message
- ErrorRepresentation error = response.readEntity(ErrorRepresentation.class);
- Assertions.assertEquals("User exists with same username", error.getErrorMessage());
- }
- }
-
- @Test
- public void createDuplicatedUser2() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user2");
- user.setEmail("user1@localhost");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
-
- ErrorRepresentation error = response.readEntity(ErrorRepresentation.class);
- Assertions.assertEquals("User exists with same email", error.getErrorMessage());
- }
- }
-
- @Test
- public void createDuplicatedUsernameWithEmail() {
- createUser("user1@local.com", "user1@local.org");
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user1@local.org");
- user.setEmail("user2@localhost");
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
-
- ErrorRepresentation error = response.readEntity(ErrorRepresentation.class);
- Assertions.assertEquals("User exists with same username", error.getErrorMessage());
- }
- }
-
- @Test
- public void createDuplicatedEmailWithUsername() {
- createUser("user1@local.com", "user1@local.org");
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user2");
- user.setEmail("user1@local.com");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
-
- ErrorRepresentation error = response.readEntity(ErrorRepresentation.class);
- Assertions.assertEquals("User exists with same email", error.getErrorMessage());
- }
- }
-
- @Test
- public void createDuplicateEmailWithExistingDuplicates() {
- //Allow duplicate emails
- RealmRepresentation rep = realm.admin().toRepresentation();
- rep.setDuplicateEmailsAllowed(true);
- realm.admin().update(rep);
-
- //Create 2 users with the same email
- UserRepresentation user = new UserRepresentation();
- user.setEmail("user1@localhost");
- user.setUsername("user1");
- createUser(user, false);
- user.setUsername("user2");
- createUser(user, false);
-
- //Disallow duplicate emails
- rep.setDuplicateEmailsAllowed(false);
- realm.admin().update(rep);
-
- //Create a third user with the same email
- user.setUsername("user3");
- //assertAdminEvents.clear();
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- ErrorRepresentation error = response.readEntity(ErrorRepresentation.class);
- Assertions.assertEquals("User exists with same username or email", error.getErrorMessage());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createUserWithHashedCredentials() {
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user_creds");
- user.setEmail("email@localhost");
-
- PasswordCredentialModel pcm = PasswordCredentialModel.createFromValues("my-algorithm", "theSalt".getBytes(), 22, "ABC");
- CredentialRepresentation hashedPassword = ModelToRepresentation.toRepresentation(pcm);
- hashedPassword.setCreatedDate(1001L);
- hashedPassword.setUserLabel("deviceX");
- hashedPassword.setType(CredentialRepresentation.PASSWORD);
-
- user.setCredentials(List.of(hashedPassword));
-
- createUser(user);
-
- // TODO: add TestingClient
- /*CredentialModel credentialHashed = fetchCredentials("user_creds");
- PasswordCredentialModel pcmh = PasswordCredentialModel.createFromCredentialModel(credentialHashed);
- assertNotNull("Expecting credential", credentialHashed);
- assertEquals("my-algorithm", pcmh.getPasswordCredentialData().getAlgorithm());
- assertEquals(Long.valueOf(1001), credentialHashed.getCreatedDate());
- assertEquals("deviceX", credentialHashed.getUserLabel());
- assertEquals(22, pcmh.getPasswordCredentialData().getHashIterations());
- assertEquals("ABC", pcmh.getPasswordSecretData().getValue());
- assertEquals("theSalt", new String(pcmh.getPasswordSecretData().getSalt()));
- assertEquals(CredentialRepresentation.PASSWORD, credentialHashed.getType());*/
- }
-
- @Test
- public void createUserWithDeprecatedCredentialsFormat() throws IOException {
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user_creds");
- user.setEmail("email@localhost");
-
- PasswordCredentialModel pcm = PasswordCredentialModel.createFromValues("my-algorithm", "theSalt".getBytes(), 22, "ABC");
- //CredentialRepresentation hashedPassword = ModelToRepresentation.toRepresentation(pcm);
- String deprecatedCredential = "{\n" +
- " \"type\" : \"password\",\n" +
- " \"hashedSaltedValue\" : \"" + pcm.getPasswordSecretData().getValue() + "\",\n" +
- " \"salt\" : \"" + Base64.encodeBytes(pcm.getPasswordSecretData().getSalt()) + "\",\n" +
- " \"hashIterations\" : " + pcm.getPasswordCredentialData().getHashIterations() + ",\n" +
- " \"algorithm\" : \"" + pcm.getPasswordCredentialData().getAlgorithm() + "\"\n" +
- " }";
-
- CredentialRepresentation deprecatedHashedPassword = JsonSerialization.readValue(deprecatedCredential, CredentialRepresentation.class);
- Assertions.assertNotNull(deprecatedHashedPassword.getHashedSaltedValue());
- Assertions.assertNull(deprecatedHashedPassword.getCredentialData());
-
- deprecatedHashedPassword.setCreatedDate(1001l);
- deprecatedHashedPassword.setUserLabel("deviceX");
- deprecatedHashedPassword.setType(CredentialRepresentation.PASSWORD);
-
- user.setCredentials(Arrays.asList(deprecatedHashedPassword));
-
- createUser(user, false);
-
- // TODO: add TestingClient
- /*CredentialModel credentialHashed = fetchCredentials("user_creds");
- PasswordCredentialModel pcmh = PasswordCredentialModel.createFromCredentialModel(credentialHashed);
- assertNotNull("Expecting credential", credentialHashed);
- assertEquals("my-algorithm", pcmh.getPasswordCredentialData().getAlgorithm());
- assertEquals(Long.valueOf(1001), credentialHashed.getCreatedDate());
- assertEquals("deviceX", credentialHashed.getUserLabel());
- assertEquals(22, pcmh.getPasswordCredentialData().getHashIterations());
- assertEquals("ABC", pcmh.getPasswordSecretData().getValue());
- assertEquals("theSalt", new String(pcmh.getPasswordSecretData().getSalt()));
- assertEquals(CredentialRepresentation.PASSWORD, credentialHashed.getType());*/
- }
-
- /*@Test
- public void updateUserWithHashedCredentials() {
- String userId = createUser("user_hashed_creds", "user_hashed_creds@localhost");
-
- byte[] salt = new byte[]{-69, 85, 87, 99, 26, -107, 125, 99, -77, 30, -111, 118, 108, 100, -117, -56};
-
- PasswordCredentialModel credentialModel = PasswordCredentialModel.createFromValues("pbkdf2-sha256", salt,
- 27500, "uskEPZWMr83pl2mzNB95SFXfIabe2UH9ClENVx/rrQqOjFEjL2aAOGpWsFNNF3qoll7Qht2mY5KxIDm3Rnve2w==");
- credentialModel.setCreatedDate(1001l);
- CredentialRepresentation hashedPassword = ModelToRepresentation.toRepresentation(credentialModel);
-
- UserRepresentation userRepresentation = new UserRepresentation();
- userRepresentation.setCredentials(Collections.singletonList(hashedPassword));
-
- realm.admin().users().get(userId).update(userRepresentation);
-
- oAuthClient.realm("REALM_NAME");
- driver.navigate().to(oauth.getLoginFormUrl());
-
- assertEquals("Sign in to your account", PageUtils.getPageTitle(driver));
-
- loginPage.login("user_hashed_creds", "admin");
-
- assertTrue(driver.getTitle().contains("AUTH_RESPONSE"));
-
- // oauth cleanup
- oauth.realm("test");
- }*/
-
- @Test
- public void createUserWithTempolaryCredentials() {
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user_temppw");
- user.setEmail("email.temppw@localhost");
-
- CredentialRepresentation password = new CredentialRepresentation();
- password.setValue("password");
- password.setType(CredentialRepresentation.PASSWORD);
- password.setTemporary(true);
- user.setCredentials(Arrays.asList(password));
-
- String userId = createUser(user);
-
- UserRepresentation userRep = realm.admin().users().get(userId).toRepresentation();
- Assertions.assertEquals(1, userRep.getRequiredActions().size());
- Assertions.assertEquals(UserModel.RequiredAction.UPDATE_PASSWORD.toString(), userRep.getRequiredActions().get(0));
- }
-
- @Test
- public void createUserWithRawCredentials() {
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user_rawpw");
- user.setEmail("email.raw@localhost");
-
- CredentialRepresentation rawPassword = new CredentialRepresentation();
- rawPassword.setValue("ABCD");
- rawPassword.setType(CredentialRepresentation.PASSWORD);
- user.setCredentials(List.of(rawPassword));
-
- createUser(user);
-
- /*CredentialModel credential = fetchCredentials("user_rawpw");
- assertNotNull("Expecting credential", credential);
- PasswordCredentialModel pcm = PasswordCredentialModel.createFromCredentialModel(credential);
- assertEquals(DefaultPasswordHash.getDefaultAlgorithm(), pcm.getPasswordCredentialData().getAlgorithm());
- assertEquals(DefaultPasswordHash.getDefaultIterations(), pcm.getPasswordCredentialData().getHashIterations());
- assertNotEquals("ABCD", pcm.getPasswordSecretData().getValue());
- assertEquals(CredentialRepresentation.PASSWORD, credential.getType());*/
- }
-
-/* private CredentialModel fetchCredentials(String username) {
- return getTestingClient().server(REALM_NAME).fetch(RunHelpers.fetchCredentials(username));
- }*/
-
- @Test
- public void createDuplicatedUser3() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("User1");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createDuplicatedUser4() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("USER1");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createDuplicatedUser5() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user2");
- user.setEmail("User1@localhost");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createDuplicatedUser6() {
- createUser();
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user2");
- user.setEmail("user1@LOCALHOST");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createDuplicatedUser7() {
- createUser("user1", "USer1@Localhost");
-
- UserRepresentation user = new UserRepresentation();
- user.setUsername("user2");
- user.setEmail("user1@localhost");
-
- try (Response response = realm.admin().users().create(user)) {
- Assertions.assertEquals(409, response.getStatus());
- //assertAdminEvents.assertEmpty();
- }
- }
-
- @Test
- public void createTwoUsersWithEmptyStringEmails() {
- createUser("user1", "");
- createUser("user2", "");
- }
-
-
-}
diff --git a/test-poc/examples/pom.xml b/tests/base/pom.xml
similarity index 80%
rename from test-poc/examples/pom.xml
rename to tests/base/pom.xml
index 83939ba869..e143c8140f 100755
--- a/test-poc/examples/pom.xml
+++ b/tests/base/pom.xml
@@ -19,23 +19,29 @@
- keycloak-test-parent
- org.keycloak.test
+ keycloak-tests-parent
+ org.keycloak.tests
999.0.0-SNAPSHOT
../pom.xml
4.0.0
- keycloak-test-framework-examples
- Keycloak Test Framework Examples
+ keycloak-tests-base
+ New Keycloak Base Testsuite
jar
- Example tests to demonstrate the new testing framework
+ New Keycloak Base Testsuite
- org.keycloak
- keycloak-test-framework
- 999.0.0-SNAPSHOT
+ org.keycloak.test
+ keycloak-test-framework-core
+ ${project.version}
+ test
+
+
+ org.keycloak.test
+ keycloak-test-framework-ui
+ ${project.version}
test
@@ -53,10 +59,6 @@
com.microsoft.sqlserver
mssql-jdbc
-
- com.oracle.database.jdbc
- ojdbc11
-
diff --git a/tests/base/src/test/java/org/keycloak/test/showcase/PlaceHolderTest.java b/tests/base/src/test/java/org/keycloak/test/showcase/PlaceHolderTest.java
new file mode 100644
index 0000000000..4e83dbce28
--- /dev/null
+++ b/tests/base/src/test/java/org/keycloak/test/showcase/PlaceHolderTest.java
@@ -0,0 +1,21 @@
+package org.keycloak.test.showcase;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.keycloak.test.framework.annotations.InjectRealm;
+import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
+import org.keycloak.test.framework.realm.ManagedRealm;
+
+@KeycloakIntegrationTest
+public class PlaceHolderTest {
+
+ @InjectRealm
+ ManagedRealm realm;
+
+ @Test
+ public void testHello() {
+ Assertions.assertNotNull(realm);
+ }
+
+
+}
diff --git a/test-poc/showcase/src/test/resources/container-license-acceptance.txt b/tests/base/src/test/resources/container-license-acceptance.txt
similarity index 100%
rename from test-poc/showcase/src/test/resources/container-license-acceptance.txt
rename to tests/base/src/test/resources/container-license-acceptance.txt
diff --git a/test-poc/examples/src/test/resources/logging.properties b/tests/base/src/test/resources/logging.properties
similarity index 100%
rename from test-poc/examples/src/test/resources/logging.properties
rename to tests/base/src/test/resources/logging.properties
diff --git a/test-poc/pom.xml b/tests/pom.xml
similarity index 83%
rename from test-poc/pom.xml
rename to tests/pom.xml
index e303890c31..99d04ebd50 100755
--- a/test-poc/pom.xml
+++ b/tests/pom.xml
@@ -26,15 +26,14 @@
4.0.0
- keycloak-test-parent
- org.keycloak.test
+ keycloak-tests-parent
+ org.keycloak.tests
pom
- Keycloak Test Parent
- Keycloak Test Parent
+ Keycloak Tests Parent
+ Keycloak Tests Parent
- examples
- showcase
+ base