2424
2525import org .slf4j .Logger ;
2626import org .slf4j .LoggerFactory ;
27- import org .testcontainers .containers .CassandraContainer ;
2827
2928import org .springframework .data .cassandra .core .cql .SessionCallback ;
3029import org .springframework .data .cassandra .support .CassandraConnectionProperties ;
3130import org .springframework .data .cassandra .support .CqlDataSet ;
3231import org .springframework .lang .NonNull ;
3332import org .springframework .util .Assert ;
34- import org .springframework .util .SocketUtils ;
3533import org .springframework .util .StringUtils ;
3634
35+ import org .testcontainers .containers .CassandraContainer ;
36+
3737import com .datastax .oss .driver .api .core .CqlIdentifier ;
3838import com .datastax .oss .driver .api .core .CqlSession ;
3939import com .datastax .oss .driver .api .core .CqlSessionBuilder ;
@@ -85,8 +85,8 @@ class CassandraDelegate {
8585 /**
8686 * Create a new {@link CassandraDelegate} allowing the use of a config file.
8787 *
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}.
9090 * @see #CassandraDelegate(String, long)
9191 */
9292 public CassandraDelegate (@ NonNull String yamlConfigurationResource ) {
@@ -258,7 +258,7 @@ private boolean isStartNeeded() {
258258 private void configureRemoteJmxPort () {
259259
260260 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" );
262262 }
263263 }
264264
@@ -273,9 +273,7 @@ private void runTestcontainerCassandra() {
273273
274274 if (container == null ) {
275275
276- container = getCassandraDockerImageName ()
277- .map (CassandraContainer ::new )
278- .orElseGet (CassandraContainer ::new );
276+ container = getCassandraDockerImageName ().map (CassandraContainer ::new ).orElseGet (CassandraContainer ::new );
279277
280278 container .start ();
281279
@@ -289,14 +287,13 @@ private void runTestcontainerCassandra() {
289287
290288 private Optional <String > getCassandraDockerImageName () {
291289
292- return resolveCassandraVersion ()
293- .map (cassandraVersion -> String .format ("cassandra:%s" , cassandraVersion ));
290+ return resolveCassandraVersion ().map (cassandraVersion -> String .format ("cassandra:%s" , cassandraVersion ));
294291 }
295292
296293 private Optional <String > resolveCassandraVersion () {
297294
298295 return Optional .ofNullable (System .getProperty ("cassandra.version" , System .getenv ("CASSANDRA_VERSION" )))
299- .filter (StringUtils ::hasText );
296+ .filter (StringUtils ::hasText );
300297 }
301298
302299 private synchronized void initializeConnection () {
0 commit comments