Skip to content

Commit

Permalink
Merge branch 'main' into issue/38543-hal-collection-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasson authored Feb 7, 2024
2 parents 7f86e22 + 11bef66 commit 0e19b9f
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/amqp.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ version: '2'
services:
artemis:
image: quay.io/artemiscloud/activemq-artemis-broker:0.1.2
image: quay.io/artemiscloud/activemq-artemis-broker:1.0.25
ports:
- "8161:8161"
- "61616:61616"
Expand Down
25 changes: 25 additions & 0 deletions docs/src/main/asciidoc/infinispan-dev-services.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
----
<infinispan> <1>
<cache-container>
<local-cache name="my-local-cache"> <2>
<encoding media-type="application/x-protostream" />
</local-cache>
</cache-container>
</infinispan>
----
<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.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/jms.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ You can follow the instructions from the https://activemq.apache.org/components/

[source,bash]
----
docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:1.0.21
docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:1.0.25
----

=== The price producer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
quarkus.infinispan-client.devservices.enabled=true
quarkus.infinispan-client.devservices.config-files=server-config-override.xml

Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<infinispan>
<cache-container>
<metrics accurate-size="true"/>
<local-cache name="my-local-cache">
<encoding media-type="application/x-protostream" />
</local-cache>
</cache-container>
</infinispan>
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public class InfinispanDevServicesConfig {
@ConfigItem
public Map<String, String> containerEnv;

/**
* Infinispan Server configuration chunks to be passed to the container.
*/
@ConfigItem
public Optional<List<String>> configFiles;

@Override
public boolean equals(Object o) {
if (this == o)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class AmqpDevServicesBuildTimeConfig {
* page</a>
* to find the available versions.
*/
@ConfigItem(defaultValue = "quay.io/artemiscloud/activemq-artemis-broker:1.0.22")
@ConfigItem(defaultValue = "quay.io/artemiscloud/activemq-artemis-broker:1.0.25")
public String imageName;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ mp.messaging.outgoing.prices-out.destination=prices
smallrye.messaging.worker.<virtual-thread>.max-concurrency=5

quarkus.artemis.devservices.enabled=true
quarkus.artemis.devservices.image-name=quay.io/artemiscloud/activemq-artemis-broker:1.0.18
quarkus.artemis.devservices.image-name=quay.io/artemiscloud/activemq-artemis-broker:1.0.25

0 comments on commit 0e19b9f

Please sign in to comment.