@@ -313,34 +313,37 @@ amqpl_amqp_bin_amqpl(_Config) ->
313313 % % incoming amqpl converted to amqp, serialized / deserialized then converted
314314 % % back to amqpl.
315315 % % simulates a legacy message published then consumed to a stream
316- Props = # 'P_basic' {content_type = <<" text/plain" >>,
317- content_encoding = <<" gzip" >>,
318- headers = [{<<" a-stream-offset" >>, long , 99 },
319- {<<" a-string" >>, longstr , <<" a string" >>},
320- {<<" a-bool" >>, bool , false },
321- {<<" a-unsignedbyte" >>, unsignedbyte , 1 },
322- {<<" a-unsignedshort" >>, unsignedshort , 1 },
323- {<<" a-unsignedint" >>, unsignedint , 1 },
324- {<<" a-signedint" >>, signedint , 1 },
325- {<<" a-timestamp" >>, timestamp , 1 },
326- {<<" a-double" >>, double , 1.0 },
327- {<<" a-float" >>, float , 1.0 },
328- {<<" a-void" >>, void , undefined },
329- {<<" a-binary" >>, binary , <<" data" >>},
330- {<<" a-array" >>, array , [{long , 1 }, {long , 2 }]},
331- {<<" x-stream-filter" >>, longstr , <<" apple" >>}
332- ],
333- delivery_mode = 2 ,
334- priority = 98 ,
335- correlation_id = <<" corr" >> ,
336- reply_to = <<" reply-to" >>,
337- expiration = <<" 1" >>,
338- message_id = <<" msg-id" >>,
339- timestamp = 99 ,
340- type = <<" 45" >>,
341- user_id = <<" banana" >>,
342- app_id = <<" rmq" >>
343- },
316+ String5k = binary :copy (<<" x" >>, 5000 ),
317+ Props = # 'P_basic' {
318+ content_type = <<" text/plain" >>,
319+ content_encoding = <<" gzip" >>,
320+ headers = [{<<" a-stream-offset" >>, long , 99 },
321+ {<<" a-string" >>, longstr , <<" a string" >>},
322+ {<<" a-very-long-string" >>, longstr , String5k },
323+ {<<" a-bool" >>, bool , false },
324+ {<<" a-unsignedbyte" >>, unsignedbyte , 1 },
325+ {<<" a-unsignedshort" >>, unsignedshort , 1 },
326+ {<<" a-unsignedint" >>, unsignedint , 1 },
327+ {<<" a-signedint" >>, signedint , 1 },
328+ {<<" a-timestamp" >>, timestamp , 1 },
329+ {<<" a-double" >>, double , 1.0 },
330+ {<<" a-float" >>, float , 1.0 },
331+ {<<" a-void" >>, void , undefined },
332+ {<<" a-binary" >>, binary , <<" data" >>},
333+ {<<" a-array" >>, array , [{long , 1 }, {long , 2 }]},
334+ {<<" x-stream-filter" >>, longstr , <<" apple" >>}
335+ ],
336+ delivery_mode = 2 ,
337+ priority = 98 ,
338+ correlation_id = <<" corr" >> ,
339+ reply_to = <<" reply-to" >>,
340+ expiration = <<" 1" >>,
341+ message_id = <<" msg-id" >>,
342+ timestamp = 99 ,
343+ type = <<" 45" >>,
344+ user_id = <<" banana" >>,
345+ app_id = <<" rmq" >>
346+ },
344347 Content = # content {properties = Props ,
345348 payload_fragments_rev = [<<" data" >>]},
346349 Msg = mc :init (mc_amqpl , Content , annotations ()),
@@ -404,6 +407,9 @@ amqpl_amqp_bin_amqpl(_Config) ->
404407
405408 ? assertEqual ({long , 99 }, Get (<<" a-stream-offset" >>, AP10 )),
406409 ? assertEqual ({utf8 , <<" a string" >>}, Get (<<" a-string" >>, AP10 )),
410+ % % We expect that a very long string is not scanned for valid UTF-8
411+ % % and instead directly turned into a binary.
412+ ? assertEqual ({binary , String5k }, Get (<<" a-very-long-string" >>, AP10 )),
407413 ? assertEqual (false , Get (<<" a-bool" >>, AP10 )),
408414 ? assertEqual ({ubyte , 1 }, Get (<<" a-unsignedbyte" >>, AP10 )),
409415 ? assertEqual ({ushort , 1 }, Get (<<" a-unsignedshort" >>, AP10 )),
0 commit comments