Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to infispan 14 #622

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@QuarkusScenario
public class BasicInfinispanBookCacheIT extends BaseBookCacheIT {

@Container(image = "docker.io/infinispan/server:13.0", expectedLog = "Infinispan Server.*started in", port = 11222)
@Container(image = "docker.io/infinispan/server:14.0", expectedLog = "Infinispan Server.*started in", port = 11222)
static final InfinispanService infinispan = new InfinispanService();

@QuarkusApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.quarkus.qe.books;

import io.quarkus.test.bootstrap.InfinispanService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
public class LegacyUsingJksInfinispanBookCacheIT extends BaseBookCacheIT {

@Container(image = "docker.io/infinispan/server:13.0", expectedLog = "Infinispan Server.*started in", port = 11222)
static final InfinispanService infinispan = new InfinispanService()
.withConfigFile("jks-config.yaml")
.withSecretFiles("jks/server.jks");

@QuarkusApplication
static final RestService app = new RestService()
.withProperty("quarkus.infinispan-client.server-list", infinispan::getInfinispanServerAddress)
.withProperty("quarkus.infinispan-client.auth-username", infinispan.getUsername())
.withProperty("quarkus.infinispan-client.auth-password", infinispan.getPassword())
.withProperty("quarkus.infinispan-client.trust-store", "secret::/jks/server.jks")
.withProperty("quarkus.infinispan-client.trust-store-password", "changeit")
.withProperty("quarkus.infinispan-client.trust-store-type", "jks");
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
@QuarkusScenario
public class UsingJksInfinispanBookCacheIT extends BaseBookCacheIT {

@Container(image = "docker.io/infinispan/server:13.0", expectedLog = "Infinispan Server.*started in", port = 11222)
@Container(image = "docker.io/infinispan/server:14.0", expectedLog = "Infinispan Server.*started in", port = 11222)
static final InfinispanService infinispan = new InfinispanService()
.withConfigFile("jks-config.yaml")
.withSecretFiles("jks/server.jks");
.withConfigFile("infinispan.xml")
.withSecretFiles("jks/keystore.jks");

@QuarkusApplication
static final RestService app = new RestService()
.withProperty("quarkus.infinispan-client.server-list", infinispan::getInfinispanServerAddress)
.withProperty("quarkus.infinispan-client.auth-username", infinispan.getUsername())
.withProperty("quarkus.infinispan-client.auth-password", infinispan.getPassword())
.withProperty("quarkus.infinispan-client.trust-store", "secret::/jks/server.jks")
.withProperty("quarkus.infinispan-client.trust-store-password", "changeit")
.withProperty("quarkus.infinispan-client.trust-store", "secret::/jks/truststore.jks")
.withProperty("quarkus.infinispan-client.trust-store-password", "password")
.withProperty("quarkus.infinispan-client.trust-store-type", "jks");
}
57 changes: 57 additions & 0 deletions examples/infinispan/src/test/resources/infinispan.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<infinispan>
<jgroups>
<!-- Creates a secure JGroups stack named "encrypt-tcp" that extends the default TCP stack. -->
<stack name="encrypt-tcp" extends="tcp">
<!-- Adds a keystore that nodes use to perform certificate authentication. -->
<!-- Uses the stack.combine and stack.position attributes to insert SSL_KEY_EXCHANGE into the default TCP stack after VERIFY_SUSPECT2. -->
<SSL_KEY_EXCHANGE keystore_name="/jks/keystore.jks" keystore_password="password" stack.combine="INSERT_AFTER" stack.position="VERIFY_SUSPECT2"/>
<!-- Configures ASYM_ENCRYPT -->
<!-- Uses the stack.combine and stack.position attributes to insert ASYM_ENCRYPT into the default TCP stack before pbcast.NAKACK2. -->
<!-- The use_external_key_exchange = "true" attribute configures nodes to use the `SSL_KEY_EXCHANGE` protocol for certificate authentication. -->
<ASYM_ENCRYPT asym_keylength="2048" asym_algorithm="RSA" change_key_on_coord_leave="false" change_key_on_leave="false" use_external_key_exchange="true" stack.combine="INSERT_BEFORE" stack.position="pbcast.NAKACK2"/>
</stack>
</jgroups>
<cache-container name="default" statistics="true">
<!-- Configures the cluster to use the JGroups stack. -->
<transport cluster="${infinispan.cluster.name:cluster}" stack="encrypt-tcp" node-name="${infinispan.node.name:}"/>
</cache-container>
<server>
<interfaces>
<interface name="public">
<inet-address value="${infinispan.bind.address:0.0.0.0}"/>
</interface>
</interfaces>
<socket-bindings default-interface="public" port-offset="${infinispan.socket.binding.port-offset:0}">
<socket-binding name="default" port="${infinispan.bind.port:11222}"/>
<socket-binding name="memcached" port="11221"/>
</socket-bindings>
<security>
<security-realms>
<security-realm name="default">
<server-identities>
<ssl>
<keystore path="/jks/keystore.jks" password="password" alias="1" generate-self-signed-certificate-host="localhost"/>
</ssl>
</server-identities>
<properties-realm groups-attribute="Roles">
<user-properties path="users.properties"/>
<group-properties path="groups.properties"/>
</properties-realm>
</security-realm>
</security-realms>
</security>
<endpoints>
<endpoint socket-binding="default" security-realm="default">
<hotrod-connector name="hotrod">
<authentication>
<sasl mechanisms="PLAIN DIGEST-MD5 BASIC" server-name="infinispan"/>
</authentication>
</hotrod-connector>
<rest-connector name="rest">
<authentication mechanisms="BASIC"/>
</rest-connector>
</endpoint>
</endpoints>
</server>
</infinispan>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static io.quarkus.test.utils.PropertiesUtils.RESOURCE_WITH_DESTINATION_PREFIX_MATCHER;
import static io.quarkus.test.utils.PropertiesUtils.RESOURCE_WITH_DESTINATION_SPLIT_CHAR;
import static io.quarkus.test.utils.PropertiesUtils.SECRET_PREFIX;
import static io.quarkus.test.utils.PropertiesUtils.SLASH;

import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -149,7 +150,7 @@ private void addFileToContainer(String filePath) {
}

private void addFileToContainer(String destinationPath, String hostFilePath) {
String containerFullPath = destinationPath + hostFilePath;
String containerFullPath = destinationPath + SLASH + hostFilePath;
innerContainer.withClasspathResourceMapping(hostFilePath, containerFullPath, BindMode.READ_ONLY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class PropertiesUtils {
public static final String RESOURCE_WITH_DESTINATION_PREFIX_MATCHER = ".*" + RESOURCE_WITH_DESTINATION_SPLIT_CHAR + ".*";
public static final String SECRET_PREFIX = "secret::/";
public static final Path TARGET = Path.of("target");
public static final String SLASH = "/";
public static final String SLASH = System.getProperty("file.separator");

private static final String AUTOGENERATED_COMMENT = "# This properties file has been auto generated "
+ "by Quarkus QE Test Framework";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public InfinispanService onPreStart(Action action) {
withProperty("PASS", getPassword());

if (StringUtils.isNotEmpty(configFile)) {
// legacy -> Infinispan previous to version 14
withProperty("CONFIG_PATH", RESOURCE_PREFIX + SLASH + configFile);
// Infinispan 14+ configuration setup
withProperty("INFINISPAN_CONFIG_PATH", "resource_with_destination::/opt/infinispan/server/conf|" + configFile);
}

if (userConfigFiles != null) {
Expand Down