Skip to content

Commit

Permalink
Merge pull request #2 from DenktMit-eG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MariusSchmidt authored Feb 20, 2024
2 parents cbb3c15 + c6e2eba commit 10c3eef
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 44 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
6 changes: 3 additions & 3 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 2 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<revision>0.1.1</revision>
<revision>0.1.2</revision>
<sha1></sha1>
<!--suppress UnresolvedMavenProperty -->
<skip.tests.all>${skipTests}</skip.tests.all>
Expand All @@ -43,12 +43,11 @@
<version.org.assertj>3.24.2</version.org.assertj>
<version.org.assertj.assertj-core>${version.org.assertj}</version.org.assertj.assertj-core>
<version.org.codehaus.mojo.flatten-maven-plugin>1.6.0</version.org.codehaus.mojo.flatten-maven-plugin>
<version.org.flywaydb.flyway-core>9.22.3</version.org.flywaydb.flyway-core>
<version.org.jacoco.jacoco-maven-plugin>0.8.11</version.org.jacoco.jacoco-maven-plugin>
<version.org.junit>5.10.1</version.org.junit>
<version.org.junit-pioneer.junit-pioneer>2.2.0</version.org.junit-pioneer.junit-pioneer>
<version.org.junit.jupiter.junit-jupiter-engine>${version.org.junit}</version.org.junit.jupiter.junit-jupiter-engine>
<version.org.keycloak.keycloak-admin-client>11.0.0</version.org.keycloak.keycloak-admin-client>
<version.org.keycloak.keycloak-admin-client>23.0.6</version.org.keycloak.keycloak-admin-client>
<version.org.postgresql.postgresql>42.6.0</version.org.postgresql.postgresql>
<version.org.sonatype.plugins.nexus-staging-maven-plugin>1.6.13</version.org.sonatype.plugins.nexus-staging-maven-plugin>
<version.org.springframework.boot>3.2.2</version.org.springframework.boot>
Expand All @@ -63,11 +62,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${version.org.flywaydb.flyway-core}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
Expand Down Expand Up @@ -119,7 +113,6 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -410,21 +403,6 @@
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${version.org.apache.maven.plugins.maven-project-info-reports-plugin}</version>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<executions>
<execution>
<id>fill-db</id>
<configuration>
<locations>
<location>classpath:db/migration</location>
<location>filesystem:src/test/resources/db/migration</location>
</locations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")));
}}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 10c3eef

Please sign in to comment.