Skip to content

Commit

Permalink
Use 1.0 instead of 0.9.1 client for 1.0 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ansd committed Mar 23, 2024
1 parent e21007f commit b2abfcf
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 161 deletions.
2 changes: 1 addition & 1 deletion deps/rabbit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ rabbitmq_integration_suite(
],
shard_count = 3,
runtime_deps = [
"//deps/amqp10_client:erlang_app",
"//deps/rabbitmq_amqp_client:erlang_app",
],
)

Expand Down
46 changes: 17 additions & 29 deletions deps/rabbit/src/rabbit_amqp_management.erl
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,8 @@ decode_queue({map, KVList}) ->
({{utf8, <<"auto_delete">>}, V}, Acc)
when is_boolean(V) ->
Acc#{auto_delete => V};
({{utf8, <<"arguments">>}, {map, List}}, Acc) ->
Args = lists:map(fun({{utf8, Key = <<"x-", _/binary>>}, {utf8, Val}}) ->
{Key, longstr, Val};
(Arg) ->
throw(<<"400">>,
"unsupported queue argument ~tp",
[Arg])
end, List),
Acc#{arguments => Args};
({{utf8, <<"arguments">>}, Args}, Acc) ->
Acc#{arguments => args_amqp_to_amqpl(Args)};
(Prop, _Acc) ->
throw(<<"400">>, "bad queue property ~tp", [Prop])
end, #{}, KVList),
Expand Down Expand Up @@ -442,15 +435,8 @@ decode_exchange({map, KVList}) ->
({{utf8, <<"internal">>}, V}, Acc)
when is_boolean(V) ->
Acc#{internal => V};
({{utf8, <<"arguments">>}, {map, List}}, Acc) ->
Args = lists:map(fun({{utf8, Key = <<"x-", _/binary>>}, {utf8, Val}}) ->
{Key, longstr, Val};
(Arg) ->
throw(<<"400">>,
"unsupported exchange argument ~tp",
[Arg])
end, List),
Acc#{arguments => Args};
({{utf8, <<"arguments">>}, Args}, Acc) ->
Acc#{arguments => args_amqp_to_amqpl(Args)};
(Prop, _Acc) ->
throw(<<"400">>, "bad exchange property ~tp", [Prop])
end, #{}, KVList),
Expand All @@ -471,17 +457,8 @@ decode_binding({map, KVList}) ->
Acc#{destination_exchange => V};
({{utf8, <<"binding_key">>}, {utf8, V}}, Acc) ->
Acc#{binding_key => V};
({{utf8, <<"arguments">>}, {map, List}}, Acc) ->
Args = lists:map(fun({{T, Key}, TypeVal})
when T =:= utf8 orelse
T =:= symbol ->
mc_amqpl:to_091(Key, TypeVal);
(Arg) ->
throw(<<"400">>,
"unsupported binding argument ~tp",
[Arg])
end, List),
Acc#{arguments => Args};
({{utf8, <<"arguments">>}, Args}, Acc) ->
Acc#{arguments => args_amqp_to_amqpl(Args)};
(Field, _Acc) ->
throw(<<"400">>, "bad binding field ~tp", [Field])
end, #{}, KVList).
Expand Down Expand Up @@ -511,6 +488,17 @@ encode_bindings(Bindings) ->
end, Bindings),
{list, Bs}.

args_amqp_to_amqpl({map, KVList}) ->
lists:map(fun({{T, Key}, TypeVal})
when T =:= utf8 orelse
T =:= symbol ->
mc_amqpl:to_091(Key, TypeVal);
(Arg) ->
throw(<<"400">>,
"unsupported argument ~tp",
[Arg])
end, KVList).

args_amqpl_to_amqp(Args) ->
{map, [{{utf8, K}, mc_amqpl:from_091(T, V)} || {K, T, V} <- Args]}.

Expand Down
Loading

0 comments on commit b2abfcf

Please sign in to comment.