Skip to content

Commit

Permalink
Remove custom Keycloak image code from the keycloak-authorization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sberyozkin committed Oct 16, 2023
1 parent db14e26 commit 5de503c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 69 deletions.
35 changes: 0 additions & 35 deletions integration-tests/keycloak-authorization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<properties>
<keycloak.url>http://localhost:8180/auth</keycloak.url>
<nashorn-core.version>15.3</nashorn-core.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -116,37 +115,20 @@
<artifactId>htmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>${nashorn-core.version}</version>
</dependency>
</dependencies>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<systemPropertyVariables>
<keycloak.image.version>${keycloak.image.version}</keycloak.image.version>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
<systemPropertyVariables>
<keycloak.image.version>${keycloak.image.version}</keycloak.image.version>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
Expand All @@ -160,23 +142,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies-quarkus</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<includeArtifactIds>nashorn-core,asm,asm-util,asm-commons</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.keycloak.util.JsonSerialization;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.builder.ImageFromDockerfile;
import org.testcontainers.images.builder.Transferable;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
Expand All @@ -45,22 +44,16 @@ public class KeycloakLifecycleManager implements QuarkusTestResourceLifecycleMan
protected static String KEYCLOAK_SERVER_URL;
private static final String KEYCLOAK_REALM = "quarkus";
private static final String KEYCLOAK_SERVICE_CLIENT = "quarkus-service-app";
private static final String KEYCLOAK_IMAGE = System.getProperty("keycloak.docker.image");
private static final String KEYCLOAK_VERSION = System.getProperty("keycloak.version");

@SuppressWarnings("resource")
@Override
public Map<String, String> start() {
try {
keycloak = new GenericContainer<>(
new ImageFromDockerfile().withDockerfile(Paths.get(getClass().getResource("/Dockerfile").toURI()))
.withBuildArg("KEYCLOAK_IMAGE", KEYCLOAK_IMAGE))
.withExposedPorts(8080)
.withEnv("KEYCLOAK_ADMIN", "admin")
.withEnv("KEYCLOAK_ADMIN_PASSWORD", "admin")
.waitingFor(Wait.forLogMessage(".*Keycloak.*started.*", 1));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
keycloak = new GenericContainer<>("quay.io/keycloak/keycloak:" + KEYCLOAK_VERSION)
.withExposedPorts(8080)
.withEnv("KEYCLOAK_ADMIN", "admin")
.withEnv("KEYCLOAK_ADMIN_PASSWORD", "admin")
.waitingFor(Wait.forLogMessage(".*Keycloak.*started.*", 1));

keycloak = keycloak
.withCopyToContainer(Transferable.of(createPoliciesJar().toByteArray()), "/opt/keycloak/providers/policies.jar")
Expand Down Expand Up @@ -172,19 +165,6 @@ private static String getAdminAccessToken() {
.as(AccessTokenResponse.class).getToken();
}

private static ClientRepresentation createServiceClient(String clientId) {
ClientRepresentation client = new ClientRepresentation();

client.setClientId(clientId);
client.setPublicClient(false);
client.setSecret("secret");
client.setDirectAccessGrantsEnabled(true);
client.setServiceAccountsEnabled(true);
client.setEnabled(true);

return client;
}

private static ClientRepresentation createClient(String clientId) {
ClientRepresentation client = new ClientRepresentation();

Expand Down

This file was deleted.

0 comments on commit 5de503c

Please sign in to comment.