diff --git a/docs/src/main/asciidoc/infinispan-dev-services.adoc b/docs/src/main/asciidoc/infinispan-dev-services.adoc
index 436ab6b5a198c..96c601bfcca76 100644
--- a/docs/src/main/asciidoc/infinispan-dev-services.adoc
+++ b/docs/src/main/asciidoc/infinispan-dev-services.adoc
@@ -62,6 +62,31 @@ Dev Services for Infinispan relies on Docker to start the broker.
If your environment does not support Docker, you will need to start the broker manually, or connect to an already running broker.
You can configure the broker address using `quarkus.infinispan-client.hosts`.
+== Providing configuration to the running server
+Dev Services for Infinispan will spin up an Infinispan with the infinispan.xml file by default.
+However, there are cases where is helpful to provide some extra configuration to the server.
+This can be done by adding configuration files in xml, yaml or json to the resources classpath and
+providing the following configuration:
+
+[source,properties]
+----
+quarkus.infinispan-client.devservices.config-files=server-config-override.xml <1>
+----
+<1> server-config-override.xml is a file under the resources folder
+
+[source,xml]
+----
+ <1>
+
+ <2>
+
+
+
+
+----
+<1> The content of server-config-override.xml file
+<2> By providing a cache configuration, this cache will be present on the server container
+
== Cross Site Replication
If you want run the Infinispan Server container with Cross Site Replication configuration, you need to provide a site name.
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 d2c27f03f61d9..36b689d36a143 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
@@ -18,6 +18,7 @@
import org.infinispan.commons.util.Version;
import org.infinispan.server.test.core.InfinispanContainer;
import org.jboss.logging.Logger;
+import org.testcontainers.containers.BindMode;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.IsNormal;
@@ -272,10 +273,16 @@ public QuarkusInfinispanContainer(String clientName, InfinispanDevServicesConfig
}
withUser(DEFAULT_USERNAME);
withPassword(InfinispanDevServiceProcessor.DEFAULT_PASSWORD);
- String command = "";
+ String command = "-c infinispan.xml";
if (config.site.isPresent()) {
command = "-c infinispan-xsite.xml -Dinfinispan.site.name=" + config.site.get();
}
+ command = command + config.configFiles.map(files -> files.stream().map(file -> {
+ String userConfigFile = "/user-config/" + file;
+ withClasspathResourceMapping(file, userConfigFile, BindMode.READ_ONLY);
+ return " -c " + userConfigFile;
+ }).collect(Collectors.joining())).orElse("");
+
if (config.mcastPort.isPresent()) {
command = command + " -Djgroups.mcast_port=" + config.mcastPort.getAsInt();
}
@@ -284,10 +291,10 @@ public QuarkusInfinispanContainer(String clientName, InfinispanDevServicesConfig
command = command + " -Dotel.exporter.otlp.endpoint=" + config.exporterOtlpEndpoint.get();
command = command + " -Dotel.service.name=infinispan-server-service -Dotel.metrics.exporter=none";
}
- if (!command.isEmpty()) {
- withCommand(command);
- }
+
config.artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0])));
+
+ withCommand(command);
}
@Override
diff --git a/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/CreateADefaultRemoteCacheManagerWithEmptyConfTest.java b/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/CreateADefaultRemoteCacheManagerWithEmptyConfTest.java
new file mode 100644
index 0000000000000..8544a26b709e5
--- /dev/null
+++ b/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/CreateADefaultRemoteCacheManagerWithEmptyConfTest.java
@@ -0,0 +1,29 @@
+
+package io.quarkus.infinispan.test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import jakarta.enterprise.inject.Default;
+
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.infinispan.counter.api.CounterManager;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.quarkus.arc.Arc;
+import io.quarkus.test.QuarkusUnitTest;
+
+public class CreateADefaultRemoteCacheManagerWithEmptyConfTest {
+
+ @RegisterExtension
+ static final QuarkusUnitTest config = new QuarkusUnitTest()
+ .withConfigurationResource("empty-application-infinispan-client.properties");
+
+ @Test
+ public void remoteCacheManagerDefaultBeansAccessible() {
+ assertThat(Arc.container().instance(RemoteCacheManager.class, Default.Literal.INSTANCE).get()).isNotNull();
+ assertThat(Arc.container().instance(CounterManager.class, Default.Literal.INSTANCE).get()).isNotNull();
+ assertThat(Arc.container().listAll(RemoteCacheManager.class).size()).isEqualTo(1);
+ assertThat(Arc.container().listAll(CounterManager.class).size()).isEqualTo(1);
+ }
+}
diff --git a/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/OverrideContainerConfigOnDevServicesTest.java b/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/OverrideContainerConfigOnDevServicesTest.java
new file mode 100644
index 0000000000000..b815b8a9aa2df
--- /dev/null
+++ b/extensions/infinispan-client/deployment/src/test/java/io/quarkus/infinispan/test/OverrideContainerConfigOnDevServicesTest.java
@@ -0,0 +1,29 @@
+
+package io.quarkus.infinispan.test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import jakarta.inject.Inject;
+
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.quarkus.test.QuarkusUnitTest;
+
+public class OverrideContainerConfigOnDevServicesTest {
+
+ @Inject
+ RemoteCacheManager cacheManager;
+
+ @RegisterExtension
+ static final QuarkusUnitTest config = new QuarkusUnitTest()
+ .withApplicationRoot((jar) -> jar
+ .addAsResource("server-config-override.xml"))
+ .withConfigurationResource("dev-services-adds-server-config.properties");
+
+ @Test
+ public void remoteCacheManagerDefaultBeansAccessible() {
+ assertThat(cacheManager.getCacheNames()).contains("my-local-cache");
+ }
+}
diff --git a/extensions/infinispan-client/deployment/src/test/resources/dev-services-adds-server-config.properties b/extensions/infinispan-client/deployment/src/test/resources/dev-services-adds-server-config.properties
new file mode 100644
index 0000000000000..e2ad5490d9aa1
--- /dev/null
+++ b/extensions/infinispan-client/deployment/src/test/resources/dev-services-adds-server-config.properties
@@ -0,0 +1,3 @@
+quarkus.infinispan-client.devservices.enabled=true
+quarkus.infinispan-client.devservices.config-files=server-config-override.xml
+
diff --git a/extensions/infinispan-client/deployment/src/test/resources/empty-application-infinispan-client.properties b/extensions/infinispan-client/deployment/src/test/resources/empty-application-infinispan-client.properties
index 8b137891791fe..e69de29bb2d1d 100644
--- a/extensions/infinispan-client/deployment/src/test/resources/empty-application-infinispan-client.properties
+++ b/extensions/infinispan-client/deployment/src/test/resources/empty-application-infinispan-client.properties
@@ -1 +0,0 @@
-
diff --git a/extensions/infinispan-client/deployment/src/test/resources/server-config-override.xml b/extensions/infinispan-client/deployment/src/test/resources/server-config-override.xml
new file mode 100644
index 0000000000000..c25b6c2d1a1e9
--- /dev/null
+++ b/extensions/infinispan-client/deployment/src/test/resources/server-config-override.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java
index 1d1178e30c416..1877049ec344d 100644
--- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java
+++ b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java
@@ -117,6 +117,12 @@ public class InfinispanDevServicesConfig {
@ConfigItem
public Map containerEnv;
+ /**
+ * Infinispan Server configuration chunks to be passed to the container.
+ */
+ @ConfigItem
+ public Optional> configFiles;
+
@Override
public boolean equals(Object o) {
if (this == o)