diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 93164e0..641b345 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,10 +28,10 @@ jobs: ports: - 5432:5432 keycloak-it: - image: "jboss/keycloak:11.0.0" + image: "denktmiteg/keycloak-dev:23.0.6-latest" env: - KEYCLOAK_USER: admin - KEYCLOAK_PASSWORD: admin + KEYCLOAK_ADMIN: admin + KEYCLOAK_ADMIN_PASSWORD: admin DB_VENDOR: h2 ports: - 18080:8080 diff --git a/README.md b/README.md index d2243ef..c1ebb64 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,3 @@ docker compose --env-file .env-dev -f docker-compose.dev.yaml down # Remove the persistent docker volumes docker volume rm ${COMPOSE_PROJECT_NAME}_db-it-data ``` - -#### Prepare the database with testdata -The pom.xml file of the persistence module defines Flyway executions to -fill the dev and it databases with testdata. - -Fill integration test database with testdata (done automatically in maven build) -```bash -./mvnw flyway:migrate@fill-it -Dflyway.configFiles=../.flyway.it.conf -f ./persistence/pom.xml -``` \ No newline at end of file diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 2c8d2ea..2ba0c99 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -15,13 +15,13 @@ services: volumes: - db-it-data:/var/lib/postgresql/data keycloak-it: - image: "jboss/keycloak:11.0.0" + image: "denktmiteg/keycloak-dev:23.0.6-latest" container_name: "${COMPOSE_PROJECT_NAME}-keycloak-it" hostname: keycloak-it restart: unless-stopped environment: - - "KEYCLOAK_USER=admin" - - "KEYCLOAK_PASSWORD=admin" + - "KEYCLOAK_ADMIN=admin" + - "KEYCLOAK_ADMIN_PASSWORD=admin" - "DB_VENDOR=h2" ports: - "18080:8080" diff --git a/pom.xml b/pom.xml index a24d0ff..0c8d330 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ ${java.version} UTF-8 UTF-8 - 0.1.1 + 0.1.2 ${skipTests} @@ -43,12 +43,11 @@ 3.24.2 ${version.org.assertj} 1.6.0 - 9.22.3 0.8.11 5.10.1 2.2.0 ${version.org.junit} - 11.0.0 + 23.0.6 42.6.0 1.6.13 3.2.2 @@ -63,11 +62,6 @@ pom import - - org.flywaydb - flyway-core - ${version.org.flywaydb.flyway-core} - org.keycloak keycloak-admin-client @@ -119,7 +113,6 @@ rest-assured test - org.assertj assertj-core @@ -410,21 +403,6 @@ maven-project-info-reports-plugin ${version.org.apache.maven.plugins.maven-project-info-reports-plugin} - - org.flywaydb - flyway-maven-plugin - - - fill-db - - - classpath:db/migration - filesystem:src/test/resources/db/migration - - - - - diff --git a/src/main/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializer.java b/src/main/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializer.java index f2eaa43..815d7aa 100644 --- a/src/main/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializer.java +++ b/src/main/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializer.java @@ -1,5 +1,6 @@ package de.denktmit.testsupport.spring; +import jakarta.ws.rs.core.Response; import org.keycloak.admin.client.CreatedResponseUtil; import org.keycloak.admin.client.Keycloak; import org.keycloak.admin.client.KeycloakBuilder; @@ -11,7 +12,6 @@ import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; -import javax.ws.rs.core.Response; import java.util.Collections; import java.util.List; @@ -299,7 +299,7 @@ public KeycloakSession(Config ic) { private void connectAdminClient() { keycloakAdminClient = KeycloakBuilder.builder() - .serverUrl(ic.keycloakAddress + "/auth") + .serverUrl(ic.keycloakAddress) .realm(ic.keycloakMasterRealm) .clientId(ic.keycloakAdminClientId) .username(ic.keycloakAdminName) @@ -360,7 +360,7 @@ private Response createUser() { setUsername(ic.testAdminUsername); setFirstName("JUnit"); setLastName("Tester"); - setEmail("junit+tester1@gec.io"); + setEmail("junit+tester1@denktmit.de"); setAttributes(java.util.Collections.singletonMap("origin", List.of("demo"))); }} ); diff --git a/src/test/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializerIT.java b/src/test/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializerIT.java index 10caa32..43ce66d 100644 --- a/src/test/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializerIT.java +++ b/src/test/java/de/denktmit/testsupport/spring/KeycloakTestContextInitializerIT.java @@ -47,7 +47,7 @@ private static String visitAndVerifyLoginPage(KeycloakTestContextInitializer.Con .queryParam("scope", "openid") .when() - .request(GET, "/auth/realms/{realmName}/protocol/openid-connect/auth", ic.getTestRealmName()) + .request(GET, "/realms/{realmName}/protocol/openid-connect/auth", ic.getTestRealmName()) .then() .statusCode(200) @@ -59,7 +59,7 @@ private static String visitAndVerifyLoginPage(KeycloakTestContextInitializer.Con } private static void login(KeycloakTestContextInitializer.Config ic, CookieFilter cookieFilter, String authenticationUri) { - String redirectUri = ic.getKeycloakAddress() + "/auth/realms/" + ic.getTestRealmName() + "/login-actions/authenticate"; + String redirectUri = ic.getKeycloakAddress() + "/realms/" + ic.getTestRealmName() + "/login-actions/authenticate"; RestAssured .given() .filter(cookieFilter)