Updated user documentation
This commit is contained in:
parent
587e7d1d0d
commit
a21b64c31c
1 changed files with 23 additions and 0 deletions
23
README.md
23
README.md
|
@ -12,14 +12,37 @@ Feel free to suggest changes!
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
## Instantiation of the Infinispan container
|
||||||
|
|
||||||
Here's simple example how you can use the `InfinispanContainer`.
|
Here's simple example how you can use the `InfinispanContainer`.
|
||||||
|
|
||||||
```
|
```
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static InfinispanContainer infinispan = new InfinispanContainer()
|
public static InfinispanContainer infinispan = new InfinispanContainer()
|
||||||
|
.withProtocolVersion(ProtocolVersion.PROTOCOL_VERSION_26);
|
||||||
|
```
|
||||||
|
## Cache creation
|
||||||
|
|
||||||
|
You can create simple local caches that need to be available for your tests. If you run an up-to-date Infinispan container (>9.1.0) then caches can be created
|
||||||
|
using the API of the `RemoteCacheManager` provided by the Infinispan client library. Simple configure some caches that the `InfinispanContainer` should create for you.
|
||||||
|
They will automatically be created once the container has started.
|
||||||
|
|
||||||
|
```
|
||||||
|
new InfinispanContainer()
|
||||||
.withProtocolVersion(ProtocolVersion.PROTOCOL_VERSION_26)
|
.withProtocolVersion(ProtocolVersion.PROTOCOL_VERSION_26)
|
||||||
.withCaches("testCache");
|
.withCaches("testCache");
|
||||||
|
```
|
||||||
|
|
||||||
|
If you run an Infinispan server version prior to `9.1.0`, you can link a configuration file that contains the necessary caches into the container:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
new InfinispanContainer("jboss/infinispan-server:9.0.3.Final")
|
||||||
|
.withProtocolVersion(ProtocolVersion.PROTOCOL_VERSION_26)
|
||||||
|
.withStandaloneConfiguration("infinispan-standalone.xml")
|
||||||
|
```
|
||||||
|
|
||||||
|
## CacheManager retrieval
|
||||||
|
|
||||||
If you want, you can retrieve a `RemoteCacheManager` from the container:
|
If you want, you can retrieve a `RemoteCacheManager` from the container:
|
||||||
```
|
```
|
||||||
infinispan.getCacheManager()
|
infinispan.getCacheManager()
|
||||||
|
|
Loading…
Reference in a new issue