24
24
25
25
import org .slf4j .Logger ;
26
26
import org .slf4j .LoggerFactory ;
27
- import org .testcontainers .containers .CassandraContainer ;
28
27
29
28
import org .springframework .data .cassandra .core .cql .SessionCallback ;
30
29
import org .springframework .data .cassandra .support .CassandraConnectionProperties ;
31
30
import org .springframework .data .cassandra .support .CqlDataSet ;
32
31
import org .springframework .lang .NonNull ;
33
32
import org .springframework .util .Assert ;
34
- import org .springframework .util .SocketUtils ;
35
33
import org .springframework .util .StringUtils ;
36
34
35
+ import org .testcontainers .containers .CassandraContainer ;
36
+
37
37
import com .datastax .oss .driver .api .core .CqlIdentifier ;
38
38
import com .datastax .oss .driver .api .core .CqlSession ;
39
39
import com .datastax .oss .driver .api .core .CqlSessionBuilder ;
@@ -85,8 +85,8 @@ class CassandraDelegate {
85
85
/**
86
86
* Create a new {@link CassandraDelegate} allowing the use of a config file.
87
87
*
88
- * @param yamlConfigurationResource {@link String name} of the configuration resource;
89
- * must not be {@literal null} or {@literal empty}.
88
+ * @param yamlConfigurationResource {@link String name} of the configuration resource; must not be {@literal null} or
89
+ * {@literal empty}.
90
90
* @see #CassandraDelegate(String, long)
91
91
*/
92
92
public CassandraDelegate (@ NonNull String yamlConfigurationResource ) {
@@ -258,7 +258,7 @@ private boolean isStartNeeded() {
258
258
private void configureRemoteJmxPort () {
259
259
260
260
if (!System .getProperties ().containsKey ("com.sun.management.jmxremote.port" )) {
261
- System .setProperty ("com.sun.management.jmxremote.port" , String . valueOf ( SocketUtils . findAvailableTcpPort ( 1024 )) );
261
+ System .setProperty ("com.sun.management.jmxremote.port" , " 1024" );
262
262
}
263
263
}
264
264
@@ -273,9 +273,7 @@ private void runTestcontainerCassandra() {
273
273
274
274
if (container == null ) {
275
275
276
- container = getCassandraDockerImageName ()
277
- .map (CassandraContainer ::new )
278
- .orElseGet (CassandraContainer ::new );
276
+ container = getCassandraDockerImageName ().map (CassandraContainer ::new ).orElseGet (CassandraContainer ::new );
279
277
280
278
container .start ();
281
279
@@ -289,14 +287,13 @@ private void runTestcontainerCassandra() {
289
287
290
288
private Optional <String > getCassandraDockerImageName () {
291
289
292
- return resolveCassandraVersion ()
293
- .map (cassandraVersion -> String .format ("cassandra:%s" , cassandraVersion ));
290
+ return resolveCassandraVersion ().map (cassandraVersion -> String .format ("cassandra:%s" , cassandraVersion ));
294
291
}
295
292
296
293
private Optional <String > resolveCassandraVersion () {
297
294
298
295
return Optional .ofNullable (System .getProperty ("cassandra.version" , System .getenv ("CASSANDRA_VERSION" )))
299
- .filter (StringUtils ::hasText );
296
+ .filter (StringUtils ::hasText );
300
297
}
301
298
302
299
private synchronized void initializeConnection () {
0 commit comments