62
62
import itest .util .ITestCleanupFailedException ;
63
63
import itest .util .Podman ;
64
64
import itest .util .http .JvmIdWebRequest ;
65
+ import org .apache .http .client .utils .URLEncodedUtils ;
65
66
import org .hamcrest .MatcherAssert ;
66
67
import org .hamcrest .Matchers ;
67
68
import org .junit .jupiter .api .AfterAll ;
@@ -133,8 +134,7 @@ void testOtherContainersFound() throws Exception {
133
134
// size should not change
134
135
MatcherAssert .assertThat (actual .size (), Matchers .equalTo (NUM_EXT_CONTAINERS + 1 ));
135
136
Set <ServiceRef > expected = new HashSet <>();
136
- String cryostatTargetId =
137
- String .format ("service:jmx:rmi:///jndi/rmi://%s:9091/jmxrmi" , Podman .POD_NAME );
137
+ String cryostatTargetId = jmxServiceUrl (9091 );
138
138
String cryostatJvmId = JvmIdWebRequest .jvmIdRequest (cryostatTargetId );
139
139
ServiceRef cryostat =
140
140
new ServiceRef (cryostatJvmId , new URI (cryostatTargetId ), "io.cryostat.Cryostat" );
@@ -150,11 +150,7 @@ void testOtherContainersFound() throws Exception {
150
150
"9091" ));
151
151
expected .add (cryostat );
152
152
for (int i = 0 ; i < NUM_EXT_CONTAINERS ; i ++) {
153
- URI uri =
154
- new URI (
155
- String .format (
156
- "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi" ,
157
- Podman .POD_NAME , 9093 + i ));
153
+ URI uri = new URI (jmxServiceUrl (9093 + i ));
158
154
String jvmId = JvmIdWebRequest .jvmIdRequest (uri , VERTX_FIB_CREDENTIALS );
159
155
ServiceRef ext = new ServiceRef (jvmId , uri , "es.andrewazor.demo.Main" );
160
156
ext .setCryostatAnnotations (
@@ -206,7 +202,8 @@ private void createInMemoryRecordings() throws Exception {
206
202
.post (
207
203
String .format (
208
204
"/api/v1/targets/%s/recordings" ,
209
- Podman .POD_NAME + ":" + (9093 + fi )))
205
+ URLEncodedUtils .formatSegments (
206
+ jmxServiceUrl (9093 + fi ))))
210
207
.putHeader (
211
208
"X-JMX-Authorization" ,
212
209
"Basic "
@@ -236,7 +233,7 @@ private void verifyInMemoryRecordingsCreated() throws Exception {
236
233
.get (
237
234
String .format (
238
235
"/api/v1/targets/%s/recordings" ,
239
- Podman . POD_NAME + ":" + ( 9093 + fi )))
236
+ URLEncodedUtils . formatSegments ( jmxServiceUrl ( 9093 + fi ) )))
240
237
.putHeader (
241
238
"X-JMX-Authorization" ,
242
239
"Basic "
@@ -279,7 +276,8 @@ private void deleteInMemoryRecordings() throws Exception {
279
276
.delete (
280
277
String .format (
281
278
"/api/v1/targets/%s/recordings/%s" ,
282
- Podman .POD_NAME + ":" + (9093 + fi ),
279
+ URLEncodedUtils .formatSegments (
280
+ jmxServiceUrl (9093 + fi )),
283
281
"interleaved-" + fi ))
284
282
.putHeader (
285
283
"X-JMX-Authorization" ,
@@ -310,7 +308,7 @@ private void verifyInMemoryRecordingsDeleted() throws Exception {
310
308
.get (
311
309
String .format (
312
310
"/api/v1/targets/%s/recordings" ,
313
- Podman . POD_NAME + ":" + ( 9093 + fi )))
311
+ URLEncodedUtils . formatSegments ( jmxServiceUrl ( 9093 + fi ) )))
314
312
.putHeader (
315
313
"X-JMX-Authorization" ,
316
314
"Basic "
0 commit comments