Commit f07c0908 authored by Andy Wilkinson's avatar Andy Wilkinson

Upgrade to Mongo Java Driver 2.12.4

The exception message for a connection timeout has been updated to
include the timeout period. The tests for the sample have been updated
accordingly.

Closes gh-1884
parent 7e95dba5
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<log4j.version>1.2.17</log4j.version> <log4j.version>1.2.17</log4j.version>
<logback.version>1.1.2</logback.version> <logback.version>1.1.2</logback.version>
<mockito.version>1.9.5</mockito.version> <mockito.version>1.9.5</mockito.version>
<mongodb.version>2.12.3</mongodb.version> <mongodb.version>2.12.4</mongodb.version>
<mysql.version>5.1.34</mysql.version> <mysql.version>5.1.34</mysql.version>
<reactor.version>1.1.5.RELEASE</reactor.version> <reactor.version>1.1.5.RELEASE</reactor.version>
<reactor-spring.version>1.1.3.RELEASE</reactor-spring.version> <reactor-spring.version>1.1.3.RELEASE</reactor-spring.version>
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package sample.data.mongo; package sample.data.mongo;
import java.util.regex.Pattern;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.test.OutputCapture; import org.springframework.boot.test.OutputCapture;
...@@ -33,6 +35,9 @@ import static org.junit.Assert.assertTrue; ...@@ -33,6 +35,9 @@ import static org.junit.Assert.assertTrue;
*/ */
public class SampleMongoApplicationTests { public class SampleMongoApplicationTests {
private static final Pattern TIMEOUT_MESSAGE_PATTERN = Pattern
.compile("Timed out after [0-9]+ ms while waiting for a server.*");
@Rule @Rule
public OutputCapture outputCapture = new OutputCapture(); public OutputCapture outputCapture = new OutputCapture();
...@@ -61,7 +66,7 @@ public class SampleMongoApplicationTests { ...@@ -61,7 +66,7 @@ public class SampleMongoApplicationTests {
if (root.getMessage().contains("Unable to connect to any server")) { if (root.getMessage().contains("Unable to connect to any server")) {
return true; return true;
} }
if (root.getMessage().contains("Timed out while waiting for a server")) { if (TIMEOUT_MESSAGE_PATTERN.matcher(root.getMessage()).matches()) {
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment