From c76283c10bec0fead33a1153b30ab09d7e6b91a9 Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Mon, 2 Mar 2020 12:54:13 +0000 Subject: [PATCH] Bump to boot 2.3.0.M2 - Needed gradle change to 5.6 - There's different mongo client in deps so needed to fix MongoDbRule as it was done for master. --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../buildtests/tck/mongodb/MongoDbRule.java | 26 +++++++------------ .../data/mongodb/MongoDbRule.java | 26 +++++++------------ 4 files changed, 20 insertions(+), 36 deletions(-) diff --git a/build.gradle b/build.gradle index 8bac7d31..2cb75abd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ buildscript { ext { log4jVersion = '1.2.17' - springBootVersion = '2.2.4.RELEASE' + springBootVersion = '2.3.0.M2' eclipsePersistenceVersion = '2.1.1' kryoVersion = '4.0.2' springCloudClusterVersion = '1.0.2.RELEASE' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f4d7b2bf..5028f28f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java index a0aab1e8..be5e2bce 100644 --- a/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java +++ b/spring-statemachine-build-tests/src/test/java/org/springframework/statemachine/buildtests/tck/mongodb/MongoDbRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,40 +15,32 @@ */ package org.springframework.statemachine.buildtests.tck.mongodb; -import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runners.model.Statement; -import com.mongodb.MongoClient; -import com.mongodb.MongoClientOptions; -import com.mongodb.ServerAddress; +import org.springframework.util.SocketUtils; /** - * Rule skipping tests if MongoDb is not available from localhost with default settings. + * Rule skipping tests if MongoDb is not available from localhost simply by + * checking if port can be bind. * * @author Janne Valkealahti * */ -public class MongoDbRule extends TestWatcher implements TestRule { +public class MongoDbRule extends TestWatcher { @Override public Statement apply(Statement base, Description description) { - MongoClient client = null; + try { - client = new MongoClient(new ServerAddress(), - MongoClientOptions.builder().connectTimeout(50).serverSelectionTimeout(50).build()); - client.getAddress(); - } catch (Exception e) { + SocketUtils.findAvailableTcpPort(27017, 27017); return super.apply(new Statement() { @Override public void evaluate() throws Throwable { } }, Description.EMPTY); - } finally { - if (client != null) { - client.close(); - } + } catch (Exception e) { + return super.apply(base, description); } - return super.apply(base, description); } } diff --git a/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java b/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java index 8ec9ddb4..099a5837 100644 --- a/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java +++ b/spring-statemachine-data/mongodb/src/test/java/org/springframework/statemachine/data/mongodb/MongoDbRule.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,40 +15,32 @@ */ package org.springframework.statemachine.data.mongodb; -import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runners.model.Statement; -import com.mongodb.MongoClient; -import com.mongodb.MongoClientOptions; -import com.mongodb.ServerAddress; +import org.springframework.util.SocketUtils; /** - * Rule skipping tests if MongoDb is not available from localhost with default settings. + * Rule skipping tests if MongoDb is not available from localhost simply by + * checking if port can be bind. * * @author Janne Valkealahti * */ -public class MongoDbRule extends TestWatcher implements TestRule { +public class MongoDbRule extends TestWatcher { @Override public Statement apply(Statement base, Description description) { - MongoClient client = null; + try { - client = new MongoClient(new ServerAddress(), - MongoClientOptions.builder().connectTimeout(50).serverSelectionTimeout(50).build()); - client.getAddress(); - } catch (Exception e) { + SocketUtils.findAvailableTcpPort(27017, 27017); return super.apply(new Statement() { @Override public void evaluate() throws Throwable { } }, Description.EMPTY); - } finally { - if (client != null) { - client.close(); - } + } catch (Exception e) { + return super.apply(base, description); } - return super.apply(base, description); } }