parent
2f5a96351d
commit
7c9593f88a
3 changed files with 43 additions and 3 deletions
12
pom.xml
12
pom.xml
|
@ -76,7 +76,7 @@
|
||||||
<h2.version>2.2.220</h2.version>
|
<h2.version>2.2.220</h2.version>
|
||||||
<hibernate-orm.plugin.version>6.2.5.Final</hibernate-orm.plugin.version>
|
<hibernate-orm.plugin.version>6.2.5.Final</hibernate-orm.plugin.version>
|
||||||
<hibernate.c3p0.version>6.2.5.Final</hibernate.c3p0.version>
|
<hibernate.c3p0.version>6.2.5.Final</hibernate.c3p0.version>
|
||||||
<infinispan.version>14.0.10.Final</infinispan.version>
|
<infinispan.version>14.0.13.Final</infinispan.version>
|
||||||
<infinispan.protostream.processor.version>4.6.2.Final</infinispan.protostream.processor.version>
|
<infinispan.protostream.processor.version>4.6.2.Final</infinispan.protostream.processor.version>
|
||||||
|
|
||||||
<!--JAKARTA-->
|
<!--JAKARTA-->
|
||||||
|
@ -812,6 +812,16 @@
|
||||||
<artifactId>infinispan-core-jakarta</artifactId>
|
<artifactId>infinispan-core-jakarta</artifactId>
|
||||||
<version>${infinispan.version}</version>
|
<version>${infinispan.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.infinispan</groupId>
|
||||||
|
<artifactId>infinispan-commons</artifactId>
|
||||||
|
<version>${infinispan.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.infinispan</groupId>
|
||||||
|
<artifactId>infinispan-commons-jakarta</artifactId>
|
||||||
|
<version>${infinispan.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.infinispan</groupId>
|
<groupId>org.infinispan</groupId>
|
||||||
<artifactId>infinispan-cachestore-remote</artifactId>
|
<artifactId>infinispan-cachestore-remote</artifactId>
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.testcontainers.containers.MSSQLServerContainer;
|
||||||
import org.testcontainers.containers.MariaDBContainer;
|
import org.testcontainers.containers.MariaDBContainer;
|
||||||
import org.testcontainers.containers.MySQLContainer;
|
import org.testcontainers.containers.MySQLContainer;
|
||||||
import org.testcontainers.containers.PostgreSQLContainer;
|
import org.testcontainers.containers.PostgreSQLContainer;
|
||||||
|
import org.testcontainers.images.PullPolicy;
|
||||||
import org.testcontainers.utility.DockerImageName;
|
import org.testcontainers.utility.DockerImageName;
|
||||||
|
|
||||||
public class DatabaseContainer {
|
public class DatabaseContainer {
|
||||||
|
@ -107,6 +108,13 @@ public class DatabaseContainer {
|
||||||
String MARIADB_IMAGE = System.getProperty("kc.db.mariadb.container.image");
|
String MARIADB_IMAGE = System.getProperty("kc.db.mariadb.container.image");
|
||||||
String MYSQL_IMAGE = System.getProperty("kc.db.mysql.container.image");
|
String MYSQL_IMAGE = System.getProperty("kc.db.mysql.container.image");
|
||||||
String INFINISPAN_IMAGE = System.getProperty("kc.infinispan.container.image");
|
String INFINISPAN_IMAGE = System.getProperty("kc.infinispan.container.image");
|
||||||
|
if (INFINISPAN_IMAGE.matches("quay.io/infinispan/.*-SNAPSHOT")) {
|
||||||
|
// If the image name ends with SNAPSHOT, someone is trying to use a snapshot release of Infinispan.
|
||||||
|
// Then switch to the closest match of the Infinispan test container
|
||||||
|
INFINISPAN_IMAGE = INFINISPAN_IMAGE.replaceAll("quay.io/infinispan/", "quay.io/infinispan-test/");
|
||||||
|
INFINISPAN_IMAGE = INFINISPAN_IMAGE.replaceAll("[0-9]*-SNAPSHOT$", "x");
|
||||||
|
}
|
||||||
|
|
||||||
String MSSQL_IMAGE = System.getProperty("kc.db.mssql.container.image");
|
String MSSQL_IMAGE = System.getProperty("kc.db.mssql.container.image");
|
||||||
|
|
||||||
switch (alias) {
|
switch (alias) {
|
||||||
|
@ -123,8 +131,13 @@ public class DatabaseContainer {
|
||||||
DockerImageName MSSQL = DockerImageName.parse(MSSQL_IMAGE).asCompatibleSubstituteFor("sqlserver");
|
DockerImageName MSSQL = DockerImageName.parse(MSSQL_IMAGE).asCompatibleSubstituteFor("sqlserver");
|
||||||
return configureJdbcContainer(new MSSQLServerContainer<>(MSSQL));
|
return configureJdbcContainer(new MSSQLServerContainer<>(MSSQL));
|
||||||
case "infinispan":
|
case "infinispan":
|
||||||
return configureInfinispanUser(new GenericContainer<>(INFINISPAN_IMAGE))
|
GenericContainer<?> infinispanContainer = configureInfinispanUser(new GenericContainer<>(INFINISPAN_IMAGE))
|
||||||
.withExposedPorts(11222);
|
.withExposedPorts(11222);
|
||||||
|
// the images in the 'infinispan-test' repository point to tags that are frequently refreshed, therefore, always pull them
|
||||||
|
if (infinispanContainer.getDockerImageName().startsWith("quay.io/infinispan-test")) {
|
||||||
|
infinispanContainer.withImagePullPolicy(PullPolicy.alwaysPull());
|
||||||
|
}
|
||||||
|
return infinispanContainer;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unsupported database: " + alias);
|
throw new RuntimeException("Unsupported database: " + alias);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.jboss.logging.Logger;
|
||||||
import org.keycloak.testsuite.arquillian.HotRodContainerProvider;
|
import org.keycloak.testsuite.arquillian.HotRodContainerProvider;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
|
import org.testcontainers.images.PullPolicy;
|
||||||
import org.testcontainers.utility.MountableFile;
|
import org.testcontainers.utility.MountableFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -50,11 +51,16 @@ public class InfinispanContainer extends GenericContainer<InfinispanContainer> {
|
||||||
private static final Pattern IP_ADDRESS_PATTERN = Pattern.compile("listening on (" + IP_ADDRESS_REGEX + "):" + PORT);
|
private static final Pattern IP_ADDRESS_PATTERN = Pattern.compile("listening on (" + IP_ADDRESS_REGEX + "):" + PORT);
|
||||||
|
|
||||||
public InfinispanContainer() {
|
public InfinispanContainer() {
|
||||||
super("quay.io/infinispan/server:" + System.getProperty("infinispan.version"));
|
super(getImageName());
|
||||||
withEnv("USER", USERNAME);
|
withEnv("USER", USERNAME);
|
||||||
withEnv("PASS", PASSWORD);
|
withEnv("PASS", PASSWORD);
|
||||||
withNetworkMode("host");
|
withNetworkMode("host");
|
||||||
|
|
||||||
|
// the images in the 'infinispan-test' repository point to tags that are frequently refreshed, therefore, always pull them
|
||||||
|
if (getImageName().startsWith("quay.io/infinispan-test")) {
|
||||||
|
withImagePullPolicy(PullPolicy.alwaysPull());
|
||||||
|
}
|
||||||
|
|
||||||
Path dir = Path.of(Path.of("").toAbsolutePath() + "/target/lib");
|
Path dir = Path.of(Path.of("").toAbsolutePath() + "/target/lib");
|
||||||
String projectVersion = System.getProperty("project.version");
|
String projectVersion = System.getProperty("project.version");
|
||||||
Path timeTaskPath;
|
Path timeTaskPath;
|
||||||
|
@ -72,6 +78,17 @@ public class InfinispanContainer extends GenericContainer<InfinispanContainer> {
|
||||||
withStartupTimeout(Duration.ofMinutes(5));
|
withStartupTimeout(Duration.ofMinutes(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getImageName() {
|
||||||
|
String version = System.getProperty("infinispan.version");
|
||||||
|
if (version.endsWith("-SNAPSHOT")) {
|
||||||
|
// for snapshot versions, '14.0.13-SNAPSHOT' translates to '14.0.x'
|
||||||
|
version = version.replaceAll("[0-9]*-SNAPSHOT$", "x");
|
||||||
|
return "quay.io/infinispan-test/server:" + version;
|
||||||
|
} else {
|
||||||
|
return "quay.io/infinispan/server:" + version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
if (HOST == null && this.isRunning()) {
|
if (HOST == null && this.isRunning()) {
|
||||||
|
|
Loading…
Reference in a new issue