From 87a52314ef839b8f97bce679d3e328e735e723f8 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Wed, 20 Jul 2022 16:15:05 +0200 Subject: [PATCH] Infinispan Dev Services image configuration --- .../InfinispanDevServiceProcessor.java | 20 +++++++++---------- .../InfinispanDevServicesConfig.java | 10 +++++++++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java index 8d4075e42114b..e6bec77042f4b 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java @@ -15,6 +15,7 @@ import java.util.stream.Collectors; import org.infinispan.client.hotrod.impl.ConfigurationProperties; +import org.infinispan.commons.util.Version; import org.infinispan.server.test.core.InfinispanContainer; import org.jboss.logging.Logger; import org.jetbrains.annotations.NotNull; @@ -153,9 +154,8 @@ private RunningDevService startContainer(DockerStatusBuildItem dockerStatusBuild } Supplier defaultInfinispanServerSupplier = () -> { - QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(devServicesConfig.port, - launchMode == DEVELOPMENT ? devServicesConfig.serviceName : null, useSharedNetwork, - devServicesConfig.artifacts); + QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(devServicesConfig, launchMode, + useSharedNetwork); timeout.ifPresent(infinispanContainer::withStartupTimeout); infinispanContainer.start(); @@ -191,17 +191,17 @@ private static class QuarkusInfinispanContainer extends InfinispanContainer { private String hostName = null; - public QuarkusInfinispanContainer(OptionalInt fixedExposedPort, String serviceName, boolean useSharedNetwork, - Optional> artifacts) { - super(); - this.fixedExposedPort = fixedExposedPort; + public QuarkusInfinispanContainer(InfinispanDevServicesConfig config, + LaunchMode launchMode, boolean useSharedNetwork) { + super(config.imageName.orElse(IMAGE_BASENAME + ":" + Version.getMajorMinor())); + this.fixedExposedPort = config.port; this.useSharedNetwork = useSharedNetwork; - if (serviceName != null) { - withLabel(DEV_SERVICE_LABEL, serviceName); + if (launchMode == DEVELOPMENT) { + withLabel(DEV_SERVICE_LABEL, config.serviceName); } withUser(DEFAULT_USERNAME); withPassword(InfinispanDevServiceProcessor.DEFAULT_PASSWORD); - artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0]))); + config.artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0]))); } @Override diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServicesConfig.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServicesConfig.java index 9bc1d2549bf8a..e41d7272b7204 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServicesConfig.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServicesConfig.java @@ -56,6 +56,13 @@ public class InfinispanDevServicesConfig { @ConfigItem(defaultValue = "infinispan") public String serviceName; + /** + * The image to use. + * Note that only official Infinispan images are supported. + */ + @ConfigItem + public Optional imageName = Optional.empty(); + /** * List of the artifacts to automatically download and add to the Infinispan server libraries. *

@@ -78,11 +85,12 @@ public boolean equals(Object o) { Objects.equals(port, that.port) && Objects.equals(shared, that.shared) && Objects.equals(serviceName, that.serviceName) && + Objects.equals(imageName, that.imageName) && Objects.equals(artifacts, this.artifacts); } @Override public int hashCode() { - return Objects.hash(enabled, port, shared, serviceName, artifacts); + return Objects.hash(enabled, port, shared, serviceName, imageName, artifacts); } }