1717 amqp10_expect_empty /2 ,
1818 await_amqp10_event /3 , amqp10_expect_one /2 ,
1919 amqp10_expect_count /3 , amqp10_publish /4 ,
20- amqp10_publish_expect /5 ,
20+ amqp10_publish_expect /5 , amqp10_declare_queue / 3 ,
2121 await_autodelete /2 ]).
2222
23+ -define (PARAM , <<" test" >>).
24+
2325all () ->
2426 [
2527 {group , non_parallel_tests },
@@ -85,7 +87,8 @@ init_per_testcase(Testcase, Config0) ->
8587 rabbit_ct_helpers :testcase_started (Config , Testcase ).
8688
8789end_per_testcase (Testcase , Config ) ->
88- rabbit_ct_broker_helpers :rpc (Config , 0 , ? MODULE , delete_all_queues , []),
90+ shovel_test_utils :clear_param (Config , ? PARAM ),
91+ rabbit_ct_broker_helpers :rpc (Config , 0 , shovel_test_utils , delete_all_queues , []),
8992 rabbit_ct_helpers :testcase_finished (Config , Testcase ).
9093
9194% % -------------------------------------------------------------------
@@ -116,11 +119,9 @@ amqp091_to_amqp10_with_dead_lettering(Config) ->
116119 TmpQ = <<" tmp" >>,
117120 with_amqp10_session (Config ,
118121 fun (Sess ) ->
119- {ok , LinkPair } = rabbitmq_amqp_client :attach_management_link_pair_sync (Sess , <<" my link pair" >>),
120- {ok , _ } = rabbitmq_amqp_client :declare_queue (LinkPair , TmpQ ,
121- #{arguments => #{<<" x-max-length" >> => {uint , 0 },
122- <<" x-dead-letter-exchange" >> => {utf8 , <<" " >>},
123- <<" x-dead-letter-routing-key" >> => {utf8 , Src }}}),
122+ amqp10_declare_queue (Sess , TmpQ , #{<<" x-max-length" >> => {uint , 0 },
123+ <<" x-dead-letter-exchange" >> => {utf8 , <<" " >>},
124+ <<" x-dead-letter-routing-key" >> => {utf8 , Src }}),
124125 {ok , Sender } = amqp10_client :attach_sender_link (Sess ,
125126 <<" sender-tmp" >>,
126127 <<" /queues/" , TmpQ /binary >>,
@@ -135,7 +136,7 @@ amqp091_to_amqp10_with_dead_lettering(Config) ->
135136
136137test_amqp10_destination (Config , Src , Dest , Sess , Protocol , ProtocolSrc ) ->
137138 MapConfig = ? config (map_config , Config ),
138- shovel_test_utils :set_param (Config , << " test " >> ,
139+ shovel_test_utils :set_param (Config , ? PARAM ,
139140 [{<<" src-protocol" >>, Protocol },
140141 {ProtocolSrc , Src },
141142 {<<" dest-protocol" >>, <<" amqp10" >>},
@@ -189,18 +190,18 @@ simple_amqp10_src(Config) ->
189190 fun (Sess ) ->
190191 shovel_test_utils :set_param (
191192 Config ,
192- << " test " >> , [{<<" src-protocol" >>, <<" amqp10" >>},
193- {<<" src-address" >>, Src },
194- {<<" dest-protocol" >>, <<" amqp091" >>},
195- {<<" dest-queue" >>, Dest },
196- {<<" add-forward-headers" >>, true },
197- {<<" dest-add-timestamp-header" >>, true },
198- {<<" publish-properties" >>,
199- case MapConfig of
200- true -> #{<<" cluster_id" >> => <<" x" >>};
201- _ -> [{<<" cluster_id" >>, <<" x" >>}]
202- end }
203- ]),
193+ ? PARAM , [{<<" src-protocol" >>, <<" amqp10" >>},
194+ {<<" src-address" >>, Src },
195+ {<<" dest-protocol" >>, <<" amqp091" >>},
196+ {<<" dest-queue" >>, Dest },
197+ {<<" add-forward-headers" >>, true },
198+ {<<" dest-add-timestamp-header" >>, true },
199+ {<<" publish-properties" >>,
200+ case MapConfig of
201+ true -> #{<<" cluster_id" >> => <<" x" >>};
202+ _ -> [{<<" cluster_id" >>, <<" x" >>}]
203+ end }
204+ ]),
204205 _Msg = amqp10_publish_expect (Sess , Src , Dest , <<" hello" >>, 1 ),
205206 % the fidelity loss is quite high when consuming using the amqp10
206207 % plugin. For example custom headers aren't current translated.
@@ -216,18 +217,18 @@ amqp10_to_amqp091_application_properties(Config) ->
216217 fun (Sess ) ->
217218 shovel_test_utils :set_param (
218219 Config ,
219- << " test " >> , [{<<" src-protocol" >>, <<" amqp10" >>},
220- {<<" src-address" >>, Src },
221- {<<" dest-protocol" >>, <<" amqp091" >>},
222- {<<" dest-queue" >>, Dest },
223- {<<" add-forward-headers" >>, true },
224- {<<" dest-add-timestamp-header" >>, true },
225- {<<" publish-properties" >>,
226- case MapConfig of
227- true -> #{<<" cluster_id" >> => <<" x" >>};
228- _ -> [{<<" cluster_id" >>, <<" x" >>}]
229- end }
230- ]),
220+ ? PARAM , [{<<" src-protocol" >>, <<" amqp10" >>},
221+ {<<" src-address" >>, Src },
222+ {<<" dest-protocol" >>, <<" amqp091" >>},
223+ {<<" dest-queue" >>, Dest },
224+ {<<" add-forward-headers" >>, true },
225+ {<<" dest-add-timestamp-header" >>, true },
226+ {<<" publish-properties" >>,
227+ case MapConfig of
228+ true -> #{<<" cluster_id" >> => <<" x" >>};
229+ _ -> [{<<" cluster_id" >>, <<" x" >>}]
230+ end }
231+ ]),
231232
232233 MsgSent = amqp10_msg :set_application_properties (
233234 #{<<" key" >> => <<" value" >>},
@@ -250,13 +251,13 @@ change_definition(Config) ->
250251 Dest2 = ? config (destq2 , Config ),
251252 with_amqp10_session (Config ,
252253 fun (Sess ) ->
253- shovel_test_utils :set_param (Config , << " test " >> ,
254+ shovel_test_utils :set_param (Config , ? PARAM ,
254255 [{<<" src-address" >>, Src },
255256 {<<" src-protocol" >>, <<" amqp10" >>},
256257 {<<" dest-protocol" >>, <<" amqp10" >>},
257258 {<<" dest-address" >>, Dest }]),
258259 amqp10_publish_expect (Sess , Src , Dest , <<" hello1" >>, 1 ),
259- shovel_test_utils :set_param (Config , << " test " >> ,
260+ shovel_test_utils :set_param (Config , ? PARAM ,
260261 [{<<" src-address" >>, Src },
261262 {<<" src-protocol" >>, <<" amqp10" >>},
262263 {<<" dest-protocol" >>, <<" amqp10" >>},
@@ -299,14 +300,14 @@ autodelete_do(Config, {AckMode, After, ExpSrc, ExpDest}) ->
299300 amqp10_publish (Session , Src , <<" hello" >>, 100 ),
300301 shovel_test_utils :set_param_nowait (
301302 Config ,
302- << " test " >> , [{<<" src-address" >>, Src },
303- {<<" src-protocol" >>, <<" amqp10" >>},
304- {<<" src-delete-after" >>, After },
305- {<<" src-prefetch-count" >>, 5 },
306- {<<" dest-address" >>, Dest },
307- {<<" dest-protocol" >>, <<" amqp10" >>},
308- {<<" ack-mode" >>, AckMode }
309- ]),
303+ ? PARAM , [{<<" src-address" >>, Src },
304+ {<<" src-protocol" >>, <<" amqp10" >>},
305+ {<<" src-delete-after" >>, After },
306+ {<<" src-prefetch-count" >>, 5 },
307+ {<<" dest-address" >>, Dest },
308+ {<<" dest-protocol" >>, <<" amqp10" >>},
309+ {<<" ack-mode" >>, AckMode }
310+ ]),
310311 await_autodelete (Config , <<" test" >>),
311312 amqp10_expect_count (Session , Dest , ExpDest ),
312313 amqp10_expect_count (Session , Src , ExpSrc )
@@ -319,14 +320,14 @@ autodelete_amqp091_src(Config, {AckMode, After, ExpSrc, ExpDest}) ->
319320 amqp10_publish (Session , Src , <<" hello" >>, 100 ),
320321 shovel_test_utils :set_param_nowait (
321322 Config ,
322- << " test " >> , [{<<" src-queue" >>, Src },
323- {<<" src-protocol" >>, <<" amqp091" >>},
324- {<<" src-delete-after" >>, After },
325- {<<" src-prefetch-count" >>, 5 },
326- {<<" dest-address" >>, Dest },
327- {<<" dest-protocol" >>, <<" amqp10" >>},
328- {<<" ack-mode" >>, AckMode }
329- ]),
323+ ? PARAM , [{<<" src-queue" >>, Src },
324+ {<<" src-protocol" >>, <<" amqp091" >>},
325+ {<<" src-delete-after" >>, After },
326+ {<<" src-prefetch-count" >>, 5 },
327+ {<<" dest-address" >>, Dest },
328+ {<<" dest-protocol" >>, <<" amqp10" >>},
329+ {<<" ack-mode" >>, AckMode }
330+ ]),
330331 await_autodelete (Config , <<" test" >>),
331332 amqp10_expect_count (Session , Dest , ExpDest ),
332333 amqp10_expect_count (Session , Src , ExpSrc )
@@ -339,14 +340,14 @@ autodelete_amqp091_dest(Config, {AckMode, After, ExpSrc, ExpDest}) ->
339340 amqp10_publish (Session , Src , <<" hello" >>, 100 ),
340341 shovel_test_utils :set_param_nowait (
341342 Config ,
342- << " test " >> , [{<<" src-address" >>, Src },
343- {<<" src-protocol" >>, <<" amqp10" >>},
344- {<<" src-delete-after" >>, After },
345- {<<" src-prefetch-count" >>, 5 },
346- {<<" dest-queue" >>, Dest },
347- {<<" dest-protocol" >>, <<" amqp091" >>},
348- {<<" ack-mode" >>, AckMode }
349- ]),
343+ ? PARAM , [{<<" src-address" >>, Src },
344+ {<<" src-protocol" >>, <<" amqp10" >>},
345+ {<<" src-delete-after" >>, After },
346+ {<<" src-prefetch-count" >>, 5 },
347+ {<<" dest-queue" >>, Dest },
348+ {<<" dest-protocol" >>, <<" amqp091" >>},
349+ {<<" ack-mode" >>, AckMode }
350+ ]),
350351 await_autodelete (Config , <<" test" >>),
351352 amqp10_expect_count (Session , Dest , ExpDest ),
352353 amqp10_expect_count (Session , Src , ExpSrc )
@@ -355,23 +356,21 @@ autodelete_amqp091_dest(Config, {AckMode, After, ExpSrc, ExpDest}) ->
355356autodelete_with_rejections (Config ) ->
356357 Src = ? config (srcq , Config ),
357358 Dest = ? config (destq , Config ),
358- with_session (
359+ with_amqp10_session (
359360 Config ,
360361 fun (Sess ) ->
361- {ok , LinkPair } = rabbitmq_amqp_client :attach_management_link_pair_sync (Sess , <<" my link pair" >>),
362- {ok , _ } = rabbitmq_amqp_client :declare_queue (LinkPair , Dest ,
363- #{arguments => #{<<" x-max-length" >> => {uint , 5 },
364- <<" x-overflow" >> => {utf8 , <<" reject-publish" >>}}}),
362+ amqp10_declare_queue (Sess , Dest , #{<<" x-max-length" >> => {uint , 5 },
363+ <<" x-overflow" >> => {utf8 , <<" reject-publish" >>}}),
365364
366- shovel_test_utils :set_param (Config , << " test " >> ,
365+ shovel_test_utils :set_param (Config , ? PARAM ,
367366 [{<<" src-protocol" >>, <<" local" >>},
368367 {<<" src-queue" >>, Src },
369368 {<<" src-delete-after" >>, 10 },
370369 {<<" dest-protocol" >>, <<" local" >>},
371370 {<<" dest-predeclared" >>, true },
372371 {<<" dest-queue" >>, Dest }
373372 ]),
374- publish_count (Sess , Src , <<" hello" >>, 10 ),
373+ amqp10_publish (Sess , Src , <<" hello" >>, 10 ),
375374 await_autodelete (Config , <<" test" >>),
376375 Expected = lists :sort ([[Src , <<" 5" >>], [Dest , <<" 5" >>]]),
377376 ? awaitMatch (
0 commit comments