@@ -154,7 +154,7 @@ class CommandMessageSpecification extends Specification {
154
154
MessageSettings . builder(). maxWireVersion(maxWireVersion). build(), true ,
155
155
payload == null
156
156
? OpMsgSequences.EmptyOpMsgSequences . INSTANCE
157
- : new ValidatableSplittablePayload ( payload, NoOpFieldNameValidator . INSTANCE ) ,
157
+ : payload,
158
158
ClusterConnectionMode . MULTIPLE , null )
159
159
def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
160
160
message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , NoOpSessionContext . INSTANCE ,
@@ -177,7 +177,8 @@ class CommandMessageSpecification extends Specification {
177
177
new BsonDocument (' insert' , new BsonString (' coll' )),
178
178
new SplittablePayload (INSERT , [new BsonDocument (' _id' , new BsonInt32 (1 )),
179
179
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 ),
181
182
],
182
183
[
183
184
LATEST_WIRE_VERSION ,
@@ -198,9 +199,9 @@ class CommandMessageSpecification extends Specification {
198
199
new BsonDocument (' _id' , new BsonInt32 (3 )). append(' c' , new BsonBinary (new byte [450 ])),
199
200
new BsonDocument (' _id' , new BsonInt32 (4 )). append(' b' , new BsonBinary (new byte [441 ])),
200
201
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 )
202
203
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 )
204
205
def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
205
206
def sessionContext = Stub (SessionContext ) {
206
207
getReadConcern() >> ReadConcern . DEFAULT
@@ -224,7 +225,7 @@ class CommandMessageSpecification extends Specification {
224
225
when :
225
226
payload = payload. getNextSplit()
226
227
message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
227
- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
228
+ false , payload, ClusterConnectionMode . MULTIPLE , null )
228
229
output. truncateToPosition(0 )
229
230
message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext, Stub (TimeoutContext ), null ))
230
231
byteBuf = new ByteBufNIO (ByteBuffer . wrap(output. toByteArray()))
@@ -242,7 +243,7 @@ class CommandMessageSpecification extends Specification {
242
243
when :
243
244
payload = payload. getNextSplit()
244
245
message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
245
- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
246
+ false , payload, ClusterConnectionMode . MULTIPLE , null )
246
247
output. truncateToPosition(0 )
247
248
message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext, Stub (TimeoutContext ), null ))
248
249
byteBuf = new ByteBufNIO (ByteBuffer . wrap(output. toByteArray()))
@@ -260,7 +261,7 @@ class CommandMessageSpecification extends Specification {
260
261
when :
261
262
payload = payload. getNextSplit()
262
263
message = new CommandMessage (namespace, insertCommand, fieldNameValidator, ReadPreference . primary(), messageSettings,
263
- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
264
+ false , payload, ClusterConnectionMode . MULTIPLE , null )
264
265
output. truncateToPosition(0 )
265
266
message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE ,
266
267
sessionContext,
@@ -288,9 +289,9 @@ class CommandMessageSpecification extends Specification {
288
289
def payload = new SplittablePayload (INSERT , [new BsonDocument (' a' , new BsonBinary (new byte [900 ])),
289
290
new BsonDocument (' b' , new BsonBinary (new byte [450 ])),
290
291
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 )
292
293
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 )
294
295
def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
295
296
def sessionContext = Stub (SessionContext ) {
296
297
getReadConcern() >> ReadConcern . DEFAULT
@@ -315,7 +316,7 @@ class CommandMessageSpecification extends Specification {
315
316
when :
316
317
payload = payload. getNextSplit()
317
318
message = new CommandMessage (namespace, command, fieldNameValidator, ReadPreference . primary(), messageSettings,
318
- false , new ValidatableSplittablePayload ( payload, fieldNameValidator) , ClusterConnectionMode . MULTIPLE , null )
319
+ false , payload, ClusterConnectionMode . MULTIPLE , null )
319
320
output. truncateToPosition(0 )
320
321
message. encode(output, new OperationContext (IgnorableRequestContext . INSTANCE , sessionContext,
321
322
Stub (TimeoutContext ), null ))
@@ -339,9 +340,9 @@ class CommandMessageSpecification extends Specification {
339
340
def messageSettings = MessageSettings . builder(). maxDocumentSize(900 )
340
341
.maxWireVersion(LATEST_WIRE_VERSION ). build()
341
342
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 )
343
344
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 )
345
346
def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
346
347
def sessionContext = Stub (SessionContext ) {
347
348
getReadConcern() >> ReadConcern . DEFAULT
@@ -362,9 +363,9 @@ class CommandMessageSpecification extends Specification {
362
363
given :
363
364
def messageSettings = MessageSettings . builder(). serverType(ServerType . SHARD_ROUTER )
364
365
.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 )
366
367
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 )
368
369
def output = new ByteBufferBsonOutput (new SimpleBufferProvider ())
369
370
def sessionContext = Stub (SessionContext ) {
370
371
getReadConcern() >> ReadConcern . DEFAULT
0 commit comments