@@ -154,7 +154,7 @@ class CommandMessageSpecification extends Specification {
154154 MessageSettings . builder(). maxWireVersion(maxWireVersion). build(), true ,
155155 payload == null
156156 ? OpMsgSequences.EmptyOpMsgSequences . INSTANCE
157- : new ValidatableSplittablePayload ( payload, NoOpFieldNameValidator . INSTANCE ) ,
157+ : payload,
158158 ClusterConnectionMode . MULTIPLE , null )
159159 def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
160160 message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , NoOpSessionContext . INSTANCE ,
@@ -177,7 +177,8 @@ class CommandMessageSpecification extends Specification {
177177 new BsonDocument (' insert' , new BsonString (' coll' )),
178178 new SplittablePayload (INSERT , [new BsonDocument (' _id' , new BsonInt32 (1 )),
179179 new BsonDocument (' _id' , new BsonInt32 (2 ))]
180- .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true ),
180+ .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true ,
181+ NoOpFieldNameValidator . INSTANCE ),
181182 ],
182183 [
183184 LATEST_WIRE_VERSION ,
@@ -198,9 +199,9 @@ class CommandMessageSpecification extends Specification {
198199 new BsonDocument (' _id' , new BsonInt32 (3 )). append(' c' , new BsonBinary (new byte [450 ])),
199200 new BsonDocument (' _id' , new BsonInt32 (4 )). append(' b' , new BsonBinary (new byte [441 ])),
200201 new BsonDocument (' _id' , new BsonInt32 (5 )). append(' c' , new BsonBinary (new byte [451 ]))]
201- .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true )
202+ .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true , fieldNameValidator )
202203 def message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
203- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
204+ false , payload, ClusterConnectionMode . MULTIPLE , null )
204205 def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
205206 def sessionContext = Stub (SessionContext ) {
206207 getReadConcern() >> ReadConcern . DEFAULT
@@ -224,7 +225,7 @@ class CommandMessageSpecification extends Specification {
224225 when :
225226 payload = payload. getNextSplit()
226227 message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
227- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
228+ false , payload, ClusterConnectionMode . MULTIPLE , null )
228229 output. truncateToPosition(0 )
229230 message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext, Stub (TimeoutContext ), null ))
230231 byteBuf = new ByteBufNIO (ByteBuffer . wrap(output. toByteArray()))
@@ -242,7 +243,7 @@ class CommandMessageSpecification extends Specification {
242243 when :
243244 payload = payload. getNextSplit()
244245 message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
245- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
246+ false , payload, ClusterConnectionMode . MULTIPLE , null )
246247 output. truncateToPosition(0 )
247248 message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext, Stub (TimeoutContext ), null ))
248249 byteBuf = new ByteBufNIO (ByteBuffer . wrap(output. toByteArray()))
@@ -260,7 +261,7 @@ class CommandMessageSpecification extends Specification {
260261 when :
261262 payload = payload. getNextSplit()
262263 message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
263- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
264+ false , payload, ClusterConnectionMode . MULTIPLE , null )
264265 output. truncateToPosition(0 )
265266 message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE ,
266267 sessionContext,
@@ -288,9 +289,9 @@ class CommandMessageSpecification extends Specification {
288289 def payload = new SplittablePayload (INSERT , [new BsonDocument (' a' , new BsonBinary (new byte [900 ])),
289290 new BsonDocument (' b' , new BsonBinary (new byte [450 ])),
290291 new BsonDocument (' c' , new BsonBinary (new byte [450 ]))]
291- .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true )
292+ .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true , fieldNameValidator )
292293 def message = new CommandMessage (namespace, command, fieldNameValidator, ReadPreference . primary(), messageSettings,
293- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
294+ false , payload, ClusterConnectionMode . MULTIPLE , null )
294295 def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
295296 def sessionContext = Stub (SessionContext ) {
296297 getReadConcern() >> ReadConcern . DEFAULT
@@ -315,7 +316,7 @@ class CommandMessageSpecification extends Specification {
315316 when :
316317 payload = payload. getNextSplit()
317318 message = new CommandMessage (namespace, command, fieldNameValidator, ReadPreference . primary(), messageSettings,
318- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
319+ false , payload, ClusterConnectionMode . MULTIPLE , null )
319320 output. truncateToPosition(0 )
320321 message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext,
321322 Stub (TimeoutContext ), null ))
@@ -339,9 +340,9 @@ class CommandMessageSpecification extends Specification {
339340 def messageSettings = MessageSettings . builder(). maxDocumentSize(900 )
340341 .maxWireVersion(LATEST_WIRE_VERSION ). build()
341342 def payload = new SplittablePayload (INSERT , [new BsonDocument (' a' , new BsonBinary (new byte [900 ]))]
342- .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true )
343+ .withIndex(). collect { doc , i -> new WriteRequestWithIndex (new InsertRequest (doc), i) }, true , fieldNameValidator )
343344 def message = new CommandMessage (namespace, command, fieldNameValidator, ReadPreference . primary(), messageSettings,
344- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
345+ false , payload, ClusterConnectionMode . MULTIPLE , null )
345346 def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
346347 def sessionContext = Stub (SessionContext ) {
347348 getReadConcern() >> ReadConcern . DEFAULT
@@ -362,9 +363,9 @@ class CommandMessageSpecification extends Specification {
362363 given :
363364 def messageSettings = MessageSettings . builder(). serverType(ServerType . SHARD_ROUTER )
364365 .maxWireVersion(FOUR_DOT_ZERO_WIRE_VERSION ). build()
365- def payload = new SplittablePayload (INSERT , [new BsonDocument (' a' , new BsonInt32 (1 ))], true )
366+ def payload = new SplittablePayload (INSERT , [new BsonDocument (' a' , new BsonInt32 (1 ))], true , fieldNameValidator )
366367 def message = new CommandMessage (namespace, command, fieldNameValidator, ReadPreference . primary(), messageSettings,
367- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
368+ false , payload, ClusterConnectionMode . MULTIPLE , null )
368369 def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
369370 def sessionContext = Stub (SessionContext ) {
370371 getReadConcern() >> ReadConcern . DEFAULT
0 commit comments