From 5e452e1be0fd5332809b30f1c8579944f987a710 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 19 Jun 2019 08:36:19 +0200 Subject: [PATCH] DATAMONGO-2305 - Upgrade to MongoDB Java Driver 3.11.0-beta4. Tested against 4.0.9 and 4.2.0-rc1 servers. Added a delay and left a todo in one of the tests where the 4.2.0-rc1 server takes a bit longer than it predecessor when creating indexes which can lead to BackgroundOperationInProgressForNamespace errors. Original pull request: #764. --- pom.xml | 2 +- .../mongodb/core/ReactiveMongoTemplateIndexTests.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 340e6922b..4aacfba02 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ multi spring-data-mongodb 2.2.0.BUILD-SNAPSHOT - 3.11.0-beta3 + 3.11.0-beta4 1.11.0 1.19 diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateIndexTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateIndexTests.java index e7cebb108..1e62a697d 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateIndexTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateIndexTests.java @@ -22,6 +22,7 @@ import lombok.Data; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; +import java.time.Duration; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; @@ -41,13 +42,13 @@ import org.springframework.data.mongodb.core.index.Index; import org.springframework.data.mongodb.core.index.IndexField; import org.springframework.data.mongodb.core.index.IndexInfo; import org.springframework.data.mongodb.core.index.Indexed; +import org.springframework.data.mongodb.test.util.MongoTestUtils; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.mongodb.client.model.IndexOptions; import com.mongodb.reactivestreams.client.ListIndexesPublisher; import com.mongodb.reactivestreams.client.MongoClient; -import com.mongodb.reactivestreams.client.Success; /** * Integration test for index creation via {@link ReactiveMongoTemplate}. @@ -68,9 +69,9 @@ public class ReactiveMongoTemplateIndexTests { @Before public void setUp() { - StepVerifier.create(template.getCollection("person").drop()).expectNext(Success.SUCCESS).verifyComplete(); - StepVerifier.create(template.getCollection("indexfail").drop()).expectNext(Success.SUCCESS).verifyComplete(); - StepVerifier.create(template.getCollection("indexedSample").drop()).expectNext(Success.SUCCESS).verifyComplete(); + MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "person", client); + MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "indexfail", client); + MongoTestUtils.dropCollectionNow(template.getMongoDatabase().getName(), "indexedSample", client); } @After @@ -199,6 +200,7 @@ public class ReactiveMongoTemplateIndexTests { .verifyComplete(); template.findAll(IndexedSample.class) // + .delayElements(Duration.ofMillis(200)) // TODO: check if 4.2.0 server GA still requires this timeout .as(StepVerifier::create) // .verifyComplete();