Skip to content

Commit

Permalink
allow for multiple locations
Browse files Browse the repository at this point in the history
resolves #128
  • Loading branch information
dasniko committed Feb 23, 2024
1 parent a35be7e commit 13849db
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

import static java.util.Objects.requireNonNull;

Expand Down Expand Up @@ -101,7 +102,7 @@ public abstract class ExtendableKeycloakContainer<SELF extends ExtendableKeycloa

private Duration startupTimeout = DEFAULT_STARTUP_TIMEOUT;

private String providerClassLocation;
private List<String> providerClassLocations;
private List<File> providerLibsLocations;

/**
Expand Down Expand Up @@ -171,8 +172,15 @@ protected void configure() {
commandParts.add("--https-client-auth=" + this.httpsClientAuth);
}

if (providerClassLocation != null) {
createKeycloakExtensionProvider(providerClassLocation);
if (providerClassLocations != null && !providerClassLocations.isEmpty()) {
AtomicInteger index = new AtomicInteger(0);
providerClassLocations.forEach(providerClassLocation -> {
createKeycloakExtensionDeployment(
DEFAULT_KEYCLOAK_PROVIDERS_LOCATION,
index.getAndIncrement() + "_" + DEFAULT_KEYCLOAK_PROVIDERS_NAME,
providerClassLocation
);
});
}

if (providerLibsLocations != null) {
Expand Down Expand Up @@ -304,12 +312,12 @@ public SELF withContextPath(String contextPath) {
}

/**
* Exposes the given classes location as an exploded providers.jar.
* Exposes the given classes locations as an exploded providers.jar.
*
* @param classesLocation a classes location relative to the current classpath root.
* @param classesLocations classes locations relative to the current classpath root.
*/
public SELF withProviderClassesFrom(String classesLocation) {
this.providerClassLocation = classesLocation;
public SELF withProviderClassesFrom(String... classesLocations) {
this.providerClassLocations = Arrays.asList(classesLocations);
return self();
}

Expand Down

0 comments on commit 13849db

Please sign in to comment.