Test Infinispan with TestContainers

Infinispan and Test Containers

Лицензия

Лицензия

Категории

Категории

Контейнер Infinispan Данные Caching
Группа

Группа

org.infinispan
Идентификатор

Идентификатор

infinispan-testcontainers
Последняя версия

Последняя версия

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Test Infinispan with TestContainers
Infinispan and Test Containers
Организация-разработчик

Организация-разработчик

JBoss, a division of Red Hat

Скачать infinispan-testcontainers

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.infinispan/infinispan-testcontainers/ -->
<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-testcontainers</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.infinispan/infinispan-testcontainers/
implementation 'org.infinispan:infinispan-testcontainers:0.1'
// https://jarcasting.com/artifacts/org.infinispan/infinispan-testcontainers/
implementation ("org.infinispan:infinispan-testcontainers:0.1")
'org.infinispan:infinispan-testcontainers:jar:0.1'
<dependency org="org.infinispan" name="infinispan-testcontainers" rev="0.1">
  <artifact name="infinispan-testcontainers" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.infinispan', module='infinispan-testcontainers', version='0.1')
)
libraryDependencies += "org.infinispan" % "infinispan-testcontainers" % "0.1"
[org.infinispan/infinispan-testcontainers "0.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.infinispan : infinispan-client-hotrod jar 10.0.0.Beta3
org.testcontainers : testcontainers jar 1.11.1

test (3)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.3.1
org.junit.jupiter : junit-jupiter-engine jar 5.3.1
org.testcontainers : junit-jupiter jar 1.11.1

Модули Проекта

Данный проект не имеет модулей.

Infinispan Test

Build Status

This library contains the utilities to help unit testing java applications backed with an Infinispan backend.

Frameworks supported

JUnit 5 - Jupiter

pom.xml
<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-junit5</artifactId>
    <version>0.2</version>
    <scope>test</scope>
</dependency>
MyTest.java
public class InfinispanExtensionTest {

    @RegisterExtension
    InfinispanServerExtension server = InfinispanServerExtension.builder().build();

    @Test
    public void test() {
        RemoteCacheManager remoteCacheManager = server.hotRodClient();
        ...
    }

You can override host and port using the builder. By default, values are localhost and 11222.

Testcontainers

A very simple container is provided to be used with Testcontainers. The image used is the latest jboss/infinispan-server:latest

Add the dependency to the classpath

pom.xml
<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-testcontainers</artifactId>
    <version>0.2</version>
    <scope>test</scope>
</dependency>

Unit test example with JUnit 5

MyTest.java
@Testcontainers
public class InfinispanContainerTest {
    @Container
    private final static InfinispanContainer INFINISPAN_SERVER = new InfinispanContainer().withCache("mycache");

    @AfterAll
    public static void cleanup() {
        INFINISPAN_SERVER.stop();
    }

    @Test
    public void test() {
        RemoteCache<String, String> cache = INFINISPAN_SERVER.getCacheManager().getCache("mycache");
        ...
    }
}

Junit 4

Add the dependency to the classpath

pom.xml
<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-junit4</artifactId>
    <version>0.2</version>
    <scope>test</scope>
</dependency>

Usage

MyTest.java
@ServerTestConfiguration
public class ClusteredServerTest {

    @ClassRule
    public static ServerTestRule serverTestRule = new ServerTestRule();

    @Rule
    public ServerTestMethodRule serverTestMethodRule = new ServerTestMethodRule(serverTestRule);

    @Test
    @ServerTestMethodConfiguration
    public void testCluster() {
        RemoteCacheManager client = serverTestRule.hotRodClient();
        ...
    }
}

@ServerTestConfiguration

Class annotation. Two properties can be configured with this annotation:

configurationFile: Default value is clustered.xml.

numServers: Number of servers in the cluster. 2 by default.

@ServerTestMethodConfiguration

Method annotation. Two properties can be configured with this annotation:

cacheName: The cache name. By default will create a cache name based on the method name

cacheConfig: The configuration to use for the cache, in XML format. Empty by default.

Версии библиотеки

Версия
0.1