3
3
import static io .restassured .RestAssured .given ;
4
4
import static org .hamcrest .CoreMatchers .is ;
5
5
import static org .junit .jupiter .api .Assertions .assertNotNull ;
6
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
7
+
8
+ import java .util .Set ;
6
9
7
10
import org .infinispan .client .hotrod .RemoteCache ;
8
11
import org .infinispan .client .hotrod .RemoteCacheManager ;
16
19
@ QuarkusTestResource (ServerResourceTestResource .class )
17
20
@ QuarkusTest
18
21
public class ServerResourceTest {
22
+ public static final int PORT = 8081 ;
23
+
19
24
@ Test
20
25
public void testSimpleWriteAndRetrieve () {
21
26
given ()
@@ -47,16 +52,18 @@ public void testGetProtobuf() {
47
52
@ Test
48
53
public void testHotRodGetCacheNames () {
49
54
ConfigurationBuilder builder = new ConfigurationBuilder ();
50
- builder .addServer ().host ("127.0.0.1" ).port (11222 );
55
+ builder .addServer ().host ("127.0.0.1" ).port (PORT );
51
56
52
57
RemoteCacheManager remoteCacheManager = new RemoteCacheManager (builder .build ());
53
- remoteCacheManager .getCacheNames ();
58
+ Set <String > cacheNames = remoteCacheManager .getCacheNames ();
59
+ assertNotNull (cacheNames );
60
+ assertTrue (cacheNames .contains ("quarkus-infinispan-server" ));
54
61
}
55
62
56
63
@ Test
57
64
public void testHotRodGetCache () {
58
65
ConfigurationBuilder builder = new ConfigurationBuilder ();
59
- builder .addServer ().host ("127.0.0.1" ).port (11222 );
66
+ builder .addServer ().host ("127.0.0.1" ).port (PORT );
60
67
61
68
RemoteCacheManager remoteCacheManager = new RemoteCacheManager (builder .build ());
62
69
assertNotNull (remoteCacheManager .getCache ("quarkus-infinispan-server" ));
@@ -65,7 +72,7 @@ public void testHotRodGetCache() {
65
72
@ Test
66
73
public void testHotRodInternalCacheOperations () {
67
74
ConfigurationBuilder builder = new ConfigurationBuilder ();
68
- builder .addServer ().host ("127.0.0.1" ).port (11222 );
75
+ builder .addServer ().host ("127.0.0.1" ).port (PORT );
69
76
70
77
RemoteCacheManager remoteCacheManager = new RemoteCacheManager (builder .build ());
71
78
RemoteCache <Object , Object > cache = remoteCacheManager .getCache ("___protobuf_metadata" );
@@ -76,10 +83,10 @@ public void testHotRodInternalCacheOperations() {
76
83
@ Test
77
84
public void testHotRodCreateCache () {
78
85
ConfigurationBuilder builder = new ConfigurationBuilder ();
79
- builder .addServer ().host ("127.0.0.1" ).port (11222 );
86
+ builder .addServer ().host ("127.0.0.1" ).port (PORT );
80
87
81
88
RemoteCacheManager remoteCacheManager = new RemoteCacheManager (builder .build ());
82
- XMLStringConfiguration config = new XMLStringConfiguration ("<infinispan><cache-container><distributed-cache name=\" default \" /></cache-container></infinispan>" );
89
+ XMLStringConfiguration config = new XMLStringConfiguration ("<infinispan><cache-container><distributed-cache name=\" created-cache \" /></cache-container></infinispan>" );
83
90
RemoteCache <Object , Object > cache = remoteCacheManager
84
91
.administration ()
85
92
.getOrCreateCache ("created-cache" , config );
0 commit comments