23
23
import com .mongodb .ReadConcernLevel ;
24
24
import com .mongodb .ServerApi ;
25
25
import com .mongodb .ServerApiVersion ;
26
- import com .mongodb .internal .connection .TestClusterListener ;
27
- import com .mongodb .logging .TestLoggingInterceptor ;
28
26
import com .mongodb .TransactionOptions ;
29
27
import com .mongodb .WriteConcern ;
30
28
import com .mongodb .assertions .Assertions ;
56
54
import com .mongodb .event .ConnectionPoolListener ;
57
55
import com .mongodb .event .ConnectionPoolReadyEvent ;
58
56
import com .mongodb .event .ConnectionReadyEvent ;
57
+ import com .mongodb .internal .connection .TestClusterListener ;
59
58
import com .mongodb .internal .connection .TestCommandListener ;
60
59
import com .mongodb .internal .connection .TestConnectionPoolListener ;
61
60
import com .mongodb .internal .connection .TestServerListener ;
62
61
import com .mongodb .internal .logging .LogMessage ;
63
62
import com .mongodb .lang .NonNull ;
63
+ import com .mongodb .logging .TestLoggingInterceptor ;
64
64
import org .bson .BsonArray ;
65
65
import org .bson .BsonBoolean ;
66
66
import org .bson .BsonDocument ;
@@ -300,6 +300,7 @@ private <T> void putEntity(final String id, final T entity, final Map<String, T>
300
300
}
301
301
302
302
public void init (final BsonArray entitiesArray ,
303
+ final BsonDocument startingClusterTime ,
303
304
final boolean waitForPoolAsyncWorkManagerStart ,
304
305
final Function <MongoClientSettings , MongoClient > mongoClientSupplier ,
305
306
final Function <MongoDatabase , GridFSBucket > gridFSBucketSupplier ,
@@ -324,7 +325,7 @@ public void init(final BsonArray entitiesArray,
324
325
break ;
325
326
}
326
327
case "session" : {
327
- initSession (entity , id );
328
+ initSession (entity , id , startingClusterTime );
328
329
break ;
329
330
}
330
331
case "bucket" : {
@@ -596,7 +597,7 @@ private void initCollection(final BsonDocument entity, final String id) {
596
597
putEntity (id , collection , collections );
597
598
}
598
599
599
- private void initSession (final BsonDocument entity , final String id ) {
600
+ private void initSession (final BsonDocument entity , final String id , final BsonDocument startingClusterTime ) {
600
601
MongoClient client = clients .get (entity .getString ("client" ).getValue ());
601
602
ClientSessionOptions .Builder optionsBuilder = ClientSessionOptions .builder ();
602
603
if (entity .containsKey ("sessionOptions" )) {
@@ -614,6 +615,7 @@ private void initSession(final BsonDocument entity, final String id) {
614
615
}
615
616
}
616
617
ClientSession session = client .startSession (optionsBuilder .build ());
618
+ session .advanceClusterTime (startingClusterTime );
617
619
putEntity (id , session , sessions );
618
620
putEntity (id + "-identifier" , session .getServerSession ().getIdentifier (), sessionIdentifiers );
619
621
}
0 commit comments