Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rooije committed May 17, 2024
1 parent cae5e97 commit 7db5a54
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 12 deletions.
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ services:
- KEYCLOAK_ADMIN_PASSWORD=Pa55w0rd
- DEBUG=true
- DEBUG_PORT=*:8787
- KC_HTTP_RELATIVE_PATH=/auth
depends_on:
- mariadb
10 changes: 10 additions & 0 deletions mydeltares-keycloak-spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ jar {

tasks.register('copyJarsToDocker', Task) {

println('Deleting old spi jar from main docker')
delete fileTree(liferayDockerPath + '/keycloak/providers/'){
include '**/mydeltares-keycloak-*.jar'
}

println('Deleting old spi jar from test docker')
delete fileTree(testDockerPath + '/keycloak/providers/'){
include '**/mydeltares-keycloak-*.jar'
}

copy {
println('Copying spi jar to main docker')
from('build/libs/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import org.testcontainers.containers.output.ToStringConsumer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import org.testcontainers.shaded.org.apache.commons.io.filefilter.WildcardFileFilter;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -43,9 +45,17 @@ public static void main(String[] args) throws Throwable {
Files.copy(new File(testResources.getParent(), "docker-compose.yml").toPath(), new File(keycloakTmpDir, "docker-compose.yml").toPath());
Files.copy(new File(testResources, "data/import/realm-export.json").toPath(), new File(dataDir, "realm-export.json").toPath());
Files.copy(new File(testResources, "conf/keycloak.conf").toPath(), new File(configDir, "keycloak.conf").toPath());
Files.copy(new File(spiBuildLib, "mydeltares-keycloak-spi-3.0.jar").toPath(), new File(deploymentDir, "mydeltares-keycloak-spi-3.0.jar").toPath());
Files.copy(new File(themeBuildLib, "mydeltares-keycloak-theme-3.0.jar").toPath(), new File(deploymentDir, "mydeltares-keycloak-theme-3.0.jar").toPath());

final WildcardFileFilter spiFilter = new WildcardFileFilter("mydeltares-keycloak-spi-*.jar");
final File[] spiFiles = new File(spiBuildLib.getPath()).listFiles((FileFilter) spiFilter);
for (File spiFile : spiFiles) {
Files.copy(spiFile.toPath(), new File(deploymentDir, spiFile.getName()).toPath());
}
final WildcardFileFilter themeFilter = new WildcardFileFilter("mydeltares-keycloak-theme-*.jar");
final File[] themeFiles = new File(themeBuildLib.getPath()).listFiles((FileFilter) themeFilter);
for (File themeFile : themeFiles) {
Files.copy(themeFile.toPath(), new File(deploymentDir, themeFile.getName()).toPath());
}
KeycloakTestServer.startKeycloak(keycloakTmpDir.getPath());

try {
Expand Down Expand Up @@ -75,7 +85,7 @@ public void accept(OutputFrame outputFrame) {
}
}
}).withExposedService("keycloak", 8080, waitStrategy);
dockerClient.start();
dockerClient. start();
running = true;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ services:
- 8787:8787
entrypoint: ["/opt/keycloak/bin/kc.sh", "start-dev", "--import-realm", "--log-level=INFO"]
volumes:
- ./keycloak/data/import/realm-export.json:/opt/keycloak/data/import/realm-export.json
- ./keycloak/conf/keycloak.conf:/opt/keycloak/conf/keycloak.conf
- ./keycloak/providers:/opt/keycloak/providers
- ./data/import/realm-export.json:/opt/keycloak/data/import/realm-export.json
- ./conf/keycloak.conf:/opt/keycloak/conf/keycloak.conf
- ./providers:/opt/keycloak/providers
restart: always
networks:
- keycloak
Expand All @@ -44,5 +44,6 @@ services:
- KEYCLOAK_ADMIN_PASSWORD=Pa55w0rd
- DEBUG=true
- DEBUG_PORT=*:8787
- KC_HTTP_RELATIVE_PATH=/auth
depends_on:
- mariadb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
keycloak.baseurl=http://localhost:8080/realms/liferay-portal/
keycloak.baseapiurl=http://localhost:8080/admin/realms/liferay-portal/
keycloak.baseurl=http://localhost:8080/auth/realms/liferay-portal/
keycloak.clientid=admin-api-admin
keycloak.clientsecret=password
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
keycloak.baseurl=http://localhost:8080/realms/liferay-portal/
keycloak.baseapiurl=http://localhost:8080/admin/realms/liferay-portal/
keycloak.baseurl=http://localhost:8080/auth/realms/liferay-portal/
keycloak.clientid=user-api-admin
keycloak.clientsecret=password
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
keycloak.baseurl=http://localhost:8080/realms/liferay-portal/
keycloak.baseapiurl=http://localhost:8080/admin/realms/liferay-portal/
keycloak.baseurl=http://localhost:8080/auth/realms/liferay-portal/
keycloak.clientid=viewer-api-admin
keycloak.clientsecret=password
11 changes: 11 additions & 0 deletions mydeltares-keycloak-theme/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ test {
}

tasks.register("copyJarsToDocker", Task) {

println('Deleting old theme jar from main docker')
delete fileTree(liferayDockerPath + '/keycloak/providers/'){
include '**/mydeltares-keycloak-*.jar'
}

println('Deleting old theme jar from test docker')
delete fileTree(testDockerPath + '/keycloak/providers/'){
include '**/mydeltares-keycloak-*.jar'
}

copy {
println('Copying theme jar to main docker')
from('build/libs/')
Expand Down

0 comments on commit 7db5a54

Please sign in to comment.