22
22
import reactor .core .publisher .Flux ;
23
23
import reactor .test .StepVerifier ;
24
24
25
+ import java .time .Duration ;
25
26
import java .util .concurrent .BlockingQueue ;
26
27
import java .util .concurrent .LinkedBlockingQueue ;
27
28
import java .util .concurrent .TimeUnit ;
41
42
import org .springframework .data .mongodb .core .index .IndexField ;
42
43
import org .springframework .data .mongodb .core .index .IndexInfo ;
43
44
import org .springframework .data .mongodb .core .index .Indexed ;
45
+ import org .springframework .data .mongodb .test .util .MongoTestUtils ;
44
46
import org .springframework .test .context .ContextConfiguration ;
45
47
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
46
48
47
49
import com .mongodb .client .model .IndexOptions ;
48
50
import com .mongodb .reactivestreams .client .ListIndexesPublisher ;
49
51
import com .mongodb .reactivestreams .client .MongoClient ;
50
- import com .mongodb .reactivestreams .client .Success ;
51
52
52
53
/**
53
54
* Integration test for index creation via {@link ReactiveMongoTemplate}.
@@ -68,9 +69,9 @@ public class ReactiveMongoTemplateIndexTests {
68
69
@ Before
69
70
public void setUp () {
70
71
71
- StepVerifier . create (template .getCollection ( "person" ). drop ()). expectNext ( Success . SUCCESS ). verifyComplete ( );
72
- StepVerifier . create (template .getCollection ( "indexfail" ). drop ()). expectNext ( Success . SUCCESS ). verifyComplete ( );
73
- StepVerifier . create (template .getCollection ( "indexedSample" ). drop ()). expectNext ( Success . SUCCESS ). verifyComplete ( );
72
+ MongoTestUtils . dropCollectionNow (template .getMongoDatabase (). getName (), "person" , client );
73
+ MongoTestUtils . dropCollectionNow (template .getMongoDatabase (). getName (), "indexfail" , client );
74
+ MongoTestUtils . dropCollectionNow (template .getMongoDatabase (). getName (), "indexedSample" , client );
74
75
}
75
76
76
77
@ After
@@ -199,6 +200,7 @@ public void shouldCreateIndexOnAccess() {
199
200
.verifyComplete ();
200
201
201
202
template .findAll (IndexedSample .class ) //
203
+ .delayElements (Duration .ofMillis (200 )) // TODO: check if 4.2.0 server GA still requires this timeout
202
204
.as (StepVerifier ::create ) //
203
205
.verifyComplete ();
204
206
0 commit comments