Testsuite PoC - modules refactoring (#31411)

Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
This commit is contained in:
Lukas Hanusovsky 2024-07-22 15:02:44 +02:00 committed by GitHub
parent d16e1ac106
commit c885d682c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 139 additions and 52 deletions

View file

@ -26,8 +26,8 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>keycloak-tests-base</artifactId> <artifactId>keycloak-test-junit5-framework-examples</artifactId>
<name>Keycloak Base Tests</name> <name>Keycloak JUnit5 Framework Examples</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Example tests to demonstrate new testing framework</description> <description>Example tests to demonstrate new testing framework</description>

View file

@ -1,12 +1,12 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.Keycloak;
import org.keycloak.common.Profile; import org.keycloak.common.Profile;
import org.keycloak.representations.info.FeatureRepresentation; import org.keycloak.representations.info.FeatureRepresentation;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.TestAdminClient; import org.keycloak.test.framework.annotations.TestAdminClient;
import org.keycloak.test.framework.server.KeycloakTestServerConfig; import org.keycloak.test.framework.server.KeycloakTestServerConfig;
import java.util.Optional; import java.util.Optional;

View file

@ -1,11 +1,11 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.Keycloak;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.TestAdminClient; import org.keycloak.test.framework.annotations.TestAdminClient;
import java.util.List; import java.util.List;

View file

@ -1,11 +1,11 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.Keycloak;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.TestAdminClient; import org.keycloak.test.framework.annotations.TestAdminClient;
import java.util.List; import java.util.List;

View file

@ -1,22 +1,19 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource; import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.TestClient;
import org.keycloak.test.framework.TestClient; import org.keycloak.test.framework.annotations.TestRealm;
import org.keycloak.test.framework.TestRealm; import org.keycloak.test.framework.annotations.TestUser;
import org.keycloak.test.framework.TestUser;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.realm.DefaultClientConfig; import org.keycloak.test.framework.realm.DefaultClientConfig;
import org.keycloak.test.framework.realm.DefaultRealmConfig; import org.keycloak.test.framework.realm.DefaultRealmConfig;
import org.keycloak.test.framework.realm.DefaultUserConfig; import org.keycloak.test.framework.realm.DefaultUserConfig;
import java.util.List;
@KeycloakIntegrationTest @KeycloakIntegrationTest
public class GlobalManagedResourcesTest { public class GlobalManagedResourcesTest {

View file

@ -1,13 +1,13 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.TestClient; import org.keycloak.test.framework.annotations.TestClient;
import org.keycloak.test.framework.TestRealm; import org.keycloak.test.framework.annotations.TestRealm;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -6,10 +6,10 @@ import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource; import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.TestClient; import org.keycloak.test.framework.annotations.TestClient;
import org.keycloak.test.framework.TestRealm; import org.keycloak.test.framework.annotations.TestRealm;
import org.keycloak.test.framework.TestUser; import org.keycloak.test.framework.annotations.TestUser;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.keycloak.test.framework.server.KeycloakTestServerConfig; import org.keycloak.test.framework.server.KeycloakTestServerConfig;

View file

@ -1,9 +1,9 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.page.LoginPage; import org.keycloak.test.framework.page.LoginPage;
import org.keycloak.test.framework.page.TestPage; import org.keycloak.test.framework.annotations.TestPage;
import org.keycloak.test.framework.page.WelcomePage; import org.keycloak.test.framework.page.WelcomePage;
@KeycloakIntegrationTest @KeycloakIntegrationTest

View file

@ -1,9 +1,9 @@
package org.keycloak.test.base; package org.keycloak.test.examples;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.page.WelcomePage; import org.keycloak.test.framework.page.WelcomePage;
import org.keycloak.test.framework.webdriver.TestWebDriver; import org.keycloak.test.framework.annotations.TestWebDriver;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
@KeycloakIntegrationTest(config = NoAdminUserKeycloakTestServerConfig.class) @KeycloakIntegrationTest(config = NoAdminUserKeycloakTestServerConfig.class)

View file

@ -4,6 +4,7 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext;
import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.injection.Registry; import org.keycloak.test.framework.injection.Registry;
public class KeycloakIntegrationTestExtension implements BeforeEachCallback, AfterEachCallback, AfterAllCallback { public class KeycloakIntegrationTestExtension implements BeforeEachCallback, AfterEachCallback, AfterAllCallback {

View file

@ -1,7 +1,7 @@
package org.keycloak.test.framework.admin; package org.keycloak.test.framework.admin;
import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.Keycloak;
import org.keycloak.test.framework.TestAdminClient; import org.keycloak.test.framework.annotations.TestAdminClient;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import org.keycloak.test.framework.server.DefaultKeycloakTestServerConfig; import org.keycloak.test.framework.server.DefaultKeycloakTestServerConfig;
import org.keycloak.test.framework.server.KeycloakTestServerConfig; import org.keycloak.test.framework.server.KeycloakTestServerConfig;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import org.keycloak.test.framework.database.DatabaseConfig; import org.keycloak.test.framework.database.DatabaseConfig;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.realm.ClientConfig; import org.keycloak.test.framework.realm.ClientConfig;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework.page; package org.keycloak.test.framework.annotations;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.realm.DefaultRealmConfig; import org.keycloak.test.framework.realm.DefaultRealmConfig;

View file

@ -1,8 +1,6 @@
package org.keycloak.test.framework; package org.keycloak.test.framework.annotations;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.realm.ClientConfig;
import org.keycloak.test.framework.realm.DefaultClientConfig;
import org.keycloak.test.framework.realm.DefaultUserConfig; import org.keycloak.test.framework.realm.DefaultUserConfig;
import org.keycloak.test.framework.realm.UserConfig; import org.keycloak.test.framework.realm.UserConfig;

View file

@ -1,4 +1,4 @@
package org.keycloak.test.framework.webdriver; package org.keycloak.test.framework.annotations;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View file

@ -1,6 +1,6 @@
package org.keycloak.test.framework.database; package org.keycloak.test.framework.database;
import org.keycloak.test.framework.KeycloakTestDatabase; import org.keycloak.test.framework.annotations.KeycloakTestDatabase;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -1,5 +1,6 @@
package org.keycloak.test.framework.page; package org.keycloak.test.framework.page;
import org.keycloak.test.framework.annotations.TestPage;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;
import org.keycloak.test.framework.injection.Supplier; import org.keycloak.test.framework.injection.Supplier;

View file

@ -4,7 +4,7 @@ import jakarta.ws.rs.core.Response;
import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.test.framework.TestClient; import org.keycloak.test.framework.annotations.TestClient;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -3,7 +3,7 @@ package org.keycloak.test.framework.realm;
import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.test.framework.TestRealm; import org.keycloak.test.framework.annotations.TestRealm;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -4,7 +4,7 @@ import jakarta.ws.rs.core.Response;
import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource; import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.test.framework.TestUser; import org.keycloak.test.framework.annotations.TestUser;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -1,6 +1,6 @@
package org.keycloak.test.framework.server; package org.keycloak.test.framework.server;
import org.keycloak.test.framework.KeycloakIntegrationTest; import org.keycloak.test.framework.annotations.KeycloakIntegrationTest;
import org.keycloak.test.framework.database.TestDatabase; import org.keycloak.test.framework.database.TestDatabase;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;

View file

@ -1,5 +1,6 @@
package org.keycloak.test.framework.webdriver; package org.keycloak.test.framework.webdriver;
import org.keycloak.test.framework.annotations.TestWebDriver;
import org.keycloak.test.framework.injection.InstanceContext; import org.keycloak.test.framework.injection.InstanceContext;
import org.keycloak.test.framework.injection.LifeCycle; import org.keycloak.test.framework.injection.LifeCycle;
import org.keycloak.test.framework.injection.RequestedInstance; import org.keycloak.test.framework.injection.RequestedInstance;

View file

@ -33,8 +33,9 @@
<description>Keycloak Test Parent</description> <description>Keycloak Test Parent</description>
<modules> <modules>
<module>base</module>
<module>framework</module> <module>framework</module>
<module>examples</module>
<module>showcase</module>
</modules> </modules>
</project> </project>

72
test-poc/showcase/pom.xml Executable file
View file

@ -0,0 +1,72 @@
<?xml version="1.0"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>keycloak-test-parent</artifactId>
<groupId>org.keycloak.test</groupId>
<version>999.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>keycloak-test-junit5-framework-showcase</artifactId>
<name>Keycloak JUnit5 Framework Showcase</name>
<packaging>jar</packaging>
<description>Showcase of new tests demonstrating the new testing framework usability</description>
<dependencies>
<dependency>
<groupId>org.keycloak.test</groupId>
<artifactId>keycloak-test-junit5-framework</artifactId>
<version>999.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>1.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
</dependency>
<!-- JDBC Drivers -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<java.util.concurrent.ForkJoinPool.common.threadFactory>io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory</java.util.concurrent.ForkJoinPool.common.threadFactory>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1 @@
mcr.microsoft.com/mssql/server:latest

View file

@ -0,0 +1,15 @@
loggers=org.keycloak.test
logger.org.keycloak.test.level=TRACE
logger.handlers=CONSOLE
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=ERROR
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
# The log format pattern for both logs
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p %t [%c] %m%n